mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[SETUPAPI] Implement SetupDiGetClassRegistryPropertyW and SetupDiSetClassRegistryPropertyW
This commit is contained in:
parent
3abb21080d
commit
44564cb682
2 changed files with 162 additions and 2 deletions
|
@ -1419,3 +1419,163 @@ cleanup:
|
||||||
TRACE("Returning %d\n", ret);
|
TRACE("Returning %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* SetupDiGetClassRegistryPropertyW(SETUPAPI.@)
|
||||||
|
*/
|
||||||
|
BOOL WINAPI
|
||||||
|
SetupDiGetClassRegistryPropertyW(
|
||||||
|
IN CONST GUID *ClassGuid,
|
||||||
|
IN DWORD Property,
|
||||||
|
OUT PDWORD PropertyRegDataType OPTIONAL,
|
||||||
|
OUT PBYTE PropertyBuffer,
|
||||||
|
IN DWORD PropertyBufferSize,
|
||||||
|
OUT PDWORD RequiredSize OPTIONAL,
|
||||||
|
IN PCWSTR MachineName OPTIONAL,
|
||||||
|
IN PVOID Reserved)
|
||||||
|
{
|
||||||
|
HMACHINE hMachine = NULL;
|
||||||
|
DWORD PropLength = 0;
|
||||||
|
DWORD Error = ERROR_SUCCESS;
|
||||||
|
CONFIGRET cr;
|
||||||
|
|
||||||
|
TRACE("%s %lu %p %p %lu %p %s %p\n",
|
||||||
|
debugstr_guid(ClassGuid), Property, PropertyRegDataType, PropertyBuffer,
|
||||||
|
PropertyBufferSize, RequiredSize, debugstr_w(MachineName), Reserved);
|
||||||
|
|
||||||
|
if (Reserved != NULL)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MachineName)
|
||||||
|
{
|
||||||
|
cr = CM_Connect_Machine(MachineName, &hMachine);
|
||||||
|
if (cr != CR_SUCCESS)
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Property >= SPCRP_MAXIMUM_PROPERTY)
|
||||||
|
{
|
||||||
|
cr = CR_INVALID_PROPERTY;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
PropLength = PropertyBufferSize;
|
||||||
|
cr = CM_Get_Class_Registry_PropertyW((LPGUID)ClassGuid,
|
||||||
|
Property + (CM_DRP_DEVICEDESC - SPDRP_DEVICEDESC),
|
||||||
|
PropertyRegDataType,
|
||||||
|
PropertyBuffer,
|
||||||
|
&PropLength,
|
||||||
|
0,
|
||||||
|
hMachine);
|
||||||
|
if ((cr == CR_SUCCESS) || (cr == CR_BUFFER_SMALL))
|
||||||
|
{
|
||||||
|
if (RequiredSize)
|
||||||
|
*RequiredSize = PropLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (cr != CR_SUCCESS)
|
||||||
|
{
|
||||||
|
switch (cr)
|
||||||
|
{
|
||||||
|
case CR_INVALID_DEVINST :
|
||||||
|
Error = ERROR_NO_SUCH_DEVINST;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CR_INVALID_PROPERTY :
|
||||||
|
Error = ERROR_INVALID_REG_PROPERTY;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CR_BUFFER_SMALL :
|
||||||
|
Error = ERROR_INSUFFICIENT_BUFFER;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default :
|
||||||
|
Error = GetErrorCodeFromCrCode(cr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hMachine != NULL)
|
||||||
|
CM_Disconnect_Machine(hMachine);
|
||||||
|
|
||||||
|
SetLastError(Error);
|
||||||
|
return (cr == CR_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* SetupDiSetClassRegistryPropertyW(SETUPAPI.@)
|
||||||
|
*/
|
||||||
|
BOOL WINAPI
|
||||||
|
SetupDiSetClassRegistryPropertyW(
|
||||||
|
IN CONST GUID *ClassGuid,
|
||||||
|
IN DWORD Property,
|
||||||
|
IN CONST BYTE *PropertyBuffer OPTIONAL,
|
||||||
|
IN DWORD PropertyBufferSize,
|
||||||
|
IN PCWSTR MachineName OPTIONAL,
|
||||||
|
IN PVOID Reserved)
|
||||||
|
{
|
||||||
|
HMACHINE hMachine = NULL;
|
||||||
|
DWORD Error = ERROR_SUCCESS;
|
||||||
|
CONFIGRET cr;
|
||||||
|
|
||||||
|
TRACE("%s %lu %p %lu %s %p\n",
|
||||||
|
debugstr_guid(ClassGuid), Property, PropertyBuffer,
|
||||||
|
PropertyBufferSize, debugstr_w(MachineName), Reserved);
|
||||||
|
|
||||||
|
if (Reserved != NULL)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MachineName)
|
||||||
|
{
|
||||||
|
cr = CM_Connect_Machine(MachineName, &hMachine);
|
||||||
|
if (cr != CR_SUCCESS)
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Property >= SPCRP_MAXIMUM_PROPERTY)
|
||||||
|
{
|
||||||
|
cr = CR_INVALID_PROPERTY;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
cr = CM_Set_Class_Registry_PropertyW((LPGUID)ClassGuid,
|
||||||
|
Property + (CM_DRP_DEVICEDESC - SPDRP_DEVICEDESC),
|
||||||
|
PropertyBuffer,
|
||||||
|
PropertyBufferSize,
|
||||||
|
0,
|
||||||
|
hMachine);
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (cr != CR_SUCCESS)
|
||||||
|
{
|
||||||
|
switch (cr)
|
||||||
|
{
|
||||||
|
case CR_INVALID_DEVINST:
|
||||||
|
Error = ERROR_NO_SUCH_DEVINST;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CR_INVALID_PROPERTY:
|
||||||
|
Error = ERROR_INVALID_REG_PROPERTY;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CR_BUFFER_SMALL:
|
||||||
|
Error = ERROR_INSUFFICIENT_BUFFER;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default :
|
||||||
|
Error = GetErrorCodeFromCrCode(cr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hMachine != NULL)
|
||||||
|
CM_Disconnect_Machine(hMachine);
|
||||||
|
|
||||||
|
SetLastError(Error);
|
||||||
|
return (cr == CR_SUCCESS);
|
||||||
|
}
|
||||||
|
|
|
@ -314,7 +314,7 @@
|
||||||
@ stdcall SetupDiGetClassInstallParamsA(ptr ptr ptr long ptr)
|
@ stdcall SetupDiGetClassInstallParamsA(ptr ptr ptr long ptr)
|
||||||
@ stdcall SetupDiGetClassInstallParamsW(ptr ptr ptr long ptr)
|
@ stdcall SetupDiGetClassInstallParamsW(ptr ptr ptr long ptr)
|
||||||
@ stub SetupDiGetClassRegistryPropertyA
|
@ stub SetupDiGetClassRegistryPropertyA
|
||||||
@ stub SetupDiGetClassRegistryPropertyW
|
@ stdcall SetupDiGetClassRegistryPropertyW(ptr long ptr ptr long ptr wstr ptr)
|
||||||
@ stub SetupDiGetCustomDevicePropertyA
|
@ stub SetupDiGetCustomDevicePropertyA
|
||||||
@ stub SetupDiGetCustomDevicePropertyW
|
@ stub SetupDiGetCustomDevicePropertyW
|
||||||
@ stdcall SetupDiGetDeviceInfoListClass(ptr ptr)
|
@ stdcall SetupDiGetDeviceInfoListClass(ptr ptr)
|
||||||
|
@ -375,7 +375,7 @@
|
||||||
@ stdcall SetupDiSetClassInstallParamsA(ptr ptr ptr long)
|
@ stdcall SetupDiSetClassInstallParamsA(ptr ptr ptr long)
|
||||||
@ stdcall SetupDiSetClassInstallParamsW(ptr ptr ptr long)
|
@ stdcall SetupDiSetClassInstallParamsW(ptr ptr ptr long)
|
||||||
@ stub SetupDiSetClassRegistryPropertyA
|
@ stub SetupDiSetClassRegistryPropertyA
|
||||||
@ stub SetupDiSetClassRegistryPropertyW
|
@ stdcall SetupDiSetClassRegistryPropertyW(ptr long ptr long wstr ptr)
|
||||||
@ stdcall SetupDiSetDeviceInstallParamsA(ptr ptr ptr)
|
@ stdcall SetupDiSetDeviceInstallParamsA(ptr ptr ptr)
|
||||||
@ stdcall SetupDiSetDeviceInstallParamsW(ptr ptr ptr)
|
@ stdcall SetupDiSetDeviceInstallParamsW(ptr ptr ptr)
|
||||||
@ stub SetupDiSetDeviceInterfaceDefault
|
@ stub SetupDiSetDeviceInterfaceDefault
|
||||||
|
|
Loading…
Reference in a new issue