Add traces
authorHervé Poussineau <hpoussin@reactos.org>
Thu, 27 Dec 2007 20:51:53 +0000 (20:51 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Thu, 27 Dec 2007 20:51:53 +0000 (20:51 +0000)
svn path=/trunk/; revision=31470

reactos/base/services/umpnpmgr/umpnpmgr.c
reactos/dll/win32/newdev/newdev.c

index c9dbdc6..04e5ac2 100644 (file)
@@ -1494,6 +1494,8 @@ InstallDevice(PCWSTR DeviceInstance, BOOL ShowWizard)
     NTSTATUS Status;
     BOOL DeviceInstalled = FALSE;
 
+    DPRINT("InstallDevice(%S, %d)\n", DeviceInstance, ShowWizard);
+
     RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
                          DeviceInstance);
     PlugPlayData.Operation = 0; /* Get status */
@@ -1503,25 +1505,40 @@ InstallDevice(PCWSTR DeviceInstance, BOOL ShowWizard)
                                (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;
 
@@ -1661,8 +1678,6 @@ DeviceInstallThread(LPVOID lpParameter)
 
     showWizard = !SetupIsActive() && !IsConsoleBoot();
 
-    SetEnvironmentVariable(L"USERPROFILE", L"."); /* FIXME: why is it needed? */
-
     while (TRUE)
     {
 #ifdef HAVE_SLIST_ENTRY_IMPLEMENTED
index bde4667..685598a 100644 (file)
@@ -643,6 +643,8 @@ DevInstallW(
        DWORD config_flags;
        BOOL retval = FALSE;
 
+       TRACE("(%p, %p, %s, %d)\n", hWndParent, hInstance, debugstr_w(InstanceId), Show);
+
        if (!IsUserAdmin())
        {
                /* XP kills the process... */
@@ -731,6 +733,7 @@ DevInstallW(
                if (config_flags & CONFIGFLAG_FAILEDINSTALL)
                {
                        /* The device is disabled */
+                       TRACE("Device is disabled\n");
                        retval = TRUE;
                        goto cleanup;
                }
@@ -748,6 +751,7 @@ DevInstallW(
        {
                /* 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? */
@@ -759,7 +763,10 @@ DevInstallW(
                                &installParams))
                        {
                                if (installParams.Flags & (DI_NEEDRESTART | DI_NEEDREBOOT))
+                               {
+                                       TRACE("Displaying 'Reboot' wizard page\n");
                                        retval = DisplayWizard(DevInstData, hWndParent, IDD_NEEDREBOOT);
+                               }
                        }
                }
                goto cleanup;
@@ -767,10 +774,12 @@ DevInstallW(
        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: