Beispiel #1
0
 public static unsafe extern Win32ErrorCode GetExtendedTcpTable(
     void *pTcpTable,
     ref int pdwSize,
     bool bOrder,
     AddressFamily ulAf,
     TCP_TABLE_CLASS TableClass,
     uint Reserved);
 public static extern UInt32 GetExtendedTcpTable(
     IntPtr pTcpTable,
     ref Int32 dwSize,
     bool bOrder,
     UInt32 ulAfInetVersion,
     TCP_TABLE_CLASS TableClass,
     UInt32 Reserved);
Beispiel #3
0
 internal static extern uint GetExtendedTcpTable(
     IntPtr tcpTable,
     ref int tcpTableLength,
     bool sort,
     int ipVersion,
     TCP_TABLE_CLASS tcpTableType,
     int reserved = 0);
Beispiel #4
0
 extern public static int GetExtendedTcpTable(
     IntPtr pTcpTable,
     ref int pdwSize,
     bool bOrder,
     uint ulAf,
     TCP_TABLE_CLASS TableClass,
     int Reserved);
Beispiel #5
0
 public static extern uint GetExtendedTcpTable(
     IntPtr pTcpTable,
     ref int dwOutBufLen,
     bool sort,
     _AddressFamily ipVersion,
     TCP_TABLE_CLASS tblClass,
     uint reserved = 0);
 private static extern uint GetExtendedTcpTable(
     IntPtr pTcpTable,
     ref int dwOutBufLen,
     [MarshalAs(UnmanagedType.Bool)] bool sort,
     int ipVersion,
     TCP_TABLE_CLASS tblClass,
     uint reserved = 0);
 public static extern uint GetExtendedTcpTable(
     IntPtr pTcpTable,
     ref int dwOutBufLen,
     bool sort,
     int ipVersion,
     TCP_TABLE_CLASS tblClass,
     int reserved);
 public static extern unsafe int GetExtendedTcpTable(
     [Out] byte *pTcpTable,
     [In, Out] ref int pdwSize,
     [In] bool bOrder,
     [In] int ulAf,
     [In] TCP_TABLE_CLASS TableClass,
     [In] uint Reserved
     );
Beispiel #9
0
 internal static extern Win32Error GetExtendedTcpTable(
     SafeBuffer pTcpTable,
     ref int pdwSize,
     [MarshalAs(UnmanagedType.Bool)]
     bool bOrder,
     AddressFamily ulAf,
     TCP_TABLE_CLASS TableClass,
     int Reserved
     );
        private static unsafe int EstimateBufferSize(AddressFamily addressFamily, TCP_TABLE_CLASS tableClass)
        {
            var size   = 0;
            var status = IPHlpApi.GetExtendedTcpTable(null, ref size, false, addressFamily, tableClass, 0);

            if (status != (int)ErrorCodes.ERROR_INSUFFICIENT_BUFFER)
            {
                Win32ExceptionUtility.Throw(status);
            }
            return(size);
        }
Beispiel #11
0
 public extern static int GetExtendedTcpTable(IntPtr Table, ref int Size,
                                              bool Order, int IpVersion, // 2 for IPv4
                                              TCP_TABLE_CLASS TableClass, int Reserved);
Beispiel #12
0
 public extern static int GetExtendedTcpTable(IntPtr Table, ref int Size,
     bool Order, int IpVersion, // 2 for IPv4
     TCP_TABLE_CLASS TableClass, int Reserved);
Beispiel #13
0
 private static extern UInt32 GetExtendedTcpTable(IntPtr pTcpTable,
                                                  ref Int32 dwOutBufLen,
                                                  Boolean sort,
                                                  Int32 ipVersion,
                                                  TCP_TABLE_CLASS tblClass,
                                                  Int32 reserved);
Beispiel #14
0
 public static extern uint GetExtendedTcpTable(IntPtr pTcpTable, ref UInt32 pdwSize, Boolean bOrder, UInt32 ulAf, TCP_TABLE_CLASS TableClass, UInt32 Reserved);
Beispiel #15
0
 static extern DWORD GetExtendedTcpTable(
   PVOID pTcpTable,
   ref DWORD pdwSize,
   BOOL bOrder,
   ULONG ulAf,
   TCP_TABLE_CLASS TableClass,
   ULONG Reserved = 0
 );
Beispiel #16
0
 public static extern UInt32 GetExtendedTcpTable(IntPtr pTcpTable, ref UInt32 dwOutBufLen, [MarshalAs(UnmanagedType.Bool)] bool order, AF_INET ipVersion, TCP_TABLE_CLASS tblClass, UInt32 reserved);
Beispiel #17
0
 public static extern UInt32 GetExtendedTcpTable(
     IntPtr pTcpTable, ref UInt32 dwOutBufLen, bool sort, int ipVersion, TCP_TABLE_CLASS tblClass, uint reserved = 0);
 public extern static uint GetExtendedTcpTable(IntPtr pTable, ref int dwSize, bool bOrder, int ulAdressFamily, TCP_TABLE_CLASS dwFlag, int Reserved);
