- Add registry property constants.
authorEric Kohl <eric.kohl@reactos.org>
Wed, 3 Aug 2005 20:10:32 +0000 (20:10 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Wed, 3 Aug 2005 20:10:32 +0000 (20:10 +0000)
- Finish CM_Set_DevNode_Registry_Property_ExW.

svn path=/trunk/; revision=17030

reactos/include/wine/cfgmgr32.h
reactos/lib/setupapi/cfgmgr.c
reactos/services/umpnpmgr/umpnpmgr.c
reactos/w32api/include/ddk/cfgmgr32.h

index 85217e3..acbfa51 100644 (file)
@@ -95,6 +95,35 @@ DECL_WINELIB_CFGMGR32_TYPE_AW(DEVINSTID)
 #define CM_SET_DEVINST_PROBLEM_OVERRIDE CM_SET_DEVNODE_PROBLEM_OVERRIDE
 #define CM_SET_DEVINST_PROBLEM_BITS     CM_SET_DEVNODE_PROBLEM_BITS
 
+/* Properties for CM_Get/Set_DevNode_Registry_Property[_Ex]A/W */
+#define CM_DRP_DEVICEDESC                  0x00000001
+#define CM_DRP_HARDWAREID                  0x00000002
+#define CM_DRP_COMPATIBLEIDS               0x00000003
+#define CM_DRP_UNUSED0                     0x00000004
+#define CM_DRP_SERVICE                     0x00000005
+#define CM_DRP_UNUSED1                     0x00000006
+#define CM_DRP_UNUSED2                     0x00000007
+#define CM_DRP_CLASS                       0x00000008
+#define CM_DRP_CLASSGUID                   0x00000009
+#define CM_DRP_DRIVER                      0x0000000A
+#define CM_DRP_CONFIGFLAGS                 0x0000000B
+#define CM_DRP_MFG                         0x0000000C
+#define CM_DRP_FRIENDLYNAME                0x0000000D
+#define CM_DRP_LOCATION_INFORMATION        0x0000000E
+#define CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME 0x0000000F
+#define CM_DRP_CAPABILITIES                0x00000010
+#define CM_DRP_UI_NUMBER                   0x00000011
+#define CM_DRP_UPPERFILTERS                0x00000012
+#define CM_DRP_LOWERFILTERS                0x00000013
+#define CM_DRP_BUSTYPEGUID                 0x00000014
+#define CM_DRP_LEGACYBUSTYPE               0x00000015
+#define CM_DRP_BUSNUMBER                   0x00000016
+#define CM_DRP_ENUMERATOR_NAME             0x00000017
+
+#define CM_DRP_MIN                         0x00000001
+#define CM_DRP_MAX                         0x00000017
+
+
 
 CONFIGRET WINAPI CM_Connect_MachineA( PCSTR, PHMACHINE );
 CONFIGRET WINAPI CM_Connect_MachineW( PCWSTR, PHMACHINE );
index 0aa54cf..48d1fbf 100644 (file)
@@ -440,7 +440,7 @@ CONFIGRET WINAPI CM_Get_DevNode_Registry_Property_ExW(
     if (dnDevInst == 0)
         return CR_INVALID_DEVNODE;
 
-    if (ulProperty < 1 /* CM_DRP_MIN */ || ulProperty > 0x17 /* CM_DRP_MAX */)
+    if (ulProperty < CM_DRP_MIN || ulProperty > CM_DRP_MAX)
         return CR_INVALID_PROPERTY;
 
     /* pulRegDataType is optional */
@@ -1356,7 +1356,7 @@ CONFIGRET WINAPI CM_Set_DevNode_Registry_Property_ExW(
     if (dnDevInst == 0)
         return CR_INVALID_DEVNODE;
 
-    if (ulProperty < 1 /* CM_DRP_MIN */ || ulProperty > 0x17 /* CM_DRP_MAX */)
+    if (ulProperty <  CM_DRP_MIN || ulProperty > CM_DRP_MAX)
         return CR_INVALID_PROPERTY;
 
     if (Buffer != NULL && ulLength == 0)
@@ -1385,7 +1385,63 @@ CONFIGRET WINAPI CM_Set_DevNode_Registry_Property_ExW(
     if (lpDevInst == NULL)
         return CR_INVALID_DEVNODE;
 
-    ulType = REG_SZ; /* FIXME */
+    switch (ulProperty)
+    {
+        case CM_DRP_DEVICEDESC:
+            ulType = REG_SZ;
+            break;
+
+        case CM_DRP_HARDWAREID:
+            ulType = REG_MULTI_SZ;
+            break;
+
+        case CM_DRP_COMPATIBLEIDS:
+            ulType = REG_MULTI_SZ;
+            break;
+
+        case CM_DRP_SERVICE:
+            ulType = REG_SZ;
+            break;
+
+        case CM_DRP_CLASS:
+            ulType = REG_SZ;
+            break;
+
+        case CM_DRP_CLASSGUID:
+            ulType = REG_SZ;
+            break;
+
+        case CM_DRP_DRIVER:
+            ulType = REG_SZ;
+            break;
+
+        case CM_DRP_CONFIGFLAGS:
+            ulType = REG_DWORD;
+            break;
+
+        case CM_DRP_MFG:
+            ulType = REG_SZ;
+            break;
+
+        case CM_DRP_FRIENDLYNAME:
+            ulType = REG_SZ;
+            break;
+
+        case CM_DRP_LOCATION_INFORMATION:
+            ulType = REG_SZ;
+            break;
+
+        case CM_DRP_UPPERFILTERS:
+            ulType = REG_MULTI_SZ;
+            break;
+
+        case CM_DRP_LOWERFILTERS:
+            ulType = REG_MULTI_SZ;
+            break;
+
+        default:
+            return CR_INVALID_PROPERTY;
+    }
 
     return PNP_SetDeviceRegProp(BindingHandle,
                                 lpDevInst,
index e99319a..c1e5142 100644 (file)
@@ -345,19 +345,103 @@ PNP_SetDeviceRegProp(handle_t BindingHandle,
                      unsigned long Flags)
 {
     CONFIGRET ret = CR_SUCCESS;
-//    ULONG Data;
+    LPWSTR lpValueName = NULL;
+    HKEY hKey = 0;
 
-    DPRINT1("PNP_SetDeviceRegProp() called\n");
+    DPRINT("PNP_SetDeviceRegProp() called\n");
 
-    DPRINT1("DeviceId: %S\n", DeviceId);
+    DPRINT("DeviceId: %S\n", DeviceId);
+    DPRINT("Property: %lu\n", Property);
+    DPRINT("DataType: %lu\n", DataType);
+    DPRINT("Length: %lu\n", Length);
 
-    DPRINT1("Property: %lu\n", Property);
-    DPRINT1("DataType: %lu\n", DataType);
-    DPRINT1("Length: %lu\n", Length);
+    switch (Property)
+    {
+        case CM_DRP_DEVICEDESC:
+            lpValueName = L"DeviceDesc";
+            break;
+
+        case CM_DRP_HARDWAREID:
+            lpValueName = L"HardwareID";
+            break;
+
+        case CM_DRP_COMPATIBLEIDS:
+            lpValueName = L"CompatibleIDs";
+            break;
+
+        case CM_DRP_SERVICE:
+            lpValueName = L"Service";
+            break;
+
+        case CM_DRP_CLASS:
+            lpValueName = L"Class";
+            break;
+
+        case CM_DRP_CLASSGUID:
+            lpValueName = L"ClassGUID";
+            break;
+
+        case CM_DRP_DRIVER:
+            lpValueName = L"Driver";
+            break;
+
+        case CM_DRP_CONFIGFLAGS:
+            lpValueName = L"ConfigFlags";
+            break;
+
+        case CM_DRP_MFG:
+            lpValueName = L"Mfg";
+            break;
+
+        case CM_DRP_FRIENDLYNAME:
+            lpValueName = L"FriendlyName";
+            break;
+
+        case CM_DRP_LOCATION_INFORMATION:
+            lpValueName = L"LocationInformation";
+            break;
+
+        case CM_DRP_UPPERFILTERS:
+            lpValueName = L"UpperFilters";
+            break;
 
-    DPRINT1("Data: %lx\n", *((PULONG)Buffer));
+        case CM_DRP_LOWERFILTERS:
+            lpValueName = L"LowerFilters";
+            break;
+
+        default:
+            return CR_INVALID_PROPERTY;
+    }
+
+    DPRINT("Value name: %S\n", lpValueName);
+
+    if (RegOpenKeyExW(hEnumKey,
+                      DeviceId,
+                      0,
+                      KEY_ALL_ACCESS,
+                      &hKey))
+        return CR_INVALID_DEVNODE;
+
+    if (Length == 0)
+    {
+        if (RegDeleteValueW(hKey,
+                            lpValueName))
+            ret = CR_REGISTRY_ERROR;
+    }
+    else
+    {
+        if (RegSetValueExW(hKey,
+                           lpValueName,
+                           0,
+                           DataType,
+                           Buffer,
+                           Length))
+            ret = CR_REGISTRY_ERROR;
+    }
+
+    RegCloseKey(hKey);
 
-    DPRINT1("PNP_SetDeviceRegProp() done (returns %lx)\n", ret);
+    DPRINT("PNP_SetDeviceRegProp() done (returns %lx)\n", ret);
 
     return ret;
 }
@@ -374,10 +458,106 @@ PNP_GetDeviceRegProp(handle_t BindingHandle,
                      DWORD Flags)
 {
     CONFIGRET ret = CR_SUCCESS;
+    LPWSTR lpValueName = NULL;
     ULONG Data;
 
     DPRINT1("PNP_GetDeviceRegProp() called\n");
 
+    switch (Property)
+    {
+        case CM_DRP_DEVICEDESC:
+            lpValueName = L"DeviceDesc";
+            break;
+
+        case CM_DRP_HARDWAREID:
+            lpValueName = L"HardwareID";
+            break;
+
+        case CM_DRP_COMPATIBLEIDS:
+            lpValueName = L"CompatibleIDs";
+            break;
+
+        case CM_DRP_SERVICE:
+            lpValueName = L"Service";
+            break;
+
+        case CM_DRP_CLASS:
+            lpValueName = L"Class";
+            break;
+
+        case CM_DRP_CLASSGUID:
+            lpValueName = L"ClassGUID";
+            break;
+
+        case CM_DRP_DRIVER:
+            lpValueName = L"Driver";
+            break;
+
+        case CM_DRP_CONFIGFLAGS:
+            lpValueName = L"ConfigFlags";
+            break;
+
+        case CM_DRP_MFG:
+            lpValueName = L"Mfg";
+            break;
+
+        case CM_DRP_FRIENDLYNAME:
+            lpValueName = L"FriendlyName";
+            break;
+
+        case CM_DRP_LOCATION_INFORMATION:
+            lpValueName = L"LocationInformation";
+            break;
+
+        case CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME:
+            lpValueName = NULL;
+            break;
+
+        case CM_DRP_CAPABILITIES:
+            lpValueName = L"Capabilities";
+            break;
+
+        case CM_DRP_UI_NUMBER:
+            break;
+
+        case CM_DRP_UPPERFILTERS:
+            lpValueName = L"UpperFilters";
+            break;
+
+        case CM_DRP_LOWERFILTERS:
+            lpValueName = L"LowerFilters";
+            break;
+
+        case CM_DRP_BUSTYPEGUID:
+            break;
+
+        case CM_DRP_LEGACYBUSTYPE:
+            break;
+
+        case CM_DRP_BUSNUMBER:
+            break;
+
+        case CM_DRP_ENUMERATOR_NAME:
+            break;
+
+        default:
+            return CR_INVALID_PROPERTY;
+    }
+
+    DPRINT1("Value name: %S\n", lpValueName);
+
+    if (lpValueName)
+    {
+        /* Retrieve information from the Registry */
+
+    }
+    else
+    {
+        /* Retrieve information from the Device Node */
+
+    }
+
+
     Data = 0xbaadf00d;
     memcpy(Buffer, &Data, sizeof(ULONG));
     *Length = sizeof(ULONG);
index fbeaa2a..cf6e857 100644 (file)
@@ -197,6 +197,33 @@ typedef RESOURCEID *PRESOURCEID;
 #define CM_GET_DEVICE_INTERFACE_LIST_ALL_DEVICES  0x00000001
 #define CM_GET_DEVICE_INTERFACE_LIST_BITS         0x00000001
 
+#define CM_DRP_DEVICEDESC                  0x00000001
+#define CM_DRP_HARDWAREID                  0x00000002
+#define CM_DRP_COMPATIBLEIDS               0x00000003
+#define CM_DRP_UNUSED0                     0x00000004
+#define CM_DRP_SERVICE                     0x00000005
+#define CM_DRP_UNUSED1                     0x00000006
+#define CM_DRP_UNUSED2                     0x00000007
+#define CM_DRP_CLASS                       0x00000008
+#define CM_DRP_CLASSGUID                   0x00000009
+#define CM_DRP_DRIVER                      0x0000000A
+#define CM_DRP_CONFIGFLAGS                 0x0000000B
+#define CM_DRP_MFG                         0x0000000C
+#define CM_DRP_FRIENDLYNAME                0x0000000D
+#define CM_DRP_LOCATION_INFORMATION        0x0000000E
+#define CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME 0x0000000F
+#define CM_DRP_CAPABILITIES                0x00000010
+#define CM_DRP_UI_NUMBER                   0x00000011
+#define CM_DRP_UPPERFILTERS                0x00000012
+#define CM_DRP_LOWERFILTERS                0x00000013
+#define CM_DRP_BUSTYPEGUID                 0x00000014
+#define CM_DRP_LEGACYBUSTYPE               0x00000015
+#define CM_DRP_BUSNUMBER                   0x00000016
+#define CM_DRP_ENUMERATOR_NAME             0x00000017
+
+#define CM_DRP_MIN                         0x00000001
+#define CM_DRP_MAX                         0x00000017
+
 
 typedef struct BusNumber_Des_s {
   DWORD  BUSD_Count;