I have created a simple server in C on one system and a client on another. My goals is take a process running on the server, send its process HANDLE to the connecting system, and by using ReadProcessMemory, read and interpret specific data values.
I am well aware of the problems that come with data transfer on differing architectures, which is I would like to see if what I am proposing is even feasible before attempting such a difficult task. My questions are as followed:
Is a HANDLE simply only a reference to, in my case, the process? Meaning that if I successfully sent the process handle to the client, I wouldn't be able to do anything with it?
If the above is true, is there some sort of way that I can take a snapshot or dump the memory of the process, send the dump via TCP (using Winsock of course), and read and sort through the memory on the client. If so, would that piece of data be too large to send.
I would like to stress that the reading of the process' memory must be done by the client system and not the server
HANDLE
is a value. Its meaning is only useful to the local system and processes. You pass the HANDLE
as argument to Windows APIs to interact with the corresponding process/window/etc, therefore it's not really useful to remote systems for anything besides identification.
Yes, you can take a snapshot of a memory region and send it over socket. In fact, you can send pretty much anything over socket. It's up to you to process the received data and give meaning to it. If you don't, it's just garbage being transferred.
I would like to stress that the reading of the process' memory must be done by the client system and not the host.
If I understand you correctly, what you call host is actually your server. The client cannot read the server's memory directly. Your final goal can be accomplished though. You'll have to define a communication protocol like the following:
As for any network communication, special attention must be given to byte order.