- 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
This commit is contained in:
Eric Kohl 2014-10-06 18:35:17 +00:00
parent d94795e842
commit 28dd65f7b6
3 changed files with 29 additions and 9 deletions

View 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 static
VOID VOID
@ -415,6 +408,7 @@ UpdateDriver(
{ {
TOKEN_PRIVILEGES Privileges; TOKEN_PRIVILEGES Privileges;
HANDLE hToken; HANDLE hToken;
DWORD dwReboot;
BOOL NeedReboot = FALSE; BOOL NeedReboot = FALSE;
// Better use InstallDevInst: // Better use InstallDevInst:
@ -426,7 +420,8 @@ UpdateDriver(
// BOOL bUpdate, // BOOL bUpdate,
// DWORD *dwReboot); // DWORD *dwReboot);
// See: http://comp.os.ms-windows.programmer.win32.narkive.com/J8FTd4KK/signature-of-undocumented-installdevinstex // 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; return;
if (NeedReboot == FALSE) if (NeedReboot == FALSE)
@ -1619,6 +1614,8 @@ UpdateDevInfo(IN HWND hwndDlg,
DWORD nDriverPages = 0; DWORD nDriverPages = 0;
BOOL RecalcPages = FALSE; BOOL RecalcPages = FALSE;
TRACE("UpdateDevInfo()\n");
hPropSheetDlg = GetParent(hwndDlg); hPropSheetDlg = GetParent(hwndDlg);
if (dap->PageInitialized) if (dap->PageInitialized)
@ -2014,6 +2011,7 @@ GetParentNode:
dap->PropertySheetType) && dap->PropertySheetType) &&
nDriverPages != 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) nDriverPages != 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{ {
TRACE("Count %d additional pages!\n", nDriverPages);
dap->nDevPropSheets += nDriverPages; dap->nDevPropSheets += nDriverPages;
} }
else else
@ -2035,6 +2033,7 @@ GetParentNode:
/* add the device property sheets */ /* add the device property sheets */
if (dap->nDevPropSheets != 0) if (dap->nDevPropSheets != 0)
{ {
TRACE("Show %d pages!\n", dap->nDevPropSheets);
dap->DevPropSheets = HeapAlloc(GetProcessHeap(), dap->DevPropSheets = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
dap->nDevPropSheets * sizeof(HPROPSHEETPAGE)); dap->nDevPropSheets * sizeof(HPROPSHEETPAGE));
@ -2054,20 +2053,28 @@ GetParentNode:
{ {
/* add the property sheets */ /* add the property sheets */
for (iPage = 0; 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, if (PropSheet_AddPage(hPropSheetDlg,
dap->DevPropSheets[iPage])) dap->DevPropSheets[iPage]))
{ {
RecalcPages = TRUE; RecalcPages = TRUE;
} }
else
{
TRACE("PropSheet_AddPage() failed\n");
}
} }
dap->FreeDevPropSheets = TRUE; dap->FreeDevPropSheets = TRUE;
} }
else else
{ {
TRACE("SetupDiGetClassDevPropertySheets() failed\n");
/* cleanup, we were unable to get the device property sheets */ /* cleanup, we were unable to get the device property sheets */
iPage = nDriverPages; iPage = nDriverPages;
dap->nDevPropSheets -= nDriverPages; dap->nDevPropSheets -= nDriverPages;

View file

@ -34,10 +34,20 @@ ShowDeviceProblemWizard(IN HWND hWndParent OPTIONAL,
IN PSP_DEVINFO_DATA DevInfoData, IN PSP_DEVINFO_DATA DevInfoData,
IN HMACHINE hMachine OPTIONAL) IN HMACHINE hMachine OPTIONAL)
{ {
WCHAR szDeviceInstanceId[256];
CONFIGRET cr; CONFIGRET cr;
ULONG Status, ProblemNumber; 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, cr = CM_Get_DevNode_Status_Ex(&Status,
&ProblemNumber, &ProblemNumber,
DevInfoData->DevInst, DevInfoData->DevInst,
@ -62,6 +72,7 @@ ShowDeviceProblemWizard(IN HWND hWndParent OPTIONAL,
case CM_PROB_UNKNOWN_RESOURCE: case CM_PROB_UNKNOWN_RESOURCE:
{ {
/* FIXME - display the update driver wizard */ /* 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: case CM_PROB_FAILED_INSTALL:
{ {
/* FIXME - display the driver (re)installation wizard */ /* FIXME - display the driver (re)installation wizard */
InstallDevInst(hWndParent, szDeviceInstanceId, TRUE, &dwReboot);
break; break;
} }

View file

@ -13,6 +13,7 @@
#include <regstr.h> #include <regstr.h>
#include <setupapi.h> #include <setupapi.h>
#include <cfgmgr32.h> #include <cfgmgr32.h>
#include <dll/newdevp.h>
#include <dll/devmgr/devmgr.h> #include <dll/devmgr/devmgr.h>
#include <wine/debug.h> #include <wine/debug.h>