[SETUPAPI] CM_Set_Class_Registry_PropertyW: Do not convert SD if ulLength is 0

This commit is contained in:
Eric Kohl 2024-12-14 20:09:27 +01:00
parent 4795177ced
commit 4d376dfd64

View file

@ -7975,17 +7975,21 @@ CM_Set_Class_Registry_PropertyW(
if (ulProperty == CM_CRP_SECURITY_SDS) if (ulProperty == CM_CRP_SECURITY_SDS)
{ {
if (!ConvertStringSecurityDescriptorToSecurityDescriptorW((LPCWSTR)Buffer, if (ulLength != 0)
SDDL_REVISION_1,
&pSecurityDescriptor,
&SecurityDescriptorSize))
{ {
ERR("ConvertStringSecurityDescriptorToSecurityDescriptorW() failed (Error %lu)\n", GetLastError()); if (!ConvertStringSecurityDescriptorToSecurityDescriptorW((LPCWSTR)Buffer,
return CR_INVALID_DATA; SDDL_REVISION_1,
&pSecurityDescriptor,
&SecurityDescriptorSize))
{
ERR("ConvertStringSecurityDescriptorToSecurityDescriptorW() failed (Error %lu)\n", GetLastError());
return CR_INVALID_DATA;
}
Buffer = (PCVOID)pSecurityDescriptor;
ulLength = SecurityDescriptorSize;
} }
Buffer = (PCVOID)pSecurityDescriptor;
ulLength = SecurityDescriptorSize;
ulProperty = CM_CRP_SECURITY; ulProperty = CM_CRP_SECURITY;
ulType = REG_BINARY; ulType = REG_BINARY;
} }