Changeset 32592 in vbox for trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDisplay.cpp
- Timestamp:
- Sep 17, 2010 11:34:06 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDisplay.cpp
r32588 r32592 65 65 int VBoxDisplayInit(const VBOXSERVICEENV *pEnv, void **ppInstance, bool *pfStartThread) 66 66 { 67 Log(("VBoxTray: VBoxDisplayInit ...\n")); 68 67 69 OSVERSIONINFO OSinfo; 68 70 OSinfo.dwOSVersionInfoSize = sizeof (OSinfo); … … 75 77 if (NULL == hUser) 76 78 { 77 Log(("VBoxTray: Could not get module handle of USER32.DLL!\n"));79 Log(("VBoxTray: VBoxDisplayInit: Could not get module handle of USER32.DLL!\n")); 78 80 return VERR_NOT_IMPLEMENTED; 79 81 } … … 81 83 { 82 84 *(uintptr_t *)&gCtx.pfnChangeDisplaySettingsEx = (uintptr_t)GetProcAddress(hUser, "ChangeDisplaySettingsExA"); 83 Log(("VBoxTray: pfnChangeDisplaySettingsEx = %p\n", gCtx.pfnChangeDisplaySettingsEx));85 Log(("VBoxTray: VBoxDisplayInit: pfnChangeDisplaySettingsEx = %p\n", gCtx.pfnChangeDisplaySettingsEx)); 84 86 85 87 *(uintptr_t *)&gCtx.pfnEnumDisplayDevices = (uintptr_t)GetProcAddress(hUser, "EnumDisplayDevicesA"); 86 Log(("VBoxTray: pfnEnumDisplayDevices = %p\n", gCtx.pfnEnumDisplayDevices));88 Log(("VBoxTray: VBoxDisplayInit: pfnEnumDisplayDevices = %p\n", gCtx.pfnEnumDisplayDevices)); 87 89 88 90 #ifdef VBOXWDDM … … 90 92 { 91 93 /* this is vista and up, check if we need to switch the display driver if to WDDM mode */ 92 Log(("VBoxTray: this is vista and up\n"));94 Log(("VBoxTray: VBoxDisplayInit: this is Windows Vista and up\n")); 93 95 VBOXDISPLAY_DRIVER_TYPE enmType = getVBoxDisplayDriverType (&gCtx); 94 96 if (enmType == VBOXDISPLAY_DRIVER_TYPE_WDDM) 95 97 { 96 Log(("VBoxTray: WDDM driver is installed, switching display driver if to WDDM mode\n"));98 Log(("VBoxTray: VBoxDisplayInit: WDDM driver is installed, switching display driver if to WDDM mode\n")); 97 99 /* this is hacky, but the most easiest way */ 98 100 DWORD err = VBoxDispIfSwitchMode(const_cast<PVBOXDISPIF>(&pEnv->dispIf), VBOXDISPIF_MODE_WDDM, NULL /* old mode, we don't care about it */); 99 101 if (err == NO_ERROR) 100 Log(("VBoxTray: DispIf switched to WDDM mode successfully\n"));102 Log(("VBoxTray: VBoxDisplayInit: DispIf switched to WDDM mode successfully\n")); 101 103 else 102 Log(("VBoxTray: failed to switch DispIf to WDDM mode, err (%d)\n", err));104 Log(("VBoxTray: VBoxDisplayInit: Failed to switch DispIf to WDDM mode, err (%d)\n", err)); 103 105 } 104 106 } … … 111 113 else /* Unsupported platform */ 112 114 { 113 Log(("VBoxTray: Warning, display for platform not handled yet!\n"));115 Log(("VBoxTray: VBoxDisplayInit: Warning, display for platform not handled yet!\n")); 114 116 return VERR_NOT_IMPLEMENTED; 115 117 } 116 118 117 Log(("VBoxTray: Display init successful.\n"));119 Log(("VBoxTray: VBoxDisplayInit: Display init successful\n")); 118 120 119 121 *pfStartThread = true; … … 128 130 129 131 #ifdef VBOXWDDM 130 static VBOXDISPLAY_DRIVER_TYPE getVBoxDisplayDriverType 132 static VBOXDISPLAY_DRIVER_TYPE getVBoxDisplayDriverType(VBOXDISPLAYCONTEXT *pCtx) 131 133 #else 132 static bool isVBoxDisplayDriverActive 134 static bool isVBoxDisplayDriverActive(VBOXDISPLAYCONTEXT *pCtx) 133 135 #endif 134 136 { … … 146 148 dispDevice.cb = sizeof(DISPLAY_DEVICE); 147 149 148 Log(("VBoxTray: Checking for active VBox display driver (W2K+)...\n"));150 Log(("VBoxTray: isVBoxDisplayDriverActive: Checking for active VBox display driver (W2K+) ...\n")); 149 151 150 152 while (EnumDisplayDevices(NULL, … … 153 155 0)) 154 156 { 155 Log(("VBoxTray: DevNum:%d\nName:%s\nString:%s\nID:%s\nKey:%s\nFlags=%08X\n\n",157 Log(("VBoxTray: isVBoxDisplayDriverActive: DevNum:%d\nName:%s\nString:%s\nID:%s\nKey:%s\nFlags=%08X\n\n", 156 158 devNum, 157 159 &dispDevice.DeviceName[0], … … 163 165 if (dispDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) 164 166 { 165 Log(("VBoxTray: Primary device.\n"));167 Log(("VBoxTray: isVBoxDisplayDriverActive: Primary device\n")); 166 168 167 169 if (strcmp(&dispDevice.DeviceString[0], "VirtualBox Graphics Adapter") == 0) … … 185 187 else /* This must be NT 4 or something really old, so don't use EnumDisplayDevices() here ... */ 186 188 { 187 Log(("VBoxTray: Checking for active VBox display driver (NT or older)...\n"));189 Log(("VBoxTray: isVBoxDisplayDriverActive: Checking for active VBox display driver (NT or older) ...\n")); 188 190 189 191 DEVMODE tempDevMode; … … 209 211 210 212 /* Returns TRUE to try again. */ 211 static BOOL ResizeDisplayDevice( 212 ULONG Id, DWORD Width, DWORD Height, DWORD BitsPerPixel 213 ) 213 static BOOL ResizeDisplayDevice(ULONG Id, DWORD Width, DWORD Height, DWORD BitsPerPixel) 214 214 { 215 215 BOOL fModeReset = (Width == 0 && Height == 0 && BitsPerPixel == 0); … … 225 225 while (EnumDisplayDevices (NULL, i, &DisplayDevice, 0)) 226 226 { 227 Log(("VBoxTray: [%d] %s\n", i, DisplayDevice.DeviceName));227 Log(("VBoxTray: ResizeDisplayDevice: [%d] %s\n", i, DisplayDevice.DeviceName)); 228 228 229 229 if (DisplayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) … … 302 302 ENUM_REGISTRY_SETTINGS, &paDeviceModes[DevNum])) 303 303 { 304 Log(("VBoxTray: ResizeDisplayDevice: EnumDisplaySettings err %d\n", GetLastError ()));304 Log(("VBoxTray: ResizeDisplayDevice: EnumDisplaySettings error %d\n", GetLastError ())); 305 305 return FALSE; 306 306 } … … 321 321 * Do not return here, ignore the error and set the display info to 0x0x0. 322 322 */ 323 Log(("VBoxTray: EnumDisplaySettings(ENUM_CURRENT_SETTINGS) err %d\n", GetLastError ()));323 Log(("VBoxTray: ResizeDisplayDevice: EnumDisplaySettings(ENUM_CURRENT_SETTINGS) error %d\n", GetLastError ())); 324 324 ZeroMemory(&paDeviceModes[DevNum], sizeof(DEVMODE)); 325 325 } … … 443 443 * requests 444 444 */ 445 unsigned __stdcall VBoxDisplayThread 445 unsigned __stdcall VBoxDisplayThread(void *pInstance) 446 446 { 447 Log(("VBoxTray: VBoxDisplayThread: Entered\n")); 448 447 449 VBOXDISPLAYCONTEXT *pCtx = (VBOXDISPLAYCONTEXT *)pInstance; 448 450 HANDLE gVBoxDriver = pCtx->pEnv->hDriver; … … 453 455 maskInfo.u32OrMask = VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST | VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED; 454 456 maskInfo.u32NotMask = 0; 455 if (DeviceIoControl 457 if (DeviceIoControl(gVBoxDriver, VBOXGUEST_IOCTL_CTL_FILTER_MASK, &maskInfo, sizeof (maskInfo), NULL, 0, &cbReturned, NULL)) 456 458 { 457 459 Log(("VBoxTray: VBoxDisplayThread: DeviceIOControl(CtlMask - or) succeeded\n")); … … 465 467 do 466 468 { 467 /* wait for a display change event*/469 /* Wait for a display change event. */ 468 470 VBoxGuestWaitEventInfo waitEvent; 469 471 waitEvent.u32TimeoutIn = 1000;
Note:
See TracChangeset
for help on using the changeset viewer.