4 ms·
Summary of the takeaway: the GetNamedPipeClientProcessId function returns the PID of the process that opened the pipe, not the one that is currently communicati
by mehrdadn 7y ago
Summary of the takeaway: the GetNamedPipeClientProcessId function returns the PID of the process that opened the pipe, not the one that is currently communicating. However, the client PID can sometimes be specified manually, and even when it can't, handle duplication followed by PID recycling can make this PID point to an arbitrary process (hence it should not be used for security checks).
- tinus_hn 7y agoSo what is the use of this function?
- londons_explore 7y agoPerhaps just for putting an informative PID in log messages?
- ammmir 7y agoWouldn't it be better to return a kind of ENOENT status if the process creating the pipe has disappeared (or its PID recycled)? Seems like a design flaw since PIDs have finite lifetimes and not communicating that through any API call return could pose a potentially serious security issue.