| Index: cfgmgr/cfgmgr.cpp |
| — | — | @@ -604,10 +604,14 @@ |
| 605 | 605 | regkey.append(_T("-"));
|
| 606 | 606 | regkey.append(crcstr);
|
| 607 | 607 | }
|
| 608 | | - GetGlobalConfig(cfg);
|
| 609 | | - RegCreateKeyEx(HKEY_CURRENT_USER,regkey.c_str(),0,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,NULL);
|
| 610 | | - ReadSettings(hKey,cfg,NULL,false,true,NULL);
|
| 611 | | - RegCloseKey(hKey);
|
| | 608 | + GetGlobalConfig(cfg, initial);
|
| | 609 | + if (initial) RegOpenKeyEx(HKEY_CURRENT_USER, regkey.c_str(), 0, KEY_READ, &hKey);
|
| | 610 | + else RegCreateKeyEx(HKEY_CURRENT_USER,regkey.c_str(),0,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,NULL);
|
| | 611 | + if (hKey)
|
| | 612 | + {
|
| | 613 | + ReadSettings(hKey, cfg, NULL, false, true, NULL);
|
| | 614 | + RegCloseKey(hKey);
|
| | 615 | + }
|
| 612 | 616 | hKey = NULL;
|
| 613 | 617 | HMODULE hSHCore = NULL;
|
| 614 | 618 | HMODULE hUser32 = NULL;
|
| — | — | @@ -645,23 +649,27 @@ |
| 646 | 650 | }
|
| 647 | 651 | DelCompatFlag(_T("DWM8And16BitMitigation"), initial);
|
| 648 | 652 | }
|
| 649 | | -void GetGlobalConfig(DXGLCFG *cfg)
|
| | 653 | +void GetGlobalConfig(DXGLCFG *cfg, bool initial)
|
| 650 | 654 | {
|
| 651 | 655 | HKEY hKey;
|
| 652 | 656 | ZeroMemory(cfg,sizeof(DXGLCFG));
|
| 653 | 657 | cfg->DPIScale = 1;
|
| 654 | | - RegCreateKeyEx(HKEY_CURRENT_USER,regkeyglobal,0,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,NULL);
|
| 655 | | - ReadSettings(hKey,cfg,NULL,true,false,NULL);
|
| 656 | | - if(!cfg->Windows8Detected)
|
| | 658 | + if (initial) RegOpenKeyEx(HKEY_CURRENT_USER, regkeyglobal, 0, KEY_READ, &hKey);
|
| | 659 | + else RegCreateKeyEx(HKEY_CURRENT_USER, regkeyglobal, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, NULL);
|
| | 660 | + if (hKey)
|
| 657 | 661 | {
|
| 658 | | - OSVERSIONINFO osver;
|
| 659 | | - osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
| 660 | | - GetVersionEx(&osver);
|
| 661 | | - if(osver.dwMajorVersion > 6) cfg->Windows8Detected = true;
|
| 662 | | - if((osver.dwMajorVersion == 6) && (osver.dwMinorVersion >= 2)) cfg->Windows8Detected = true;
|
| 663 | | - if(cfg->Windows8Detected) cfg->AllColorDepths = true;
|
| | 662 | + ReadSettings(hKey, cfg, NULL, true, false, NULL);
|
| | 663 | + if (!cfg->Windows8Detected)
|
| | 664 | + {
|
| | 665 | + OSVERSIONINFO osver;
|
| | 666 | + osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
| | 667 | + GetVersionEx(&osver);
|
| | 668 | + if (osver.dwMajorVersion > 6) cfg->Windows8Detected = true;
|
| | 669 | + if ((osver.dwMajorVersion == 6) && (osver.dwMinorVersion >= 2)) cfg->Windows8Detected = true;
|
| | 670 | + if (cfg->Windows8Detected) cfg->AllColorDepths = true;
|
| | 671 | + }
|
| | 672 | + RegCloseKey(hKey);
|
| 664 | 673 | }
|
| 665 | | - RegCloseKey(hKey);
|
| 666 | 674 | }
|
| 667 | 675 |
|
| 668 | 676 | void GetConfig(DXGLCFG *cfg, DXGLCFG *mask, LPCTSTR name)
|
| Index: cfgmgr/cfgmgr.h |
| — | — | @@ -45,7 +45,7 @@ |
| 46 | 46 | void ReadSettings(HKEY hKey, DXGLCFG *cfg, DXGLCFG *mask, bool global, bool dll, LPTSTR dir);
|
| 47 | 47 | void WriteSettings(HKEY hKey, const DXGLCFG *cfg, const DXGLCFG *mask, bool global);
|
| 48 | 48 | void GetCurrentConfig(DXGLCFG *cfg, bool initial);
|
| 49 | | -void GetGlobalConfig(DXGLCFG *cfg);
|
| | 49 | +void GetGlobalConfig(DXGLCFG *cfg, bool initial);
|
| 50 | 50 | void SetGlobalConfig(const DXGLCFG *cfg);
|
| 51 | 51 | void GetConfig(DXGLCFG *cfg, DXGLCFG *mask, LPCTSTR name);
|
| 52 | 52 | void SetConfig(const DXGLCFG *cfg, const DXGLCFG *mask, LPCTSTR name);
|
| Index: dxglcfg/dxglcfg.cpp |
| — | — | @@ -460,7 +460,7 @@ |
| 461 | 461 | apps = (app_setting *)malloc(maxapps*sizeof(app_setting));
|
| 462 | 462 | apps[0].name = new tstring(_T("Global"));
|
| 463 | 463 | apps[0].regkey = new tstring(_T("Global"));
|
| 464 | | - GetGlobalConfig(&apps[0].cfg);
|
| | 464 | + GetGlobalConfig(&apps[0].cfg, false);
|
| 465 | 465 | cfg = &apps[0].cfg;
|
| 466 | 466 | cfgmask = &apps[0].mask;
|
| 467 | 467 | dirty = &apps[0].dirty;
|