Add traces

svn path=/trunk/; revision=31470
This commit is contained in:
Hervé Poussineau 2007-12-27 20:51:53 +00:00
parent 9781b2b0d9
commit 707c10cf78
2 changed files with 26 additions and 2 deletions

View file

@ -1494,6 +1494,8 @@ InstallDevice(PCWSTR DeviceInstance, BOOL ShowWizard)
NTSTATUS Status; NTSTATUS Status;
BOOL DeviceInstalled = FALSE; BOOL DeviceInstalled = FALSE;
DPRINT("InstallDevice(%S, %d)\n", DeviceInstance, ShowWizard);
RtlInitUnicodeString(&PlugPlayData.DeviceInstance, RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
DeviceInstance); DeviceInstance);
PlugPlayData.Operation = 0; /* Get status */ PlugPlayData.Operation = 0; /* Get status */
@ -1503,25 +1505,40 @@ InstallDevice(PCWSTR DeviceInstance, BOOL ShowWizard)
(PVOID)&PlugPlayData, (PVOID)&PlugPlayData,
sizeof(PLUGPLAY_CONTROL_STATUS_DATA)); sizeof(PLUGPLAY_CONTROL_STATUS_DATA));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{
DPRINT1("NtPlugPlayControl('%S') failed with status 0x%08lx\n", DeviceInstance, Status);
return FALSE; return FALSE;
}
if ((PlugPlayData.DeviceStatus & (DNF_STARTED | DNF_START_FAILED)) != 0) if ((PlugPlayData.DeviceStatus & (DNF_STARTED | DNF_START_FAILED)) != 0)
{
/* Device is already started, or disabled due to some problem. Don't install it */ /* Device is already started, or disabled due to some problem. Don't install it */
DPRINT("No need to install '%S'\n", DeviceInstance);
return TRUE; return TRUE;
}
/* Install device */ /* Install device */
SetEnvironmentVariableW(L"USERPROFILE", L"."); /* FIXME: why is it needed? */ SetEnvironmentVariableW(L"USERPROFILE", L"."); /* FIXME: why is it needed? */
hNewDev = LoadLibraryW(L"newdev.dll"); hNewDev = LoadLibraryW(L"newdev.dll");
if (!hNewDev) if (!hNewDev)
{
DPRINT1("Unable to load newdev.dll\n");
goto cleanup; goto cleanup;
}
DevInstallW = (PDEV_INSTALL_W)GetProcAddress(hNewDev, (LPCSTR)"DevInstallW"); DevInstallW = (PDEV_INSTALL_W)GetProcAddress(hNewDev, (LPCSTR)"DevInstallW");
if (!DevInstallW) if (!DevInstallW)
{
DPRINT1("'DevInstallW' not found in newdev.dll\n");
goto cleanup; goto cleanup;
}
if (!DevInstallW(NULL, NULL, DeviceInstance, ShowWizard ? SW_SHOWNOACTIVATE : SW_HIDE)) if (!DevInstallW(NULL, NULL, DeviceInstance, ShowWizard ? SW_SHOWNOACTIVATE : SW_HIDE))
{
DPRINT1("DevInstallW('%S') failed\n", DeviceInstance);
goto cleanup; goto cleanup;
}
DeviceInstalled = TRUE; DeviceInstalled = TRUE;
@ -1661,8 +1678,6 @@ DeviceInstallThread(LPVOID lpParameter)
showWizard = !SetupIsActive() && !IsConsoleBoot(); showWizard = !SetupIsActive() && !IsConsoleBoot();
SetEnvironmentVariable(L"USERPROFILE", L"."); /* FIXME: why is it needed? */
while (TRUE) while (TRUE)
{ {
#ifdef HAVE_SLIST_ENTRY_IMPLEMENTED #ifdef HAVE_SLIST_ENTRY_IMPLEMENTED

View file

@ -643,6 +643,8 @@ DevInstallW(
DWORD config_flags; DWORD config_flags;
BOOL retval = FALSE; BOOL retval = FALSE;
TRACE("(%p, %p, %s, %d)\n", hWndParent, hInstance, debugstr_w(InstanceId), Show);
if (!IsUserAdmin()) if (!IsUserAdmin())
{ {
/* XP kills the process... */ /* XP kills the process... */
@ -731,6 +733,7 @@ DevInstallW(
if (config_flags & CONFIGFLAG_FAILEDINSTALL) if (config_flags & CONFIGFLAG_FAILEDINSTALL)
{ {
/* The device is disabled */ /* The device is disabled */
TRACE("Device is disabled\n");
retval = TRUE; retval = TRUE;
goto cleanup; goto cleanup;
} }
@ -748,6 +751,7 @@ DevInstallW(
{ {
/* Driver found ; install it */ /* Driver found ; install it */
retval = InstallCurrentDriver(DevInstData); retval = InstallCurrentDriver(DevInstData);
TRACE("InstallCurrentDriver() returned %d\n", retval);
if (retval && Show != SW_HIDE) if (retval && Show != SW_HIDE)
{ {
/* Should we display the 'Need to reboot' page? */ /* Should we display the 'Need to reboot' page? */
@ -759,7 +763,10 @@ DevInstallW(
&installParams)) &installParams))
{ {
if (installParams.Flags & (DI_NEEDRESTART | DI_NEEDREBOOT)) if (installParams.Flags & (DI_NEEDRESTART | DI_NEEDREBOOT))
{
TRACE("Displaying 'Reboot' wizard page\n");
retval = DisplayWizard(DevInstData, hWndParent, IDD_NEEDREBOOT); retval = DisplayWizard(DevInstData, hWndParent, IDD_NEEDREBOOT);
}
} }
} }
goto cleanup; goto cleanup;
@ -767,10 +774,12 @@ DevInstallW(
else if (Show == SW_HIDE) else if (Show == SW_HIDE)
{ {
/* We can't show the wizard. Fail the install */ /* We can't show the wizard. Fail the install */
TRACE("No wizard\n");
goto cleanup; goto cleanup;
} }
/* Prepare the wizard, and display it */ /* Prepare the wizard, and display it */
TRACE("Need to show install wizard\n");
retval = DisplayWizard(DevInstData, hWndParent, IDD_WELCOMEPAGE); retval = DisplayWizard(DevInstData, hWndParent, IDD_WELCOMEPAGE);
cleanup: cleanup: