From a3647ed28453060e3fab7d3021d1364754e37d6a Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Thu, 20 Sep 2007 09:10:32 -0700 Subject: [PATCH] Implement SetupDiSetDeviceRegistryPropertyA/W --- dlls/setupapi/devinst.c | 96 +++++++++++++++++++++++++++++++++++++++++++ dlls/setupapi/setupapi.spec | 4 +- 2 files changed, 98 insertions(+), 2 deletions(-) diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 9b9dceb..f1178ff 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -1647,6 +1647,102 @@ BOOL WINAPI SetupDiGetDeviceRegistryProp } /*********************************************************************** + * SetupDiSetDeviceRegistryPropertyA (SETUPAPI.@) + */ +BOOL WINAPI SetupDiSetDeviceRegistryPropertyA( + HDEVINFO DeviceInfoSet, + PSP_DEVINFO_DATA DeviceInfoData, + DWORD Property, + const BYTE *PropertyBuffer, + DWORD PropertyBufferSize) +{ + BOOL ret = FALSE; + struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet; + struct DeviceInfo *devInfo; + + TRACE("%p %p %d %p %d\n", DeviceInfoSet, DeviceInfoData, Property, + PropertyBuffer, PropertyBufferSize); + + if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + if (!DeviceInfoData || DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA) + || !DeviceInfoData->Reserved) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved; + if (Property < sizeof(PropertyMap) / sizeof(PropertyMap[0]) + && PropertyMap[Property].nameA) + { + LONG l = RegSetValueExA(devInfo->key, PropertyMap[Property].nameA, 0, + PropertyMap[Property].regType, PropertyBuffer, + PropertyBufferSize); + if (!l) + ret = TRUE; + else + SetLastError(l); + } + return ret; +} + +/*********************************************************************** + * SetupDiSetDeviceRegistryPropertyW (SETUPAPI.@) + */ +BOOL WINAPI SetupDiSetDeviceRegistryPropertyW( + HDEVINFO DeviceInfoSet, + PSP_DEVINFO_DATA DeviceInfoData, + DWORD Property, + const BYTE *PropertyBuffer, + DWORD PropertyBufferSize) +{ + BOOL ret = FALSE; + struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet; + struct DeviceInfo *devInfo; + + TRACE("%p %p %d %p %d\n", DeviceInfoSet, DeviceInfoData, Property, + PropertyBuffer, PropertyBufferSize); + + if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + if (!DeviceInfoData || DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA) + || !DeviceInfoData->Reserved) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved; + if (Property < sizeof(PropertyMap) / sizeof(PropertyMap[0]) + && PropertyMap[Property].nameW) + { + LONG l = RegSetValueExW(devInfo->key, PropertyMap[Property].nameW, 0, + PropertyMap[Property].regType, PropertyBuffer, + PropertyBufferSize); + if (!l) + ret = TRUE; + else + SetLastError(l); + } + return ret; +} + +/*********************************************************************** * SetupDiInstallClassA (SETUPAPI.@) */ BOOL WINAPI SetupDiInstallClassA( diff --git a/dlls/setupapi/setupapi.spec b/dlls/setupapi/setupapi.spec index 870a1f9..6b93af3 100644 --- a/dlls/setupapi/setupapi.spec +++ b/dlls/setupapi/setupapi.spec @@ -374,8 +374,8 @@ # Yes, Microsoft really misspelled this @ stub SetupDiSetClassInstallParamsW @ stub SetupDiSetDeviceInstallParamsA @ stub SetupDiSetDeviceInstallParamsW -@ stub SetupDiSetDeviceRegistryPropertyA -@ stub SetupDiSetDeviceRegistryPropertyW +@ stdcall SetupDiSetDeviceRegistryPropertyA(ptr ptr long ptr ptr) +@ stdcall SetupDiSetDeviceRegistryPropertyW(ptr ptr long ptr ptr) @ stub SetupDiSetDriverInstallParamsA @ stub SetupDiSetDriverInstallParamsW @ stub SetupDiSetSelectedDevice -- 1.4.1