mirror of
https://github.com/reactos/reactos.git
synced 2024-07-14 08:26:08 +00:00
Implement SetupDiGetDeviceRegistryPropertyA
Add stub for SetupDiGetDeviceRegistryPropertyW svn path=/trunk/; revision=16398
This commit is contained in:
parent
1d354a90fe
commit
3988ea5599
|
@ -747,6 +747,7 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(HDEVINFO, PSP_DEVICE_INTERFACE_
|
|||
DWORD, PDWORD, PSP_DEVINFO_DATA);
|
||||
#define SetupDiGetDeviceInterfaceDetail WINELIB_NAME_AW(SetupDiGetDeviceInterfaceDetail)
|
||||
BOOL WINAPI SetupDiGetDeviceRegistryPropertyA(HDEVINFO, PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD);
|
||||
BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(HDEVINFO, PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD);
|
||||
BOOL WINAPI SetupDiInstallClassA(HWND, PCSTR, DWORD, HSPFILEQ);
|
||||
BOOL WINAPI SetupDiInstallClassW(HWND, PCWSTR, DWORD, HSPFILEQ);
|
||||
#define SetupDiInstallClass WINELIB_NAME_AW(SetupDiInstallClass)
|
||||
|
|
|
@ -1180,6 +1180,79 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyA(
|
|||
PBYTE PropertyBuffer,
|
||||
DWORD PropertyBufferSize,
|
||||
PDWORD RequiredSize)
|
||||
{
|
||||
BOOL bResult;
|
||||
BOOL bIsStringProperty;
|
||||
DWORD RegType;
|
||||
DWORD RequiredSizeA, RequiredSizeW;
|
||||
DWORD PropertyBufferSizeW;
|
||||
PBYTE PropertyBufferW;
|
||||
|
||||
TRACE("%04lx %p %ld %p %p %ld %p\n", (DWORD)devinfo, DeviceInfoData,
|
||||
Property, PropertyRegDataType, PropertyBuffer, PropertyBufferSize,
|
||||
RequiredSize);
|
||||
|
||||
PropertyBufferSizeW = PropertyBufferSize * 2;
|
||||
PropertyBufferW = HeapAlloc(GetProcessHeap(), 0, PropertyBufferSizeW);
|
||||
|
||||
bResult = SetupDiGetDeviceRegistryPropertyW(
|
||||
devinfo,
|
||||
DeviceInfoData,
|
||||
Property,
|
||||
&RegType,
|
||||
PropertyBufferW,
|
||||
PropertyBufferSizeW,
|
||||
&RequiredSizeW);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, PropertyBufferW);
|
||||
|
||||
if (!bResult)
|
||||
return bResult;
|
||||
|
||||
bIsStringProperty = (RegType == REG_SZ || RegType == REG_MULTI_SZ);
|
||||
|
||||
if (bIsStringProperty)
|
||||
RequiredSizeA = RequiredSizeW / sizeof(WCHAR);
|
||||
else
|
||||
RequiredSizeA = RequiredSizeW;
|
||||
|
||||
if (RequiredSizeA <= PropertyBufferSize)
|
||||
{
|
||||
if (bIsStringProperty && PropertyBufferSize > 0)
|
||||
{
|
||||
if (WideCharToMultiByte(CP_ACP, 0, (LPWSTR)PropertyBufferW, RequiredSizeW / sizeof(WCHAR), PropertyBuffer, PropertyBufferSize, NULL, NULL) == 0)
|
||||
{
|
||||
/* Last error is already set by WideCharToMultiByte */
|
||||
bResult = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
memcpy(PropertyBuffer, PropertyBufferW, RequiredSizeA);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
bResult = FALSE;
|
||||
}
|
||||
|
||||
if (PropertyRegDataType)
|
||||
*PropertyRegDataType = RegType;
|
||||
if (RequiredSize)
|
||||
*RequiredSize = RequiredSizeA;
|
||||
return bResult;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* SetupDiGetDeviceRegistryPropertyW (SETUPAPI.@)
|
||||
*/
|
||||
BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(
|
||||
HDEVINFO devinfo,
|
||||
PSP_DEVINFO_DATA DeviceInfoData,
|
||||
DWORD Property,
|
||||
PDWORD PropertyRegDataType,
|
||||
PBYTE PropertyBuffer,
|
||||
DWORD PropertyBufferSize,
|
||||
PDWORD RequiredSize)
|
||||
{
|
||||
FIXME("%04lx %p %ld %p %p %ld %p\n", (DWORD)devinfo, DeviceInfoData,
|
||||
Property, PropertyRegDataType, PropertyBuffer, PropertyBufferSize,
|
||||
|
@ -1187,6 +1260,7 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyA(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SetupDiInstallClassA (SETUPAPI.@)
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue