| Index: cfgmgr/cfgmgr.cpp |
| — | — | @@ -359,7 +359,52 @@ |
| 360 | 360 | else MessageBox(NULL,_T("Registry value could not be deleted. Your program may crash as a result."),_T("Error"),MB_OK|MB_ICONWARNING);
|
| 361 | 361 | }
|
| 362 | 362 | }
|
| | 363 | + RegCloseKey(hKey);
|
| 363 | 364 | }
|
| | 365 | + if(is64) error = RegOpenKeyEx(HKEY_CURRENT_USER,_T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"),0,KEY_READ|KEY_WOW64_64KEY,&hKey);
|
| | 366 | + else error = RegOpenKeyEx(HKEY_CURRENT_USER,_T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"),0,KEY_READ,&hKey);
|
| | 367 | + if(error == ERROR_SUCCESS)
|
| | 368 | + {
|
| | 369 | + GetModuleFileName(NULL,filename,MAX_PATH);
|
| | 370 | + TCHAR buffer[1024];
|
| | 371 | + ZeroMemory(buffer,1024*sizeof(TCHAR));
|
| | 372 | + DWORD sizeout = 1024*sizeof(TCHAR);
|
| | 373 | + if(RegQueryValueEx(hKey,filename,NULL,NULL,(LPBYTE)buffer,&sizeout) == ERROR_SUCCESS)
|
| | 374 | + {
|
| | 375 | + if(_tcsstr(buffer,_T("DWM8And16BitMitigation")))
|
| | 376 | + {
|
| | 377 | + MessageBox(NULL,_T("DXGL has detected an incompatible AppCompat flag for the program you are currently running. To continue, the registry value must be deleted.\nIf you see a UAC prompt, you must click Yes."),
|
| | 378 | + _T("AppCompat error"),MB_OK|MB_ICONHAND);
|
| | 379 | + error = RegDeleteValue(hKey,filename);
|
| | 380 | + if(error == ERROR_ACCESS_DENIED)
|
| | 381 | + {
|
| | 382 | + tstring command;
|
| | 383 | + if(is64) command.assign(_T("DELETE \"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /reg:64 /f /v \""));
|
| | 384 | + else command.assign(_T("DELETE \"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /f /v \""));
|
| | 385 | + command.append(filename);
|
| | 386 | + command.append(_T("\""));
|
| | 387 | + SHELLEXECUTEINFO info;
|
| | 388 | + ZeroMemory(&info,sizeof(SHELLEXECUTEINFO));
|
| | 389 | + info.cbSize = sizeof(SHELLEXECUTEINFO);
|
| | 390 | + info.lpVerb = _T("runas");
|
| | 391 | + info.lpFile = _T("reg.exe");
|
| | 392 | + info.lpParameters = command.c_str();
|
| | 393 | + info.nShow = SW_SHOWNORMAL;
|
| | 394 | + info.fMask = SEE_MASK_NOCLOSEPROCESS;
|
| | 395 | + ShellExecuteEx(&info);
|
| | 396 | + WaitForSingleObject(info.hProcess,INFINITE);
|
| | 397 | + GetExitCodeProcess(info.hProcess,(LPDWORD)&error);
|
| | 398 | + }
|
| | 399 | + if(!error)
|
| | 400 | + {
|
| | 401 | + MessageBox(NULL,_T("Registry value successfully deleted. Please restart the program."),_T("Success"),MB_OK|MB_ICONINFORMATION);
|
| | 402 | + exit(0);
|
| | 403 | + }
|
| | 404 | + else MessageBox(NULL,_T("Registry value could not be deleted. Your program may crash as a result."),_T("Error"),MB_OK|MB_ICONWARNING);
|
| | 405 | + }
|
| | 406 | + }
|
| | 407 | + RegCloseKey(hKey);
|
| | 408 | + }
|
| 364 | 409 | }
|
| 365 | 410 | void GetGlobalConfig(DXGLCFG *cfg)
|
| 366 | 411 | {
|