Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip WSA_FLAG_NO_HANDLE_INHERIT on system < Windows 7 SP1 #126

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/Thunks/WS2_32.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1463,6 +1463,34 @@ namespace YY::Thunks
}
#endif

#if (YY_Thunks_Target < __WindowsNT6_1_SP1)
#ifndef WSA_FLAG_NO_HANDLE_INHERIT
#define WSA_FLAG_NO_HANDLE_INHERIT 0x80
#endif

__DEFINE_THUNK(
ws2_32,
24,
SOCKET,
WSAAPI,
WSASocketW,
_In_ int af,
_In_ int type,
_In_ int protocol,
_In_opt_ LPWSAPROTOCOL_INFOW lpProtocolInfo,
_In_ GROUP g,
_In_ DWORD dwFlags
)
{
if (auto const pWSASocketW = try_get_WSASocketW())
{
// This flag is supported on Windows 7 with SP1, Windows Server 2008 R2 with SP1, and later
dwFlags &= ~WSA_FLAG_NO_HANDLE_INHERIT;
stevefan1999-personal marked this conversation as resolved.
Show resolved Hide resolved
return pWSASocketW(af, type, protocol, lpProtocolInfo, g, dwFlags);
}
return INVALID_SOCKET;
}
#endif

#if (YY_Thunks_Target < __WindowsNT6_2)

Expand Down