NTSTATUS Status;
BOOL DeviceInstalled = FALSE;
+ DPRINT("InstallDevice(%S, %d)\n", DeviceInstance, ShowWizard);
+
RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
DeviceInstance);
PlugPlayData.Operation = 0; /* Get status */
(PVOID)&PlugPlayData,
sizeof(PLUGPLAY_CONTROL_STATUS_DATA));
if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("NtPlugPlayControl('%S') failed with status 0x%08lx\n", DeviceInstance, Status);
return FALSE;
+ }
if ((PlugPlayData.DeviceStatus & (DNF_STARTED | DNF_START_FAILED)) != 0)
+ {
/* Device is already started, or disabled due to some problem. Don't install it */
+ DPRINT("No need to install '%S'\n", DeviceInstance);
return TRUE;
+ }
/* Install device */
SetEnvironmentVariableW(L"USERPROFILE", L"."); /* FIXME: why is it needed? */
hNewDev = LoadLibraryW(L"newdev.dll");
if (!hNewDev)
+ {
+ DPRINT1("Unable to load newdev.dll\n");
goto cleanup;
+ }
DevInstallW = (PDEV_INSTALL_W)GetProcAddress(hNewDev, (LPCSTR)"DevInstallW");
if (!DevInstallW)
+ {
+ DPRINT1("'DevInstallW' not found in newdev.dll\n");
goto cleanup;
+ }
if (!DevInstallW(NULL, NULL, DeviceInstance, ShowWizard ? SW_SHOWNOACTIVATE : SW_HIDE))
+ {
+ DPRINT1("DevInstallW('%S') failed\n", DeviceInstance);
goto cleanup;
+ }
DeviceInstalled = TRUE;
showWizard = !SetupIsActive() && !IsConsoleBoot();
- SetEnvironmentVariable(L"USERPROFILE", L"."); /* FIXME: why is it needed? */
-
while (TRUE)
{
#ifdef HAVE_SLIST_ENTRY_IMPLEMENTED
DWORD config_flags;
BOOL retval = FALSE;
+ TRACE("(%p, %p, %s, %d)\n", hWndParent, hInstance, debugstr_w(InstanceId), Show);
+
if (!IsUserAdmin())
{
/* XP kills the process... */
if (config_flags & CONFIGFLAG_FAILEDINSTALL)
{
/* The device is disabled */
+ TRACE("Device is disabled\n");
retval = TRUE;
goto cleanup;
}
{
/* Driver found ; install it */
retval = InstallCurrentDriver(DevInstData);
+ TRACE("InstallCurrentDriver() returned %d\n", retval);
if (retval && Show != SW_HIDE)
{
/* Should we display the 'Need to reboot' page? */
&installParams))
{
if (installParams.Flags & (DI_NEEDRESTART | DI_NEEDREBOOT))
+ {
+ TRACE("Displaying 'Reboot' wizard page\n");
retval = DisplayWizard(DevInstData, hWndParent, IDD_NEEDREBOOT);
+ }
}
}
goto cleanup;
else if (Show == SW_HIDE)
{
/* We can't show the wizard. Fail the install */
+ TRACE("No wizard\n");
goto cleanup;
}
/* Prepare the wizard, and display it */
+ TRACE("Need to show install wizard\n");
retval = DisplayWizard(DevInstData, hWndParent, IDD_WELCOMEPAGE);
cleanup: