--- In [email protected], "Sheri" <sheri...@...> wrote:
> <http://tech.groups.yahoo.com/group/power-pro/message/33318>
>
> I guess you would need to be using the dll plugin to get a pointer to
a wstring instead of a string. Then possibly the unicode plugin or
another API could be used to translate the widestring to ascii.
>
> Regards,
> Sheri
>
Thx for the hints sheri, bruce.

I came up with  this,  it is not perfect ... but it seems to work :
i just have to map back to unicode string using unicode.from_binary and 
back to ascii ...

function sendMessageRemoteOUT( han, message, wParam, maxSize )
     local pHan, mem

     local PROCESS_ALL_ACCESS = 0x1F0FFF
     local MEM_COMMIT = 0x1000
     local MEM_RELEASE = 0x8000
     local PAGE_READWRITE = 0x04

     binaryVar = binary.from_ascii("x".repeat(maxSize))

     pHan = dll.call("OpenProcess|ui i ui", PROCESS_ALL_ACCESS, 0,
han.getProcessId)
     // allocate memory:
     mem = dll.call("VirtualAllocEx|ui[5]", pHan, 0, bsize, MEM_COMMIT,
PAGE_READWRITE)
     // get text of third segment:
     ret = han.sendMessage(message, wParam, mem)
     // copy memory content to buffer:
     dll.call("ReadProcessMemory|ui[5]", pHan, mem,
dll.get_pointer(binaryVar), maxSize, 0)
     // free memory:
     dll.call("VirtualFreeEx|ui[4]", pHan, mem, 0, MEM_RELEASE)
     // free process handle:
     dll.call("CloseHandle|ui", pHan)
quit( binaryVar )

// ps i tried to use binary.empty to get an empty buffer with maxsize
allocated but dll.get_pointer do not succeed !



[Non-text portions of this message have been removed]

Reply via email to