[DEVMGR]
authorGed Murphy <gedmurphy@reactos.org>
Mon, 19 Oct 2015 08:45:48 +0000 (08:45 +0000)
committerGed Murphy <gedmurphy@reactos.org>
Mon, 19 Oct 2015 08:45:48 +0000 (08:45 +0000)
- Implement updating the device from the toolbar
- Add a message before uninstalling a device. Dedicated to Jared Smudde.

svn path=/trunk/; revision=69614

reactos/dll/win32/devmgr/devmgmt/DeviceView.cpp
reactos/dll/win32/devmgr/devmgmt/DeviceView.h

index 33ead33..0119b0c 100644 (file)
@@ -271,7 +271,8 @@ CDeviceView::OnAction(
 
         case IDC_UPDATE_DRV:
         {
-            MessageBox(m_hMainWnd, L"Not yet implemented", L"Update Driver", MB_OK);
+            bool NeedsReboot;
+            UpdateSelectedDevice(NeedsReboot);
             break;
         }
 
@@ -740,6 +741,24 @@ CDeviceView::EnableSelectedDevice(
     return false;
 }
 
+bool
+CDeviceView::UpdateSelectedDevice(
+    _Out_ bool &NeedsReboot
+    )
+{
+    CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
+    if (Node == nullptr) return false;
+
+    DWORD dwReboot;
+    if (InstallDevInst(m_hMainWnd, Node->GetDeviceId(), TRUE, &dwReboot))
+    {
+        NeedsReboot = false;
+        return true;
+    }
+
+    return false;
+}
+
 bool
 CDeviceView::UninstallSelectedDevice(
     )
@@ -747,6 +766,18 @@ CDeviceView::UninstallSelectedDevice(
     CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
     if (Node == nullptr) return false;
 
+    CAtlStringW str;
+    if (str.LoadStringW(g_hThisInstance, IDS_CONFIRM_UNINSTALL))
+    {
+        if (MessageBoxW(m_hMainWnd,
+            str,
+            Node->GetDisplayName(),
+            MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES)
+        {
+            return false;
+        }
+    }
+
     return Node->UninstallDevice();
 }
 
index 739da2b..f82d951 100644 (file)
@@ -115,6 +115,10 @@ private:
         _Out_ bool &NeedsReboot
         );
 
+    bool UpdateSelectedDevice(
+        _Out_ bool &NeedsReboot
+        );
+
     bool UninstallSelectedDevice(
         );