- Implement CM_Disable_DevNode[_Ex], CM_Enable_DevNode[_Ex], CM_Reenumerate_DevNode[_Ex] and CM_Run_Detection[_Ex].
- Implement StringTableAddStringEx and StringTableLookUpStringEx.
Modified: trunk/reactos/include/idl/pnp.idl
Modified: trunk/reactos/include/wine/cfgmgr32.h
Modified: trunk/reactos/lib/setupapi/cfgmgr.c
Modified: trunk/reactos/lib/setupapi/setupapi.spec
Modified: trunk/reactos/lib/setupapi/stringtable.c
Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c
Modified: trunk/reactos/w32api/include/ddk/cfgmgr32.h

Modified: trunk/reactos/include/idl/pnp.idl
--- trunk/reactos/include/idl/pnp.idl	2005-12-17 12:16:28 UTC (rev 20222)
+++ trunk/reactos/include/idl/pnp.idl	2005-12-17 12:23:41 UTC (rev 20223)
@@ -30,6 +30,9 @@
                                [out] unsigned long *State,
                                [in] unsigned long Flags);
 
+  /* Function 4 */
+  CONFIGRET PNP_InitDetection(handle_t BindingHandle);
+
   /* Function 6 */
   CONFIGRET PNP_ValidateDeviceInstance(handle_t BindingHandle,
                                        [in, string] wchar_t *DeviceInstance,
@@ -106,6 +109,13 @@
                           [in] unsigned long DesiredAccess,
                           [in] unsigned long Flags);
 
+  /* Function 17 */
+  CONFIGRET PNP_DeleteRegistryKey(handle_t BindingHandle,
+                                  [in, string] wchar_t *DeviceId,
+                                  [in, string] wchar_t *ParentKey,
+                                  [in, string] wchar_t *ChildKey,
+                                  [in] unsigned long Flags);
+
   /* Function 19 */
   CONFIGRET PNP_GetClassName(handle_t BindingHandle,
                              [in, string] wchar_t *ClassGuid,
@@ -118,6 +128,13 @@
                                [in, string] wchar_t *ClassGuid,
                                [in] unsigned long Flags);
 
+  /* Function 29 */
+  CONFIGRET PNP_DeviceInstanceAction(handle_t BindingHandle,
+                                     [in] unsigned long MajorAction,
+                                     [in] unsigned long MinorAction,
+                                     [in, unique, string] wchar_t *DeviceInstance1,
+                                     [in, unique, string] wchar_t *DeviceInstance2);
+
   /* Function 30 */
   CONFIGRET PNP_GetDeviceStatus(handle_t BindingHandle,
                                 [in, string] wchar_t *DeviceInstance,
@@ -137,4 +154,8 @@
 
   /* Function 39 */
   CONFIGRET PNP_RequestEjectPC(handle_t BindingHandle);
+
+  /* Function 58 */
+  CONFIGRET PNP_RunDetection(handle_t BindingHandle,
+                             [in] unsigned long Flags);
 }

Modified: trunk/reactos/include/wine/cfgmgr32.h
--- trunk/reactos/include/wine/cfgmgr32.h	2005-12-17 12:16:28 UTC (rev 20222)
+++ trunk/reactos/include/wine/cfgmgr32.h	2005-12-17 12:23:41 UTC (rev 20223)
@@ -139,13 +139,31 @@
 #define CM_GETIDLIST_DONOTGENERATE              (0x10000040)
 #define CM_GETIDLIST_FILTER_BITS                (0x1000007F)
 
+/* ulFlags for CM_Reenumerate_DevNode[_Ex] */
+#define CM_REENUMERATE_NORMAL             0x00000000
+#define CM_REENUMERATE_SYNCHRONOUS        0x00000001
+#define CM_REENUMERATE_RETRY_INSTALLATION 0x00000002
+#define CM_REENUMERATE_ASYNCHRONOUS       0x00000004
+#define CM_REENUMERATE_BITS               0x00000007
 
