Communicating processes using WM_COPYDATA

new topic     » topic index » view thread      » older message » newer message

I've got this working, but it begs a question.

Two programs, P and Q, (both exw, sorry Tone) are communicating using
the WM_COPYDATA method.

Let's say P wants to get a string from Q. My first instinct was that P
sends a message, which Q replies to by allocating some space, poking
the text into it, and returning the address. However the peek (in P)
crashes. Scratching my head, and with a WM_GETTEXTLENGTH/ allocate/
WM_GETTEXT immediately above, I tried that approach, and it worked
fine, ie P asks Q how long the string it wants is, allocates space,
and then passes a memory address to Q for storing the string in.

My question is: Does this mean a windows program can /*poke*/ into the
memory space of another process, but cannot peek it?

That just seems completely the wrong way round! It would certainly
explain why windows programs so often manage to kill off other
programs! Wouldn't it have been smarter to 1) P asks Q to allocate,
poke and return the address, 2) P lets Q know it can now free() that
memory?

Confused,
Pete

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu