Juan Lang : setupapi: Implement SetupDiSetDeviceRegistryPropertyA/W.

Alexandre Julliard julliard at winehq.org
Fri Sep 21 07:23:04 CDT 2007


Module: wine
Branch: master
Commit: 60fefd72e8330e2942235309e3cd3ea2604c7a4c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=60fefd72e8330e2942235309e3cd3ea2604c7a4c

Author: Juan Lang <juan.lang at gmail.com>
Date:   Thu Sep 20 09:10:32 2007 -0700

setupapi: 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 40b6a7e..d92754b 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -1647,6 +1647,102 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(
 }
 
 /***********************************************************************
+ *		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 @@
 @ 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




More information about the wine-cvs mailing list