Windows XP Check Terminal Services is Enable or Not Programatically Using C++ or VC++ code

Joined
Jun 19, 2008
Messages
1
Reaction score
0
Hi all,

I need to check Terminal Services is Enable or not on a remote machine. I find one link from this Forum. link is as below :



https://www.pcreview.co.uk/forums/thread-1609344.php



and i have get the code as below and executed.



BOOL Is_Terminal_Services ()

{

OSVERSIONINFOEX osvi;

DWORDLONG dwlConditionMask = 0;

// Initialize the OSVERSIONINFOEX structure.

ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));

osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);

osvi.wSuiteMask = VER_SUITE_TERMINAL | VER_SUITE_SINGLEUSERTS;

// Initialize the condition mask.

VER_SET_CONDITION( dwlConditionMask, VER_SUITENAME, VER_OR );

// Perform the test.

return VerifyVersionInfo(

&osvi,

VER_SUITENAME,

dwlConditionMask);

}



int _tmain(int argc, _TCHAR* argv[])

{

bool bflag = Is_Terminal_Services () ;

}



But even I am unable to analyze. Because if my Terminal service is stopped then it returns 0 else it returns 1.

But my Terminal service is not enable in Control Panel -> Add and Remove Programs -> Add / Remove Windows Components -> Terminal Services.



So I need the check the above thing whether Terminal Services are enable or not so what I need to Do. Kindly provide any code snippet will be great.





 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top