In order to implement WebKit2's SharedMemory class (bug 47499), we'll need a way to pass HANDLEs (specifically, those representing file-mapping objects) across processes.
In order to pass a HANDLE between processes, we'll need to call ::DuplicateHandle to copy the handle into the target process. But doing this requires knowing what the target process is, which is not known at argument-encoding time. Anders suggests that we use CoreIPC::Attachment for this. Specifically, we'd: A1) Make CoreIPC::Connection perform a handshake that exchanges process HANDLEs between the two ends of the connection (on Vista and newer we could perhaps use ::GetNamedPipeClientProcessId/::GetNamedPipeServerProcessId to simplify this) A2) Use the process HANDLE received in the handshake to call ::DuplicateHandle when sending the message I think another option that wouldn't require the handshake is: B1) Call ::DuplicateHandle to duplicate the HANDLE in the source process at argument-encoding time B2) Send both the HANDLE and the source process's PID in the message to the target process B3) When the message is received in the target process, call ::DuplicateHandle to copy the handle into the target process and pass DUPLICATE_CLOSE_SOURCE to close the HANDLE the source process made in (B1) I'm not positive that the ::DuplicateHandle call in (B3) will actually succeed, however. Maybe Windows doesn't allow it to be used like this.
<rdar://problem/8536804>
*** This bug has been marked as a duplicate of bug 47499 ***