From b96e648019152e20f984bdb1dab11167ab0b1722 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 14 Dec 2024 13:52:55 +0100 Subject: [PATCH] [SETUPAPI] CM_Set_Class_Registry_PropertyW: Implement SD conversion Convert text SD to binary SD for the CM_CRP_SECURITY_SDS property. --- dll/win32/setupapi/cfgmgr.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/dll/win32/setupapi/cfgmgr.c b/dll/win32/setupapi/cfgmgr.c index bfd1da4a5f7..0444611c184 100644 --- a/dll/win32/setupapi/cfgmgr.c +++ b/dll/win32/setupapi/cfgmgr.c @@ -7933,6 +7933,8 @@ CM_Set_Class_Registry_PropertyW( RPC_BINDING_HANDLE BindingHandle = NULL; WCHAR szGuidString[PNP_MAX_GUID_STRING_LEN + 1]; ULONG ulType = 0; + PSECURITY_DESCRIPTOR pSecurityDescriptor = NULL; + ULONG SecurityDescriptorSize = 0; CONFIGRET ret; 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) { - FIXME("Conversion from text SD to binary SD is not implemented yet!\n"); - return CR_CALL_NOT_IMPLEMENTED; + if (!ConvertStringSecurityDescriptorToSecurityDescriptorW((LPCWSTR)Buffer, + 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 @@ -7993,6 +8006,9 @@ CM_Set_Class_Registry_PropertyW( } RpcEndExcept; + if (pSecurityDescriptor) + LocalFree(pSecurityDescriptor); + return ret; }