1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-01 08:03:32 +00:00

Added support for non-english username and hostname on Windows. Server modifications still needed for hostname display.

This commit is contained in:
Bryan Roe
2019-08-19 13:53:37 -07:00
parent 07cfa46500
commit 8292a609ea
3 changed files with 28 additions and 11 deletions

View File

@@ -96,7 +96,7 @@ function UserSessions()
{
this._wts = this._marshal.CreateNativeProxy('Wtsapi32.dll');
this._wts.CreateMethod('WTSEnumerateSessionsA');
this._wts.CreateMethod('WTSQuerySessionInformationA');
this._wts.CreateMethod('WTSQuerySessionInformationW');
this._wts.CreateMethod('WTSRegisterSessionNotification');
this._wts.CreateMethod('WTSUnRegisterSessionNotification');
this._wts.CreateMethod('WTSFreeMemory');
@@ -193,12 +193,12 @@ function UserSessions()
var buffer = this._marshal.CreatePointer();
var bytesReturned = this._marshal.CreateVariable(4);
if (this._wts.WTSQuerySessionInformationA(0, sessionId, attr, buffer, bytesReturned).Val == 0)
if (this._wts.WTSQuerySessionInformationW(0, sessionId, attr, buffer, bytesReturned).Val == 0)
{
throw ('Error calling WTSQuerySessionInformation: ' + this._kernel32.GetLastError.Val);
throw ('Error calling WTSQuerySessionInformationW: ' + this._kernel32.GetLastError.Val);
}
var retVal = buffer.Deref().String;
var retVal = buffer.Deref().Wide2UTF8;
this._wts.WTSFreeMemory(buffer.Deref());
return (retVal);