DXGL r820 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r819‎ | r820 | r821 >
Date:00:17, 23 June 2018
Author:admin
Status:new
Tags:
Comment:
Fix detection of Windows 8 and above, and combine added color depths with the previous ones.
Modified paths:
  • /cfgmgr/cfgmgr.c (modified) (history)

Diff [purge]

Index: cfgmgr/cfgmgr.c
@@ -681,6 +681,15 @@
682682 RegSetValueEx(hKey, _T("InstallPath"), 0, REG_SZ,
683683 (LPBYTE)path, _tcslen(path) * sizeof(TCHAR));
684684 }
 685+ if (global && !cfg->Windows8Detected)
 686+ {
 687+ OSVERSIONINFO osver;
 688+ osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
 689+ GetVersionEx(&osver);
 690+ if (osver.dwMajorVersion > 6) cfg->Windows8Detected = TRUE;
 691+ if ((osver.dwMajorVersion == 6) && (osver.dwMinorVersion >= 2)) cfg->Windows8Detected = TRUE;
 692+ if (cfg->Windows8Detected) cfg->AddColorDepths |= 1 | 4 | 16;
 693+ }
685694 }
686695
687696 void WriteBool(HKEY hKey, BOOL value, BOOL mask, LPCTSTR name)
@@ -936,7 +945,7 @@
937946 GetVersionEx(&osver);
938947 if (osver.dwMajorVersion > 6) Windows8Detected = TRUE;
939948 if ((osver.dwMajorVersion == 6) && (osver.dwMinorVersion >= 2)) Windows8Detected = TRUE;
940 - if (Windows8Detected) cfg->AddColorDepths = 1 | 4 | 16;
 949+ if (Windows8Detected) cfg->AddColorDepths |= (1 | 4 | 16);
941950 }
942951 }
943952
@@ -1172,15 +1181,6 @@
11731182 GetDefaultConfig(cfg);
11741183 ReadINI(cfg);
11751184 }
1176 - if (!cfg->Windows8Detected)
1177 - {
1178 - OSVERSIONINFO osver;
1179 - osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
1180 - GetVersionEx(&osver);
1181 - if (osver.dwMajorVersion > 6) cfg->Windows8Detected = TRUE;
1182 - if ((osver.dwMajorVersion == 6) && (osver.dwMinorVersion >= 2)) cfg->Windows8Detected = TRUE;
1183 - if (cfg->Windows8Detected) cfg->AddColorDepths = 1 | 4 | 16;
1184 - }
11851185 if (initial || cfg->NoWriteRegistry) RegOpenKeyEx(HKEY_CURRENT_USER, cfg->regkey, 0, KEY_READ, &hKey);
11861186 else
11871187 {