exe name
-
Is there any API through which processes can be enumerated on the basis of Port they are using. Thanx Sunit
never say die
-
Is there any API through which processes can be enumerated on the basis of Port they are using. Thanx Sunit
never say die
You can use a combination of AllocateAndGetTcpExTableFromStack[^] or AllocateAndGetUdpExTableFromStack[^] from Iphlpapi.dll to find all open TCP/UDP ports and the PID of the process owning the handle. This technique should be used on OS prior to XP-SP2. Not available on 95/98/Me. On XP SP2/Vista/2003/2008 the function GetExtendedTcpTable [^]is available as the prior mentioned functions have been deprecated. Once you have the ports and the corresponding PID you can use CreateToolhelp32Snapshot toolhelp [^]functions to walk all available processes and find the name of the executable matching the PID. Structures you will need: MIB_TCPROW_OWNER_PID[^] MIB_TCPTABLE_OWNER_PID[^] Best Wishes, -David Delaune
-
You can use a combination of AllocateAndGetTcpExTableFromStack[^] or AllocateAndGetUdpExTableFromStack[^] from Iphlpapi.dll to find all open TCP/UDP ports and the PID of the process owning the handle. This technique should be used on OS prior to XP-SP2. Not available on 95/98/Me. On XP SP2/Vista/2003/2008 the function GetExtendedTcpTable [^]is available as the prior mentioned functions have been deprecated. Once you have the ports and the corresponding PID you can use CreateToolhelp32Snapshot toolhelp [^]functions to walk all available processes and find the name of the executable matching the PID. Structures you will need: MIB_TCPROW_OWNER_PID[^] MIB_TCPTABLE_OWNER_PID[^] Best Wishes, -David Delaune