Beispiel #19
0
 public static extern int GetExtendedTcpTable(IntPtr pTcpTable, ref int pdwSize, bool bOrder, int ipVersion, TCP_TABLE_CLASS tblClass, int reserved);
Beispiel #20
0
 internal static extern uint GetExtendedTcpTable(IntPtr pTcpTable, ref uint dwOutBufLen, [MarshalAs(UnmanagedType.Bool)] bool sort, AF_INET ipVersion, TCP_TABLE_CLASS tblClass, uint reserved);
 public static extern UInt32 GetExtendedTcpTable(
     IntPtr pTcpTable, ref UInt32 dwOutBufLen, bool sort, int ipVersion, TCP_TABLE_CLASS tblClass, uint reserved = 0);
Beispiel #22
0
 public static extern int GetExtendedTcpTable(byte[] pTcpTable, out int dwOutBufLen, bool sort,
     int ipVersion, TCP_TABLE_CLASS tblClass, int reserved);
Beispiel #23
0
 private static extern uint GetExtendedTcpTable(IntPtr pTcpTable, ref int pdwSize, bool bOrder, int ulAf, TCP_TABLE_CLASS TableClass, uint Reserved = 0);
Beispiel #24
0
 public static extern uint GetExtendedTcpTable(IntPtr tcpTable, ref int tcpTableLength, bool sort, int ipVersion, TCP_TABLE_CLASS tcpTableClass, uint reserved = 0);
Beispiel #25
0
 public static extern ERROR GetExtendedTcpTable(IntPtr pTcpTable, ref int dwSize, bool bOrder, FAMILY Family, TCP_TABLE_CLASS TableClass, uint Reserved);
Beispiel #26
0
 static extern int GetExtendedTcpTable(byte[] pTcpTable,
                                       ref int bufferlength,
                                       bool sort,
                                       int ipVersion,
                                       TCP_TABLE_CLASS tblClass,
                                       int reserved);
Beispiel #27
0
 public static extern uint GetExtendedTcpTable(IntPtr tcpTable, ref int tcpTableLength, bool sort, uint ipVersion, TCP_TABLE_CLASS tcpTableClass, uint reserved = 0);
 public static extern uint GetExtendedTcpTable([NativeTypeName("PVOID")] void *pTcpTable, [NativeTypeName("PDWORD")] uint *pdwSize, BOOL bOrder, [NativeTypeName("ULONG")] uint ulAf, TCP_TABLE_CLASS TableClass, [NativeTypeName("ULONG")] uint Reserved);
 private static extern uint GetExtendedTcpTable(IntPtr pTcpTable, ref int dwOutBufLen, bool sort, int ipVersion, TCP_TABLE_CLASS tblClass, int reserved);
Beispiel #30
0
 private static extern int GetExtendedTcpTable(IntPtr pTcpTable, ref int dwOutBufLen, bool bOrder, UInt32 /*ulong*/ dwFamily, TCP_TABLE_CLASS dwClass, UInt32 /*ulong*/ dwReserved);
        private static NtResult <TcpListenerInformation[]> GetTcpListeners <T>(AddressFamily address_family, TCP_TABLE_CLASS table_class, bool throw_on_error) where T : struct, ITcpTable <T>
        {
            int curr_size   = 64 * 1024;
            int retry_count = 10;

            while (retry_count-- > 0)
            {
                using (var buffer = new SafeStructureInOutBuffer <T>(curr_size, true))
                {
                    var error = Win32NetworkNativeMethods.GetExtendedTcpTable(buffer, ref curr_size,
                                                                              true, address_family, table_class, 0);
                    if (error == Win32Error.ERROR_INSUFFICIENT_BUFFER)
                    {
                        continue;
                    }

                    if (error != Win32Error.SUCCESS)
                    {
                        return(error.CreateResultFromDosError <TcpListenerInformation[]>(throw_on_error));
                    }

                    return(buffer.Result.GetListeners(buffer).CreateResult());
                }
            }
            return(NtStatus.STATUS_BUFFER_TOO_SMALL.CreateResultFromError <TcpListenerInformation[]>(throw_on_error));
        }
Beispiel #32
0
 public static extern int GetExtendedTcpTable(byte[] pTcpTable, out int dwOutBufLen, bool sort,
                                              int ipVersion, TCP_TABLE_CLASS tblClass, int reserved);
Beispiel #33
0
 private static NtResult <TcpListenerInformation[]> GetTcpListeners <T>(AddressFamily address_family, TCP_TABLE_CLASS table_class, bool throw_on_error) where T : struct, IIpTable <T, TcpListenerInformation>
 {
     return(GetListeners <T, TcpListenerInformation, TCP_TABLE_CLASS>(Win32NetworkNativeMethods.GetExtendedTcpTable, address_family, table_class, throw_on_error));
 }