[SETUPAPI] CM_Set_Class_Registry_PropertyW: Implement SD conversion

Convert text SD to binary SD for the CM_CRP_SECURITY_SDS property.
This commit is contained in:
Eric Kohl 2024-12-14 13:52:55 +01:00
parent 0540c212ea
commit b96e648019

View file

@ -7933,6 +7933,8 @@ CM_Set_Class_Registry_PropertyW(
RPC_BINDING_HANDLE BindingHandle = NULL; RPC_BINDING_HANDLE BindingHandle = NULL;
WCHAR szGuidString[PNP_MAX_GUID_STRING_LEN + 1]; WCHAR szGuidString[PNP_MAX_GUID_STRING_LEN + 1];
ULONG ulType = 0; ULONG ulType = 0;
PSECURITY_DESCRIPTOR pSecurityDescriptor = NULL;
ULONG SecurityDescriptorSize = 0;
CONFIGRET ret; CONFIGRET ret;
TRACE("CM_Set_Class_Registry_PropertyW(%p %lx %p %lu %lx %p)\n", TRACE("CM_Set_Class_Registry_PropertyW(%p %lx %p %lu %lx %p)\n",
@ -7973,8 +7975,19 @@ CM_Set_Class_Registry_PropertyW(
if (ulProperty == CM_CRP_SECURITY_SDS) if (ulProperty == CM_CRP_SECURITY_SDS)
{ {
FIXME("Conversion from text SD to binary SD is not implemented yet!\n"); if (!ConvertStringSecurityDescriptorToSecurityDescriptorW((LPCWSTR)Buffer,
return CR_CALL_NOT_IMPLEMENTED; SDDL_REVISION_1,
&pSecurityDescriptor,
&SecurityDescriptorSize))
{
ERR("ConvertStringSecurityDescriptorToSecurityDescriptorW() failed (Error %lu)\n", GetLastError());
return CR_INVALID_DATA;
}
Buffer = (PCVOID)pSecurityDescriptor;
ulLength = SecurityDescriptorSize;
ulProperty = CM_CRP_SECURITY;
ulType = REG_BINARY;
} }
RpcTryExcept RpcTryExcept
@ -7993,6 +8006,9 @@ CM_Set_Class_Registry_PropertyW(
} }
RpcEndExcept; RpcEndExcept;
if (pSecurityDescriptor)
LocalFree(pSecurityDescriptor);
return ret; return ret;
} }