SecurityDescriptorHelpers.GetSddlForAppContainerNames 方法

定义

获取指定包系列名称的安全描述符定义语言 (SDDL) (PPN) 。

public:
 static Platform::String ^ GetSddlForAppContainerNames(Platform::Array <AppContainerNameAndAccess> ^ accessRequests, Platform::String ^ principalStringSid, unsigned int principalAccessMask);
 static winrt::hstring GetSddlForAppContainerNames(winrt::array_view <AppContainerNameAndAccess> const& accessRequests, winrt::hstring const& principalStringSid, uint32_t const& principalAccessMask);
public static string GetSddlForAppContainerNames(AppContainerNameAndAccess[] accessRequests, string principalStringSid, uint principalAccessMask);
function getSddlForAppContainerNames(accessRequests, principalStringSid, principalAccessMask)
Public Shared Function GetSddlForAppContainerNames (accessRequests As AppContainerNameAndAccess(), principalStringSid As String, principalAccessMask As UInteger) As String

参数

accessRequests
AppContainerNameAndAccess[]

AppContainerNameAndAccess 结构的数组,用于指定 PPN 和访问权限。

principalStringSid
String

Platform::String

winrt::hstring

安全标识符 (主体的 SID) 。 此参数是可选的,可以是 null

principalAccessMask
UInt32

unsigned int

uint32_t

主体的访问权限。

返回

String

Platform::String

winrt::hstring

返回 SDDL 字符串。

示例

EventWaitHandle CreateShareableEvent(string name)
{
    var access = new AppContainerNameAndAccess[]
    {
        new AppContainerNameAndAccess("Contoso.Test.App_12345678",
          (uint)(EventWaitHandleRights.Modify |
                 EventWaitHandleRights.Synchronize));
    };

    string sddl = SecurityDescriptorHelpers.GetSddlForAppContainerNames(
        access, null,
        (uint)(EventWaitHandleRights.Modify |
                 EventWaitHandleRights.Synchronize));

    var security = new EventWaitHandleSecurity();
    security.SetSecurityDescriptorSddlForm(sddl);

    Boolean created;
    return new EventWaitHandle(false,
      EventResetMode.AutoReset, name, out created, security);
}

注解

如果 principalStringSid 参数为 null,则使用当前线程的主体。

适用于

另请参阅