【问题标题】:How to add synchronisation right in a SDDL string for CreateEvent如何在 SDDL 字符串中为 CreateEvent 添加同步权限
【发布时间】:2013-10-03 16:06:49
【问题描述】:

我的 Windows 服务使用 CreateEvent 创建 2 个事件,用于与用户应用程序通信。 服务和用户应用程序不在同一个用户帐户下运行。 用户应用程序打开事件并将其设置为无错误信号。但是该服务永远不会收到该事件。另一个事件在相反的方向起作用。 所以我认为这些事件错​​过了同步权。

服务:

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 
;

感谢您的帮助,

奥利维尔

【问题讨论】:

    标签: windows service acl dacl


    【解决方案1】:

    不要使用“字符串 SDDL 权限”(如 GA),而是使用 0xXXXXXXXX 格式(您可以组合标志,然后将它们转换为十六进制字符串)。

    例如,此 SDDL:D:(A;;0x001F0003;;;BA)(A;;0x00100002;;;AU) 为以下内容创建 DACL:

    - 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 - 字段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. 
    ...
    

    【讨论】:

    • 是的,你是对的。由于同步权限不作为 SDDL 字符串存在,唯一的解决方案是使用全局十六进制字符串。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-23
    • 2012-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-14
    相关资源
    最近更新 更多