https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b96e648019152e20f984bdb1dab11167ab0b1722

commit b96e648019152e20f984bdb1dab11167ab0b1722
Author:     Eric Kohl <[email protected]>
AuthorDate: Sat Dec 14 13:52:55 2024 +0100
Commit:     Eric Kohl <[email protected]>
CommitDate: Sat Dec 14 13:52:55 2024 +0100

    [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;
 }
 

Reply via email to