mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 22:52:54 +00:00
Changes partly based on a patch and ideas by Gregor Brunmar <gregor.brunmar@home.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. svn path=/trunk/; revision=28970
This commit is contained in:
parent
87351e3290
commit
b4bf4d4ce9
1 changed files with 17 additions and 2 deletions
|
@ -203,24 +203,39 @@ static BOOL
|
||||||
LoadResolutionSettings(DWORD *ResX, DWORD *ResY, DWORD *ColDepth)
|
LoadResolutionSettings(DWORD *ResX, DWORD *ResY, DWORD *ColDepth)
|
||||||
{
|
{
|
||||||
HKEY hReg;
|
HKEY hReg;
|
||||||
DWORD Type, Size;
|
DWORD Type, Size = sizeof(DWORD);
|
||||||
|
|
||||||
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||||
L"SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Device0",
|
L"SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Device0",
|
||||||
0, KEY_QUERY_VALUE, &hReg) != ERROR_SUCCESS)
|
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 ||
|
if(RegQueryValueEx(hReg, L"DefaultSettings.BitsPerPel", 0, &Type, (BYTE*)ColDepth, &Size) != ERROR_SUCCESS ||
|
||||||
Type != REG_DWORD)
|
Type != REG_DWORD)
|
||||||
{
|
{
|
||||||
*ColDepth = 8;
|
*ColDepth = 8;
|
||||||
|
Size = sizeof(DWORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(RegQueryValueEx(hReg, L"DefaultSettings.XResolution", 0, &Type, (BYTE*)ResX, &Size) != ERROR_SUCCESS ||
|
if(RegQueryValueEx(hReg, L"DefaultSettings.XResolution", 0, &Type, (BYTE*)ResX, &Size) != ERROR_SUCCESS ||
|
||||||
Type != REG_DWORD)
|
Type != REG_DWORD)
|
||||||
{
|
{
|
||||||
*ResX = 640;
|
*ResX = 640;
|
||||||
|
Size = sizeof(DWORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(RegQueryValueEx(hReg, L"DefaultSettings.YResolution", 0, &Type, (BYTE*)ResY, &Size) != ERROR_SUCCESS ||
|
if(RegQueryValueEx(hReg, L"DefaultSettings.YResolution", 0, &Type, (BYTE*)ResY, &Size) != ERROR_SUCCESS ||
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue