Can someone explain to me how sending pointers between processes works, if you calling a richedit window, but fails if your calling your own window (in the same external process?)

Im working on Vkim's debugger, and when printing text, it sends the ADDRESS of a text string, from the under-test window, to an external process 'dbgwin.exe', which has a child Richedit window that recieves and uses this pointer to copy and disply the string of text.

We all seen this work before. Thing here is, two separate processes, and a pointer being sent via SendMessage.


So i modified 'dbgwin.exe' and added my own custom control window into the source. I also used the exact same "sendmessage" api with a pointer to data in the debug-process.

However, this time when i trace thu with SoftIce, i discover that in this case, the pointer is applied to its own process 'dbgwin' and finds false data. Makes sense because the processes are separeate, but what doesnt is why it still works for the Richedit window??

Im Stumped..... Maybe im missing something here? I was under the impression that the SendMessage API opens a "sharing - window" between processes only while the API has not returned. Guess im way wrong here... :confused:

NaN
Posted on 2002-06-04 00:33:16 by NaN
NaN
I don't know if this will help but while I was reading your post I had a thought. Maybe it has something to do with the richedit window proc being in a dll.
Posted on 2002-06-04 01:42:37 by Kudos
SendMessage doesn't send the pointer; pointers make no sense when address spaces differ.

Having seen your calling SendMessage to a window belonging to another process, the function checks to see if the message is WM_GETTEXT, WM_SETTEXT, or WM_COPYDATA. If yes it copies the null-terminated string pointed to by your parameter into a block of memory shared by both processes (via memory mapped files), and this shared memory is decommited and released before SendMessage returns.
Posted on 2002-06-04 02:44:03 by C.Z.
I'm not into anything Win32 specific too much at all, even less SendMessage and windows.. but a quick instinctive thought I had is that the receiver of the message (and thus of the pointer) may know which process sent it, and then use ReadProcessMemory() on that process.

That would work.
Posted on 2002-06-04 03:36:42 by Maverick
Thanx for your suggestions.. i need to experiment now to find a solution that is an acceptable trade off ;)

My gut feeling says stay away from ReadProcessMemory.. but will look into it all the same...

Thanx again!
:NaN:
Posted on 2002-06-05 14:18:55 by NaN