Anyone got a working code for using WTSQuerySessionInformation.
I need to get the WTSClientName for computers connected to my application with Terminalserver.
MODULE('WTSAPI32.DLL')
WTSFreeMemory(ULONG),PASCAL
WTSQuerySessionInformation(ULONG,ULONG,ULONG,*ULONG,*ULONG),ULONG,PASCAL,RAW,NAME('WTSQuerySessionInformationA')
END
In the procedure ::
Code:
MemoryAddr ULONG
StringRef &CSTRING
WTSCurrServer LONG(0h)
WTSCurrSession LONG(-1h)
WTSClientAddress LONG(14)
WTSClientName LONG(10)
! Get client computer name
lcl:Result = WTSQuerySessionInformation(WTS_Current_Server_Handle,WTS_Current_Session,WTSClientName,MemoryAddr,lcl:Length)
IF lcl:Result
StringRef &= (MemoryAddr)
glo:ClientName = StringRef
END
WTSFreeMemory(MemoryAddr)
You may need to create a LIB using LibMaker from WTSAPI32.dll of the 2 API functions and link it to the project.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.