+/* ulFlags for CM_Run_Detection[_Ex] */
+#define CM_DETECT_NEW_PROFILE       0x00000001
+#define CM_DETECT_CRASHED           0x00000002
+#define CM_DETECT_HWPROF_FIRST_BOOT 0x00000004
+#define CM_DETECT_RUN               0x80000000
+#define CM_DETECT_BITS              0x80000007
+
+
 CONFIGRET WINAPI CM_Connect_MachineA( PCSTR, PHMACHINE );
 CONFIGRET WINAPI CM_Connect_MachineW( PCWSTR, PHMACHINE );
 #define     CM_Connect_Machine WINELIB_NAME_AW(CM_Connect_Machine)
 CONFIGRET WINAPI CM_Delete_Class_Key( LPGUID, ULONG );
 CONFIGRET WINAPI CM_Delete_Class_Key_Ex( LPGUID, ULONG, HANDLE );
+CONFIGRET WINAPI CM_Disable_DevNode( DEVINST, ULONG );
+CONFIGRET WINAPI CM_Disable_DevNode_Ex( DEVINST, ULONG, HMACHINE );
 CONFIGRET WINAPI CM_Disconnect_Machine( HMACHINE );
+CONFIGRET WINAPI CM_Enable_DevNode( DEVINST, ULONG );
+CONFIGRET WINAPI CM_Enable_DevNode_Ex( DEVINST, ULONG, HMACHINE );
 CONFIGRET WINAPI CM_Enumerate_Classes( ULONG, LPGUID, ULONG );
 CONFIGRET WINAPI CM_Enumerate_Classes_Ex( ULONG, LPGUID, ULONG, HMACHINE );
 CONFIGRET WINAPI CM_Enumerate_EnumeratorsA( ULONG, PCHAR, PULONG, ULONG );
@@ -223,9 +241,14 @@
 CONFIGRET WINAPI CM_Open_Class_Key_ExW(LPGUID, LPCWSTR, REGSAM, REGDISPOSITION, PHKEY, ULONG, HMACHINE);
 #define     CM_Open_Class_Key_Ex WINELIB_NAME_AW(CM_Open_Class_Key_Ex)
 
+CONFIGRET WINAPI CM_Reenumerate_DevNode( DEVINST, ULONG );
+CONFIGRET WINAPI CM_Reenumerate_DevNode_Ex( DEVINST, ULONG, HMACHINE );
+
 CONFIGRET WINAPI CM_Request_Eject_PC( VOID );
 CONFIGRET WINAPI CM_Request_Eject_PC_Ex( HMACHINE );
 
+CONFIGRET WINAPI CM_Run_Detection( ULONG );
+CONFIGRET WINAPI CM_Run_Detection_Ex( ULONG, HMACHINE );
 CONFIGRET WINAPI CM_Set_DevNode_Problem( DEVINST, ULONG, ULONG );
 CONFIGRET WINAPI CM_Set_DevNode_Problem_Ex( DEVINST, ULONG, ULONG, HMACHINE );
 CONFIGRET WINAPI CM_Set_DevNode_Registry_PropertyA( DEVINST, ULONG, PCVOID, ULONG, ULONG );

