Skip to content

Commit 387067a

Browse files
andy-123ThFabba
authored andcommitted
[SETUPAPI]: Fix a FIXME in SetupDiSetDeviceRegistryPropertyA.
Rename SetupDiSetDeviceRegistryPropertyW to IntSetupDiSetDeviceRegistryPropertyAW and use it for both (A/W). The FIXME in the A-Version was already implemented in the W-Version. CORE-14173.
1 parent 7b39851 commit 387067a

File tree

1 file changed

+55
-47
lines changed

1 file changed

+55
-47
lines changed

dll/win32/setupapi/devinst.c

Lines changed: 55 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3447,53 +3447,15 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(
34473447
}
34483448

34493449
/***********************************************************************
3450-
* SetupDiSetDeviceRegistryPropertyA (SETUPAPI.@)
3451-
*/
3452-
BOOL WINAPI SetupDiSetDeviceRegistryPropertyA(
3453-
HDEVINFO DeviceInfoSet,
3454-
PSP_DEVINFO_DATA DeviceInfoData,
3455-
DWORD Property,
3456-
const BYTE *PropertyBuffer,
3457-
DWORD PropertyBufferSize)
3458-
{
3459-
BOOL ret = FALSE;
3460-
struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
3461-
3462-
TRACE("%p %p %d %p %d\n", DeviceInfoSet, DeviceInfoData, Property,
3463-
PropertyBuffer, PropertyBufferSize);
3464-
3465-
if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE)
3466-
{
3467-
SetLastError(ERROR_INVALID_HANDLE);
3468-
return FALSE;
3469-
}
3470-
if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
3471-
{
3472-
SetLastError(ERROR_INVALID_HANDLE);
3473-
return FALSE;
3474-
}
3475-
if (!DeviceInfoData || DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA)
3476-
|| !DeviceInfoData->Reserved)
3477-
{
3478-
SetLastError(ERROR_INVALID_PARAMETER);
3479-
return FALSE;
3480-
}
3481-
3482-
FIXME("%p %p 0x%lx %p 0x%lx\n", DeviceInfoSet, DeviceInfoData,
3483-
Property, PropertyBuffer, PropertyBufferSize);
3484-
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3485-
return ret;
3486-
}
3487-
3488-
/***********************************************************************
3489-
* SetupDiSetDeviceRegistryPropertyW (SETUPAPI.@)
3450+
* Internal for SetupDiSetDeviceRegistryPropertyA/W
34903451
*/
3491-
BOOL WINAPI SetupDiSetDeviceRegistryPropertyW(
3452+
BOOL WINAPI IntSetupDiSetDeviceRegistryPropertyAW(
34923453
HDEVINFO DeviceInfoSet,
34933454
PSP_DEVINFO_DATA DeviceInfoData,
34943455
DWORD Property,
34953456
const BYTE *PropertyBuffer,
3496-
DWORD PropertyBufferSize)
3457+
DWORD PropertyBufferSize,
3458+
BOOL isAnsi)
34973459
{
34983460
BOOL ret = FALSE;
34993461
struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
@@ -3518,18 +3480,29 @@ BOOL WINAPI SetupDiSetDeviceRegistryPropertyW(
35183480
return FALSE;
35193481
}
35203482
if (Property < sizeof(PropertyMap) / sizeof(PropertyMap[0])
3521-
&& PropertyMap[Property].nameW)
3483+
&& PropertyMap[Property].nameW
3484+
&& PropertyMap[Property].nameA)
35223485
{
35233486
HKEY hKey;
35243487
LONG l;
35253488
hKey = SetupDiOpenDevRegKey(DeviceInfoSet, DeviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_SET_VALUE);
35263489
if (hKey == INVALID_HANDLE_VALUE)
35273490
return FALSE;
35283491
/* Write new data */
3529-
l = RegSetValueExW(
3530-
hKey, PropertyMap[Property].nameW, 0,
3531-
PropertyMap[Property].regType, PropertyBuffer,
3532-
PropertyBufferSize);
3492+
if (isAnsi)
3493+
{
3494+
l = RegSetValueExA(
3495+
hKey, PropertyMap[Property].nameA, 0,
3496+
PropertyMap[Property].regType, PropertyBuffer,
3497+
PropertyBufferSize);
3498+
}
3499+
else
3500+
{
3501+
l = RegSetValueExW(
3502+
hKey, PropertyMap[Property].nameW, 0,
3503+
PropertyMap[Property].regType, PropertyBuffer,
3504+
PropertyBufferSize);
3505+
}
35333506
if (!l)
35343507
ret = TRUE;
35353508
else
@@ -3545,6 +3518,41 @@ BOOL WINAPI SetupDiSetDeviceRegistryPropertyW(
35453518
TRACE("Returning %d\n", ret);
35463519
return ret;
35473520
}
3521+
/***********************************************************************
3522+
* SetupDiSetDeviceRegistryPropertyA (SETUPAPI.@)
3523+
*/
3524+
BOOL WINAPI SetupDiSetDeviceRegistryPropertyA(
3525+
HDEVINFO DeviceInfoSet,
3526+
PSP_DEVINFO_DATA DeviceInfoData,
3527+
DWORD Property,
3528+
const BYTE *PropertyBuffer,
3529+
DWORD PropertyBufferSize)
3530+
{
3531+
return IntSetupDiSetDeviceRegistryPropertyAW(DeviceInfoSet,
3532+
DeviceInfoData,
3533+
Property,
3534+
PropertyBuffer,
3535+
PropertyBufferSize,
3536+
TRUE);
3537+
}
3538+
3539+
/***********************************************************************
3540+
* SetupDiSetDeviceRegistryPropertyW (SETUPAPI.@)
3541+
*/
3542+
BOOL WINAPI SetupDiSetDeviceRegistryPropertyW(
3543+
HDEVINFO DeviceInfoSet,
3544+
PSP_DEVINFO_DATA DeviceInfoData,
3545+
DWORD Property,
3546+
const BYTE *PropertyBuffer,
3547+
DWORD PropertyBufferSize)
3548+
{
3549+
return IntSetupDiSetDeviceRegistryPropertyAW(DeviceInfoSet,
3550+
DeviceInfoData,
3551+
Property,
3552+
PropertyBuffer,
3553+
PropertyBufferSize,
3554+
FALSE);
3555+
}
35483556

35493557
/***********************************************************************
35503558
* SetupDiInstallClassA (SETUPAPI.@)

0 commit comments

Comments
 (0)