Hi,
I'm trying to fetch some data from out terminal server (connection time, login time, etc.). Therefore the DLL winsta.dll can be used. Although searching the web for any help on this, I'm still failing to return any useful data. That's what I have so far:
#include <Array.au3>
Local $sServerName = @ComputerName
Local $iSessionId = 0
Local $aResult = DllCall("wtsapi32.dll", "HANDLE", "WTSOpenServerA", "STR", $sServerName)
If (Not @error) Then
Local Const $hServer = $aResult[0]
Local Const $tagWINSTATIONINFORMATIONW = _
"BYTE Reserved1[72];" & _
"ULONG SessionId;" & _
"BYTE Reserved2[4];" & _
"CHAR ConnectTime;" & _
"CHAR DisconnectTime;" & _
"CHAR LastInputTime;" & _
"CHAR LoginTime;" & _
"BYTE Reserved3[1096];" & _
"CHAR CurrentTime;"
Local $tTmp = DllStructCreate($tagWINSTATIONINFORMATIONW)
$aResult = DllCall("winsta.dll", "BOOL", "WinStationQueryInformationW", "HANDLE", $hServer, "DWORD", $iSessionId, "DWORD", 8, "PTR", $tTmp, "DWORD", DllStructGetSize($tTmp), "PTR*", 0)
If (Not @error) Then
_ArrayDisplay($aResult)
MsgBox(0, "", DllStructGetData($tagWINSTATIONINFORMATIONW, 5))
EndIf
EndIf
MSDN: https://msdn.microsoft.com/en-us/library/aa383827(v=VS.85).aspx .
The call returns "some" results, but how to extract the data from the structure?
S.