Similar to what was done in commit 2a925f27, the spawn-helper shouldn't assume the inherited fd are simple HANDLE. If they are actually SOCKET, we should use WSADuplicateSocket API.
I introduce new private API to check if a HANDLE is a SOCKET, and to reopen a handle with NOINHERIT. This is useful for testing purposes, but also in future work I intend to submit to allow HANDLE-passing over DBus.
(I aslo included a few simple not-directly-related patches here, to avoid maintaining/working on dozen of branches)