Modified: trunk/reactos/lib/setupapi/cfgmgr.c
--- trunk/reactos/lib/setupapi/cfgmgr.c	2005-12-17 12:16:28 UTC (rev 20222)
+++ trunk/reactos/lib/setupapi/cfgmgr.c	2005-12-17 12:23:41 UTC (rev 20223)
@@ -174,6 +174,66 @@
 
 
 /***********************************************************************
+ * CM_Disable_DevNode [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Disable_DevNode(
+    DEVINST dnDevInst, ULONG ulFlags)
+{
+    TRACE("%p %lx\n", dnDevInst, ulFlags);
+    return CM_Disable_DevNode_Ex(dnDevInst, ulFlags, NULL);
+}
+
+
+/***********************************************************************
+ * CM_Disable_DevNode_Ex [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Disable_DevNode_Ex(
+    DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
+{
+    RPC_BINDING_HANDLE BindingHandle = NULL;
+    HSTRING_TABLE StringTable = NULL;
+    LPWSTR lpDevInst;
+
+    FIXME("%p %lx %p\n", dnDevInst, ulFlags, hMachine);
+
+//    if (!IsUserAdmin())
+//        return CR_ACCESS_DENIED;
+
+    if (dnDevInst == 0)
+        return CR_INVALID_DEVINST;
+
+    if (ulFlags != 0)
+        return CR_INVALID_FLAG;
+
+    if (hMachine != NULL)
+    {
+        BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+        if (BindingHandle == NULL)
+            return CR_FAILURE;
+
+        StringTable = ((PMACHINE_INFO)hMachine)->StringTable;
+        if (StringTable == 0)
+            return CR_FAILURE;
+    }
+    else
+    {
+        if (!PnpGetLocalHandles(&BindingHandle, &StringTable))
+            return CR_FAILURE;
+    }
+
+    lpDevInst = StringTableStringFromId(StringTable, dnDevInst);
+    if (lpDevInst == NULL)
+        return CR_INVALID_DEVNODE;
+
+    return PNP_DeviceInstanceAction(BindingHandle,
+                                    5,
+                                    ulFlags,
+                                    lpDevInst,
+                                    NULL);
+}
+
+
+/***********************************************************************
  * CM_Disconnect_Machine [SETUPAPI.@]
  */
 CONFIGRET WINAPI CM_Disconnect_Machine(HMACHINE hMachine)
@@ -199,6 +259,66 @@
 
 
 /***********************************************************************
+ * CM_Enable_DevNode [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Enable_DevNode(
+    DEVINST dnDevInst, ULONG ulFlags)
+{
+    TRACE("%p %lx\n", dnDevInst, ulFlags);
+    return CM_Enable_DevNode_Ex(dnDevInst, ulFlags, NULL);
+}
+
+
+/***********************************************************************
+ * CM_Enable_DevNode_Ex [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Enable_DevNode_Ex(
+    DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
+{
+    RPC_BINDING_HANDLE BindingHandle = NULL;
+    HSTRING_TABLE StringTable = NULL;
+    LPWSTR lpDevInst;
+
+    FIXME("%p %lx %p\n", dnDevInst, ulFlags, hMachine);
+
+//    if (!IsUserAdmin())
+//        return CR_ACCESS_DENIED;
+
+    if (dnDevInst == 0)
+        return CR_INVALID_DEVINST;
+
+    if (ulFlags != 0)
+        return CR_INVALID_FLAG;
+
+    if (hMachine != NULL)
+    {
+        BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+        if (BindingHandle == NULL)
+            return CR_FAILURE;
+
+        StringTable = ((PMACHINE_INFO)hMachine)->StringTable;
+        if (StringTable == 0)
+            return CR_FAILURE;
+    }
+    else
+    {
+        if (!PnpGetLocalHandles(&BindingHandle, &StringTable))
+            return CR_FAILURE;
+    }
+
+    lpDevInst = StringTableStringFromId(StringTable, dnDevInst);
+    if (lpDevInst == NULL)
+        return CR_INVALID_DEVNODE;
+
+    return PNP_DeviceInstanceAction(BindingHandle,
+                                    4,
+                                    ulFlags,
+                                    lpDevInst,
+                                    NULL);
+}
+
+
+/***********************************************************************
  * CM_Enumerate_Classes [SETUPAPI.@]
  */
 CONFIGRET WINAPI CM_Enumerate_Classes(
@@ -1875,6 +1995,64 @@
 
 
 /***********************************************************************
+ * CM_Reenumerate_DevNode [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Reenumerate_DevNode(
+    DEVINST dnDevInst, ULONG ulFlags)
+{
+    TRACE("%lx %lx\n", dnDevInst, ulFlags);
+    return CM_Reenumerate_DevNode_Ex(dnDevInst, ulFlags, NULL);
+}
+
+
+/***********************************************************************
+ * CM_Reenumerate_DevNode_Ex [SETUPAPI.@]
+ */
+CONFIGRET WINAPI
+CM_Reenumerate_DevNode_Ex(
+    DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
+{
+    RPC_BINDING_HANDLE BindingHandle = NULL;
+    HSTRING_TABLE StringTable = NULL;
+    LPWSTR lpDevInst;
+
+    FIXME("%lx %lx %lx\n", dnDevInst, ulFlags, hMachine);
+
+    if (dnDevInst == 0)
+        return CR_INVALID_DEVNODE;
+
+    if (ulFlags & ~CM_REENUMERATE_BITS)
+        return CR_INVALID_FLAG;
+
+    if (hMachine != NULL)
+    {
+        BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+        if (BindingHandle == NULL)
+            return CR_FAILURE;
+
+        StringTable = ((PMACHINE_INFO)hMachine)->StringTable;
+        if (StringTable == 0)
+            return CR_FAILURE;
+    }
+    else
+    {
+        if (!PnpGetLocalHandles(&BindingHandle, &StringTable))
+            return CR_FAILURE;
+    }
+
+    lpDevInst = StringTableStringFromId(StringTable, dnDevInst);
+    if (lpDevInst == NULL)
+        return CR_INVALID_DEVNODE;
+
+    return PNP_DeviceInstanceAction(BindingHandle,
+                                    7,
+                                    ulFlags,
+                                    lpDevInst,
+                                    NULL);
+}
+
+
+/***********************************************************************
  * CM_Request_Eject_PC [SETUPAPI.@]
  */
 CONFIGRET WINAPI CM_Request_Eject_PC(VOID)
@@ -1911,6 +2089,50 @@
 
 
 /***********************************************************************
+ * CM_Run_Detection [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Run_Detection(
+    ULONG ulFlags)
+{
+    TRACE("%lx\n", ulFlags);
+    return CM_Run_Detection_Ex(ulFlags, NULL);
+}
+
+
+/***********************************************************************
+ * CM_Run_Detection_Ex [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Run_Detection_Ex(
+    ULONG ulFlags, HMACHINE hMachine)
+{
+    RPC_BINDING_HANDLE BindingHandle = NULL;
+
+    TRACE("%lx %lx\n", ulFlags, hMachine);
+
+//    if (!IsUserAdmin())
+//        return CR_ACCESS_DENIED;
+
+    if (ulFlags & ~CM_DETECT_BITS)
+        return CR_INVALID_FLAG;
+
+    if (hMachine != NULL)
+    {
+        BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+        if (BindingHandle == NULL)
+            return CR_FAILURE;
+    }
+    else
+    {
+        if (!PnpGetLocalHandles(&BindingHandle, NULL))
+            return CR_FAILURE;
+    }
+
+    return PNP_RunDetection(BindingHandle,
+                            ulFlags);
+}
+
+
+/***********************************************************************
  * CM_Set_DevNode_Problem [SETUPAPI.@]
  */
 CONFIGRET WINAPI CM_Set_DevNode_Problem(

Modified: trunk/reactos/lib/setupapi/setupapi.spec
--- trunk/reactos/lib/setupapi/setupapi.spec	2005-12-17 12:16:28 UTC (rev 20222)
+++ trunk/reactos/lib/setupapi/setupapi.spec	2005-12-17 12:23:41 UTC (rev 20223)
@@ -32,12 +32,12 @@
 @ stub CM_Delete_Range
 @ stub CM_Detect_Resource_Conflict
 @ stub CM_Detect_Resource_Conflict_Ex
-@ stub CM_Disable_DevNode
-@ stub CM_Disable_DevNode_Ex
+@ stdcall CM_Disable_DevNode(long long)
+@ stdcall CM_Disable_DevNode_Ex(long long ptr)
 @ stdcall CM_Disconnect_Machine(long)
 @ stub CM_Dup_Range_List
-@ stub CM_Enable_DevNode
-@ stub CM_Enable_DevNode_Ex
+@ stdcall CM_Enable_DevNode(long long)
+@ stdcall CM_Enable_DevNode_Ex(long long ptr)
 @ stdcall CM_Enumerate_Classes(long ptr long)
 @ stdcall CM_Enumerate_Classes_Ex(long ptr long ptr)
 @ stdcall CM_Enumerate_EnumeratorsA(long str ptr long)
@@ -151,8 +151,8 @@
 @ stub CM_Query_Arbitrator_Free_Size_Ex
 @ stub CM_Query_Remove_SubTree
 @ stub CM_Query_Remove_SubTree_Ex
-@ stub CM_Reenumerate_DevNode
-@ stub CM_Reenumerate_DevNode_Ex
+@ stdcall CM_Reenumerate_DevNode(long long)
+@ stdcall CM_Reenumerate_DevNode_Ex(long long long)
 @ stub CM_Register_Device_Driver
 @ stub CM_Register_Device_Driver_Ex
 @ stub CM_Register_Device_InterfaceA
@@ -165,12 +165,12 @@
 @ stub CM_Remove_Unmarked_Children_Ex
 @ stub CM_Request_Device_EjectA
 @ stub CM_Request_Device_EjectW
-@ stub CM_Request_Eject_PC
-@ stub CM_Request_Eject_PC_Ex
+@ stdcall CM_Request_Eject_PC()
+@ stdcall CM_Request_Eject_PC_Ex(long)
 @ stub CM_Reset_Children_Marks
 @ stub CM_Reset_Children_Marks_Ex
-@ stub CM_Run_Detection
-@ stub CM_Run_Detection_Ex
+@ stdcall CM_Run_Detection(long)
+@ stdcall CM_Run_Detection_Ex(long long)
 @ stdcall CM_Set_DevNode_Problem(long long long)
 @ stdcall CM_Set_DevNode_Problem_Ex(long long long long)
 @ stdcall CM_Set_DevNode_Registry_PropertyA(long long ptr long long)

Modified: trunk/reactos/lib/setupapi/stringtable.c
--- trunk/reactos/lib/setupapi/stringtable.c	2005-12-17 12:16:28 UTC (rev 20222)
+++ trunk/reactos/lib/setupapi/stringtable.c	2005-12-17 12:23:41 UTC (rev 20223)
@@ -307,7 +307,83 @@
                        LPVOID lpExtraData,
                        DWORD dwExtraDataSize)
 {
-    FIXME("\n");
+    PSTRING_TABLE pStringTable;
+    DWORD i;
+
+    TRACE("%p %s %lx\n", (PVOID)hStringTable, debugstr_w(lpString), dwFlags);
+
+    pStringTable = (PSTRING_TABLE)hStringTable;
+    if (pStringTable == NULL)
+    {
+        ERR("Invalid hStringTable!\n");
+        return (DWORD)-1;
+    }
+
+    /* Search for existing string in the string table */
+    for (i = 0; i < pStringTable->dwMaxSlots; i++)
+    {
+        if (pStringTable->pSlots[i].pString != NULL)
+        {
+            if (dwFlags & 1)
+            {
+                if (!lstrcmpW(pStringTable->pSlots[i].pString, lpString))
+                {
+                    return i + 1;
+                }
+            }
+            else
+            {
+                if (!lstrcmpiW(pStringTable->pSlots[i].pString, lpString))
+                {
+                    return i + 1;
+                }
+            }
+        }
+    }
+
+    /* Check for filled slot table */
+    if (pStringTable->dwUsedSlots == pStringTable->dwMaxSlots)
+    {
+        FIXME("Resize the string table!\n");
+        return (DWORD)-1;
+    }
+
+    /* Search for an empty slot */
+    for (i = 0; i < pStringTable->dwMaxSlots; i++)
+    {
+        if (pStringTable->pSlots[i].pString == NULL)
+        {
+            pStringTable->pSlots[i].pString = MyMalloc((lstrlenW(lpString) + 1) * sizeof(WCHAR));
+            if (pStringTable->pSlots[i].pString == NULL)
+            {
+                TRACE("Couldn't allocate memory for a new string!\n");
+                return (DWORD)-1;
+            }
+
+            lstrcpyW(pStringTable->pSlots[i].pString, lpString);
+
+            pStringTable->pSlots[i].pData = MyMalloc(dwExtraDataSize);
+            if (pStringTable->pSlots[i].pData == NULL)
+            {
+                TRACE("Couldn't allocate memory for a new extra data!\n");
+                MyFree(pStringTable->pSlots[i].pString);
+                pStringTable->pSlots[i].pString = NULL;
+                return (DWORD)-1;
+            }
+
+            memcpy(pStringTable->pSlots[i].pData,
+                   lpExtraData,
+                   dwExtraDataSize);
+            pStringTable->pSlots[i].dwSize = dwExtraDataSize;
+
+            pStringTable->dwUsedSlots++;
+
+            return i + 1;
+        }
+    }
+
+    TRACE("Couldn't find an empty slot!\n");
+
     return (DWORD)-1;
 }
 
@@ -527,7 +603,48 @@
                           LPVOID lpExtraData,
                           LPDWORD lpReserved)
 {
-    FIXME("\n");
+    PSTRING_TABLE pStringTable;
+    DWORD i;
+
+    TRACE("%p %s %lx\n", (PVOID)hStringTable, debugstr_w(lpString), dwFlags);
+
+    pStringTable = (PSTRING_TABLE)hStringTable;
+    if (pStringTable == NULL)
+    {
+        ERR("Invalid hStringTable!\n");
+        return (DWORD)-1;
+    }
+
+    /* Search for existing string in the string table */
+    for (i = 0; i < pStringTable->dwMaxSlots; i++)
+    {
+        if (pStringTable->pSlots[i].pString != NULL)
+        {
+            if (dwFlags & 1)
+            {
+                if (!lstrcmpW(pStringTable->pSlots[i].pString, lpString))
+                {
+                    memcpy(lpExtraData,
+                           pStringTable->pSlots[i].pData,
+                           pStringTable->pSlots[i].dwSize);
+                    *lpReserved = 0;
+                    return i + 1;
+                }
+            }
+            else
+            {
+                if (!lstrcmpiW(pStringTable->pSlots[i].pString, lpString))
+                {
+                    memcpy(lpExtraData,
+                           pStringTable->pSlots[i].pData,
+                           pStringTable->pSlots[i].dwSize);
+                    *lpReserved = 0;
+                    return i + 1;
+                }
+            }
+        }
+    }
+
     return (DWORD)-1;
 }
 

Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c
--- trunk/reactos/services/umpnpmgr/umpnpmgr.c	2005-12-17 12:16:28 UTC (rev 20222)
+++ trunk/reactos/services/umpnpmgr/umpnpmgr.c	2005-12-17 12:23:41 UTC (rev 20223)
@@ -118,16 +118,18 @@
 {
     switch (Status)
     {
-    	case STATUS_NO_SUCH_DEVICE:
-    		return CR_NO_SUCH_DEVINST;
-    	default:
-    		/* FIXME: add more mappings */
-    		DPRINT1("Unable to map status 0x%08lx\n", Status);
-    		return CR_FAILURE;
+        case STATUS_NO_SUCH_DEVICE:
+            return CR_NO_SUCH_DEVINST;
+
+        default:
+            /* FIXME: add more mappings */
+            DPRINT1("Unable to map status 0x%08lx\n", Status);
+            return CR_FAILURE;
     }
 }
 
 
+/* Function 2 */
 CONFIGRET
 PNP_GetVersion(handle_t BindingHandle,
                unsigned short *Version)
@@ -137,6 +139,7 @@
 }
 
 
