Index: trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDisplay.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDisplay.cpp	(revision 49891)
+++ trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDisplay.cpp	(revision 51469)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -15,17 +15,27 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
-#define _WIN32_WINNT 0x0500
 #include "VBoxTray.h"
 #include "VBoxHelpers.h"
 #include "VBoxSeamless.h"
+
+#include <malloc.h>
+
+#include <iprt/assert.h>
+#ifdef VBOX_WITH_WDDM
+# include <iprt/asm.h>
+#endif
+
+#ifdef DEBUG
+# define LOG_ENABLED
+# define LOG_GROUP LOG_GROUP_DEFAULT
+#endif
+#include <VBox/log.h>
+#include <VBox/VMMDev.h>
+
+#include <VBoxDisplay.h>
+#include <VBoxGuestInternal.h>
 #include <VBoxHook.h>
-#include <VBoxDisplay.h>
-#include <VBox/VMMDev.h>
-#include <iprt/assert.h>
-#include <malloc.h>
-#include <VBoxGuestInternal.h>
-#ifdef VBOX_WITH_WDDM
-#include <iprt/asm.h>
-#endif
+
+
 
 typedef struct _VBOXDISPLAYCONTEXT
@@ -57,5 +67,5 @@
 int VBoxDisplayInit(const VBOXSERVICEENV *pEnv, void **ppInstance, bool *pfStartThread)
 {
-    Log(("VBoxTray: VBoxDisplayInit ...\n"));
+    LogFlowFunc(("VBoxDisplayInit ...\n"));
 
     OSVERSIONINFO OSinfo;
@@ -69,5 +79,5 @@
     if (NULL == hUser)
     {
-        Log(("VBoxTray: VBoxDisplayInit: Could not get module handle of USER32.DLL!\n"));
+        LogFlowFunc(("Could not get module handle of USER32.DLL!\n"));
         return VERR_NOT_IMPLEMENTED;
     }
@@ -75,8 +85,8 @@
     {
         *(uintptr_t *)&gCtx.pfnChangeDisplaySettingsEx = (uintptr_t)GetProcAddress(hUser, "ChangeDisplaySettingsExA");
-        Log(("VBoxTray: VBoxDisplayInit: pfnChangeDisplaySettingsEx = %p\n", gCtx.pfnChangeDisplaySettingsEx));
+        LogFlowFunc(("pfnChangeDisplaySettingsEx = %p\n", gCtx.pfnChangeDisplaySettingsEx));
 
         *(uintptr_t *)&gCtx.pfnEnumDisplayDevices = (uintptr_t)GetProcAddress(hUser, "EnumDisplayDevicesA");
-        Log(("VBoxTray: VBoxDisplayInit: pfnEnumDisplayDevices = %p\n", gCtx.pfnEnumDisplayDevices));
+        LogFlowFunc(("pfnEnumDisplayDevices = %p\n", gCtx.pfnEnumDisplayDevices));
 
 #ifdef VBOX_WITH_WDDM
@@ -84,16 +94,16 @@
         {
             /* this is vista and up, check if we need to switch the display driver if to WDDM mode */
-            Log(("VBoxTray: VBoxDisplayInit: this is Windows Vista and up\n"));
+            LogFlowFunc(("this is Windows Vista and up\n"));
             VBOXDISPLAY_DRIVER_TYPE enmType = getVBoxDisplayDriverType (&gCtx);
             if (enmType == VBOXDISPLAY_DRIVER_TYPE_WDDM)
             {
-                Log(("VBoxTray: VBoxDisplayInit: WDDM driver is installed, switching display driver if to WDDM mode\n"));
+                LogFlowFunc(("WDDM driver is installed, switching display driver if to WDDM mode\n"));
                 /* this is hacky, but the most easiest way */
                 VBOXDISPIF_MODE enmMode = (OSinfo.dwMajorVersion > 6 || OSinfo.dwMinorVersion > 0) ? VBOXDISPIF_MODE_WDDM_W7 : VBOXDISPIF_MODE_WDDM;
                 DWORD err = VBoxDispIfSwitchMode(const_cast<PVBOXDISPIF>(&pEnv->dispIf), enmMode, NULL /* old mode, we don't care about it */);
                 if (err == NO_ERROR)
-                    Log(("VBoxTray: VBoxDisplayInit: DispIf switched to WDDM mode successfully\n"));
+                    LogFlowFunc(("DispIf switched to WDDM mode successfully\n"));
                 else
-                    Log(("VBoxTray: VBoxDisplayInit: Failed to switch DispIf to WDDM mode, err (%d)\n", err));
+                    LogFlowFunc(("Failed to switch DispIf to WDDM mode, err (%d)\n", err));
             }
         }
@@ -106,5 +116,5 @@
     else                                /* Unsupported platform */
     {
-        Log(("VBoxTray: VBoxDisplayInit: Warning, display for platform not handled yet!\n"));
+        LogFlowFunc(("Warning, display for platform not handled yet!\n"));
         return VERR_NOT_IMPLEMENTED;
     }
@@ -118,5 +128,5 @@
         gCtx.fAnyX = TRUE;
 
-    Log(("VBoxTray: VBoxDisplayInit: Display init successful\n"));
+    LogFlowFunc(("Display init successful\n"));
 
     *pfStartThread = true;
@@ -149,5 +159,5 @@
         dispDevice.cb = sizeof(DISPLAY_DEVICE);
 
-        Log(("VBoxTray: isVBoxDisplayDriverActive: Checking for active VBox display driver (W2K+) ...\n"));
+        LogFlowFunc(("isVBoxDisplayDriverActive: Checking for active VBox display driver (W2K+) ...\n"));
 
         while (EnumDisplayDevices(NULL,
@@ -156,5 +166,5 @@
                                   0))
         {
-            Log(("VBoxTray: isVBoxDisplayDriverActive: DevNum:%d\nName:%s\nString:%s\nID:%s\nKey:%s\nFlags=%08X\n\n",
+            LogFlowFunc(("isVBoxDisplayDriverActive: DevNum:%d\nName:%s\nString:%s\nID:%s\nKey:%s\nFlags=%08X\n\n",
                           devNum,
                           &dispDevice.DeviceName[0],
@@ -166,5 +176,5 @@
             if (dispDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
             {
-                Log(("VBoxTray: isVBoxDisplayDriverActive: Primary device\n"));
+                LogFlowFunc(("isVBoxDisplayDriverActive: Primary device\n"));
 
                 if (strcmp(&dispDevice.DeviceString[0], "VirtualBox Graphics Adapter") == 0)
@@ -191,5 +201,5 @@
     else    /* This must be NT 4 or something really old, so don't use EnumDisplayDevices() here  ... */
     {
-        Log(("VBoxTray: isVBoxDisplayDriverActive: Checking for active VBox display driver (NT or older) ...\n"));
+        LogFlowFunc(("isVBoxDisplayDriverActive: Checking for active VBox display driver (NT or older) ...\n"));
 
         DEVMODE tempDevMode;
@@ -249,5 +259,5 @@
             if(!(displayDevice.StateFlags & DISPLAY_DEVICE_ACTIVE))
             {
-                LogRel(("VBoxTray: Secondary Monitor with ID=%d and name=%s Not Enabled. Enabling it.\n", Id, displayDevice.DeviceName));
+                LogRel(("Secondary Monitor with ID=%d and name=%s Not Enabled. Enabling it.\n", Id, displayDevice.DeviceName));
                 deviceMode.dmPosition.x = paDeviceModes[0].dmPelsWidth;
                 deviceMode.dmPosition.y = 0;
@@ -272,5 +282,5 @@
                 if (aWidth !=0 && aHeight != 0)
                 {
-                    LogRel(("VBoxTray: Display : %s , Change Height: %d & Width: %d\n", displayDevice.DeviceName, aWidth, aHeight));
+                    LogRel(("Display : %s , Change Height: %d & Width: %d\n", displayDevice.DeviceName, aWidth, aHeight));
                     deviceMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL
                                           | DM_DISPLAYFREQUENCY | DM_DISPLAYFLAGS;
@@ -281,5 +291,5 @@
                 if (aPosX != 0 || aPosY != 0)
                 {
-                    LogRel(("VBoxTray: Display: %s PosX: %d, PosY: %d\n", displayDevice.DeviceName, aPosX, aPosY));
+                    LogRel(("Display: %s PosX: %d, PosY: %d\n", displayDevice.DeviceName, aPosX, aPosY));
                     deviceMode.dmFields |=  DM_POSITION;
                     deviceMode.dmPosition.x = aPosX;
@@ -294,5 +304,5 @@
         else /* Request is there to disable the monitor with ID = Id*/
         {
-            LogRel(("VBoxTray: Disable the Display: %d\n", displayDevice.DeviceName));
+            LogRel(("Disable the Display: %d\n", displayDevice.DeviceName));
 
             DEVMODE deviceModeTmp;
@@ -322,9 +332,9 @@
     while (EnumDisplayDevices (NULL, i, &DisplayDevice, 0))
     {
-        Log(("VBoxTray: ResizeDisplayDevice: [%d] %s\n", i, DisplayDevice.DeviceName));
+        LogFlowFunc(("ResizeDisplayDevice: [%d] %s\n", i, DisplayDevice.DeviceName));
 
         if (DisplayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
         {
-            Log(("VBoxTray: ResizeDisplayDevice: Found primary device. err %d\n", GetLastError ()));
+            LogFlowFunc(("ResizeDisplayDevice: Found primary device. err %d\n", GetLastError ()));
             NumDevices++;
         }
@@ -332,5 +342,5 @@
         {
 
-            Log(("VBoxTray: ResizeDisplayDevice: Found secondary device. err %d\n", GetLastError ()));
+            LogFlowFunc(("ResizeDisplayDevice: Found secondary device. err %d\n", GetLastError ()));
             NumDevices++;
         }
@@ -358,5 +368,5 @@
     while (EnumDisplayDevices (NULL, i, &DisplayDevice, 0))
     {
-        Log(("VBoxTray: ResizeDisplayDevice: [%d(%d)] %s\n", i, DevNum, DisplayDevice.DeviceName));
+        LogFlowFunc(("ResizeDisplayDevice: [%d(%d)] %s\n", i, DevNum, DisplayDevice.DeviceName));
 
         BOOL bFetchDevice = FALSE;
@@ -364,5 +374,5 @@
         if (DisplayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
         {
-            Log(("VBoxTray: ResizeDisplayDevice: Found primary device. err %d\n", GetLastError ()));
+            LogFlowFunc(("ResizeDisplayDevice: Found primary device. err %d\n", GetLastError ()));
             DevPrimaryNum = DevNum;
             bFetchDevice = TRUE;
@@ -371,5 +381,5 @@
         {
 
-            Log(("VBoxTray: ResizeDisplayDevice: Found secondary device. err %d\n", GetLastError ()));
+            LogFlowFunc(("ResizeDisplayDevice: Found secondary device. err %d\n", GetLastError ()));
             bFetchDevice = TRUE;
         }
@@ -379,5 +389,5 @@
             if (DevNum >= NumDevices)
             {
-                WARN(("VBoxTray: ResizeDisplayDevice: %d >= %d\n", NumDevices, DevNum));
+                LogFlowFunc(("ResizeDisplayDevice: %d >= %d\n", NumDevices, DevNum));
                 return ERROR_BUFFER_OVERFLOW;
             }
@@ -394,5 +404,5 @@
                  ENUM_REGISTRY_SETTINGS, &paDeviceModes[DevNum]))
             {
-                Log(("VBoxTray: ResizeDisplayDevice: EnumDisplaySettings error %d\n", GetLastError ()));
+                LogFlowFunc(("ResizeDisplayDevice: EnumDisplaySettings error %d\n", GetLastError ()));
             }
 
@@ -412,5 +422,5 @@
                      * Do not return here, ignore the error and set the display info to 0x0x0.
                      */
-                    Log(("VBoxTray: ResizeDisplayDevice: EnumDisplaySettings(ENUM_CURRENT_SETTINGS) error %d\n", GetLastError ()));
+                    LogFlowFunc(("ResizeDisplayDevice: EnumDisplaySettings(ENUM_CURRENT_SETTINGS) error %d\n", GetLastError ()));
                 }
             }
@@ -440,5 +450,5 @@
     DWORD dmFields = 0;
 
-    Log(("VBoxTray: ResizeDisplayDevice Width= %d, Height=%d , PosX=%d and PosY=%d \
+    LogFlowFunc(("ResizeDisplayDevice Width= %d, Height=%d , PosX=%d and PosY=%d \
          fEnabled = %d, fExtDisSup = %d\n",
           Width, Height, dwNewPosX, dwNewPosY, fEnabled, fExtDispSup));
@@ -453,9 +463,9 @@
     if (NumDevices == 0 || Id >= NumDevices)
     {
-        WARN(("VBoxTray: ResizeDisplayDevice: Requested identifier %d is invalid. err %d\n", Id, GetLastError ()));
+        LogFlowFunc(("ResizeDisplayDevice: Requested identifier %d is invalid. err %d\n", Id, GetLastError ()));
         return FALSE;
     }
 
-    Log(("VBoxTray: ResizeDisplayDevice: Found total %d devices. err %d\n", NumDevices, GetLastError ()));
+    LogFlowFunc(("ResizeDisplayDevice: Found total %d devices. err %d\n", NumDevices, GetLastError ()));
 
     DISPLAY_DEVICE *paDisplayDevices = (DISPLAY_DEVICE *)alloca (sizeof (DISPLAY_DEVICE) * NumDevices);
@@ -467,10 +477,10 @@
     if (dwStatus != NO_ERROR)
     {
-        WARN(("VBoxTray: ResizeDisplayDevice: VBoxGetDisplayConfig failed, %d\n", dwStatus));
+        LogFlowFunc(("ResizeDisplayDevice: VBoxGetDisplayConfig failed, %d\n", dwStatus));
         return dwStatus;
     }
 
     if (NumDevices != DevNum)
-        WARN(("VBoxTray: ResizeDisplayDevice: NumDevices(%d) != DevNum(%d)\n", NumDevices, DevNum));
+        LogFlowFunc(("ResizeDisplayDevice: NumDevices(%d) != DevNum(%d)\n", NumDevices, DevNum));
 
     DWORD i = 0;
@@ -480,6 +490,6 @@
         if (fExtDispSup)
         {
-            LogRel(("VBoxTray: Extended Display Support.\n"));
-            Log(("VBoxTray: ResizeDisplayDevice1: %dx%dx%d at %d,%d . Id = %d and DevNum=%d, fEnabled=%d\n",
+            LogRel(("Extended Display Support.\n"));
+            LogFlowFunc(("ResizeDisplayDevice1: %dx%dx%d at %d,%d . Id = %d and DevNum=%d, fEnabled=%d\n",
                   paDeviceModes[Id].dmPelsWidth,
                   paDeviceModes[Id].dmPelsHeight,
@@ -491,5 +501,5 @@
         else
         {
-            LogRel(("VBoxTray: NO Ext Display Support \n"));
+            LogRel(("NO Ext Display Support \n"));
         }
 
@@ -503,5 +513,5 @@
     if (paDisplayDevices[Id].StateFlags & DISPLAY_DEVICE_ACTIVE)
     {
-        LogRel(("VBoxTray: Display with ID=%d already enabled\n", Id));
+        LogRel(("Display with ID=%d already enabled\n", Id));
         fDispAlreadyEnabled = TRUE;
     }
@@ -559,5 +569,5 @@
         && paDeviceModes[Id].dmBitsPerPel == BitsPerPixel)
     {
-        LogRel(("VBoxTray: Already at desired resolution. No Change.\n"));
+        LogRel(("Already at desired resolution. No Change.\n"));
         return FALSE;
     }
@@ -568,5 +578,5 @@
     for (i = 0; i < NumDevices; i++)
     {
-        Log(("VBoxTray: ResizeDisplayDevice: [%d]: %d,%d %dx%d\n",
+        LogFlowFunc(("ResizeDisplayDevice: [%d]: %d,%d %dx%d\n",
                 i, paRects[i].left, paRects[i].top,
                 paRects[i].right - paRects[i].left,
@@ -597,10 +607,10 @@
             if (!(paDeviceModes[i].dmFields & DM_BITSPERPEL))
             {
-                WARN(("VBoxTray: (WDDM) no DM_BITSPERPEL\n"));
+                LogFlowFunc(("no DM_BITSPERPEL\n"));
                 paDeviceModes[i].dmFields |= DM_BITSPERPEL;
                 paDeviceModes[i].dmBitsPerPel = 32;
             }
 
-            Log(("VBoxTray: (WDDM) ResizeDisplayDevice: pfnChangeDisplaySettingsEx %x: %dx%dx%d at %d,%d\n",
+            LogFlowFunc(("ResizeDisplayDevice: pfnChangeDisplaySettingsEx %x: %dx%dx%d at %d,%d\n",
                   gCtx.pfnChangeDisplaySettingsEx,
                   paDeviceModes[i].dmPelsWidth,
@@ -611,16 +621,16 @@
         }
 
-        Log(("VBoxTray: (WDDM) Request to resize the displa\n"));
+        LogFlowFunc(("Request to resize the displa\n"));
         DWORD err = VBoxDispIfResizeModes(&pCtx->pEnv->dispIf, Id, fEnabled, fExtDispSup, paDisplayDevices, paDeviceModes, DevNum);
         if (err == NO_ERROR || err != ERROR_RETRY)
         {
             if (err == NO_ERROR)
-                Log(("VBoxTray: VBoxDisplayThread: (WDDM) VBoxDispIfResizeModes succeeded\n"));
+                LogFlowFunc(("VBoxDispIfResizeModes succeeded\n"));
             else
-               WARN(("VBoxTray: VBoxDisplayThread: (WDDM) Failure VBoxDispIfResizeModes (%d)\n", err));
+               LogFlowFunc(("Failure VBoxDispIfResizeModes (%d)\n", err));
             return FALSE;
         }
 
-        Log(("VBoxTray: ResizeDisplayDevice: (WDDM) RETRY requested\n"));
+        LogFlowFunc(("ResizeDisplayDevice: RETRY requested\n"));
         return TRUE;
     }
@@ -635,5 +645,5 @@
         tempDevMode.dmSize = sizeof(DEVMODE);
         EnumDisplaySettings((LPSTR)paDisplayDevices[i].DeviceName, 0xffffff, &tempDevMode);
-        Log(("VBoxTray: ResizeDisplayDevice: EnumDisplaySettings last error %d\n", GetLastError ()));
+        LogFlowFunc(("ResizeDisplayDevice: EnumDisplaySettings last error %d\n", GetLastError ()));
     }
 
@@ -658,5 +668,5 @@
         }
 
-        Log(("VBoxTray: ResizeDisplayDevice: pfnChangeDisplaySettingsEx Current MonitorId=%d: %dx%dx%d at %d,%d\n",
+        LogFlowFunc(("ResizeDisplayDevice: pfnChangeDisplaySettingsEx Current MonitorId=%d: %dx%dx%d at %d,%d\n",
               i,
               paDeviceModes[i].dmPelsWidth,
@@ -668,8 +678,8 @@
         LONG status = gCtx.pfnChangeDisplaySettingsEx((LPSTR)paDisplayDevices[i].DeviceName,
                                         &paDeviceModes[i], NULL, CDS_NORESET | CDS_UPDATEREGISTRY, NULL);
-        Log(("VBoxTray: ResizeDisplayDevice: ChangeDisplaySettingsEx position status %d, err %d\n", status, GetLastError ()));
-    }
-
-    Log(("VBoxTray: Enable And Resize Device. Id = %d, Width=%d Height=%d, \
+        LogFlowFunc(("ResizeDisplayDevice: ChangeDisplaySettingsEx position status %d, err %d\n", status, GetLastError ()));
+    }
+
+    LogFlowFunc(("Enable And Resize Device. Id = %d, Width=%d Height=%d, \
          dwNewPosX = %d, dwNewPosY = %d fEnabled=%d & fExtDispSupport = %d \n",
          Id, Width, Height, dwNewPosX, dwNewPosY, fEnabled, fExtDispSup));
@@ -693,5 +703,5 @@
 unsigned __stdcall VBoxDisplayThread(void *pInstance)
 {
-    Log(("VBoxTray: VBoxDisplayThread: Entered\n"));
+    LogFlowFunc(("Entered\n"));
 
     VBOXDISPLAYCONTEXT *pCtx = (VBOXDISPLAYCONTEXT *)pInstance;
@@ -705,5 +715,5 @@
     if (!DeviceIoControl(gVBoxDriver, VBOXGUEST_IOCTL_CTL_FILTER_MASK, &maskInfo, sizeof (maskInfo), NULL, 0, &cbReturned, NULL))
     {
-        Log(("VBoxTray: VBoxDisplayThread: DeviceIOControl(CtlMask - or) failed, thread exiting\n"));
+        LogFlowFunc(("DeviceIOControl(CtlMask - or) failed, thread exiting\n"));
         return 0;
     }
@@ -722,13 +732,13 @@
         if (DeviceIoControl(gVBoxDriver, VBOXGUEST_IOCTL_WAITEVENT, &waitEvent, sizeof(waitEvent), &waitEvent, sizeof(waitEvent), &cbReturned, NULL))
         {
-            /*Log(("VBoxTray: VBoxDisplayThread: DeviceIOControl succeeded\n"));*/
+            /*LogFlowFunc(("DeviceIOControl succeeded\n"));*/
 
             if (NULL == pCtx) {
-                Log(("VBoxTray: VBoxDisplayThread: Invalid context detected!\n"));
+                LogFlowFunc(("Invalid context detected!\n"));
                 break;
             }
 
             if (NULL == pCtx->pEnv) {
-                Log(("VBoxTray: VBoxDisplayThread: Invalid context environment detected!\n"));
+                LogFlowFunc(("Invalid context environment detected!\n"));
                 break;
             }
@@ -738,10 +748,10 @@
                 break;
 
-            /*Log(("VBoxTray: VBoxDisplayThread: checking event\n"));*/
+            /*LogFlowFunc(("checking event\n"));*/
 
             /* did we get the right event? */
             if (waitEvent.u32EventFlagsOut & VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST)
             {
-                Log(("VBoxTray: VBoxDisplayThread: going to get display change information\n"));
+                LogFlowFunc(("going to get display change information\n"));
                 BOOL fDisplayChangeQueried;
 
@@ -763,5 +773,5 @@
                if (!fDisplayChangeQueried)
                {
-                    Log(("VBoxTray: Extended Display Not Supported. Trying VMMDevDisplayChangeRequest2\n"));
+                    LogFlowFunc(("Extended Display Not Supported. Trying VMMDevDisplayChangeRequest2\n"));
                     fExtDispSup = FALSE; /* Extended display Change request is not supported */
 
@@ -780,5 +790,5 @@
                 if (!fDisplayChangeQueried)
                 {
-                    Log(("VBoxTray: Extended Display Not Supported. Trying VMMDevDisplayChangeRequest\n"));
+                    LogFlowFunc(("Extended Display Not Supported. Trying VMMDevDisplayChangeRequest\n"));
                     fExtDispSup = FALSE; /*Extended display Change request is not supported */
                     /* Try the old version of the request for old VBox hosts. */
@@ -801,5 +811,5 @@
                     for (;;)
                     {
-                        Log(("VBoxTray: VBoxDisplayThread: VMMDevReq_GetDisplayChangeRequest2: %dx%dx%d at %d\n", displayChangeRequest.xres, displayChangeRequest.yres, displayChangeRequest.bpp, displayChangeRequest.display));
+                        LogFlowFunc(("VMMDevReq_GetDisplayChangeRequest2: %dx%dx%d at %d\n", displayChangeRequest.xres, displayChangeRequest.yres, displayChangeRequest.bpp, displayChangeRequest.display));
 
                         /*
@@ -810,5 +820,5 @@
 
                         if (enmDriverType == VBOXDISPLAY_DRIVER_TYPE_WDDM)
-                            Log(("VBoxTray: VBoxDisplayThread: Detected WDDM Driver\n"));
+                            LogFlowFunc(("Detected WDDM Driver\n"));
 
                         if (enmDriverType != VBOXDISPLAY_DRIVER_TYPE_UNKNOWN)
@@ -817,11 +827,11 @@
 #endif
                         {
-                            Log(("VBoxTray: VBoxDisplayThread: Display driver is active!\n"));
+                            LogFlowFunc(("Display driver is active!\n"));
 
                             if (pCtx->pfnChangeDisplaySettingsEx != 0)
                             {
-                                Log(("VBoxTray: VBoxDisplayThread: Detected W2K or later\n"));
+                                LogFlowFunc(("Detected W2K or later\n"));
                                 /* W2K or later. */
-                                Log(("DisplayChangeReqEx parameters  aDisplay=%d x xRes=%d x yRes=%d x bpp=%d x SecondayMonEnb=%d x NewOriginX=%d x NewOriginY=%d x ChangeOrigin=%d\n",
+                                LogFlowFunc(("DisplayChangeReqEx parameters  aDisplay=%d x xRes=%d x yRes=%d x bpp=%d x SecondayMonEnb=%d x NewOriginX=%d x NewOriginY=%d x ChangeOrigin=%d\n",
                                      displayChangeRequest.display,
                                      displayChangeRequest.xres,
@@ -843,5 +853,5 @@
                                                          ))
                                 {
-                                    Log(("ResizeDipspalyDevice return 0\n"));
+                                    LogFlowFunc(("ResizeDipspalyDevice return 0\n"));
                                     break;
                                 }
@@ -850,5 +860,5 @@
                             else
                             {
-                                Log(("VBoxTray: VBoxDisplayThread: Detected NT\n"));
+                                LogFlowFunc(("Detected NT\n"));
 
                                 /* Single monitor NT. */
@@ -860,5 +870,5 @@
                                 if (EnumDisplaySettings(NULL, ENUM_REGISTRY_SETTINGS, &devMode))
                                 {
-                                    Log(("VBoxTray: VBoxDisplayThread: Current mode: %d x %d x %d at %d,%d\n",
+                                    LogFlowFunc(("Current mode: %d x %d x %d at %d,%d\n",
                                           devMode.dmPelsWidth, devMode.dmPelsHeight, devMode.dmBitsPerPel, devMode.dmPosition.x, devMode.dmPosition.y));
 
@@ -879,5 +889,5 @@
                                     {
                                         /* All zero values means a forced mode reset. Do nothing. */
-                                        Log(("VBoxTray: VBoxDisplayThread: Forced mode reset\n"));
+                                        LogFlowFunc(("Forced mode reset\n"));
                                     }
 
@@ -887,5 +897,5 @@
                                         && devMode.dmBitsPerPel == displayChangeRequest.bpp)
                                     {
-                                        Log(("VBoxTray: VBoxDisplayThread: already at desired resolution\n"));
+                                        LogFlowFunc(("already at desired resolution\n"));
                                         break;
                                     }
@@ -905,5 +915,5 @@
                                         devMode.dmBitsPerPel = displayChangeRequest.bpp;
 
-                                    Log(("VBoxTray: VBoxDisplayThread: setting new mode %d x %d, %d BPP\n",
+                                    LogFlowFunc(("setting new mode %d x %d, %d BPP\n",
                                          devMode.dmPelsWidth, devMode.dmPelsHeight, devMode.dmBitsPerPel));
 
@@ -912,5 +922,5 @@
                                     if (status != DISP_CHANGE_SUCCESSFUL)
                                     {
-                                        Log(("VBoxTray: VBoxDisplayThread: error from ChangeDisplaySettings: %d\n", status));
+                                        LogFlowFunc(("error from ChangeDisplaySettings: %d\n", status));
 
                                         if (status == DISP_CHANGE_BADMODE)
@@ -928,5 +938,5 @@
                                 else
                                 {
-                                    Log(("VBoxTray: VBoxDisplayThread: error from EnumDisplaySettings: %d\n", GetLastError ()));
+                                    LogFlowFunc(("error from EnumDisplaySettings: %d\n", GetLastError ()));
                                     break;
                                 }
@@ -935,5 +945,5 @@
                         else
                         {
-                            Log(("VBoxTray: VBoxDisplayThread: vboxDisplayDriver is not active\n"));
+                            LogFlowFunc(("vboxDisplayDriver is not active\n"));
                         }
 
@@ -949,5 +959,5 @@
                 else
                 {
-                    Log(("VBoxTray: VBoxDisplayThread: error from DeviceIoControl VBOXGUEST_IOCTL_VMMREQUEST\n"));
+                    LogFlowFunc(("error from DeviceIoControl VBOXGUEST_IOCTL_VMMREQUEST\n"));
                     /* sleep a bit to not eat too much CPU while retrying */
                     /* are we supposed to stop? */
@@ -965,5 +975,5 @@
         {
 #ifndef DEBUG_andy /* Too noisy for me. */
-            Log(("VBoxTray: VBoxDisplayThread: error 0 from DeviceIoControl VBOXGUEST_IOCTL_WAITEVENT\n"));
+            LogFlowFunc(("error 0 from DeviceIoControl VBOXGUEST_IOCTL_WAITEVENT\n"));
 #endif
             /* sleep a bit to not eat too much CPU in case the above call always fails */
@@ -982,8 +992,8 @@
     maskInfo.u32NotMask = VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST | VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED;
     if (!DeviceIoControl(gVBoxDriver, VBOXGUEST_IOCTL_CTL_FILTER_MASK, &maskInfo, sizeof (maskInfo), NULL, 0, &cbReturned, NULL))
-        Log(("VBoxTray: VBoxDisplayThread: DeviceIOControl(CtlMask - not) failed\n"));
+        LogFlowFunc(("DeviceIOControl(CtlMask - not) failed\n"));
     PostMessage(ghwndToolWindow, WM_VBOX_GRAPHICS_UNSUPPORTED, 0, 0);
 
-    Log(("VBoxTray: VBoxDisplayThread: finished display change request thread\n"));
+    LogFlowFunc(("finished display change request thread\n"));
     return 0;
 }
