- Add stubs: CM_GetChild, CM_GetChild_Ex, CM_GetParent, CM_GetPaarent_Ex, CM_GetSibling, CM_GetSibling_Ex, CM_Locate_DevNodeA, CM_Locate_DevNodeW, CM_Locate_DevNode_ExA, CM_Locate_DevNode_ExW
- Implement:  CM_GetVersion, CM_GetVersion_Ex, CM_Connect_MachineA, CM_Connect_MachineW, CM_Disconnect_Machine.
- Implement RPC server in umpnpmgr.dll to reply to calls to CM_GetVersion/CM_GetVersion_Ex.
Added: trunk/reactos/include/idl/
Added: trunk/reactos/include/idl/pnp.idl
Modified: trunk/reactos/include/wine/cfgmgr32.h
Modified: trunk/reactos/include/wine/setupapi.h
Modified: trunk/reactos/lib/setupapi/Makefile.in
Modified: trunk/reactos/lib/setupapi/cfgmgr.c
Modified: trunk/reactos/lib/setupapi/makefile
Added: trunk/reactos/lib/setupapi/rpc.c
Modified: trunk/reactos/lib/setupapi/setupapi.spec
Modified: trunk/reactos/services/umpnpmgr/makefile
Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c
Modified: trunk/reactos/w32api/include/setupapi.h

Added: trunk/reactos/include/idl/pnp.idl
--- trunk/reactos/include/idl/pnp.idl	2005-03-20 20:28:19 UTC (rev 14234)
+++ trunk/reactos/include/idl/pnp.idl	2005-03-20 20:43:46 UTC (rev 14235)
@@ -0,0 +1,19 @@
+/*
+ * Plug and Play Manager interface definition
+ */
+
+#define WORD unsigned short
+
+[
+  uuid (809F4e40-A03D-11CE-8F69-08003E30051B),
+  version(1.0),
+  pointer_default(unique),
+  explicit_handle
+]
+interface pnp
+{
+//  unsigned long PNP_GetRootDeviceInstance(handle_t BindingHandle,
+//					  [out, string, size_is(Length)] wchar_t *DeviceInstance,
+//					  [in] unsigned long Length);
+  WORD PNP_GetVersion(handle_t BindingHandle);
+}

Modified: trunk/reactos/include/wine/cfgmgr32.h
--- trunk/reactos/include/wine/cfgmgr32.h	2005-03-20 20:28:19 UTC (rev 14234)
+++ trunk/reactos/include/wine/cfgmgr32.h	2005-03-20 20:43:46 UTC (rev 14235)
@@ -19,21 +19,39 @@
 #ifndef _CFGMGR32_H_
 #define _CFGMGR32_H_
 
+/* cfgmgr32 doesn't use the normal convention, it adds an underscore before A/W */
+#ifdef __WINESRC__
+# define DECL_WINELIB_CFGMGR32_TYPE_AW(type)  /* nothing */
+#else   /* __WINESRC__ */
+# define DECL_WINELIB_CFGMGR32_TYPE_AW(type)  typedef WINELIB_NAME_AW(type##_) type;
+#endif  /* __WINESRC__ */
+
 typedef DWORD CONFIGRET;
 typedef HANDLE HMACHINE;
 typedef HMACHINE *PHMACHINE;
+typedef DWORD DEVINST;
+typedef DEVINST *PDEVINST;
 
-#define CR_SUCCESS       0x00000000
-#define CR_INVALID_DATA  0x0000001F
-#define CR_ACCESS_DENIED 0x00000033
+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_INVALID_DATA        0x0000001F
+#define CR_INVALID_MACHINENAME 0x0000002F
+#define CR_ACCESS_DENIED       0x00000033
+
+
 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_Disconnect_Machine( HMACHINE );
 
+CONFIGRET WINAPI CM_Get_Child( PDEVINST, DEVINST, ULONG );
+CONFIGRET WINAPI CM_Get_Child_Ex( PDEVINST, DEVINST, ULONG, HMACHINE );
 CONFIGRET WINAPI CM_Get_Device_ID_ListA( PCSTR, PCHAR, ULONG, ULONG );
 CONFIGRET WINAPI CM_Get_Device_ID_ListW( PCWSTR, PWCHAR, ULONG, ULONG );
 #define     CM_Get_Device_ID_List WINELIB_NAME_AW(CM_Get_Device_ID_List)
@@ -46,5 +64,18 @@
 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_Parent( PDEVINST, DEVINST, ULONG );
+CONFIGRET WINAPI CM_Get_Parent_Ex( PDEVINST, DEVINST, ULONG, HMACHINE );
+CONFIGRET WINAPI CM_Get_Sibling( PDEVINST, DEVINST, ULONG );
+CONFIGRET WINAPI CM_Get_Sibling_Ex( PDEVINST, DEVINST, ULONG, HMACHINE );
+WORD WINAPI CM_Get_Version( VOID );
+WORD WINAPI CM_Get_Version_Ex( HMACHINE );
 
+CONFIGRET WINAPI CM_Locate_DevNodeA(PDEVINST, DEVINSTID_A, ULONG);
+CONFIGRET WINAPI CM_Locate_DevNodeW(PDEVINST, DEVINSTID_W, ULONG);
+#define     CM_Locate_DevNode WINELIB_NAME_AW(CM_Locate_DevNode)
+CONFIGRET WINAPI CM_Locate_DevNode_ExA(PDEVINST, DEVINSTID_A, ULONG, HMACHINE);
+CONFIGRET WINAPI CM_Locate_DevNode_ExW(PDEVINST, DEVINSTID_W, ULONG, HMACHINE);
+#define     CM_Locate_DevNode_Ex WINELIB_NAME_AW(CM_Locate_DevNode_Ex)
+
 #endif /* _CFGMGR32_H_ */

Modified: trunk/reactos/include/wine/setupapi.h
--- trunk/reactos/include/wine/setupapi.h	2005-03-20 20:28:19 UTC (rev 14234)
+++ trunk/reactos/include/wine/setupapi.h	2005-03-20 20:43:46 UTC (rev 14235)
@@ -666,6 +666,8 @@
 
 
 LONG     WINAPI AddTagToGroupOrderList(PCWSTR lpGroupName, DWORD dwUnknown2, DWORD dwUnknown3);
+DWORD    WINAPI CaptureAndConvertAnsiArg(PCSTR lpSrc, PWSTR *lpDst);
+DWORD    WINAPI CaptureStringArg(PCWSTR lpSrc, PWSTR *lpDst);
 BOOL     WINAPI DelayedMove(PCWSTR lpExistingFileName, PCWSTR lpNewFileName);
 BOOL     WINAPI DoesUserHavePrivilege(PCWSTR lpPrivilegeName);
 PWSTR    WINAPI DuplicateString(PCWSTR lpSrc);

Modified: trunk/reactos/lib/setupapi/Makefile.in
--- trunk/reactos/lib/setupapi/Makefile.in	2005-03-20 20:28:19 UTC (rev 14234)
+++ trunk/reactos/lib/setupapi/Makefile.in	2005-03-20 20:43:46 UTC (rev 14235)
@@ -18,7 +18,9 @@
 	parser.c \
 	queue.c \
 	setupcab.c \
-	stubs.c
+	stubs.c \
+	rpc.c \
+	pnp_c.c
 
 C_SRCS16 = \
 	devinst16.c \

Modified: trunk/reactos/lib/setupapi/cfgmgr.c
--- trunk/reactos/lib/setupapi/cfgmgr.c	2005-03-20 20:28:19 UTC (rev 14234)
+++ trunk/reactos/lib/setupapi/cfgmgr.c	2005-03-20 20:43:46 UTC (rev 14235)
@@ -31,11 +31,20 @@
 #include "cfgmgr32.h"
 #include "setupapi_private.h"
 
+#include "rpc.h"
+
+#include "pnp.h"
+
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
 
+typedef struct _MACHINE_INFO
+{
+  RPC_BINDING_HANDLE BindingHandle;
+} MACHINE_INFO, *PMACHINE_INFO;
 
+
 /***********************************************************************
  * CM_Connect_MachineA [SETUPAPI.@]
  */
@@ -47,14 +56,10 @@
     TRACE("%s %p\n", UNCServerName, phMachine);
 
     if (UNCServerName == NULL || *UNCServerName == 0)
-    {
         return CM_Connect_MachineW(NULL, phMachine);
-    }
 
     if (CaptureAndConvertAnsiArg(UNCServerName, &pServerNameW))
-    {
         return CR_INVALID_DATA;
-    }
 
     ret = CM_Connect_MachineW(pServerNameW, phMachine);
 
@@ -69,8 +74,23 @@
  */
 CONFIGRET WINAPI CM_Connect_MachineW(PCWSTR UNCServerName, PHMACHINE phMachine)
 {
-    FIXME("%s %p\n", debugstr_w(UNCServerName), phMachine);
-    return CR_ACCESS_DENIED;
+    PMACHINE_INFO pMachine;
+
+    TRACE("%s %p\n", debugstr_w(UNCServerName), phMachine);
+
+    pMachine = (PMACHINE_INFO)GlobalAlloc(GPTR, sizeof(MACHINE_INFO));
+    if (pMachine == NULL)
+        return CR_OUT_OF_MEMORY;
+
+    if (!PnpBindRpc(UNCServerName, &pMachine->BindingHandle))
+    {
+        GlobalFree(pMachine);
+        return CR_INVALID_MACHINENAME;
+    }
+
+    phMachine = (PHMACHINE)pMachine;
+
+    return CR_SUCCESS;
 }
 
 
@@ -79,12 +99,46 @@
  */
 CONFIGRET WINAPI CM_Disconnect_Machine(HMACHINE hMachine)
 {
-    FIXME("%lx\n", hMachine);
+    PMACHINE_INFO pMachine;
+
+    TRACE("%lx\n", hMachine);
+
+    if (hMachine == NULL)
+        return CR_SUCCESS;
+
+    pMachine = (PMACHINE_INFO)hMachine;
+    if (!PnpUnbindRpc(pMachine->BindingHandle))
+        return CR_ACCESS_DENIED;
+
+    GlobalFree(pMachine);
+
     return CR_SUCCESS;
 }
 
 
 /***********************************************************************
+ * CM_Get_Child [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Get_Child(
+    PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags)
+{
+    TRACE("%p %p %lx\n", pdnDevInst, dnDevInst, ulFlags);
+    return CM_Get_Sibling_Ex(pdnDevInst, dnDevInst, ulFlags, NULL);
+}
+
+
+/***********************************************************************
+ * CM_Get_Child_Ex [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Get_Child_Ex(
+    PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
+{
+    TRACE("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
+    return CR_SUCCESS;
+}
+
+
+/***********************************************************************
  * CM_Get_Device_ID_ListA [SETUPAPI.@]
  */
 CONFIGRET WINAPI CM_Get_Device_ID_ListA(
@@ -154,9 +208,8 @@
 CONFIGRET WINAPI CM_Get_Device_ID_List_SizeW(
     PULONG pulLen, PCWSTR pszFilter, ULONG ulFlags)
 {
-    FIXME("%p %s %ld\n", pulLen, debugstr_w(pszFilter), ulFlags);
-    *pulLen = 2;
-    return CR_SUCCESS;
+    TRACE("%p %s %ld\n", pulLen, debugstr_w(pszFilter), ulFlags);
+    return CM_Get_Device_ID_List_Size_ExW(pulLen, pszFilter, ulFlags, NULL);
 }
 
 
@@ -182,3 +235,128 @@
     *pulLen = 2;
     return CR_SUCCESS;
 }
+
+
+/***********************************************************************
+ * CM_Get_Parent [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Get_Parent(
+    PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags)
+{
+    TRACE("%p %p %lx\n", pdnDevInst, dnDevInst, ulFlags);
+    return CM_Get_Sibling_Ex(pdnDevInst, dnDevInst, ulFlags, NULL);
+}
+
+
+/***********************************************************************
+ * CM_Get_Parent_Ex [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Get_Parent_Ex(
+    PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
+{
+    TRACE("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
+    return CR_SUCCESS;
+}
+
+
+/***********************************************************************
+ * CM_Get_Sibling [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Get_Sibling(
+    PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags)
+{
+    TRACE("%p %p %lx\n", pdnDevInst, dnDevInst, ulFlags);
+    return CM_Get_Sibling_Ex(pdnDevInst, dnDevInst, ulFlags, NULL);
+}
+
+
+/***********************************************************************
+ * CM_Get_Sibling_Ex [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Get_Sibling_Ex(
+    PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
+{
+    TRACE("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
+    return CR_SUCCESS;
+}
+
+
+/***********************************************************************
+ * CM_Get_Version [SETUPAPI.@]
+ */
+WORD WINAPI CM_Get_Version(VOID)
+{
+    TRACE("\n");
+    return CM_Get_Version_Ex(NULL);
+}
+
+
+/***********************************************************************
+ * CM_Get_Version_Ex [SETUPAPI.@]
+ */
+WORD WINAPI CM_Get_Version_Ex(HMACHINE hMachine)
+{
+    RPC_BINDING_HANDLE BindingHandle = NULL;
+    RPC_STATUS Status;
+
+    FIXME("%lx\n", hMachine);
+
+    if (hMachine != NULL)
+    {
+        BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+        if (BindingHandle == NULL)
+            return 0;
+    }
+    else
+    {
+        Status = PnpGetLocalBindingHandle(&BindingHandle);
+        if (Status != RPC_S_OK)
+            return 0;
+    }
+
+    return PNP_GetVersion(BindingHandle);
+}
+
+
+/***********************************************************************
+ * CM_Locate_DevNodeA [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Locate_DevNodeA(
+    PDEVINST pdnDevInst, DEVINSTID_A pDeviceID, ULONG ulFlags)
+{
+  FIXME("%p %p %lu\n", pdnDevInst, pDeviceID, ulFlags);
+  return CR_SUCCESS;
+}
+
+
+/***********************************************************************
+ * CM_Locate_DevNodeW [SETUPAPI.@]
+ */
+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);
+}
+
+
+/***********************************************************************
+ * CM_Locate_DevNode_ExA [SETUPAPI.@]
+ */
+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;
+}
+
+
+/***********************************************************************
+ * CM_Locate_DevNode_ExW [SETUPAPI.@]
+ */
+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;
+}

Modified: trunk/reactos/lib/setupapi/makefile
--- trunk/reactos/lib/setupapi/makefile	2005-03-20 20:28:19 UTC (rev 14234)
+++ trunk/reactos/lib/setupapi/makefile	2005-03-20 20:43:46 UTC (rev 14235)
@@ -4,6 +4,15 @@
 
 TARGET_TYPE = winedll
 
+TARGET_CLEAN = pnp_c.c pnp.h
+
 include $(PATH_TO_TOP)/rules.mak
 
 include $(TOOLS_PATH)/helper.mk
+
+WIDL_FLAGS = -o \
+             -D _X86_ -D MIDL_PASS \
+             -I $(PATH_TO_TOP)/w32api/include
+
+pnp_c.c pnp.h: $(PATH_TO_TOP)/include/idl/pnp.idl
+	$(WIDL) $(WIDL_FLAGS) -h -H pnp.h -c -C pnp_c.c $(PATH_TO_TOP)/include/idl/pnp.idl

Added: trunk/reactos/lib/setupapi/rpc.c
--- trunk/reactos/lib/setupapi/rpc.c	2005-03-20 20:28:19 UTC (rev 14234)
+++ trunk/reactos/lib/setupapi/rpc.c	2005-03-20 20:43:46 UTC (rev 14235)
@@ -0,0 +1,82 @@
+/* rpc.c */
+
+#include <windows.h>
+#include <rpc.h>
+#include <rpcdce.h>
+
+
+static RPC_BINDING_HANDLE LocalBindingHandle = NULL;
+
+
+RPC_STATUS
+PnpBindRpc(LPWSTR pszMachine,
+           RPC_BINDING_HANDLE* BindingHandle)
+{
+  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 = RpcBindingFromStringBindingW(pszStringBinding,
+					BindingHandle);
+
+  RpcStringFreeW(&pszStringBinding);
+
+  return Status;
+}
+
+
+RPC_STATUS
+PnpUnbindRpc(RPC_BINDING_HANDLE *BindingHandle)
+{
+  if (BindingHandle != NULL)
+  {
+    RpcBindingFree(*BindingHandle);
+    *BindingHandle = NULL;
+  }
+
+  return RPC_S_OK;
+}
+
+
+RPC_STATUS
+PnpGetLocalBindingHandle(RPC_BINDING_HANDLE *BindingHandle)
+{
+  if (LocalBindingHandle != NULL)
+  {
+    BindingHandle = LocalBindingHandle;
+    return RPC_S_OK;
+  }
+
+  return PnpBindRpc(NULL, BindingHandle);
+}
+
+
+RPC_STATUS
+PnpUnbindLocalBindingHandle(VOID)
+{
+  return PnpUnbindRpc(&LocalBindingHandle);
+}
+
+
+void __RPC_FAR * __RPC_USER
+midl_user_allocate(size_t len)
+{
+  return GlobalAlloc(GPTR, len);
+}
+
+
+void __RPC_USER
+midl_user_free(void __RPC_FAR * ptr)
+{
+  GlobalFree(ptr);
+}
+
+/* EOF */

Modified: trunk/reactos/lib/setupapi/setupapi.spec
--- trunk/reactos/lib/setupapi/setupapi.spec	2005-03-20 20:28:19 UTC (rev 14234)
+++ trunk/reactos/lib/setupapi/setupapi.spec	2005-03-20 20:43:46 UTC (rev 14235)
@@ -53,8 +53,8 @@
 @ stub CM_Free_Res_Des
 @ stub CM_Free_Res_Des_Ex
 @ stub CM_Free_Res_Des_Handle
-@ stub CM_Get_Child
-@ stub CM_Get_Child_Ex
+@ stdcall CM_Get_Child(ptr long long)
+@ stdcall CM_Get_Child_Ex(ptr long long long)
 @ stub CM_Get_Class_Key_NameA
 @ stub CM_Get_Class_Key_NameW
 @ stub CM_Get_Class_Key_Name_ExA
@@ -115,23 +115,23 @@
 @ stub CM_Get_Next_Log_Conf_Ex
 @ stub CM_Get_Next_Res_Des
 @ stub CM_Get_Next_Res_Des_Ex
-@ stub CM_Get_Parent
-@ stub CM_Get_Parent_Ex
+@ stdcall CM_Get_Parent(ptr long long)
+@ stdcall CM_Get_Parent_Ex(ptr long long long)
 @ stub CM_Get_Res_Des_Data
 @ stub CM_Get_Res_Des_Data_Ex
 @ stub CM_Get_Res_Des_Data_Size
 @ stub CM_Get_Res_Des_Data_Size_Ex
-@ stub CM_Get_Sibling
-@ stub CM_Get_Sibling_Ex
-@ stub CM_Get_Version
-@ stub CM_Get_Version_Ex
+@ stdcall CM_Get_Sibling(ptr long long)
+@ stdcall CM_Get_Sibling_Ex(ptr long long long)
+@ stdcall CM_Get_Version()
+@ stdcall CM_Get_Version_Ex(long)
 @ stub CM_Intersect_Range_List
 @ stub CM_Invert_Range_List
 @ stub CM_Is_Dock_Station_Present
-@ stub CM_Locate_DevNodeA
-@ stub CM_Locate_DevNodeW
-@ stub CM_Locate_DevNode_ExA
-@ stub CM_Locate_DevNode_ExW
+@ stdcall CM_Locate_DevNodeA(ptr str long)
+@ stdcall CM_Locate_DevNodeW(ptr wstr long)
+@ stdcall CM_Locate_DevNode_ExA(ptr str long long)
+@ stdcall CM_Locate_DevNode_ExW(ptr wstr long long)
 @ stub CM_Merge_Range_List
 @ stub CM_Modify_Res_Des
 @ stub CM_Modify_Res_Des_Ex

Modified: trunk/reactos/services/umpnpmgr/makefile
--- trunk/reactos/services/umpnpmgr/makefile	2005-03-20 20:28:19 UTC (rev 14234)
+++ trunk/reactos/services/umpnpmgr/makefile	2005-03-20 20:43:46 UTC (rev 14235)
@@ -12,12 +12,25 @@
 
 TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.a rpcrt4.a
 
-TARGET_OBJECTS = umpnpmgr.o
+TARGET_OBJECTS = umpnpmgr.o pnp_s.o
 
-TARGET_CFLAGS = -Wall -Werror -D__USE_W32API
+TARGET_CFLAGS = -Wall -Werror -D__USE_W32API -DUNICODE -D_UNICODE
 
+TARGET_CLEAN = pnp_s.c pnp.h
+
+DEP_OBJECTS = $(TARGET_OBJECTS)
+
 include $(PATH_TO_TOP)/rules.mak
 
 include $(TOOLS_PATH)/helper.mk
 
+include $(TOOLS_PATH)/depend.mk
+
+WIDL_FLAGS = \
+             -D _X86_ -D MIDL_PASS \
+             -I $(PATH_TO_TOP)/w32api/include
+
+pnp_s.c pnp.h: $(PATH_TO_TOP)/include/idl/pnp.idl
+	$(WIDL) $(WIDL_FLAGS) -h -H pnp.h -s -S pnp_s.c $(PATH_TO_TOP)/include/idl/pnp.idl
+
 # EOF

Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c
--- trunk/reactos/services/umpnpmgr/umpnpmgr.c	2005-03-20 20:28:19 UTC (rev 14234)
+++ trunk/reactos/services/umpnpmgr/umpnpmgr.c	2005-03-20 20:43:46 UTC (rev 14235)
@@ -27,9 +27,6 @@
 
 /* INCLUDES *****************************************************************/
 
-#define UNICODE
-#define _UNICODE
-
 #define NTOS_MODE_USER
 #include <ntos.h>
 #include <ntos/ntpnp.h>
@@ -41,6 +38,8 @@
 #include <rpc.h>
 #include <rpcdce.h>
 
+#include "pnp.h"
+
 #define DBG
 #define NDEBUG
 #include <debug.h>
@@ -62,6 +61,66 @@
 /* FUNCTIONS *****************************************************************/
 
 static DWORD WINAPI
+RpcServerThread(LPVOID lpParameter)
+{
+  RPC_STATUS Status;
+
+  DPRINT("RpcServerThread() called\n");
+
+  Status = RpcServerUseProtseqEpW(L"ncacn_np",
+                                  20,
+                                  L"\\pipe\\umpnpmgr",
+                                  NULL);  // Security descriptor
+  if (Status != RPC_S_OK)
+  {
+    DPRINT1("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status);
+    return 0;
+  }
+
+  Status = RpcServerRegisterIf(pnp_v1_0_s_ifspec,
+                               NULL,
+                               NULL);
+  if (Status != RPC_S_OK)
+  {
+    DPRINT1("RpcServerRegisterIf() failed (Status %lx)\n", Status);
+    return 0;
+  }
+
+  Status = RpcServerListen(1,
+                           20,
+                           FALSE);
+  if (Status != RPC_S_OK)
+  {
+    DPRINT1("RpcServerListen() failed (Status %lx)\n", Status);
+    return 0;
+  }
+
+  DPRINT("RpcServerThread() done\n");
+
+  return 0;
+}
+
+
+void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len)
+{
+  return GlobalAlloc(GPTR, len);
+}
+
+
+void __RPC_USER midl_user_free(void __RPC_FAR * ptr)
+{
+  GlobalFree(ptr);
+}
+
+
+//WORD PNP_GetVersion(RPC_BINDING_HANDLE BindingHandle)
+WORD PNP_GetVersion(handle_t BindingHandle)
+{
+  return 0x0400;
+}
+
+
+static DWORD WINAPI
 PnpEventThread(LPVOID lpParameter)
 {
   PPLUGPLAY_EVENT_BLOCK PnpEvent;
@@ -134,6 +193,15 @@
   if (hThread != NULL)
     CloseHandle(hThread);
 
+  hThread = CreateThread(NULL,
+			 0,
+			 RpcServerThread,
+			 NULL,
+			 0,
+			 &dwThreadId);
+  if (hThread != NULL)
+    CloseHandle(hThread);
+
   DPRINT("ServiceMain() done\n");
 }
 

Modified: trunk/reactos/w32api/include/setupapi.h
--- trunk/reactos/w32api/include/setupapi.h	2005-03-20 20:28:19 UTC (rev 14234)
+++ trunk/reactos/w32api/include/setupapi.h	2005-03-20 20:43:46 UTC (rev 14235)
@@ -1031,6 +1031,15 @@
     *PSP_BACKUP_QUEUE_PARAMS;
 #endif /* UNICODE */
 
+
+WINSETUPAPI LONG WINAPI AddTagToGroupOrderList(PCWSTR, DWORD, DWORD);
+WINSETUPAPI PWSTR WINAPI DuplicateString(PCWSTR);
+WINSETUPAPI BOOL WINAPI IsUserAdmin(VOID);
+WINSETUPAPI VOID WINAPI MyFree(PVOID);
+WINSETUPAPI PVOID WINAPI MyMalloc(DWORD);
+WINSETUPAPI PVOID WINAPI MyRealloc(PVOID, DWORD);
+WINSETUPAPI LONG WINAPI QueryRegistryValue(HKEY, PCWSTR, PBYTE*, PDWORD, PDWORD);
+
 WINSETUPAPI BOOL WINAPI SetupAddInstallSectionToDiskSpaceListA(HDSKSPC,HINF,HINF,PCSTR,PVOID,UINT);
 WINSETUPAPI BOOL WINAPI SetupAddInstallSectionToDiskSpaceListW(HDSKSPC,HINF,HINF,PCWSTR,PVOID,UINT);
 WINSETUPAPI BOOL WINAPI SetupAddSectionToDiskSpaceListA(HDSKSPC,HINF,HINF,PCSTR,UINT,PVOID,UINT);