- How soon can I destroy the structure pointed to by
lpSecurityAttributes passed to CreateNamedPipe() ? - Do I need a separate instance for each channel instance?
The MSDN documentation for CreateNamedPipe () says:
lpSecurityAttributes [in, optional]
Pointer to a SECURITY_ATTRIBUTES structure that defines the security descriptor for the new named pipe ...
The emphasis is mine. “New” means a new named pipe or a new instance of a named pipe? The following is said:
Note
To create an instance of a named pipe using CreateNamedPipe, the user must have FILE_CREATE_PIPE_INSTANCE access to the named pipe object. If a new named pipe is created, the access control list (ACL) from the security attribute setting defines discretionary access control for the named pipe.
(We emphasize again.) One could read this as the meaning that lpSecurityAttributes used only when creating the first instance of the named pipe (new named pipe) and is ignored when creating additional instances of the same pipe name. If so, then only one instance of the lpSecurityAttributes structure is lpSecurityAttributes .
Or maybe you need to pass a valid lpSecurityAttributes for each instance, but it can (should?) Be the same?
Or maybe you need to allocate a new SECURITY_ATTRIBUTES structure for each channel instance?
My related question is: can the SECURITY_ATTRIBUTES structure be destroyed as soon as the CreateNamedPipe() call returns or remains in effect until the last handle (to the pipe or only this channel instance?) Isn even called.
Does anyone have definitive answers to these two questions?
source share