The code below is working superbly, but now I want to generalize it, as GetNamedPipeClientProcessID is only compatible with Windows Vista and above. What alternative options do I have that support windows XP?

bRet = GetNamedPipeClientProcessId(hIn, &ClientID);
if (FALSE == bRet)
{
        printf("\nGetNamedPipeClientProcessId FAILED\n");
    CloseHandle(Overlapped.hEvent);
    CloseHandle(hIn);
    return 1;
}
有帮助吗?

解决方案

If you handle the protocol, when the connection is established send a packet with the process id and read it in the other endpoint.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top