Skip to content

Commit 18c3f39

Browse files
committed
[SETUPAPI] Implement CM_Set_Class_Registry_PropertyW()
The conversion of text SDs to binary SDs is not implemented yet.
1 parent 9223134 commit 18c3f39

File tree

1 file changed

+62
-2
lines changed

1 file changed

+62
-2
lines changed

dll/win32/setupapi/cfgmgr.c

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7863,10 +7863,70 @@ CM_Set_Class_Registry_PropertyW(
78637863
_In_ ULONG ulFlags,
78647864
_In_opt_ HMACHINE hMachine)
78657865
{
7866-
FIXME("CM_Set_Class_Registry_PropertyW(%p %lx %p %lu %lx %p)\n",
7866+
RPC_BINDING_HANDLE BindingHandle = NULL;
7867+
WCHAR szGuidString[PNP_MAX_GUID_STRING_LEN + 1];
7868+
ULONG ulType = 0;
7869+
CONFIGRET ret;
7870+
7871+
TRACE("CM_Set_Class_Registry_PropertyW(%p %lx %p %lu %lx %p)\n",
78677872
ClassGuid, ulProperty, Buffer, ulLength, ulFlags, hMachine);
78687873

7869-
return CR_CALL_NOT_IMPLEMENTED;
7874+
if (ClassGuid == NULL)
7875+
return CR_INVALID_POINTER;
7876+
7877+
if ((Buffer == NULL) && (ulLength != 0))
7878+
return CR_INVALID_POINTER;
7879+
7880+
if (ulFlags != 0)
7881+
return CR_INVALID_FLAG;
7882+
7883+
if (pSetupStringFromGuid(ClassGuid,
7884+
szGuidString,
7885+
PNP_MAX_GUID_STRING_LEN) != 0)
7886+
return CR_INVALID_DATA;
7887+
7888+
if ((ulProperty < CM_CRP_MIN) || (ulProperty > CM_CRP_MAX))
7889+
return CR_INVALID_PROPERTY;
7890+
7891+
if (hMachine != NULL)
7892+
{
7893+
BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
7894+
if (BindingHandle == NULL)
7895+
return CR_FAILURE;
7896+
}
7897+
else
7898+
{
7899+
if (!PnpGetLocalHandles(&BindingHandle, NULL))
7900+
return CR_FAILURE;
7901+
}
7902+
7903+
ulType = GetRegistryPropertyType(ulProperty);
7904+
if ((ulType == REG_DWORD) && (ulLength != sizeof(DWORD)))
7905+
return CR_INVALID_DATA;
7906+
7907+
if (ulProperty == CM_CRP_SECURITY_SDS)
7908+
{
7909+
FIXME("Conversion from text SD to binary SD is not implemented yet!\n");
7910+
return CR_CALL_NOT_IMPLEMENTED;
7911+
}
7912+
7913+
RpcTryExcept
7914+
{
7915+
ret = PNP_SetClassRegProp(BindingHandle,
7916+
szGuidString,
7917+
ulProperty,
7918+
ulType,
7919+
(LPBYTE)Buffer,
7920+
ulLength,
7921+
ulFlags);
7922+
}
7923+
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
7924+
{
7925+
ret = RpcStatusToCmStatus(RpcExceptionCode());
7926+
}
7927+
RpcEndExcept;
7928+
7929+
return ret;
78707930
}
78717931

78727932

0 commit comments

Comments
 (0)