mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +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)
|
||||
{
|
||||
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 ||
|
||||
|
|
Loading…
Reference in a new issue