+/* Function 3 */
 CONFIGRET
 PNP_GetGlobalState(handle_t BindingHandle,
                    unsigned long *State,
@@ -147,7 +150,17 @@
 }
 
 
+/* Function 4 */
 CONFIGRET
+PNP_InitDetection(handle_t BindingHandle)
+{
+    DPRINT("PNP_InitDetection() called\n");
+    return CR_SUCCESS;
+}
+
+
+/* Function 6 */
+CONFIGRET
 PNP_ValidateDeviceInstance(handle_t BindingHandle,
                            wchar_t *DeviceInstance,
                            unsigned long Flags)
@@ -196,6 +209,7 @@
 }
 
 
+/* Function 7 */
 CONFIGRET
 PNP_GetRootDeviceInstance(handle_t BindingHandle,
                           wchar_t *DeviceInstance,
@@ -221,6 +235,7 @@
 }
 
 
+/* Function 8 */
 CONFIGRET
 PNP_GetRelatedDeviceInstance(handle_t BindingHandle,
                              unsigned long Relationship,
@@ -264,6 +279,7 @@
 }
 
 
+/* Function 9 */
 CONFIGRET
 PNP_EnumerateSubKeys(handle_t BindingHandle,
                      unsigned long Branch,
@@ -317,6 +333,7 @@
 }
 
 
