Changeset 44136 in vbox
- Timestamp:
- Dec 14, 2012 2:53:09 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDispIf.cpp
r44040 r44136 757 757 int i = 0; 758 758 UINT cMatched = 0; 759 DEVMODE DeviceMode;759 DEVMODE CurDevMode, RegDevMode; 760 760 for (int i = 0; ; ++i) 761 761 { … … 794 794 * a current video mode (ENUM_CURRENT_SETTINGS). 795 795 */ 796 ZeroMemory(& DeviceMode, sizeof(DeviceMode));797 DeviceMode.dmSize = sizeof(DEVMODE);796 ZeroMemory(&RegDevMode, sizeof(RegDevMode)); 797 RegDevMode.dmSize = sizeof(DEVMODE); 798 798 if (!EnumDisplaySettings((LPSTR)DisplayDevice.DeviceName, 799 ENUM_REGISTRY_SETTINGS, & DeviceMode))799 ENUM_REGISTRY_SETTINGS, &RegDevMode)) 800 800 { 801 801 Log(("VBoxTray: vboxDispIfValidateResize: EnumDisplaySettings error %d\n", GetLastError ())); … … 803 803 } 804 804 805 if ( DeviceMode.dmPelsWidth == 0 806 || DeviceMode.dmPelsHeight == 0) 807 { 808 /* No ENUM_REGISTRY_SETTINGS yet. Seen on Vista after installation. 809 * Get the current video mode then. 810 */ 811 ZeroMemory(&DeviceMode, sizeof(DeviceMode)); 812 DeviceMode.dmSize = sizeof(DeviceMode); 813 if (!EnumDisplaySettings((LPSTR)DisplayDevice.DeviceName, 814 ENUM_CURRENT_SETTINGS, &DeviceMode)) 805 /* with Win8 WDDM Display-only driver, it seems like sometimes we get an auto-resize setting being stored in registry, although current settings do not match */ 806 ZeroMemory(&CurDevMode, sizeof(CurDevMode)); 807 CurDevMode.dmSize = sizeof(CurDevMode); 808 if (!EnumDisplaySettings((LPSTR)DisplayDevice.DeviceName, 809 ENUM_CURRENT_SETTINGS, &CurDevMode)) 810 { 811 /* ENUM_CURRENT_SETTINGS returns FALSE when the display is not active: 812 * for example a disabled secondary display */ 813 Log(("VBoxTray: vboxDispIfValidateResize: EnumDisplaySettings(ENUM_CURRENT_SETTINGS) error %d\n", GetLastError ())); 814 return FALSE; 815 } 816 817 /* No ENUM_REGISTRY_SETTINGS yet. Seen on Vista after installation. 818 * Get the current video mode then. 819 */ 820 if ( RegDevMode.dmPelsWidth != 0 821 && RegDevMode.dmPelsHeight == 0) 822 { 823 if (CurDevMode.dmBitsPerPel != RegDevMode.dmBitsPerPel 824 || CurDevMode.dmPelsWidth != RegDevMode.dmPelsWidth 825 || CurDevMode.dmPelsHeight != RegDevMode.dmPelsHeight 826 || CurDevMode.dmPosition.x != RegDevMode.dmPosition.x 827 || CurDevMode.dmPosition.y != RegDevMode.dmPosition.y) 815 828 { 816 /* ENUM_CURRENT_SETTINGS returns FALSE when the display is not active: 817 * for example a disabled secondary display */ 818 Log(("VBoxTray: vboxDispIfValidateResize: EnumDisplaySettings(ENUM_CURRENT_SETTINGS) error %d\n", GetLastError ())); 829 Log(("VBoxTray: vboxDispIfValidateResize: current settings do not match registry settings, trating as no-match")); 819 830 return FALSE; 820 831 } … … 824 835 for (; j < cDevModes; ++j) 825 836 { 826 if (!strncmp(DisplayDevice.DeviceName, paDisplayDevices[j].DeviceName, RT_ELEMENTS( DeviceMode.dmDeviceName)))837 if (!strncmp(DisplayDevice.DeviceName, paDisplayDevices[j].DeviceName, RT_ELEMENTS(CurDevMode.dmDeviceName))) 827 838 { 828 if (paDeviceModes[j].dmBitsPerPel != DeviceMode.dmBitsPerPel829 || (paDeviceModes[j].dmPelsWidth & 0xfff8) != ( DeviceMode.dmPelsWidth & 0xfff8)830 || (paDeviceModes[j].dmPelsHeight & 0xfff8) != ( DeviceMode.dmPelsHeight & 0xfff8)831 || (paDeviceModes[j].dmPosition.x & 0xfff8) != ( DeviceMode.dmPosition.x & 0xfff8)832 || (paDeviceModes[j].dmPosition.y & 0xfff8) != ( DeviceMode.dmPosition.y & 0xfff8)839 if (paDeviceModes[j].dmBitsPerPel != CurDevMode.dmBitsPerPel 840 || (paDeviceModes[j].dmPelsWidth & 0xfff8) != (CurDevMode.dmPelsWidth & 0xfff8) 841 || (paDeviceModes[j].dmPelsHeight & 0xfff8) != (CurDevMode.dmPelsHeight & 0xfff8) 842 || (paDeviceModes[j].dmPosition.x & 0xfff8) != (CurDevMode.dmPosition.x & 0xfff8) 843 || (paDeviceModes[j].dmPosition.y & 0xfff8) != (CurDevMode.dmPosition.y & 0xfff8) 833 844 || (paDisplayDevices[j].StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP) != (DisplayDevice.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) 834 845 {
Note:
See TracChangeset
for help on using the changeset viewer.