[DEVMGR]
authorGed Murphy <gedmurphy@reactos.org>
Thu, 25 Jun 2015 20:34:57 +0000 (20:34 +0000)
committerGed Murphy <gedmurphy@reactos.org>
Thu, 25 Jun 2015 20:34:57 +0000 (20:34 +0000)
- When disabling a device, show the user a message box to confirm before disabling
- Some code cleanup

svn path=/trunk/; revision=68267

reactos/dll/win32/devmgr/devmgmt/DeviceNode.cpp
reactos/dll/win32/devmgr/devmgmt/DeviceView.cpp
reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp
reactos/dll/win32/devmgr/devmgmt/Resource.h
reactos/dll/win32/devmgr/devmgmt/lang/en-US.rc

index 31f7d1e..7695f5f 100644 (file)
@@ -340,6 +340,8 @@ CDeviceNode::EnableDevice(
 
         if (Enable)
         {
+            // config specific enablling first, then global enabling.
+            // The global appears to be the one that starts the device
             pcp.Scope = DICS_FLAG_GLOBAL;
             if (SetupDiSetClassInstallParamsW(m_hDevInfo,
                                               &m_DevinfoData,
index e956eb5..b6ef077 100644 (file)
@@ -311,6 +311,21 @@ CDeviceView::EnableSelectedDevice(
     CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
     if (Node)
     {
+        if (Enable == false)
+        {
+            CAtlStringW str;
+            if (str.LoadStringW(g_hInstance, IDS_CONFIRM_DISABLE))
+            {
+                if (MessageBoxW(m_hMainWnd,
+                                str,
+                                Node->GetDisplayName(),
+                                MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES)
+                {
+                    return false;
+                }
+            }
+        }
+
         if (Node->EnableDevice(Enable, NeedsReboot))
         {
             Refresh(m_ViewType, true, true);
index d1fe131..6bdb925 100644 (file)
@@ -50,19 +50,6 @@ static const MENU_HINT MainMenuHintTable[] =
 };
 
 
-
-
-#define IDS_HINT_BLANK          20000
-#define IDS_HINT_PROPERTIES     20001
-#define IDS_HINT_SCAN           20002
-#define IDS_HINT_ENABLE         20003
-#define IDS_HINT_DISABLE        20004
-#define IDS_HINT_UPDATE         20005
-#define IDS_HINT_UNINSTALL      20006
-#define IDS_HINT_ADD            20007
-#define IDS_HINT_ABOUT          20008
-#define IDS_HINT_EXIT           20009
-
 // system menu hints
 static const MENU_HINT SystemMenuHintTable[] =
 {
index b872347..a281680 100644 (file)
@@ -1,5 +1,7 @@
 #define IDC_STATIC          -1
 
+#define IDS_APPNAME         10
+
 #define IDI_MAIN_ICON       20
 #define IDB_ROOT_IMAGE      21
 #define IDB_TOOLBAR         22
 #define IDC_RESBYCONN       203
 #define IDC_SHOWHIDDEN      204
 
-/* about box info */
-#define IDD_ABOUTBOX        300
-#define IDC_LICENSE_EDIT    301
-#define IDS_APPNAME         302
-#define IDS_LICENSE         303
 
 /* tooltips */
-#define IDS_TOOLTIP_PROPERTIES  6000
-#define IDS_TOOLTIP_SCAN        6001
-#define IDS_TOOLTIP_ENABLE      6002
-#define IDS_TOOLTIP_DIABLE      6003
-#define IDS_TOOLTIP_UPDATE      6004
-#define IDS_TOOLTIP_UNINSTALL   6005
-
+#define IDS_TOOLTIP_PROPERTIES  300
+#define IDS_TOOLTIP_SCAN        301
+#define IDS_TOOLTIP_ENABLE      302
+#define IDS_TOOLTIP_DIABLE      303
+#define IDS_TOOLTIP_UPDATE      304
+#define IDS_TOOLTIP_UNINSTALL   305
 
+/* General strings */
+#define IDS_CONFIRM_DISABLE     400
 
 /* menu hints */
-#define IDS_HINT_BLANK          20000
-#define IDS_HINT_PROPERTIES     20001
-#define IDS_HINT_SCAN           20002
-#define IDS_HINT_ENABLE         20003
-#define IDS_HINT_DISABLE        20004
-#define IDS_HINT_UPDATE         20005
-#define IDS_HINT_UNINSTALL      20006
-#define IDS_HINT_ADD            20007
+#define IDS_HINT_BLANK          1000
+#define IDS_HINT_PROPERTIES     1001
+#define IDS_HINT_SCAN           1002
+#define IDS_HINT_ENABLE         1003
+#define IDS_HINT_DISABLE        1004
+#define IDS_HINT_UPDATE         1005
+#define IDS_HINT_UNINSTALL      1006
+#define IDS_HINT_ADD            1007
 #define IDS_HINT_ABOUT          20008
 #define IDS_HINT_EXIT           20009
 
index d16f750..d4557cc 100644 (file)
@@ -49,12 +49,12 @@ BEGIN
   END
 END
 
-#define IDS_HINT_PROPERTIES     20001
-#define IDS_HINT_SCAN           20002
-#define IDS_HINT_ENABLE         20003
-#define IDS_HINT_DISABLE        20004
-#define IDS_HINT_UPDATE         20005
-#define IDS_HINT_UNINSTALL      20006
+
+
+STRINGTABLE DISCARDABLE
+BEGIN
+  IDS_CONFIRM_DISABLE       "Disabling this device will cause it to stop functioning.\r\nDo you really want to disable it?"
+END
 
 STRINGTABLE DISCARDABLE
 BEGIN