- Implement CM_Get_Global_State/CM_Get_Global_State_Ex.
- All RPC-Calls to umpnpmgr return CONFIGRET.
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/rpc.c
Added: trunk/reactos/lib/setupapi/rpc_private.h
Modified: trunk/reactos/lib/setupapi/setupapi.spec
Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c
Modified: trunk/reactos/w32api/include/ddk/cfg.h
Modified: trunk/reactos/w32api/include/ddk/cfgmgr32.h

Modified: trunk/reactos/include/idl/pnp.idl
--- trunk/reactos/include/idl/pnp.idl	2005-07-09 15:22:07 UTC (rev 16524)
+++ trunk/reactos/include/idl/pnp.idl	2005-07-10 11:49:10 UTC (rev 16525)
@@ -1,8 +1,9 @@
 /*
- * Plug and Play Manager interface definition
+ * Plug and Play Manager RPC interface definition
  */
 
 #define WORD unsigned short
+#define DWORD unsigned long
 #define CONFIGRET unsigned long
 
 [
@@ -13,9 +14,14 @@
 ]
 interface pnp
 {
-//  unsigned long PNP_GetRootDeviceInstance(handle_t BindingHandle,
-//					  [out, string, size_is(Length)] wchar_t *DeviceInstance,
-//					  [in] unsigned long Length);
   CONFIGRET PNP_GetVersion(handle_t BindingHandle,
                            [out] WORD *Version);
+
+  CONFIGRET PNP_GetGlobalState(handle_t BindingHandle,
+                               [out] unsigned long *State,
+                               [in] unsigned long Flags);
+
+//  CONFIGRET PNP_GetRootDeviceInstance(handle_t BindingHandle,
+//                                      [out, string, size_is(Length)] wchar_t *DeviceInstance,
+//                                      [in] DWORD Length);
 }

Modified: trunk/reactos/include/wine/cfgmgr32.h
--- trunk/reactos/include/wine/cfgmgr32.h	2005-07-09 15:22:07 UTC (rev 16524)
+++ trunk/reactos/include/wine/cfgmgr32.h	2005-07-10 11:49:10 UTC (rev 16525)
@@ -31,25 +31,47 @@
 typedef HMACHINE *PHMACHINE;
 typedef DWORD DEVINST;
 typedef DEVINST *PDEVINST;
+typedef ULONG REGDISPOSITION;
 
 typedef CHAR  *DEVINSTID_A;
 typedef WCHAR *DEVINSTID_W;
 DECL_WINELIB_CFGMGR32_TYPE_AW(DEVINSTID)
 
-#define CR_SUCCESS             0x00000000
-#define CR_OUT_OF_MEMORY       0x00000002
-#define CR_FAILURE             0x00000013
-#define CR_BUFFER_SMALL        0x0000001A
-#define CR_INVALID_DATA        0x0000001F
+#define CR_SUCCESS              0x00000000
+#define CR_OUT_OF_MEMORY        0x00000002
+#define CR_INVALID_POINTER      0x00000003
+#define CR_INVALID_FLAG         0x00000004
+#define CR_INVALID_DEVNODE      0x00000005
+#define CR_INVALID_DEVINST      CR_INVALID_DEVNODE
+#define CR_NO_SUCH_DEVNODE      0x0000000D
+#define CR_NO_SUCH_DEVINST      CR_NO_SUCH_DEVNODE
+#define CR_FAILURE              0x00000013
+#define CR_BUFFER_SMALL         0x0000001A
+#define CR_REGISTRY_ERROR       0x0000001D
+#define CR_INVALID_DEVICE_ID    0x0000001E
+#define CR_INVALID_DATA         0x0000001F
 #define CR_NO_SUCH_VALUE       0x00000025
-#define CR_INVALID_MACHINENAME 0x0000002F
-#define CR_ACCESS_DENIED       0x00000033
+#define CR_NO_SUCH_REGISTRY_KEY 0x0000002E
+#define CR_INVALID_MACHINENAME  0x0000002F
+#define CR_ACCESS_DENIED        0x00000033
 
 #define MAX_CLASS_NAME_LEN  32
 #define MAX_GUID_STRING_LEN 39
 #define MAX_PROFILE_LEN     80
+#define MAX_DEVICE_ID_LEN      200
+#define MAX_DEVNODE_ID_LEN     MAX_DEVICE_ID_LEN
 
