Function 60 - Inter Process Communication (IPC)
IPC is used to send messages from one process / thread to another. In
doing so, you must first agree on how to interpret a particular message.
Subfunction 1 - set the area to get IPC
Called by a receiver process.
Options:
·
eax =
60 - function number
·
ebx =
1 - number of subfunction
·
ecx =
pointer to buffer
·
edx =
buffer size
Return value:
·
eax =
0 - always successful
IPC buffer format:
·
+0: dword: if here is not 0,
then the buffer is considered blocked; block / unlock the buffer when you are
actively working with it and you need to prevent the buffer data from being
changed from the outside (no new messages were received)
·
+4: dword: buffer space
occupied (bytes)
·
+8: first post
·
+8 + n: second message
·
...
Message format:
·
+0: dword: PID of the
process / thread that sent the message
·
+4: dword: message length
(not counting this header)
·
+8: n * byte: message data
Subfunction 2 - send IPC message
Called by the initiator process.
Options:
·
eax =
60 - function number
·
ebx =
2 - subfunction number
·
ecx =
PID receiver
·
edx =
pointer to the message data
·
esi =
message length (in bytes)
Return value:
·
eax =
0 - successful
·
eax =
1 - the receiver has not defined a buffer for IPC messages (maybe not yet had
time, and maybe this is not the flow which is needed)
·
eax =
2 - the receiver has blocked the IPC buffer; try to wait a bit
·
eax =
3 - receiver IPC buffer overflow
·
eax =
4 - there is no process / thread with such a PID
Remarks:
·
The
system immediately after writing the IPC message to the buffer sends event 7 to
the receiving stream (see event codes).
Constants for registers:
eax -
SF_IPC (60)
ebx -
SSF_SET_AREA (1), SSF_SEND_MESSAGE (2)