[UMPNPMGR]
[reactos.git] / reactos / base / services / umpnpmgr / umpnpmgr.c
index c46e705..f2cc8b9 100644 (file)
@@ -37,6 +37,8 @@
 #include <winbase.h>
 #include <winreg.h>
 #include <winsvc.h>
+#include <winuser.h>
+#include <dbt.h>
 #include <stdio.h>
 #include <cmfuncs.h>
 #include <rtlfuncs.h>
@@ -3563,8 +3565,16 @@ PnpEventThread(LPVOID lpParameter)
         }
         else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_ARRIVAL, &RpcStatus))
         {
+            DWORD dwRecipient;
+
             DPRINT("Device arrival: %S\n", PnpEvent->TargetDevice.DeviceIds);
-            /* FIXME: ? */
+
+            dwRecipient = BSM_ALLDESKTOPS | BSM_APPLICATIONS;
+            BroadcastSystemMessageW(BSF_POSTMESSAGE,
+                                    &dwRecipient,
+                                    WM_DEVICECHANGE,
+                                    DBT_DEVNODES_CHANGED,
+                                    0);
         }
         else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_EJECT_VETOED, &RpcStatus))
         {
@@ -3576,11 +3586,29 @@ PnpEventThread(LPVOID lpParameter)
         }
         else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_SAFE_REMOVAL, &RpcStatus))
         {
+            DWORD dwRecipient;
+
             DPRINT1("Safe removal: %S\n", PnpEvent->TargetDevice.DeviceIds);
+
+            dwRecipient = BSM_ALLDESKTOPS | BSM_APPLICATIONS;
+            BroadcastSystemMessageW(BSF_POSTMESSAGE,
+                                    &dwRecipient,
+                                    WM_DEVICECHANGE,
+                                    DBT_DEVNODES_CHANGED,
+                                    0);
         }
         else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_SURPRISE_REMOVAL, &RpcStatus))
         {
+            DWORD dwRecipient;
+
             DPRINT1("Surprise removal: %S\n", PnpEvent->TargetDevice.DeviceIds);
+
+            dwRecipient = BSM_ALLDESKTOPS | BSM_APPLICATIONS;
+            BroadcastSystemMessageW(BSF_POSTMESSAGE,
+                                    &dwRecipient,
+                                    WM_DEVICECHANGE,
+                                    DBT_DEVNODES_CHANGED,
+                                    0);
         }
         else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_REMOVAL_VETOED, &RpcStatus))
         {