- Gregory Rusak
- PowerBuilder
- Monday, 11 July 2022 10:35 PM UTC
Hello,
PowerBuilder 2021 Build 1288
We're in the process of trying to get the remote IP Address of the client machine when running our application through an RDP session.
We're successful at using the Windows WTSQuerySessionInformation API and get values for WTSClientName, WTSUserName, etc. but currently we're not able to get a value for WTSClientAddress.
It appears that according to the MSDN docs (https://docs.microsoft.com/en-us/windows/win32/api/wtsapi32/ne-wtsapi32-wts_info_class?redirectedfrom=MSDN):
"The IP address is offset by two bytes from the start of the Address member of the WTS_CLIENT_ADDRESS
structure."
Here's a snippet of code we're using to get the session info:
If WTSQuerySessionInformation(aul_hserver, aul_sessionid, aul_infoclass, lul_ppBuffer, lul_pBytesReturned) Then
If lul_pBytesReturned > 0 Then
ls_infovalue = String(lul_ppBuffer, 'address')
end if
end if
How do we get the value out of the memory pointer skipping the first 2 bytes?
Thanks for your help in advance.
Greg
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.