+/* Function 11 */
 CONFIGRET
 PNP_GetDeviceListSize(handle_t BindingHandle,
                       wchar_t *Filter,
@@ -332,6 +349,7 @@
 }
 
 
+/* Function 12 */
 CONFIGRET
 PNP_GetDepth(handle_t BindingHandle,
              wchar_t *DeviceInstance,
@@ -365,119 +383,8 @@
 }
 
 
+/* Function 13 */
 CONFIGRET
-PNP_SetDeviceRegProp(handle_t BindingHandle,
-                     wchar_t *DeviceId,
-                     unsigned long Property,
-                     unsigned long DataType,
-                     char *Buffer,
-                     unsigned long Length,
-                     unsigned long Flags)
-{
-    CONFIGRET ret = CR_SUCCESS;
-    LPWSTR lpValueName = NULL;
-    HKEY hKey = 0;
-
-    DPRINT("PNP_SetDeviceRegProp() called\n");
-
-    DPRINT("DeviceId: %S\n", DeviceId);
-    DPRINT("Property: %lu\n", Property);
-    DPRINT("DataType: %lu\n", DataType);
-    DPRINT("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;
-
-        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,
-                           (const BYTE*)Buffer,
-                           Length))
-            ret = CR_REGISTRY_ERROR;
-    }
-
-    RegCloseKey(hKey);
-
-    DPRINT("PNP_SetDeviceRegProp() done (returns %lx)\n", ret);
-
-    return ret;
-}
-
-
-CONFIGRET
 PNP_GetDeviceRegProp(handle_t BindingHandle,
                      wchar_t *DeviceInstance,
                      unsigned long Property,
@@ -664,7 +571,121 @@
 }
 
 
