mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 06:38:37 -05:00
Log the client process ID for Windows named pipes too.
Turns out it didn't take much googling to find the right API function. (cherry picked from commit 5fc4bbf59d420af5019dc086e558e18454eab6b5)
This commit is contained in:
parent
41f63b6e5d
commit
82814e18ec
@ -236,6 +236,26 @@ static const char *sk_handle_socket_error(Socket s)
|
||||
|
||||
static char *sk_handle_peer_info(Socket s)
|
||||
{
|
||||
Handle_Socket ps = (Handle_Socket) s;
|
||||
ULONG pid;
|
||||
static HMODULE kernel32_module;
|
||||
DECL_WINDOWS_FUNCTION(static, BOOL, GetNamedPipeClientProcessId,
|
||||
(HANDLE, PULONG));
|
||||
|
||||
if (!kernel32_module) {
|
||||
kernel32_module = load_system32_dll("kernel32.dll");
|
||||
GET_WINDOWS_FUNCTION(kernel32_module, GetNamedPipeClientProcessId);
|
||||
}
|
||||
|
||||
/*
|
||||
* Of course, not all handles managed by this module will be
|
||||
* server ends of named pipes, but if they are, then it's useful
|
||||
* to log what we can find out about the client end.
|
||||
*/
|
||||
if (p_GetNamedPipeClientProcessId &&
|
||||
p_GetNamedPipeClientProcessId(ps->send_H, &pid))
|
||||
return dupprintf("process id %lu", (unsigned long)pid);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user