+/* Disposition values for CM_Open_Class_Key[_Ex] */
+#define RegDisposition_OpenAlways   0x00000000
+#define RegDisposition_OpenExisting 0x00000001
+#define RegDisposition_Bits         0x00000001
 
+/* ulFlags for CM_Open_Class_Key[_Ex] */
+#define CM_OPEN_CLASS_KEY_INSTALLER 0x00000000
+#define CM_OPEN_CLASS_KEY_INTERFACE 0x00000001
+#define CM_OPEN_CLASS_KEY_BITS      0x00000001
+
+
 CONFIGRET WINAPI CM_Connect_MachineA( PCSTR, PHMACHINE );
 CONFIGRET WINAPI CM_Connect_MachineW( PCWSTR, PHMACHINE );
 #define     CM_Connect_Machine WINELIB_NAME_AW(CM_Connect_Machine)
@@ -71,6 +93,8 @@
 CONFIGRET WINAPI CM_Get_Device_ID_List_Size_ExA( PULONG, PCSTR, ULONG, HMACHINE );
 CONFIGRET WINAPI CM_Get_Device_ID_List_Size_ExW( PULONG, PCWSTR, ULONG, HMACHINE );
 #define     CM_Get_Device_ID_List_Size_Ex WINELIB_NAME_AW(CM_Get_Device_ID_List_Size_Ex)
+CONFIGRET WINAPI CM_Get_Global_State( PULONG, ULONG );
+CONFIGRET WINAPI CM_Get_Global_State_Ex( PULONG, ULONG, HMACHINE );
 CONFIGRET WINAPI CM_Get_Parent( PDEVINST, DEVINST, ULONG );
 CONFIGRET WINAPI CM_Get_Parent_Ex( PDEVINST, DEVINST, ULONG, HMACHINE );
 CONFIGRET WINAPI CM_Get_Sibling( PDEVINST, DEVINST, ULONG );
@@ -85,4 +109,12 @@
 CONFIGRET WINAPI CM_Locate_DevNode_ExW(PDEVINST, DEVINSTID_W, ULONG, HMACHINE);
 #define     CM_Locate_DevNode_Ex WINELIB_NAME_AW(CM_Locate_DevNode_Ex)
 
+CONFIGRET WINAPI CM_Open_Class_KeyA(LPGUID, LPCSTR, REGSAM, REGDISPOSITION, PHKEY, ULONG);
+CONFIGRET WINAPI CM_Open_Class_KeyW(LPGUID, LPCWSTR, REGSAM, REGDISPOSITION, PHKEY, ULONG);
+#define     CM_Open_Class_Key WINELIB_NAME_AW(CM_Open_Class_Key)
+CONFIGRET WINAPI CM_Open_Class_Key_ExA(LPGUID, LPCSTR, REGSAM, REGDISPOSITION, PHKEY, ULONG, HMACHINE);
+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)
+
+
 #endif /* _CFGMGR32_H_ */

Modified: trunk/reactos/lib/setupapi/cfgmgr.c
--- trunk/reactos/lib/setupapi/cfgmgr.c	2005-07-09 15:22:07 UTC (rev 16524)
+++ trunk/reactos/lib/setupapi/cfgmgr.c	2005-07-10 11:49:10 UTC (rev 16525)
@@ -32,6 +32,7 @@
 #include "setupapi_private.h"
 
 #include "rpc.h"
+#include "rpc_private.h"
 
 #include "pnp_c.h"
 
@@ -41,9 +42,9 @@
 
 /* Registry key and value names */
 static const WCHAR ControlClass[] = {'S','y','s','t','e','m','\\',
-                                  'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
-                                  'C','o','n','t','r','o','l','\\',
-                                  'C','l','a','s','s',0};
+                                     'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
+                                     'C','o','n','t','r','o','l','\\',
+                                     'C','l','a','s','s',0};
 
 
 typedef struct _MACHINE_INFO
@@ -137,17 +138,32 @@
 
 static CONFIGRET GetCmCodeFromErrorCode(DWORD ErrorCode)
 {
-	switch (ErrorCode)
-	{
-		case ERROR_SUCCESS:             return CR_SUCCESS;
-		case ERROR_ACCESS_DENIED:       return CR_ACCESS_DENIED;
-		case ERROR_INSUFFICIENT_BUFFER: return CR_BUFFER_SMALL;
-		case ERROR_INVALID_DATA:        return CR_INVALID_DATA;
-		case ERROR_INVALID_PARAMETER:   return CR_INVALID_DATA;
-		case ERROR_NO_MORE_ITEMS:       return CR_NO_SUCH_VALUE;
-		case ERROR_NO_SYSTEM_RESOURCES: return CR_OUT_OF_MEMORY;
-		default:                        return CR_FAILURE;
-	}
+    switch (ErrorCode)
+    {
+        case ERROR_SUCCESS:
+            return CR_SUCCESS;
+
+        case ERROR_ACCESS_DENIED:
+            return CR_ACCESS_DENIED;
+
+        case ERROR_INSUFFICIENT_BUFFER:
+            return CR_BUFFER_SMALL;
+
+        case ERROR_INVALID_DATA:
+            return CR_INVALID_DATA;
+
+        case ERROR_INVALID_PARAMETER:
+            return CR_INVALID_DATA;
+
+        case ERROR_NO_MORE_ITEMS:
+            return CR_NO_SUCH_VALUE;
+
+        case ERROR_NO_SYSTEM_RESOURCES:
+            return CR_OUT_OF_MEMORY;
+
+        default:
+            return CR_FAILURE;
+    }
 }
 
 
@@ -194,7 +210,7 @@
         Buffer[37] = UNICODE_NULL;
         /* Convert the buffer to a GUID */
         if (UuidFromStringW(&Buffer[1], ClassGuid) != RPC_S_OK)
-        return CR_FAILURE;
+            return CR_FAILURE;
     }
 
     return GetCmCodeFromErrorCode(rc);
