forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reimplement socket duplication, fix dotnet#1760
- Loading branch information
1 parent
704aa77
commit 52dc552
Showing
16 changed files
with
555 additions
and
82 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
src/libraries/Common/src/Interop/Windows/WinSock/Interop.WSADuplicateSocket.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using System.Net.Sockets; | ||
using System.Runtime.InteropServices; | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class Winsock | ||
{ | ||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] | ||
internal struct WSAProtocolChain | ||
{ | ||
internal int ChainLen; | ||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=7)] | ||
internal uint[] ChainEntries; | ||
} | ||
|
||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] | ||
internal struct WSAProtocolInfo | ||
{ | ||
internal uint ServiceFlags1; | ||
internal uint ServiceFlags2; | ||
internal uint ServiceFlags3; | ||
internal uint ServiceFlags4; | ||
internal uint ProviderFlags; | ||
internal Guid ProviderId; | ||
internal uint CatalogEntryId; | ||
internal WSAProtocolChain ProtocolChain; | ||
internal int Version; | ||
internal AddressFamily AddressFamily; | ||
internal int MaxSockAddr; | ||
internal int MinSockAddr; | ||
internal SocketType SocketType; | ||
internal ProtocolType ProtocolType; | ||
internal int ProtocolMaxOffset; | ||
internal int NetworkByteOrder; | ||
internal int SecurityScheme; | ||
internal uint MessageSize; | ||
internal uint ProviderReserved; | ||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] | ||
internal string ProtocolName; | ||
|
||
public static readonly int Size = Marshal.SizeOf(typeof(WSAProtocolInfo)); | ||
} | ||
|
||
[DllImport(Interop.Libraries.Ws2_32, SetLastError = true)] | ||
internal static extern unsafe SocketError WSADuplicateSocket( | ||
[In] SafeHandle socketHandle, | ||
[In] uint targetProcessId, | ||
[In] byte* pinnedBuffer | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.