+/* Function 14 */
 CONFIGRET
+PNP_SetDeviceRegProp(handle_t BindingHandle,
+                     wchar_t *DeviceId,
+                     unsigned long Property,
+                     unsigned long DataType,
+                     char *Buffer,
+                     unsigned long Length,
+                     unsigned long Flags)
+{
+    CONFIGRET ret = CR_SUCCESS;
+    LPWSTR lpValueName = NULL;
+    HKEY hKey = 0;
+
+    DPRINT("PNP_SetDeviceRegProp() called\n");
+
+    DPRINT("DeviceId: %S\n", DeviceId);
+    DPRINT("Property: %lu\n", Property);
+    DPRINT("DataType: %lu\n", DataType);
+    DPRINT("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;
+
+        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,
+                           (const BYTE*)Buffer,
+                           Length))
+            ret = CR_REGISTRY_ERROR;
+    }
+
+    RegCloseKey(hKey);
+
+    DPRINT("PNP_SetDeviceRegProp() done (returns %lx)\n", ret);
+
+    return ret;
+}
+
+
+/* Function 16 */
+CONFIGRET
 PNP_CreateKey(handle_t BindingHandle,
               wchar_t *SubKey,
               unsigned long samDesired,
@@ -680,7 +701,65 @@
 }
 
 
