Ugly...
; MemAddr - memory address
; nSize - number of bytes allocated at MemAddr
#DefineFunction StrFromMemAddr(MemAddr, nSize)
hBin = BinaryAlloc(nSize+1)
DllCall("Kernel32.dll",long:"lstrcpynA",lpbinary:hBin, long:MemAddr, long:nSize)
BinaryEODSet(hBin,nSize)
strResult = BinaryPeekStr(hBin, 0, nSize)
BinaryFree(hBin)
return strResult ; ANSI string returned
#EndFunction
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Very quick and dirty example that likely doesn't server any useful purpose.
WTSApplicationName = 1
hServer = DllCall('Wtsapi32.dll', long:'WTSOpenServerA', lpstr:'.')
SessId = 1
hPtr = BinaryAlloc(4)
hBufSize = BinaryAlloc(4)
bResult = DllCall('Wtsapi32.dll', long:'WTSQuerySessionInformationA',long:hServer,long:SessId,long:WTSApplicationName,lpbinary:hPtr,lpbinary:hBufSize)
MemAddr =BinaryPeek4(hPtr,0)
strApp = StrFromMemAddr(MemAddr, BinaryPeek4(hBufSize,0))
DllCall('Wtsapi32.dll', long:'WTSFreeMemory',long:MemAddr)
BinaryFree(hBufSize)
BinaryFree(hPtr)
Message("Find Anything?", strApp)