1234567891011121314151617181920212223242526272829 |
- using System;
- using System.Net.Sockets;
- using System.Runtime.InteropServices;
- namespace Microsoft.Win32
- {
-
-
-
- public static partial class Util
- {
-
-
-
-
-
-
-
- public static Delegate SioGetExtensionFunctionPointer(Guid guid, Type type, IntPtr socket)
- {
- IntPtr funPointer = IntPtr.Zero;
- int byteTransfered = 0;
- SocketError nErrorCode = UnsafeNativeMethods.WSAIoctl(socket, NativeMethods.SIO_GET_EXTENSION_FUNCTION_POINTER, ref guid, Marshal.SizeOf(guid), ref funPointer, IntPtr.Size, out byteTransfered, NativeMethods.NULL, NativeMethods.NULL);
- if (nErrorCode != SocketError.Success)
- throw new SocketException((int)nErrorCode);
- return Marshal.GetDelegateForFunctionPointer(funPointer, type);
- }
- }
- }
|