Author: fireball
Date: Sun Sep 9 15:04:22 2007
New Revision: 28970
URL:
http://svn.reactos.org/svn/reactos?rev=28970&view=rev
Log:
Changes partly based on a patch and ideas by Gregor Brunmar
<gregor.brunmar(a)home.se>se>:
- Fix size argument in calls to RegQueryValueEx() (if some fails, it may not be equal to
sizeof(DWORD)).
- If it's impossible to read settings from vmware's registry key, obtain current
screen settings and pass them.
Modified:
trunk/reactos/base/setup/vmwinst/vmwinst.c
Modified: trunk/reactos/base/setup/vmwinst/vmwinst.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/vmwinst/vmwinst…
==============================================================================
--- trunk/reactos/base/setup/vmwinst/vmwinst.c (original)
+++ trunk/reactos/base/setup/vmwinst/vmwinst.c Sun Sep 9 15:04:22 2007
@@ -203,24 +203,39 @@
LoadResolutionSettings(DWORD *ResX, DWORD *ResY, DWORD *ColDepth)
{
HKEY hReg;
- DWORD Type, Size;
+ DWORD Type, Size = sizeof(DWORD);
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
L"SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Device0",
0, KEY_QUERY_VALUE, &hReg) != ERROR_SUCCESS)
{
- return FALSE;
- }
+ DEVMODE CurrentDevMode;
+
+ /* If this key is absent, just get current settings */
+ memset(&CurrentDevMode, 0, sizeof(CurrentDevMode));
+ CurrentDevMode.dmSize = sizeof(CurrentDevMode);
+ if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &CurrentDevMode) == TRUE)
+ {
+ *ColDepth = CurrentDevMode.dmBitsPerPel;
+ *ResX = CurrentDevMode.dmPelsWidth;
+ *ResY = CurrentDevMode.dmPelsHeight;
+
+ return TRUE;
+ }
+ }
+
if(RegQueryValueEx(hReg, L"DefaultSettings.BitsPerPel", 0, &Type,
(BYTE*)ColDepth, &Size) != ERROR_SUCCESS ||
Type != REG_DWORD)
{
*ColDepth = 8;
+ Size = sizeof(DWORD);
}
if(RegQueryValueEx(hReg, L"DefaultSettings.XResolution", 0, &Type,
(BYTE*)ResX, &Size) != ERROR_SUCCESS ||
Type != REG_DWORD)
{
*ResX = 640;
+ Size = sizeof(DWORD);
}
if(RegQueryValueEx(hReg, L"DefaultSettings.YResolution", 0, &Type,
(BYTE*)ResY, &Size) != ERROR_SUCCESS ||