RFC: adding fd-passing to win32

Marc-André Lureau marcandre.lureau at gmail.com
Tue Apr 12 11:15:56 UTC 2022


Hi,

I am looking at implementing fd-passing for win32. I have learned that the
way to share sockets and other objects with Windows is through the
DuplicateHandle() and WSADuplicateSocket() calls. The slightly annoying
thing is that unlike ancillary data, the dbus protocol would need to be
modified to send the list of target HANDLEs and WSAPROTOCOL_INFOs along
with the message, for each message target.

I have started hacking gdbus to experiment with the implementation. It
seems practical, as processes by default seem to have the
PROCESS_DUP_HANDLE capability, and we can map fd<->{HANDLE,SOCKET}
transparently. But I could use some help on how best to transmit the ARRAY
of UNION { HANDLE, WSAPROTOCOL_INFO }. One reasonable approach would be to
add new header fields (however, I think the same type should not be present
multiple times) and serialize the win32 data/structs in dbus form. The
major downside is that the header will need to be modified for each target
process, although at fixed size/location.

Another approach would be to prepend or append some new data (before/after
body for example), perhaps not necessarily using the dbus encoding, but the
native data/struct types.

Any other idea? (of course, the protocol change would need to be negotiated
first!)

Thanks for your feedback and help!

-- 
Marc-André Lureau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20220412/9a9e1267/attachment.htm>


More information about the dbus mailing list