Parent Directory
|
Revision Log
|
Patch
--- trunk/TSAdminTool/TerminalServices.cs 2012/07/16 15:48:04 188 +++ trunk/TSAdminTool/TerminalServices.cs 2012/07/16 15:54:57 189 @@ -445,24 +445,29 @@ public static string GetTSClientName(uint sessionID, IntPtr server) { - System.IntPtr ppBuffer = System.IntPtr.Zero; - int adrBuffer; - uint pBytesReturned = 0; string clientName = ""; + if (!System.Windows.Forms.SystemInformation.TerminalServerSession) + { + System.IntPtr ppBuffer = System.IntPtr.Zero; + int adrBuffer; + uint pBytesReturned = 0; + if (WTSQuerySessionInformation( + server, + sessionID, + WTSInfoClass.WTSClientName, + out ppBuffer, + out pBytesReturned)) + { + adrBuffer = (int)ppBuffer; + clientName = Marshal.PtrToStringAnsi((System.IntPtr)adrBuffer); + } - if (WTSQuerySessionInformation( - server, - sessionID, - WTSInfoClass.WTSClientName, - out ppBuffer, - out pBytesReturned)) + WTSFreeMemory(ppBuffer); + } + else { - adrBuffer = (int)ppBuffer; - clientName = Marshal.PtrToStringAnsi((System.IntPtr)adrBuffer); + clientName = System.Environment.MachineName; } - - WTSFreeMemory(ppBuffer); - return clientName; }
ViewVC Help | |
Powered by ViewVC 1.1.22 |