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"); #if (defined _MSC_VER && _MSC_VER < 1900) || defined __MINGW32__ || defined COVERITY /* For older Visual Studio, and MinGW too (at least as of * Ubuntu 16.04), this function isn't available in the header * files to type-check. Ditto the toolchain I use for * Coveritying the Windows code. */ GET_WINDOWS_FUNCTION_NO_TYPECHECK( kernel32_module, GetNamedPipeClientProcessId); #else GET_WINDOWS_FUNCTION( kernel32_module, GetNamedPipeClientProcessId); #endif } /* * 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; }
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; }