public static extern UInt32 GetExtendedUdpTable(
     IntPtr pUdpTable,
     ref Int32 dwSize,
     bool bOrder,
     UInt32 ulAfInetVersion,
     UDP_TABLE_CLASS TableClass,
     UInt32 Reserved);
Exemple #2
0
 public static extern uint GetExtendedUdpTable(
     IntPtr pUdpTable,
     ref uint dwOutBufLen,
     bool sort,
     int ipVersion,
     UDP_TABLE_CLASS tblClass,
     int reserved);
Exemple #3
0
 public static extern System.UInt32 GetExtendedUdpTable(
     System.IntPtr Table,
     ref System.UInt32 Size,
     bool Order,
     [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)]
     Address_Family AF,
     [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.I4)]
     UDP_TABLE_CLASS TableClass,
     UInt32 Reserved);
Exemple #4
0
 internal static extern Win32Error GetExtendedUdpTable(
     SafeBuffer pUdpTable,
     ref int pdwSize,
     [MarshalAs(UnmanagedType.Bool)]
     bool bOrder,
     AddressFamily ulAf,
     UDP_TABLE_CLASS TableClass,
     int Reserved
     );
Exemple #5
0
        private static MIB_UDPTABLE_OWNER_PID[] getCurrentUDPListeners()
        {
            int buflen;

            MIB_UDPTABLE_OWNER_PID[] tableContents;
            int res = GetExtendedUdpTable(IntPtr.Zero, out buflen, false, 2, UDP_TABLE_OWNER_PID, 0);

            if (res != 122) // error_more_data
            {
                throw new Win32Exception(res, "GetExtendedUdpTable (first) failed");
            }
            IntPtr tableBuffer = Marshal.AllocHGlobal(buflen);

            try
            {
                res = GetExtendedUdpTable(tableBuffer, out buflen, false, 2, UDP_TABLE_OWNER_PID, 0);
                if (res != 0)
                {
                    throw new Win32Exception(res, "GetExtendedUdpTable (second) failed");
                }
                UDP_TABLE_CLASS table = (UDP_TABLE_CLASS)Marshal.PtrToStructure(tableBuffer, typeof(UDP_TABLE_CLASS));
                tableContents = new MIB_UDPTABLE_OWNER_PID[(buflen - Marshal.SizeOf(typeof(UDP_TABLE_CLASS))) / Marshal.SizeOf(typeof(MIB_UDPTABLE_OWNER_PID))];

                for (int rowIndex = 0; rowIndex < tableContents.Length; rowIndex++)
                {
                    IntPtr pos = tableBuffer +
                                 Marshal.SizeOf(typeof(UDP_TABLE_CLASS)) +
                                 ((Marshal.SizeOf(typeof(MIB_UDPTABLE_OWNER_PID))) * rowIndex);
                    MIB_UDPTABLE_OWNER_PID row = (MIB_UDPTABLE_OWNER_PID)Marshal.PtrToStructure(pos, typeof(MIB_UDPTABLE_OWNER_PID));

                    row.localPort = byteswap((UInt16)row.localPort);

                    tableContents[rowIndex] = row;
                }
            }
            finally
            {
                Marshal.FreeHGlobal(tableBuffer);
            }

            return(tableContents);
        }
Exemple #6
0
 private static NtResult <UdpListenerInformation[]> GetUdpListeners <T>(AddressFamily address_family, UDP_TABLE_CLASS table_class, bool throw_on_error) where T : struct, IIpTable <T, UdpListenerInformation>
 {
     return(GetListeners <T, UdpListenerInformation, UDP_TABLE_CLASS>(Win32NetworkNativeMethods.GetExtendedUdpTable, address_family, table_class, throw_on_error));
 }
Exemple #7
0
 public static extern int GetExtendedUdpTable(byte[] pUdpTable, out int dwOutBufLen, bool sort,
     int ipVersion, UDP_TABLE_CLASS tblClass, int reserved);
Exemple #8
0
 internal static extern uint GetExtendedUdpTable(IntPtr udpTable, ref int tableLength, bool sort, int ipVersion, UDP_TABLE_CLASS tableClass, uint reserved = 0);
Exemple #9
0
 public extern static int GetExtendedUdpTable(IntPtr Table, ref int Size,
     bool Order, int IpVersion, // 2 for IPv4
     UDP_TABLE_CLASS TableClass, int Reserved);
Exemple #10
0
 public static extern UInt32 GetExtendedUdpTable(IntPtr pUdpTable, ref UInt32 dwOutBufLen, bool order, AF_INET ipVersion, UDP_TABLE_CLASS tblClass, UInt32 reserved);
Exemple #11
0
 public static extern uint GetExtendedUdpTable(IntPtr pUdpTable, ref UInt32 pdwSize, Boolean bOrder, UInt32 ulAf, UDP_TABLE_CLASS TableClass, UInt32 Reserved);
Exemple #12
0
 private static extern UInt32 GetExtendedUdpTable(IntPtr pUdpTable, ref UInt32 pdwSize, Int32 bOrder, UInt32 ulAf, UDP_TABLE_CLASS TableClass, UInt32 Reserved);
 private static extern UInt32 GetExtendedUdpTable(IntPtr pUdpTable, ref UInt32 pdwSize, Int32 bOrder, UInt32 ulAf, UDP_TABLE_CLASS TableClass, UInt32 Reserved);
Exemple #14
0
 private static extern uint GetExtendedUdpTable(IntPtr pTcpTable, ref int dwOutBufLen, bool sort, int ipVersion, UDP_TABLE_CLASS tblClass, uint reserved = 0);
Exemple #15
0
 public extern static int GetExtendedUdpTable(IntPtr Table, ref int Size,
                                              bool Order, int IpVersion, // 2 for IPv4
                                              UDP_TABLE_CLASS TableClass, int Reserved);
Exemple #16
0
 internal static extern uint GetExtendedUdpTable(IntPtr pUdpTable, ref int dwOutBufLen, bool sort, AF_INET ipVersion, UDP_TABLE_CLASS tblClass, uint reserved);
Exemple #17
0
 private static extern int GetExtendedUdpTable(IntPtr pTable, ref UInt32 dwOutBufLen, bool sort, int ipVersion, UDP_TABLE_CLASS tblClass, int reserved);
Exemple #18
0
 public static extern ERROR GetExtendedUdpTable(IntPtr pUdpTable, ref int dwSize, bool bOrder, FAMILY Family, UDP_TABLE_CLASS TableClass, uint Reserved);
 public static extern uint GetExtendedUdpTable([NativeTypeName("PVOID")] void *pUdpTable, [NativeTypeName("PDWORD")] uint *pdwSize, BOOL bOrder, [NativeTypeName("ULONG")] uint ulAf, UDP_TABLE_CLASS TableClass, [NativeTypeName("ULONG")] uint Reserved);
 public extern static uint GetExtendedUdpTable(IntPtr pTable, ref int dwSize, bool bOrder, int ulAdressFamily, UDP_TABLE_CLASS dwFlags, int Reserved);
Exemple #21
0
 public static extern int GetExtendedUdpTable(byte[] pUdpTable, out int dwOutBufLen, bool sort,
                                              int ipVersion, UDP_TABLE_CLASS tblClass, int reserved);
Exemple #22
0
 public extern static int GetExtendedUdpTable(IntPtr pUdpTable, ref int pdwSize, bool bOrder, int ulAf,
                                              UDP_TABLE_CLASS TableClass, uint Reserved);