https://git.reactos.org/?p=reactos.git;a=commitdiff;h=18c3f39c1866a4b033c15…
commit 18c3f39c1866a4b033c151c4731d5d23ba5027bb
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Dec 8 23:03:30 2024 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Dec 8 23:03:30 2024 +0100
[SETUPAPI] Implement CM_Set_Class_Registry_PropertyW()
The conversion of text SDs to binary SDs is not implemented yet.
---
dll/win32/setupapi/cfgmgr.c | 64 +++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 62 insertions(+), 2 deletions(-)
diff --git a/dll/win32/setupapi/cfgmgr.c b/dll/win32/setupapi/cfgmgr.c
index 30a38e81134..ffef4d5590c 100644
--- a/dll/win32/setupapi/cfgmgr.c
+++ b/dll/win32/setupapi/cfgmgr.c
@@ -7863,10 +7863,70 @@ CM_Set_Class_Registry_PropertyW(
_In_ ULONG ulFlags,
_In_opt_ HMACHINE hMachine)
{
- FIXME("CM_Set_Class_Registry_PropertyW(%p %lx %p %lu %lx %p)\n",
+ RPC_BINDING_HANDLE BindingHandle = NULL;
+ WCHAR szGuidString[PNP_MAX_GUID_STRING_LEN + 1];
+ ULONG ulType = 0;
+ CONFIGRET ret;
+
+ TRACE("CM_Set_Class_Registry_PropertyW(%p %lx %p %lu %lx %p)\n",
ClassGuid, ulProperty, Buffer, ulLength, ulFlags, hMachine);
- return CR_CALL_NOT_IMPLEMENTED;
+ if (ClassGuid == NULL)
+ return CR_INVALID_POINTER;
+
+ if ((Buffer == NULL) && (ulLength != 0))
+ return CR_INVALID_POINTER;
+
+ if (ulFlags != 0)
+ return CR_INVALID_FLAG;
+
+ if (pSetupStringFromGuid(ClassGuid,
+ szGuidString,
+ PNP_MAX_GUID_STRING_LEN) != 0)
+ return CR_INVALID_DATA;
+
+ if ((ulProperty < CM_CRP_MIN) || (ulProperty > CM_CRP_MAX))
+ return CR_INVALID_PROPERTY;
+
+ if (hMachine != NULL)
+ {
+ BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+ if (BindingHandle == NULL)
+ return CR_FAILURE;
+ }
+ else
+ {
+ if (!PnpGetLocalHandles(&BindingHandle, NULL))
+ return CR_FAILURE;
+ }
+
+ ulType = GetRegistryPropertyType(ulProperty);
+ if ((ulType == REG_DWORD) && (ulLength != sizeof(DWORD)))
+ return CR_INVALID_DATA;
+
+ if (ulProperty == CM_CRP_SECURITY_SDS)
+ {
+ FIXME("Conversion from text SD to binary SD is not implemented
yet!\n");
+ return CR_CALL_NOT_IMPLEMENTED;
+ }
+
+ RpcTryExcept
+ {
+ ret = PNP_SetClassRegProp(BindingHandle,
+ szGuidString,
+ ulProperty,
+ ulType,
+ (LPBYTE)Buffer,
+ ulLength,
+ ulFlags);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ ret = RpcStatusToCmStatus(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return ret;
}