[英]Is it possible to get the thread Id of a process that is listening to a Port in Windows?
In windows we can list the ports that are currently used and the process that are listening to it using the netstat command. 在Windows中,我们可以列出当前使用的端口以及使用netstat命令监听它的进程。 Just wondering if it is possible to find the exact thread id that opened the port inside the process?
只是想知道是否有可能找到在进程内打开端口的确切线程ID?
I am looking for programmatic solutions like open process, IPC, etx. 我正在寻找程序化的解决方案,如开放流程,IPC,etx。 In windows if I inject a dll to the process I can get all the windows messages, however it does not include port related events.
在Windows中,如果我向进程注入一个dll,我可以获取所有的Windows消息,但是它不包括与端口相关的事件。
hook socket
, bind
, listen
, accept
(and WSAXxx
equivalents) and call GetCurrentThreadId() in the hook handlers. 钩子
socket
, bind
, listen
, accept
(和WSAXxx
等价物)并在钩子处理程序中调用GetCurrentThreadId()。 you can leverage eg MS Detours, EasyHook, or MHook
etc to implement your handlers. 您可以利用
MS Detours, EasyHook, or MHook
等来实现您的处理程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.