Status: Accepted
Owner: danports
Labels: Type-Enhancement Priority-Medium Milestone-2.1
New issue 70 by danports: Add a property to ITerminalServicesSession to
fetch the session's virtual IP address
http://code.google.com/p/cassia/issues/detail?id=70
Like this:
// VirtualIP.cpp : Defines the entry point for the console application.
#pragma comment(lib,"Wtsapi32.lib") // Library for WTS functions
#include "stdafx.h"
#include "windows.h"
#include "Wtsapi32.h"
int _tmain(int argc, _TCHAR* argv[])
{
PWTS_SESSION_ADDRESS wAddr = NULL;
DWORD dwBytes = 0;
// Use WTS_CURRENT_SERVER_HANDLE and
// WTS_CURRENT_SESSION to get just our virtual address
if(WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE,
WTS_CURRENT_SESSION, WTSSessionAddressV4,
(LPWSTR*)&wAddr, &dwBytes))
{
//wAddr->AddressFamily is always 2 (AF_INET)
printf("Family: %d\n",wAddr->AddressFamily);
printf("Address: %d.%d.%d.%d\n",wAddr->Address[2],
wAddr->Address[3],wAddr->Address[4],wAddr->Address[5]);
} else
{
printf("WTSQuerySessionInformation failed.
GLE=%d\n",GetLastError());
}
return 0;
}
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings