Modified: trunk/reactos/Makefile
Modified: trunk/reactos/bootdata/hivesys.inf
Modified: trunk/reactos/bootdata/packages/reactos.dff
Added: trunk/reactos/services/umpnpmgr/
Added: trunk/reactos/services/umpnpmgr/makefile
Added: trunk/reactos/services/umpnpmgr/umpnpmgr.c
Added: trunk/reactos/services/umpnpmgr/umpnpmgr.rc

Modified: trunk/reactos/Makefile
--- trunk/reactos/Makefile	2005-02-05 00:17:49 UTC (rev 13412)
+++ trunk/reactos/Makefile	2005-02-05 00:20:14 UTC (rev 13413)
@@ -105,8 +105,7 @@
   winlogon regedit winefile notepad reactos
 
 # System services
-# rpcss eventlog
-SYS_SVC = rpcss eventlog
+SYS_SVC = rpcss eventlog umpnpmgr
 
 APPS = testsets utils
 

Modified: trunk/reactos/bootdata/hivesys.inf
--- trunk/reactos/bootdata/hivesys.inf	2005-02-05 00:17:49 UTC (rev 13412)
+++ trunk/reactos/bootdata/hivesys.inf	2005-02-05 00:20:14 UTC (rev 13413)
@@ -201,6 +201,7 @@
  "NDIS", \
  "PNP_TDI", \
  "TDI", \
+ "PlugPlay", \
  "Extended Base"
 
 ; Group order, the first DWORD is the count of entries, 
@@ -676,6 +677,13 @@
 ;HKLM,"SYSTEM\CurrentControlSet\Services\ntice","Start",0x00010001,0x00000000
 ;HKLM,"SYSTEM\CurrentControlSet\Services\ntice","Type",0x00010001,0x00000001
 
+; Plug and Play manager
+HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ErrorControl",0x00010001,0x00000000
+HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Group",0x00000000,"PlugPlay"
+HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ImagePath",0x00020000,"%SystemRoot%\system32\umpnpmgr.exe"
+HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Start",0x00010001,0x00000002
+HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Type",0x00010001,0x00000010
+
 ; PS/2 mouse port driver
 HKLM,"SYSTEM\CurrentControlSet\Services\Psaux","ErrorControl",0x00010001,0x00000000
 HKLM,"SYSTEM\CurrentControlSet\Services\Psaux","Group",0x00000000,"Pointer Port"

Modified: trunk/reactos/bootdata/packages/reactos.dff
--- trunk/reactos/bootdata/packages/reactos.dff	2005-02-05 00:17:49 UTC (rev 13412)
+++ trunk/reactos/bootdata/packages/reactos.dff	2005-02-05 00:20:14 UTC (rev 13413)
@@ -161,8 +161,9 @@
 subsys\system\winefile\winefile.exe     1
 services\eventlog\eventlog.exe          1
 services\rpcss\rpcss.exe                1
+services\umpnpmgr\umpnpmgr.exe          1
 apps\utils\net\arp\arp.exe              1
-apps\utils\net\route\route.exe		1
+apps\utils\net\route\route.exe          1
 apps\utils\net\finger\finger.exe        1
 apps\utils\net\ftp\ftp.exe              1
 apps\utils\net\ipconfig\ipconfig.exe    1

Added: trunk/reactos/services/umpnpmgr/makefile
--- trunk/reactos/services/umpnpmgr/makefile	2005-02-05 00:17:49 UTC (rev 13412)
+++ trunk/reactos/services/umpnpmgr/makefile	2005-02-05 00:20:14 UTC (rev 13413)
@@ -0,0 +1,23 @@
+# $Id$
+
+PATH_TO_TOP = ../..
+
+TARGET_TYPE = program
+
+TARGET_APPTYPE = console
+
+TARGET_NAME = umpnpmgr
+
+TARGET_INSTALLDIR = system32
+
+TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.a rpcrt4.a
+
+TARGET_OBJECTS = umpnpmgr.o
+
+TARGET_CFLAGS = -Wall -Werror -D__USE_W32API
+
+include $(PATH_TO_TOP)/rules.mak
+
+include $(TOOLS_PATH)/helper.mk
+
+# EOF