+/* Function 17 */
 CONFIGRET
+PNP_DeleteRegistryKey(handle_t BindingHandle,
+                      wchar_t *DeviceId,
+                      wchar_t *ParentKey,
+                      wchar_t *ChildKey,
+                      unsigned long Flags)
+{
+    CONFIGRET ret = CR_SUCCESS;
+
+    DPRINT("PNP_DeleteRegistryKey() called\n");
+
+    DPRINT("PNP_DeleteRegistryKey() done (returns %lx)\n", ret);
+
+    return ret;
+}
+
+
+/* Function 18 */
+#if 0
+CONFIGRET
+PNP_GetClassCount(handle_t BindingHandle,
+                  unsigned long *ClassCount,
+                  unsigned long Flags)
+{
+    HANDLE hKey = NULL;
+    DWORD dwError;
+
+    dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+                            pszRegPathClass,
+                            0,
+                            KEY_QUERY_VALUE,
+                            &hKey);
+    if (dwError != ERROR_SUCCESS)
+        return CR_INVALID_DATA;
+
+    dwError = RegQueryInfoKeyW(hKey,
+                               NULL,
+                               NULL,
+                               NULL,
+                               &ClassCount,
+                               NULL,
+                               NULL,
+                               NULL,
+                               NULL,
+                               NULL,
+                               NULL,
+                               NULL);
+    RegCloseKey(hKey);
+    if (dwError != ERROR_SUCCESS)
+        return CR_INVALID_DATA;
+
+    return CR_SUCCESS;
+}
+#endif
+
+
+/* Function 19 */
+CONFIGRET
 PNP_GetClassName(handle_t BindingHandle,
                  wchar_t *ClassGuid,
                  wchar_t *Buffer,
@@ -729,6 +808,7 @@
 }
 
 
+/* Function 20 */
 CONFIGRET
 PNP_DeleteClassKey(handle_t BindingHandle,
                    wchar_t *ClassGuid,
@@ -755,7 +835,45 @@
 }
 
 
+/* Function 29 */
 CONFIGRET
+PNP_DeviceInstanceAction(handle_t BindingHandle,
+                         unsigned long MajorAction,
+                         unsigned long MinorAction,
+                         wchar_t *DeviceInstance1,
+                         wchar_t *DeviceInstance2)
+{
+    CONFIGRET ret = CR_SUCCESS;
+
+    DPRINT("PNP_DeviceInstanceAction() called\n");
+
+    switch (MajorAction)
+    {
+        case 4:
+            DPRINT("Enable device instance\n");
+            break;
+
+        case 5:
+            DPRINT("Disable device instance\n");
+            break;
+
+        case 7:
+            DPRINT("Reenumerate device instance\n");
+            break;
+
+        default:
+            DPRINT1("Unknown function %lu\n", MajorAction);
+            ret = CR_CALL_NOT_IMPLEMENTED;
+    }
+
+    DPRINT("PNP_DeviceInstanceAction() done (returns %lx)\n", ret);
+
+    return ret;
+}
+
+
+/* Function 30 */
+CONFIGRET
 PNP_GetDeviceStatus(handle_t BindingHandle,
[truncated at 1000 lines; 175 more skipped]