using System.Runtime.InteropServices; using Vanara.InteropServices; namespace Vanara.PInvoke { public static partial class IpHlpApi { /// /// /// The TCP_TABLE_CLASS enumeration defines the set of values used to indicate the type of table returned by calls to GetExtendedTcpTable. /// /// /// /// /// On the Microsoft Windows Software Development Kit (SDK) released for Windows Vista and later, the organization of header files /// has changed and the TCP_TABLE_CLASS enumeration is defined in the Iprtrmib.h header file, not in the Iphlpapi.h header /// file. Note that the Iprtrmib.h header file is automatically included in Iphlpapi.h header file. The Iprtrmib.h header files /// should never be used directly. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/iprtrmib/ne-iprtrmib-_tcp_table_class typedef enum _TCP_TABLE_CLASS { // TCP_TABLE_BASIC_LISTENER , TCP_TABLE_BASIC_CONNECTIONS , TCP_TABLE_BASIC_ALL , TCP_TABLE_OWNER_PID_LISTENER , // TCP_TABLE_OWNER_PID_CONNECTIONS , TCP_TABLE_OWNER_PID_ALL , TCP_TABLE_OWNER_MODULE_LISTENER , TCP_TABLE_OWNER_MODULE_CONNECTIONS , // TCP_TABLE_OWNER_MODULE_ALL } TCP_TABLE_CLASS, *PTCP_TABLE_CLASS; [PInvokeData("iprtrmib.h", MSDNShortId = "abfaf7e5-7739-4f23-bfb4-09206111599f")] public enum TCP_TABLE_CLASS { /// /// A MIB_TCPTABLE table that contains all listening (receiving only) TCP endpoints on the local computer is returned to the caller. /// [CorrespondingType(typeof(MIB_TCPTABLE), CorrespondingAction.Get)] TCP_TABLE_BASIC_LISTENER, /// A MIB_TCPTABLE table that contains all connected TCP endpoints on the local computer is returned to the caller. [CorrespondingType(typeof(MIB_TCPTABLE), CorrespondingAction.Get)] TCP_TABLE_BASIC_CONNECTIONS, /// A MIB_TCPTABLE table that contains all TCP endpoints on the local computer is returned to the caller. [CorrespondingType(typeof(MIB_TCPTABLE), CorrespondingAction.Get)] TCP_TABLE_BASIC_ALL, /// /// A MIB_TCPTABLE_OWNER_PID or MIB_TCP6TABLE_OWNER_PID that contains all listening (receiving only) TCP endpoints on the local /// computer is returned to the caller. /// [CorrespondingType(typeof(MIB_TCPTABLE_OWNER_PID), CorrespondingAction.Get)] [CorrespondingType(typeof(MIB_TCP6TABLE_OWNER_PID), CorrespondingAction.Get)] TCP_TABLE_OWNER_PID_LISTENER, /// /// A MIB_TCPTABLE_OWNER_PID or MIB_TCP6TABLE_OWNER_PID that structure that contains all connected TCP endpoints on the local /// computer is returned to the caller. /// [CorrespondingType(typeof(MIB_TCPTABLE_OWNER_PID), CorrespondingAction.Get)] [CorrespondingType(typeof(MIB_TCP6TABLE_OWNER_PID), CorrespondingAction.Get)] TCP_TABLE_OWNER_PID_CONNECTIONS, /// /// A MIB_TCPTABLE_OWNER_PID or MIB_TCP6TABLE_OWNER_PID structure that contains all TCP endpoints on the local computer is /// returned to the caller. /// [CorrespondingType(typeof(MIB_TCPTABLE_OWNER_PID), CorrespondingAction.Get)] [CorrespondingType(typeof(MIB_TCP6TABLE_OWNER_PID), CorrespondingAction.Get)] TCP_TABLE_OWNER_PID_ALL, /// /// A MIB_TCPTABLE_OWNER_MODULE or MIB_TCP6TABLE_OWNER_MODULE structure that contains all listening (receiving only) TCP /// endpoints on the local computer is returned to the caller. /// [CorrespondingType(typeof(MIB_TCPTABLE_OWNER_MODULE), CorrespondingAction.Get)] [CorrespondingType(typeof(MIB_TCP6TABLE_OWNER_MODULE), CorrespondingAction.Get)] TCP_TABLE_OWNER_MODULE_LISTENER, /// /// A MIB_TCPTABLE_OWNER_MODULE or MIB_TCP6TABLE_OWNER_MODULE structure that contains all connected TCP endpoints on the local /// computer is returned to the caller. /// [CorrespondingType(typeof(MIB_TCPTABLE_OWNER_MODULE), CorrespondingAction.Get)] [CorrespondingType(typeof(MIB_TCP6TABLE_OWNER_MODULE), CorrespondingAction.Get)] TCP_TABLE_OWNER_MODULE_CONNECTIONS, /// /// A MIB_TCPTABLE_OWNER_MODULE or MIB_TCP6TABLE_OWNER_MODULE structure that contains all TCP endpoints on the local computer is /// returned to the caller. /// [CorrespondingType(typeof(MIB_TCPTABLE_OWNER_MODULE), CorrespondingAction.Get)] [CorrespondingType(typeof(MIB_TCP6TABLE_OWNER_MODULE), CorrespondingAction.Get)] TCP_TABLE_OWNER_MODULE_ALL } /// /// The TCPIP_OWNER_MODULE_INFO_CLASS enumeration defines the type of module information structure passed to calls of the /// GetOwnerModuleFromXXXEntry family. /// // https://docs.microsoft.com/en-us/windows/desktop/api/iprtrmib/ne-iprtrmib-_tcpip_owner_module_info_class typedef enum // _TCPIP_OWNER_MODULE_INFO_CLASS { TCPIP_OWNER_MODULE_INFO_BASIC } TCPIP_OWNER_MODULE_INFO_CLASS, *PTCPIP_OWNER_MODULE_INFO_CLASS; [PInvokeData("iprtrmib.h", MSDNShortId = "8529dd62-8516-47d0-8118-95e6d33fc799")] public enum TCPIP_OWNER_MODULE_INFO_CLASS { /// A structure is passed to the GetOwnerModuleFromXXXEntry function. [CorrespondingType(typeof(TCPIP_OWNER_MODULE_BASIC_INFO))] TCPIP_OWNER_MODULE_INFO_BASIC, } /// /// /// The UDP_TABLE_CLASS enumeration defines the set of values used to indicate the type of table returned by calls to GetExtendedUdpTable. /// /// /// /// /// On the Microsoft Windows Software Development Kit (SDK) released for Windows Vista and later, the organization of header files /// has changed and the UDP_TABLE_CLASS enumeration is defined in the Iprtrmib.h header file, not in the Iphlpapi.h header /// file. Note that the Iprtrmib.h header file is automatically included in Iphlpapi.h header file. The Iprtrmib.h header files /// should never be used directly. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/iprtrmib/ne-iprtrmib-_udp_table_class typedef enum _UDP_TABLE_CLASS { // UDP_TABLE_BASIC , UDP_TABLE_OWNER_PID , UDP_TABLE_OWNER_MODULE } UDP_TABLE_CLASS, *PUDP_TABLE_CLASS; [PInvokeData("iprtrmib.h", MSDNShortId = "2e7304d1-b89c-46d4-9121-936a1c38cc51")] public enum UDP_TABLE_CLASS { /// A MIB_UDPTABLE structure that contains all UDP endpoints on the local computer is returned to the caller. [CorrespondingType(typeof(MIB_UDPTABLE), CorrespondingAction.Get)] UDP_TABLE_BASIC, /// /// A MIB_UDPTABLE_OWNER_PID or MIB_UDP6TABLE_OWNER_PID structure that contains all UDP endpoints on the local computer is /// returned to the caller. /// [CorrespondingType(typeof(MIB_UDPTABLE_OWNER_PID), CorrespondingAction.Get)] [CorrespondingType(typeof(MIB_UDP6TABLE_OWNER_PID), CorrespondingAction.Get)] UDP_TABLE_OWNER_PID, /// /// A MIB_UDPTABLE_OWNER_MODULE or MIB_UDP6TABLE_OWNER_MODULE structure that contains all UDP endpoints on the local computer is /// returned to the caller. /// [CorrespondingType(typeof(MIB_UDPTABLE_OWNER_MODULE), CorrespondingAction.Get)] [CorrespondingType(typeof(MIB_UDP6TABLE_OWNER_MODULE), CorrespondingAction.Get)] UDP_TABLE_OWNER_MODULE, } /// /// The TCPIP_OWNER_MODULE_BASIC_INFO structure contains pointers to the module name and module path values associated with a /// TCP connection. The TCPIP_OWNER_MODULE_BASIC_INFO structure is returned by the GetOwnerModuleFromTcpEntry and /// GetOwnerModuleFromTcp6Entry functions. /// /// /// /// If the module owner is the system kernel, the lpModuleName and lpModulePath members point to a wide character /// string that contains "System". /// /// /// On Windows Vista and later as well as on the Microsoft Windows Software Development Kit (SDK), the organization of header files /// has changed and the TCPIP_OWNER_MODULE_BASIC_INFO structure is defined in the Iprtrmib.h header file. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/iprtrmib/ns-iprtrmib-tcpip_owner_module_basic_info typedef struct // _TCPIP_OWNER_MODULE_BASIC_INFO { PWCHAR pModuleName; PWCHAR pModulePath; } TCPIP_OWNER_MODULE_BASIC_INFO, *PTCPIP_OWNER_MODULE_BASIC_INFO; [PInvokeData("iprtrmib.h", MSDNShortId = "cce3e0ff-31f2-454b-8aae-3b35f72f47ed")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct TCPIP_OWNER_MODULE_BASIC_INFO { /// /// A pointer to the name of the module. This field should be a NULL pointer when passed to GetOwnerModuleFromTcpEntry or /// GetOwnerModuleFromTcp6Entry function. /// public string pModuleName; /// /// A pointer to the full path of the module, including the module name. This field should be a NULL pointer when passed /// to GetOwnerModuleFromTcpEntry or GetOwnerModuleFromTcp6Entry function. /// public string pModulePath; } /// /// The TCPIP_OWNER_MODULE_BASIC_INFO structure contains pointers to the module name and module path values associated with a /// TCP connection. The TCPIP_OWNER_MODULE_BASIC_INFO structure is returned by the GetOwnerModuleFromTcpEntry and /// GetOwnerModuleFromTcp6Entry functions. /// /// /// /// If the module owner is the system kernel, the lpModuleName and lpModulePath members point to a wide character /// string that contains "System". /// /// /// On Windows Vista and later as well as on the Microsoft Windows Software Development Kit (SDK), the organization of header files /// has changed and the TCPIP_OWNER_MODULE_BASIC_INFO structure is defined in the Iprtrmib.h header file. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/iprtrmib/ns-iprtrmib-tcpip_owner_module_basic_info typedef struct // _TCPIP_OWNER_MODULE_BASIC_INFO { PWCHAR pModuleName; PWCHAR pModulePath; } TCPIP_OWNER_MODULE_BASIC_INFO, *PTCPIP_OWNER_MODULE_BASIC_INFO; [PInvokeData("iprtrmib.h", MSDNShortId = "cce3e0ff-31f2-454b-8aae-3b35f72f47ed")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct TCPIP_OWNER_MODULE_BASIC_INFO_UNMGD { /// /// A pointer to the name of the module. This field should be a NULL pointer when passed to GetOwnerModuleFromTcpEntry or /// GetOwnerModuleFromTcp6Entry function. /// public StrPtrUni pModuleName; /// /// A pointer to the full path of the module, including the module name. This field should be a NULL pointer when passed /// to GetOwnerModuleFromTcpEntry or GetOwnerModuleFromTcp6Entry function. /// public StrPtrUni pModulePath; /// Performs an implicit conversion from to . /// The unmanaged structure. /// The result of the conversion. public static implicit operator TCPIP_OWNER_MODULE_BASIC_INFO(TCPIP_OWNER_MODULE_BASIC_INFO_UNMGD unmgd) => new TCPIP_OWNER_MODULE_BASIC_INFO { pModuleName = unmgd.pModuleName, pModulePath = unmgd.pModulePath }; } } }