[DEVMGR]
authorEric Kohl <eric.kohl@reactos.org>
Mon, 6 Oct 2014 18:35:17 +0000 (18:35 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Mon, 6 Oct 2014 18:35:17 +0000 (18:35 +0000)
- Replace the call to DevInstallW by InstallDevInst in the device properties.
- Also call InstallDevInst from the device problem wizard.
CORE-6350 #resolve

svn path=/trunk/; revision=64566

reactos/dll/win32/devmgr/advprop.c
reactos/dll/win32/devmgr/devprblm.c
reactos/dll/win32/devmgr/precomp.h

index ee74cae..5761752 100644 (file)
@@ -399,13 +399,6 @@ DriverDetailsDlgProc(IN HWND hwndDlg,
     return Ret;
 }
 
     return Ret;
 }
 
-BOOL
-WINAPI
-DevInstallW(
-    IN HWND hWndParent,
-    IN HINSTANCE hInstance,
-    IN LPCWSTR InstanceId,
-    IN INT Show);
 
 static
 VOID
 
 static
 VOID
@@ -415,6 +408,7 @@ UpdateDriver(
 {
     TOKEN_PRIVILEGES Privileges;
     HANDLE hToken;
 {
     TOKEN_PRIVILEGES Privileges;
     HANDLE hToken;
+    DWORD dwReboot;
     BOOL NeedReboot = FALSE;
 
     // Better use InstallDevInst:
     BOOL NeedReboot = FALSE;
 
     // Better use InstallDevInst:
@@ -426,7 +420,8 @@ UpdateDriver(
     //         BOOL bUpdate,
     //         DWORD *dwReboot);
     // See: http://comp.os.ms-windows.programmer.win32.narkive.com/J8FTd4KK/signature-of-undocumented-installdevinstex
     //         BOOL bUpdate,
     //         DWORD *dwReboot);
     // See: http://comp.os.ms-windows.programmer.win32.narkive.com/J8FTd4KK/signature-of-undocumented-installdevinstex
-    if (!DevInstallW(hwndDlg, NULL, dap->szDeviceID, SW_SHOWNOACTIVATE))
+
+    if (!InstallDevInst(hwndDlg, dap->szDeviceID, TRUE, &dwReboot))
         return;
 
     if (NeedReboot == FALSE)
         return;
 
     if (NeedReboot == FALSE)
@@ -1619,6 +1614,8 @@ UpdateDevInfo(IN HWND hwndDlg,
     DWORD nDriverPages = 0;
     BOOL RecalcPages = FALSE;
 
     DWORD nDriverPages = 0;
     BOOL RecalcPages = FALSE;
 
+    TRACE("UpdateDevInfo()\n");
+
     hPropSheetDlg = GetParent(hwndDlg);
 
     if (dap->PageInitialized)
     hPropSheetDlg = GetParent(hwndDlg);
 
     if (dap->PageInitialized)
@@ -2014,6 +2011,7 @@ GetParentNode:
                                           dap->PropertySheetType) &&
         nDriverPages != 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
     {
                                           dap->PropertySheetType) &&
         nDriverPages != 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
     {
+TRACE("Count %d additional pages!\n", nDriverPages);
         dap->nDevPropSheets += nDriverPages;
     }
     else
         dap->nDevPropSheets += nDriverPages;
     }
     else
@@ -2035,6 +2033,7 @@ GetParentNode:
     /* add the device property sheets */
     if (dap->nDevPropSheets != 0)
     {
     /* add the device property sheets */
     if (dap->nDevPropSheets != 0)
     {
+TRACE("Show %d pages!\n", dap->nDevPropSheets);
         dap->DevPropSheets = HeapAlloc(GetProcessHeap(),
                                        HEAP_ZERO_MEMORY,
                                        dap->nDevPropSheets * sizeof(HPROPSHEETPAGE));
         dap->DevPropSheets = HeapAlloc(GetProcessHeap(),
                                        HEAP_ZERO_MEMORY,
                                        dap->nDevPropSheets * sizeof(HPROPSHEETPAGE));
@@ -2054,20 +2053,28 @@ GetParentNode:
                 {
                     /* add the property sheets */
                     for (iPage = 0;
                 {
                     /* add the property sheets */
                     for (iPage = 0;
-                         iPage != nDriverPages;
+                         iPage < nDriverPages;
                          iPage++)
                     {
                          iPage++)
                     {
+TRACE("Add page %d\n", iPage);
+TRACE("Sheet %p\n", dap->DevPropSheets[iPage]);
+
                         if (PropSheet_AddPage(hPropSheetDlg,
                                               dap->DevPropSheets[iPage]))
                         {
                             RecalcPages = TRUE;
                         }
                         if (PropSheet_AddPage(hPropSheetDlg,
                                               dap->DevPropSheets[iPage]))
                         {
                             RecalcPages = TRUE;
                         }
+                        else
+                        {
+TRACE("PropSheet_AddPage() failed\n");
+                        }
                     }
 
                     dap->FreeDevPropSheets = TRUE;
                 }
                 else
                 {
                     }
 
                     dap->FreeDevPropSheets = TRUE;
                 }
                 else
                 {
+TRACE("SetupDiGetClassDevPropertySheets() failed\n");
                     /* cleanup, we were unable to get the device property sheets */
                     iPage = nDriverPages;
                     dap->nDevPropSheets -= nDriverPages;
                     /* cleanup, we were unable to get the device property sheets */
                     iPage = nDriverPages;
                     dap->nDevPropSheets -= nDriverPages;
index e271747..6265f50 100644 (file)
@@ -34,10 +34,20 @@ ShowDeviceProblemWizard(IN HWND hWndParent  OPTIONAL,
                         IN PSP_DEVINFO_DATA DevInfoData,
                         IN HMACHINE hMachine  OPTIONAL)
 {
                         IN PSP_DEVINFO_DATA DevInfoData,
                         IN HMACHINE hMachine  OPTIONAL)
 {
+    WCHAR szDeviceInstanceId[256];
     CONFIGRET cr;
     ULONG Status, ProblemNumber;
     CONFIGRET cr;
     ULONG Status, ProblemNumber;
+    DWORD dwReboot;
     BOOL Ret = FALSE;
 
     BOOL Ret = FALSE;
 
+    /* Get the device instance id */
+    if (!SetupDiGetDeviceInstanceId(hDevInfo,
+                                    DevInfoData,
+                                    szDeviceInstanceId,
+                                    256,
+                                    NULL))
+        return FALSE;
+
     cr = CM_Get_DevNode_Status_Ex(&Status,
                                   &ProblemNumber,
                                   DevInfoData->DevInst,
     cr = CM_Get_DevNode_Status_Ex(&Status,
                                   &ProblemNumber,
                                   DevInfoData->DevInst,
@@ -62,6 +72,7 @@ ShowDeviceProblemWizard(IN HWND hWndParent  OPTIONAL,
             case CM_PROB_UNKNOWN_RESOURCE:
             {
                 /* FIXME - display the update driver wizard */
             case CM_PROB_UNKNOWN_RESOURCE:
             {
                 /* FIXME - display the update driver wizard */
+                InstallDevInst(hWndParent, szDeviceInstanceId, TRUE, &dwReboot);
                 break;
             }
 
                 break;
             }
 
@@ -78,6 +89,7 @@ ShowDeviceProblemWizard(IN HWND hWndParent  OPTIONAL,
             case CM_PROB_FAILED_INSTALL:
             {
                 /* FIXME - display the driver (re)installation wizard */
             case CM_PROB_FAILED_INSTALL:
             {
                 /* FIXME - display the driver (re)installation wizard */
+                InstallDevInst(hWndParent, szDeviceInstanceId, TRUE, &dwReboot);
                 break;
             }
 
                 break;
             }
 
index 2bf4266..29f4631 100644 (file)
@@ -13,6 +13,7 @@
 #include <regstr.h>
 #include <setupapi.h>
 #include <cfgmgr32.h>
 #include <regstr.h>
 #include <setupapi.h>
 #include <cfgmgr32.h>
+#include <dll/newdevp.h>
 #include <dll/devmgr/devmgr.h>
 #include <wine/debug.h>
 
 #include <dll/devmgr/devmgr.h>
 #include <wine/debug.h>