teapot_of_wine
teapot_of_wine

Reputation: 526

Check if Windows machine can act as a host in RDP connection

I'm writing a program and I want to be sure that it will run only on Windows machines that can act as a host in RDP connection. For example, some Windows versions can't do such a thing – e.g. win7 basic, win7 home, win8.
I can check Windows version and compare it with list of RDP-host-compatible versions, but I wonder if there is а more common way to check this ability. Maybe some WinAPI method or a special registry key. Any suggestions?

Upvotes: 3

Views: 474

Answers (2)

teapot_of_wine
teapot_of_wine

Reputation: 526

Like David Heffernan suggested edition check was hardcoded.

Upvotes: 0

Werner Henze
Werner Henze

Reputation: 16726

As far as I understand MSDN Remote Desktop Services Administration the function NetServerGetInfo should give you the information you want.

LPSERVER_INFO_101 pSI = NULL;
if(NetServerGetInfo(NULL, 101, (LPBYTE*)&pSI) == NErr_Success) {
    const bool bIsTerminalServer = pSI->sv101_type & SV_TYPE_TERMINALSERVER;
    NetApiBufferFree(pSI);
}

Other newsgroup posts suggest to check if the service TermService is running (you can use QueryServiceStatusEx for that).

Upvotes: 2

Related Questions