@@ -218,7 +234,7 @@
 CONFIGRET WINAPI CM_Get_Child_Ex(
     PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
 {
-    TRACE("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
+    FIXME("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
     return CR_SUCCESS;
 }
 
@@ -229,9 +245,9 @@
 CONFIGRET WINAPI CM_Get_Device_ID_ListA(
     PCSTR pszFilter, PCHAR Buffer, ULONG BufferLen, ULONG ulFlags )
 {
-    FIXME("%p %p %ld %ld\n", pszFilter, Buffer, BufferLen, ulFlags);
-    memset(Buffer,0,2);
-    return CR_SUCCESS;
+    TRACE("%p %p %ld %ld\n", pszFilter, Buffer, BufferLen, ulFlags);
+    return CM_Get_Device_ID_List_ExA(pszFilter, Buffer, BufferLen,
+                                     ulFlags, NULL);
 }
 
 
@@ -281,9 +297,8 @@
 CONFIGRET WINAPI CM_Get_Device_ID_List_SizeA(
     PULONG pulLen, PCSTR pszFilter, ULONG ulFlags)
 {
-    FIXME("%p %s %ld\n", pulLen, pszFilter, ulFlags);
-    *pulLen = 2;
-    return CR_SUCCESS;
+    TRACE("%p %s %ld\n", pulLen, pszFilter, ulFlags);
+    return CM_Get_Device_ID_List_Size_ExA(pulLen, pszFilter, ulFlags, NULL);
 }
 
 
@@ -323,6 +338,51 @@
 
 
 /***********************************************************************
+ * CM_Get_Global_State [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Get_Global_State(
+    PULONG pulState, ULONG ulFlags)
+{
+    TRACE("%p %lx\n", pulState, ulFlags);
+    return CM_Get_Global_State_Ex(pulState, ulFlags, NULL);
+}
+
+
+/***********************************************************************
+ * CM_Get_Global_State_Ex [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Get_Global_State_Ex(
+    PULONG pulState, ULONG ulFlags, HMACHINE hMachine)
+{
+    RPC_BINDING_HANDLE BindingHandle = NULL;
+    RPC_STATUS Status;
+
+    TRACE("%p %lx %lx\n", pulState, ulFlags, hMachine);
+
+    if (pulState == NULL)
+        return CR_INVALID_POINTER;
+
+    if (ulFlags != 0)
+        return CR_INVALID_FLAG;
+
+    if (hMachine != NULL)
+    {
+        BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+        if (BindingHandle == NULL)
+            return CR_FAILURE;
+    }
+    else
+    {
+        Status = PnpGetLocalBindingHandle(&BindingHandle);
+        if (Status != RPC_S_OK)
+            return CR_FAILURE;
+    }
+
+    return PNP_GetGlobalState(BindingHandle, pulState, ulFlags);
+}
+
+
+/***********************************************************************
  * CM_Get_Parent [SETUPAPI.@]
  */
 CONFIGRET WINAPI CM_Get_Parent(
@@ -339,7 +399,7 @@
 CONFIGRET WINAPI CM_Get_Parent_Ex(
     PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
 {
-    TRACE("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
+    FIXME("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
     return CR_SUCCESS;
 }
 
@@ -361,7 +421,7 @@
 CONFIGRET WINAPI CM_Get_Sibling_Ex(
     PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
 {
-    TRACE("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
+    FIXME("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
     return CR_SUCCESS;
 }
 
@@ -385,7 +445,7 @@
     RPC_STATUS Status;
     WORD Version = 0;
 
-    FIXME("%lx\n", hMachine);
+    TRACE("%lx\n", hMachine);
 
     if (hMachine != NULL)
     {
@@ -413,8 +473,8 @@
 CONFIGRET WINAPI CM_Locate_DevNodeA(
     PDEVINST pdnDevInst, DEVINSTID_A pDeviceID, ULONG ulFlags)
 {
-  FIXME("%p %p %lu\n", pdnDevInst, pDeviceID, ulFlags);
-  return CR_SUCCESS;
+    TRACE("%p %s %lu\n", pdnDevInst, pDeviceID, ulFlags);
+    return CM_Locate_DevNode_ExA(pdnDevInst, pDeviceID, ulFlags, NULL);
 }
 
 
@@ -424,8 +484,8 @@
 CONFIGRET WINAPI CM_Locate_DevNodeW(
     PDEVINST pdnDevInst, DEVINSTID_W pDeviceID, ULONG ulFlags)
 {
-  TRACE("%p %p %lu\n", pdnDevInst, pDeviceID, ulFlags);
-  return CM_Locate_DevNode_ExW(pdnDevInst, pDeviceID, ulFlags, NULL);
+    TRACE("%p %s %lu\n", pdnDevInst, debugstr_w(pDeviceID), ulFlags);
+    return CM_Locate_DevNode_ExW(pdnDevInst, pDeviceID, ulFlags, NULL);
 }
 
 
@@ -435,8 +495,23 @@
 CONFIGRET WINAPI CM_Locate_DevNode_ExA(
     PDEVINST pdnDevInst, DEVINSTID_A pDeviceID, ULONG ulFlags, HMACHINE hMachine)
 {
-  FIXME("%p %p %lu %lx\n", pdnDevInst, pDeviceID, ulFlags, hMachine);
-  return CR_SUCCESS;
+    DEVINSTID_W pDevIdW = NULL;
+    CONFIGRET rc = CR_SUCCESS;
+
+    TRACE("%p %s %lu %lx\n", pdnDevInst, pDeviceID, ulFlags, hMachine);
+
+    if (pDeviceID != NULL)
+    {
+       if (CaptureAndConvertAnsiArg(pDeviceID, &pDevIdW))
+         return CR_INVALID_DEVICE_ID;
+    }
+
+    rc = CM_Locate_DevNode_ExW(pdnDevInst, pDevIdW, ulFlags, hMachine);
+
+    if (pDevIdW != NULL)
+        MyFree(pDevIdW);
+
+    return rc;
 }
 
 
@@ -446,6 +521,6 @@
 CONFIGRET WINAPI CM_Locate_DevNode_ExW(
     PDEVINST pdnDevInst, DEVINSTID_W pDeviceID, ULONG ulFlags, HMACHINE hMachine)
 {
-  FIXME("%p %p %lu %lx\n", pdnDevInst, pDeviceID, ulFlags, hMachine);
-  return CR_SUCCESS;
+    FIXME("%p %s %lu %lx\n", pdnDevInst, debugstr_w(pDeviceID), ulFlags, hMachine);
+    return CR_SUCCESS;
 }

Modified: trunk/reactos/lib/setupapi/rpc.c
--- trunk/reactos/lib/setupapi/rpc.c	2005-07-09 15:22:07 UTC (rev 16524)
+++ trunk/reactos/lib/setupapi/rpc.c	2005-07-10 11:49:10 UTC (rev 16525)
@@ -1,82 +1,101 @@
-/* rpc.c */
+/*
+ * RPC support routines
+ *
+ * Copyright 2005 Eric Kohl
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
 #include <windows.h>
 #include <rpc.h>
 #include <rpcdce.h>
+#include "rpc_private.h"
 
 
 static RPC_BINDING_HANDLE LocalBindingHandle = NULL;
 
 
 RPC_STATUS
-PnpBindRpc(LPWSTR pszMachine,
+PnpBindRpc(LPCWSTR pszMachine,
            RPC_BINDING_HANDLE* BindingHandle)
 {
-  PWSTR pszStringBinding = NULL;
-  RPC_STATUS Status;
+    PWSTR pszStringBinding = NULL;
+    RPC_STATUS Status;
 
-  Status = RpcStringBindingComposeW(NULL,
-				    L"ncacn_np",
-				    pszMachine,
-				    L"\\pipe\\umpnpmgr",
-				    NULL,
-				    &pszStringBinding);
-  if (Status != RPC_S_OK)
-    return Status;
+    Status = RpcStringBindingComposeW(NULL,
+                                      L"ncacn_np",
+                                      (LPWSTR)pszMachine,
+                                      L"\\pipe\\umpnpmgr",
+                                      NULL,
+                                      &pszStringBinding);
+    if (Status != RPC_S_OK)
+        return Status;
 
-  Status = RpcBindingFromStringBindingW(pszStringBinding,
-					BindingHandle);
+    Status = RpcBindingFromStringBindingW(pszStringBinding,
+                                          BindingHandle);
 
-  RpcStringFreeW(&pszStringBinding);
+    RpcStringFreeW(&pszStringBinding);
 
-  return Status;
+    return Status;
 }
 
 
 RPC_STATUS
 PnpUnbindRpc(RPC_BINDING_HANDLE *BindingHandle)
 {
-  if (BindingHandle != NULL)
-  {
-    RpcBindingFree(*BindingHandle);
-    *BindingHandle = NULL;
-  }
+    if (BindingHandle != NULL)
+    {
+        RpcBindingFree(*BindingHandle);
+        *BindingHandle = NULL;
+    }
 
-  return RPC_S_OK;
+    return RPC_S_OK;
 }
 
 
 RPC_STATUS
 PnpGetLocalBindingHandle(RPC_BINDING_HANDLE *BindingHandle)
 {
-  if (LocalBindingHandle != NULL)
-  {
-    BindingHandle = LocalBindingHandle;
-    return RPC_S_OK;
-  }
+    if (LocalBindingHandle != NULL)
+    {
+        BindingHandle = LocalBindingHandle;
+        return RPC_S_OK;
+    }
 
-  return PnpBindRpc(NULL, BindingHandle);
+    return PnpBindRpc(NULL, BindingHandle);
 }
 
 
 RPC_STATUS
 PnpUnbindLocalBindingHandle(VOID)
 {
-  return PnpUnbindRpc(&LocalBindingHandle);
+    return PnpUnbindRpc(&LocalBindingHandle);
 }
 
 
 void __RPC_FAR * __RPC_USER
 midl_user_allocate(size_t len)
 {
-  return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
+    return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
 }
 
 
 void __RPC_USER
 midl_user_free(void __RPC_FAR * ptr)
 {
-  HeapFree(GetProcessHeap(), 0, ptr);
+    HeapFree(GetProcessHeap(), 0, ptr);
 }
 
 /* EOF */

Added: trunk/reactos/lib/setupapi/rpc_private.h
--- trunk/reactos/lib/setupapi/rpc_private.h	2005-07-09 15:22:07 UTC (rev 16524)
+++ trunk/reactos/lib/setupapi/rpc_private.h	2005-07-10 11:49:10 UTC (rev 16525)
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005 Eric Kohl
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __RPC_PRIVATE_H
+#define __RPC_PRIVATE_H
+
+RPC_STATUS PnpBindRpc(LPCWSTR pszMachine,
+                      RPC_BINDING_HANDLE* BindingHandle);
+RPC_STATUS PnpUnbindRpc(RPC_BINDING_HANDLE *BindingHandle);
+
+RPC_STATUS PnpGetLocalBindingHandle(RPC_BINDING_HANDLE *BindingHandle);
+RPC_STATUS PnpUnbindLocalHandles(VOID);
+
+#endif /* __RPC_PRIVATE_H */

Modified: trunk/reactos/lib/setupapi/setupapi.spec
--- trunk/reactos/lib/setupapi/setupapi.spec	2005-07-09 15:22:07 UTC (rev 16524)
+++ trunk/reactos/lib/setupapi/setupapi.spec	2005-07-10 11:49:10 UTC (rev 16525)
@@ -99,8 +99,8 @@
 @ stub CM_Get_Device_Interface_List_Size_ExW
 @ stub CM_Get_First_Log_Conf
 @ stub CM_Get_First_Log_Conf_Ex
-@ stub CM_Get_Global_State
-@ stub CM_Get_Global_State_Ex
+@ stdcall CM_Get_Global_State(ptr long)
+@ stdcall CM_Get_Global_State_Ex(ptr long long)
 @ stub CM_Get_HW_Prof_FlagsA
 @ stub CM_Get_HW_Prof_FlagsW
 @ stub CM_Get_HW_Prof_Flags_ExA

Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c
--- trunk/reactos/services/umpnpmgr/umpnpmgr.c	2005-07-09 15:22:07 UTC (rev 16524)
+++ trunk/reactos/services/umpnpmgr/umpnpmgr.c	2005-07-10 11:49:10 UTC (rev 16525)
@@ -107,15 +107,25 @@
 }
 
 
-//WORD PNP_GetVersion(RPC_BINDING_HANDLE BindingHandle)
+//CONFIRET PNP_GetVersion(RPC_BINDING_HANDLE BindingHandle,
+//                        WORD *Version)
 unsigned long PNP_GetVersion(handle_t BindingHandle,
                              unsigned short *Version)
 {
   *Version = 0x0400;
-  return 0;
+  return 0; /* CR_SUCCESS */
 }
 
 
+unsigned long PNP_GetGlobalState(handle_t BindingHandle,
+                                 unsigned long *State,
+                                 unsigned long Flags)
+{
+    *State = 5;
+    return 0; /* CR_SUCCESS */
+}
+
+
 static DWORD WINAPI
 PnpEventThread(LPVOID lpParameter)
 {

Modified: trunk/reactos/w32api/include/ddk/cfg.h
--- trunk/reactos/w32api/include/ddk/cfg.h	2005-07-09 15:22:07 UTC (rev 16524)
+++ trunk/reactos/w32api/include/ddk/cfg.h	2005-07-10 11:49:10 UTC (rev 16525)
@@ -31,7 +31,7 @@
 extern "C" {
 #endif
 
-#define CM_PROB_NOT_CONFIGURED		  				0x00000001
+#define CM_PROB_NOT_CONFIGURED              0x00000001
 #define CM_PROB_DEVLOADER_FAILED            0x00000002
 #define CM_PROB_OUT_OF_MEMORY               0x00000003
 #define CM_PROB_ENTRY_IS_WRONG_TYPE         0x00000004
@@ -62,13 +62,13 @@
 #define CM_PROB_HARDWARE_DISABLED           0x0000001D
 #define CM_PROB_CANT_SHARE_IRQ              0x0000001E
 #define CM_PROB_FAILED_ADD                  0x0000001F
-#define CM_PROB_DISABLED_SERVICE          	0x00000020
-#define CM_PROB_TRANSLATION_FAILED        	0x00000021
-#define CM_PROB_NO_SOFTCONFIG             	0x00000022
-#define CM_PROB_BIOS_TABLE                	0x00000023
-#define CM_PROB_IRQ_TRANSLATION_FAILED    	0x00000024
-#define CM_PROB_FAILED_DRIVER_ENTRY       	0x00000025
-#define CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD	0x00000026
+#define CM_PROB_DISABLED_SERVICE            0x00000020
+#define CM_PROB_TRANSLATION_FAILED          0x00000021
+#define CM_PROB_NO_SOFTCONFIG               0x00000022
+#define CM_PROB_BIOS_TABLE                  0x00000023
+#define CM_PROB_IRQ_TRANSLATION_FAILED      0x00000024
+#define CM_PROB_FAILED_DRIVER_ENTRY         0x00000025
+#define CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD  0x00000026
 #define CM_PROB_DRIVER_FAILED_LOAD          0x00000027
 #define CM_PROB_DRIVER_SERVICE_KEY_INVALID  0x00000028
 #define CM_PROB_LEGACY_SERVICE_NO_DEVICES   0x00000029
@@ -79,7 +79,7 @@
 #define CM_PROB_SYSTEM_SHUTDOWN             0x0000002E
 #define CM_PROB_HELD_FOR_EJECT              0x0000002F
 #define CM_PROB_DRIVER_BLOCKED              0x00000030
-#define CM_PROB_REGISTRY_TOO_LARGE        	0x00000031
+#define CM_PROB_REGISTRY_TOO_LARGE          0x00000031
 
 #define LCPRI_FORCECONFIG                 0x00000000
 #define LCPRI_BOOTCONFIG                  0x00000001
@@ -97,25 +97,25 @@
 #define LCPRI_DISABLED                    0x0000FFFF
 #define MAX_LCPRI                         0x0000FFFF
 
-#define DN_ROOT_ENUMERATED	0x00000001	/* Was enumerated by ROOT */
-#define DN_DRIVER_LOADED	0x00000002	/* Has Register_Device_Driver */
-#define DN_ENUM_LOADED		0x00000004	/* Has Register_Enumerator */
-#define DN_STARTED		0x00000008	/* Is currently configured */
-#define DN_MANUAL		0x00000010	/* Manually installed */
-#define DN_NEED_TO_ENUM		0x00000020	/* May need reenumeration */
-#define DN_NOT_FIRST_TIME	0x00000040	/* Has received a config */
-#define DN_HARDWARE_ENUM	0x00000080	/* Enum generates hardware ID */
-#define DN_LIAR			0x00000100	/* Lied about can reconfig once */
-#define DN_HAS_MARK		0x00000200	/* Not CM_Create_DevNode lately */
-#define DN_HAS_PROBLEM		0x00000400	/* Need device installer */
-#define DN_FILTERED		0x00000800	/* Is filtered */
-#define DN_MOVED		0x00001000	/* Has been moved */
-#define DN_DISABLEABLE		0x00002000	/* Can be rebalanced */
-#define DN_REMOVABLE		0x00004000	/* Can be removed */
-#define DN_PRIVATE_PROBLEM	0x00008000	/* Has a private problem */
-#define DN_MF_PARENT		0x00010000	/* Multi function parent */
-#define DN_MF_CHILD		0x00020000	/* Multi function child */
-#define DN_WILL_BE_REMOVED	0x00040000	/* Devnode is being removed */
+#define DN_ROOT_ENUMERATED  0x00000001	/* Was enumerated by ROOT */
+#define DN_DRIVER_LOADED    0x00000002	/* Has Register_Device_Driver */
+#define DN_ENUM_LOADED      0x00000004	/* Has Register_Enumerator */
+#define DN_STARTED          0x00000008	/* Is currently configured */
+#define DN_MANUAL           0x00000010	/* Manually installed */
+#define DN_NEED_TO_ENUM     0x00000020	/* May need reenumeration */
+#define DN_NOT_FIRST_TIME   0x00000040	/* Has received a config */
+#define DN_HARDWARE_ENUM    0x00000080	/* Enum generates hardware ID */
+#define DN_LIAR             0x00000100	/* Lied about can reconfig once */
+#define DN_HAS_MARK         0x00000200	/* Not CM_Create_DevNode lately */
+#define DN_HAS_PROBLEM      0x00000400	/* Need device installer */
+#define DN_FILTERED         0x00000800	/* Is filtered */
+#define DN_MOVED            0x00001000	/* Has been moved */
+#define DN_DISABLEABLE      0x00002000	/* Can be rebalanced */
+#define DN_REMOVABLE        0x00004000	/* Can be removed */
+#define DN_PRIVATE_PROBLEM  0x00008000	/* Has a private problem */
+#define DN_MF_PARENT        0x00010000	/* Multi function parent */
+#define DN_MF_CHILD         0x00020000	/* Multi function child */
+#define DN_WILL_BE_REMOVED  0x00040000	/* Devnode is being removed */
 
 typedef enum _PNP_VETO_TYPE {
   PNP_VetoTypeUnknown,

Modified: trunk/reactos/w32api/include/ddk/cfgmgr32.h
--- trunk/reactos/w32api/include/ddk/cfgmgr32.h	2005-07-09 15:22:07 UTC (rev 16524)
+++ trunk/reactos/w32api/include/ddk/cfgmgr32.h	2005-07-10 11:49:10 UTC (rev 16525)
@@ -41,27 +41,27 @@
 
 #include <pshpack1.h>
 
-#define CR_SUCCESS                  			0x00000000
+#define CR_SUCCESS                        0x00000000
 #define CR_DEFAULT                        0x00000001
 #define CR_OUT_OF_MEMORY                  0x00000002
 #define CR_INVALID_POINTER                0x00000003
 #define CR_INVALID_FLAG                   0x00000004
 #define CR_INVALID_DEVNODE                0x00000005
-#define CR_INVALID_DEVINST          			CR_INVALID_DEVNODE
+#define CR_INVALID_DEVINST                CR_INVALID_DEVNODE
 #define CR_INVALID_RES_DES                0x00000006
 #define CR_INVALID_LOG_CONF               0x00000007
 #define CR_INVALID_ARBITRATOR             0x00000008
 #define CR_INVALID_NODELIST               0x00000009
 #define CR_DEVNODE_HAS_REQS               0x0000000A
-#define CR_DEVINST_HAS_REQS         			CR_DEVNODE_HAS_REQS
+#define CR_DEVINST_HAS_REQS               CR_DEVNODE_HAS_REQS
 #define CR_INVALID_RESOURCEID             0x0000000B
 #define CR_DLVXD_NOT_FOUND                0x0000000C
 #define CR_NO_SUCH_DEVNODE                0x0000000D
-#define CR_NO_SUCH_DEVINST          			CR_NO_SUCH_DEVNODE
+#define CR_NO_SUCH_DEVINST                CR_NO_SUCH_DEVNODE
 #define CR_NO_MORE_LOG_CONF               0x0000000E
 #define CR_NO_MORE_RES_DES                0x0000000F
 #define CR_ALREADY_SUCH_DEVNODE           0x00000010
-#define CR_ALREADY_SUCH_DEVINST     			CR_ALREADY_SUCH_DEVNODE
+#define CR_ALREADY_SUCH_DEVINST           CR_ALREADY_SUCH_DEVNODE
 #define CR_INVALID_RANGE_LIST             0x00000011
 #define CR_INVALID_RANGE                  0x00000012
 #define CR_FAILURE                        0x00000013
@@ -150,21 +150,21 @@
 typedef ULONG RESOURCEID;
 typedef RESOURCEID *PRESOURCEID;
 
-#define CM_RESDES_WIDTH_DEFAULT 					0x00000000
-#define CM_RESDES_WIDTH_32      					0x00000001
-#define CM_RESDES_WIDTH_64      					0x00000002
-#define CM_RESDES_WIDTH_BITS    					0x00000003
+#define CM_RESDES_WIDTH_DEFAULT  0x00000000
+#define CM_RESDES_WIDTH_32       0x00000001
+#define CM_RESDES_WIDTH_64       0x00000002
+#define CM_RESDES_WIDTH_BITS     0x00000003
 
 
-#define MAX_CONFIG_VALUE      						9999
-#define MAX_INSTANCE_VALUE    						9999
+#define MAX_CONFIG_VALUE         9999
+#define MAX_INSTANCE_VALUE       9999
 
-#define MAX_DEVICE_ID_LEN     						200
-#define MAX_DEVNODE_ID_LEN    						MAX_DEVICE_ID_LEN
+#define MAX_DEVICE_ID_LEN        200
+#define MAX_DEVNODE_ID_LEN       MAX_DEVICE_ID_LEN
 
-#define MAX_CLASS_NAME_LEN    						32
-#define MAX_GUID_STRING_LEN   						39
-#define MAX_PROFILE_LEN       						80
+#define MAX_CLASS_NAME_LEN       32
+#define MAX_GUID_STRING_LEN      39
+#define MAX_PROFILE_LEN          80
 
 
 #define ResType_All                       0x00000000
@@ -183,7 +183,7 @@
 #define ResType_PcCardConfig              0x00008002
 #define ResType_MfCardConfig              0x00008003
 
-#define CM_GETIDLIST_FILTER_NONE          		0x00000000
+#define CM_GETIDLIST_FILTER_NONE              0x00000000
 #define CM_GETIDLIST_FILTER_ENUMERATOR        0x00000001
 #define CM_GETIDLIST_FILTER_SERVICE           0x00000002
 #define CM_GETIDLIST_FILTER_EJECTRELATIONS    0x00000004
@@ -193,9 +193,9 @@
 #define CM_GETIDLIST_DONOTGENERATE            0x10000040
 #define CM_GETIDLIST_FILTER_BITS              0x1000007F
 
-#define CM_GET_DEVICE_INTERFACE_LIST_PRESENT     	0x00000000
-#define CM_GET_DEVICE_INTERFACE_LIST_ALL_DEVICES 	0x00000001
-#define CM_GET_DEVICE_INTERFACE_LIST_BITS        	0x00000001
+#define CM_GET_DEVICE_INTERFACE_LIST_PRESENT      0x00000000
+#define CM_GET_DEVICE_INTERFACE_LIST_ALL_DEVICES  0x00000001
+#define CM_GET_DEVICE_INTERFACE_LIST_BITS         0x00000001
 
 
 typedef struct BusNumber_Des_s {