我的Windows用CreateEvent创建两个事件,以便与用户应用程序通信。服务和用户应用程序不在同一个用户帐户下运行。用户应用程序打开事件并将其设置为无错误信号。但是这个活动从来没有被服务部门接收过。另一个事件则相反。所以我认为这些事件错过了同步化的权利。
服务:
SECURITY_ATTRIBUTES security;
ZeroMemory(&security, sizeof(security));
security.nLength = sizeof(security);
ConvertStringSecurityDescriptorToSecurityDescriptor(L"D:P(A;OICI;GA;;;SY)(A;OICI;GA;;;BA)(A;OICI;GWGR;;;IU)", SDDL_REVISION_1, &security.lpSecurityDescriptor, NULL);
EvtCreateNewUserSession = CreateEventW(
&security, // security attributes
TRUE, // manual-reset event
FALSE, // initial state is not signaled
L"Global\\MyEvent" // object name
);
交互式应用程序:
HANDLE EvtCreateNewUserSession = OpenEventW(
EVENT_MODIFY_STATE | SYNCHRONIZE, // default security attributes
FALSE, // initial state is not signaled
L"Global\\MyEvent" // object name
;
谢谢你的帮忙,
奥利维尔
发布于 2013-10-22 11:03:40
不要使用“string权限”(如GA),而是使用0xXXXXXXXX格式(您可以组合标志,然后将它们转换为十六进制)。
例如,这个SDDL:D:(A;;0x001F0003;;;BA)(A;;0x00100002;;;AU)
为:
- BA=Administrators, 0x001F0003=EVENT_ALL_ACCESS (LocalSystem and LocalService are in Administrators group, but NetworkService is not)
- AU=Authenticated Users, 0x00100002=SYNCHRONIZE | EVENT_MODIFY_STATE
http://msdn.microsoft.com/en-us/library/windows/desktop/aa374928(v=vs.85).aspx - field rights
A string that indicates the access rights controlled by the ACE.
This string can be a hexadecimal string representation of the access rights,
such as "0x7800003F", or it can be a concatenation of the following strings.
...
https://stackoverflow.com/questions/19049412
复制相似问题