コード例 #1
0
DWORD
VmAfdAllocateSecurityDescriptorFromSddlCString(
    PSECURITY_DESCRIPTOR_RELATIVE *ppSDRel,
    DWORD *pdwSDRelSize,
    PCSTR pszSddlAcl)
{
    DWORD dwError = 0;
    NTSTATUS ntStatus = 0;

    ntStatus = RtlAllocateSecurityDescriptorFromSddlCString(
                  ppSDRel,
                  pdwSDRelSize,
                  pszSddlAcl,
                  SDDL_REVISION_1);
    dwError = LwNtStatusToWin32Error(ntStatus);

    return dwError;
}
コード例 #2
0
ファイル: memstore.c プロジェクト: twistround/pbis
NTSTATUS
MemRegStoreCreateNodeSdFromSddl(
    IN PSTR SecurityDescriptor,
    IN ULONG SecurityDescriptorLen,
    PMEMREG_NODE_SD *ppRetNodeSd)
{
    NTSTATUS status = 0;
    PMEMREG_NODE_SD pNodeSd = NULL;

    if (!SecurityDescriptor || SecurityDescriptorLen == 0)
    {
        status = STATUS_INVALID_PARAMETER;
        BAIL_ON_NT_STATUS(status);
    }
    
    status = LW_RTL_ALLOCATE((PVOID*) &pNodeSd,
                                      PMEMREG_NODE_SD,
                                      sizeof(*pNodeSd));
    BAIL_ON_NT_STATUS(status);

    /* Add security descriptor to current key node */
    status = RtlAllocateSecurityDescriptorFromSddlCString(
                 &pNodeSd->SecurityDescriptor,
                 &pNodeSd->SecurityDescriptorLen,
                 SecurityDescriptor,
                 SDDL_REVISION_1);
    BAIL_ON_NT_STATUS(status);
    pNodeSd->SecurityDescriptorAllocated = TRUE;
  
    *ppRetNodeSd = pNodeSd;

cleanup:
    return status;

error:
    LWREG_SAFE_FREE_MEMORY(pNodeSd->SecurityDescriptor);
    LWREG_SAFE_FREE_MEMORY(pNodeSd);
    goto cleanup;
}