Added: trunk/reactos/services/umpnpmgr/umpnpmgr.c
--- trunk/reactos/services/umpnpmgr/umpnpmgr.c	2005-02-05 00:17:49 UTC (rev 13412)
+++ trunk/reactos/services/umpnpmgr/umpnpmgr.c	2005-02-05 00:20:14 UTC (rev 13413)
@@ -0,0 +1,147 @@
+/*
+ *  ReactOS kernel
+ *  Copyright (C) 2005 ReactOS Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/* $Id$
+ *
+ * COPYRIGHT:        See COPYING in the top level directory
+ * PROJECT:          ReactOS kernel
+ * FILE:             services/umpnpmgr/umpnpmgr.c
+ * PURPOSE:          User-mode Plug and Play manager
+ * PROGRAMMER:       Eric Kohl
+ */
+
+/* INCLUDES *****************************************************************/
+
+#define UNICODE
+#define _UNICODE
+
+#define NTOS_MODE_USER
+#include <ntos.h>
+#include <ntos/ntpnp.h>
+#include <ddk/wdmguid.h>
+#include <windows.h>
+#include <tchar.h>
+#include <stdio.h>
+
+#include <rpc.h>
+#include <rpcdce.h>
+
+#define DBG
+#define NDEBUG
+#include <debug.h>
+
+
+
+/* GLOBALS ******************************************************************/
+
+static VOID CALLBACK
+ServiceMain(DWORD argc, LPTSTR *argv);
+
+static SERVICE_TABLE_ENTRY ServiceTable[2] =
+{
+  {_T("PlugPlay"), ServiceMain},
+  {NULL, NULL}
+};
+
+
+/* FUNCTIONS *****************************************************************/
+
+static DWORD WINAPI
+PnpEventThread(LPVOID lpParameter)
+{
+  PPLUGPLAY_EVENT_BLOCK PnpEvent;
+  NTSTATUS Status;
+  RPC_STATUS RpcStatus;
+
+  PnpEvent = HeapAlloc(GetProcessHeap(), 0, 1024);
+  if (PnpEvent == NULL)
+    return ERROR_OUTOFMEMORY;
+
+  for (;;)
+  {
+    DPRINT("Calling NtGetPlugPlayEvent()\n");
+
+    ZeroMemory(PnpEvent, 1024);
+
+    /* Wait for the next pnp event */
+    Status = NtGetPlugPlayEvent(0, 0, PnpEvent, 1024);
+    if (!NT_SUCCESS(Status))
+    {
+      DPRINT("NtPlugPlayEvent() failed (Status %lx)\n", Status);
+      break;
+    }
+
+    DPRINT("Received PnP Event\n");
+    if (UuidEqual((UUID*)&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_ARRIVAL, &RpcStatus))
+    {
+      DPRINT1("Device arrival event: %S\n", PnpEvent->TargetDevice.DeviceIds);
+    }
+    else
+    {
+      DPRINT1("Unknown event\n");
+    }
+
+    /* FIXME: Process the pnp event */
+
+
+    /* Dequeue the current pnp event and signal the next one */
+    NtPlugPlayControl(PLUGPLAY_USER_RESPONSE, NULL, 0);
+  }
+
+  HeapFree(GetProcessHeap(), 0, PnpEvent);
+
+  return ERROR_SUCCESS;
+}
+
+
+static VOID CALLBACK
+ServiceMain(DWORD argc, LPTSTR *argv)
+{
+  HANDLE hThread;
+  DWORD dwThreadId;
+
+  DPRINT("ServiceMain() called\n");
+
+  hThread = CreateThread(NULL,
+			 0,
+			 PnpEventThread,
+			 NULL,
+			 0,
+			 &dwThreadId);
+  if (hThread != NULL)
+    CloseHandle(hThread);
+
+  DPRINT("ServiceMain() done\n");
+}
+
+
+int
+main(int argc, char *argv[])
+{
+  DPRINT("Umpnpmgr: main() started\n");
+
+  StartServiceCtrlDispatcher(ServiceTable);
+
+  DPRINT("Umpnpmgr: main() done\n");
+
+  ExitThread(0);
+
+  return 0;
+}
+
+/* EOF */

Added: trunk/reactos/services/umpnpmgr/umpnpmgr.rc
--- trunk/reactos/services/umpnpmgr/umpnpmgr.rc	2005-02-05 00:17:49 UTC (rev 13412)
+++ trunk/reactos/services/umpnpmgr/umpnpmgr.rc	2005-02-05 00:20:14 UTC (rev 13413)
@@ -0,0 +1,4 @@
+#define REACTOS_STR_FILE_DESCRIPTION	"User-Mode Plug and Play manager\0"
+#define REACTOS_STR_INTERNAL_NAME	"Umpnpmgr\0"
+#define REACTOS_STR_ORIGINAL_FILENAME	"Umpnpmgr.exe\0"
+#include <reactos/version.rc>