WTSVirtualChannelOpen fails with ERROR_NOT_SUPPORTED on Windows 2012 R2

  • Thread starter Thread starter Targash
  • Start date Start date
T

Targash

Guest
Hi,

I am testing this simple C++ application below on Windows 2012 R2 and WTSVirtualChannelOpen fails with error code "ERROR_NOT_SUPPORTED". The same application runs fine on Windows Server 2008.

I have tried with WTSVirtualChannelOpenEx but I got the same error code.

Can anyone help me shed some light on this issue? That would be much appreciated :-)

Thank you.

#include <conio.h>
#include <windows.h>
#include <Wtsapi32.h>
#include <iostream>

#define TERMINAL_SERVICES_VC_NAME "TEST"

int _tmain(int argc, _TCHAR* argv[])
{
std::cout << "<< Virtual Channel App >>" << std::endl;
HANDLE hVirtualChannel = WTSVirtualChannelOpen(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, TERMINAL_SERVICES_VC_NAME);

if(hVirtualChannel)
std::cout << "WTSVirtualChannelOpen successful" << std::endl;
else
std::cerr << "WTSVirtualChannelOpen fails with error code: " << GetLastError() << std::endl;

std::cout << "Press Enter to quit..." << std::endl;
_getch();

if(WTSVirtualChannelClose(hVirtualChannel))
std::cout << "TSVirtualChannelClose successful" << std::endl;
else
std::cerr << "TSVirtualChannelClose fails with error code: " << GetLastError() << std::endl;
return 0;
}

Continue reading...
 
Back
Top