是否可以从没有SeChangeNotifyPrivilege
权限的进程中打开管道?
我使用CreateNamedPipe
控制管道的创建,并希望在CreateFile
的另一个进程中打开管道。我删除SeChangeNotifyPrivilege
后立即收到访问被拒绝错误。是否可以以某种方式创建管道,以便其他进程不需要此权限?
编辑:示例
在流程A中创建管道:
hPipe = CreateNamedPipeW(
name, // pipe name
PIPE_ACCESS_INBOUND, // read/write access
PIPE_TYPE_MESSAGE | // message type pipe
PIPE_READMODE_MESSAGE | // message-read mode
PIPE_WAIT, // blocking mode
PIPE_UNLIMITED_INSTANCES, // max. instances
buf_size, // output buffer size
buf_size, // input buffer size
0, // client time-out
&attr); // security attribute
选择安全属性以允许访问所有人(NULL ACL)。
访问流程B中的管道:
HANDLE hPipe = CreateFileW(
name, // pipe name
GENERIC_WRITE, // write access
0, // no sharing
NULL, // default security attributes
OPEN_EXISTING, // opens existing pipe
0, // default attributes
NULL); // no template file
进程B具有禁用SeChangeNotifyPrivilege
权限的受限访问令牌。 CreateFileW
返回拒绝访问权限。启用权限时,打开管道可以正常工作。请注意,在我的应用程序中,由于要求,我无法将此权限赋予进程B.