Index: Installer/dxgl.nsi |
— | — | @@ -124,7 +124,7 @@ |
125 | 125 | StrLen $5 $3
|
126 | 126 | IntOp $5 $5 + 1
|
127 | 127 | !ifdef NSIS_UNICODE
|
128 | | - IntOp $5 $5 * 2
|
| 128 | + IntOp $5 $5 + 2
|
129 | 129 | !endif
|
130 | 130 | IntOp $4 $4 + $5
|
131 | 131 | ;copy file here
|
— | — | @@ -151,6 +151,8 @@ |
152 | 152 | novc:
|
153 | 153 | MessageBox MB_OK|MB_ICONEXCLAMATION "DXGL will not work if the Visual C++ 2010 Runtime is not installed. Please install the Visual C++ 2010 Runtime before running DXGL."
|
154 | 154 | skipvcredist:
|
| 155 | + WriteRegStr HKLM "Software\DXGL" "InstallDir" "$INSTDIR"
|
| 156 | + ExecWait '"$INSTDIR\dxgltest.exe" install'
|
155 | 157 | SectionEnd
|
156 | 158 |
|
157 | 159 | Section -AdditionalIcons
|
— | — | @@ -200,6 +202,7 @@ |
201 | 203 |
|
202 | 204 | DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
|
203 | 205 | DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
|
| 206 | + DeleteRegKey HKLM "Software\DXGL"
|
204 | 207 |
|
205 | 208 | StrCpy $8 0
|
206 | 209 | SetPluginUnload alwaysoff
|
Index: cfgmgr/cfgmgr.cpp |
— | — | @@ -250,26 +250,57 @@ |
251 | 251 | return (LPTSTR)newregname.c_str();
|
252 | 252 | }
|
253 | 253 |
|
| 254 | +bool IsInstalledDXGLTest(LPCTSTR path)
|
| 255 | +{
|
| 256 | + LRESULT err;
|
| 257 | + TCHAR dir[MAX_PATH+1];
|
| 258 | + TCHAR cmp[MAX_PATH+1];
|
| 259 | + _tcsncpy(dir,path,MAX_PATH);
|
| 260 | + GetDirFromPath(dir);
|
| 261 | + HKEY hKey;
|
| 262 | + DWORD sizeout = MAX_PATH*sizeof(TCHAR);
|
| 263 | + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("Software\\DXGL"),0,KEY_READ,&hKey) != ERROR_SUCCESS)
|
| 264 | + return false;
|
| 265 | + err = RegQueryValueEx(hKey,_T("InstallDir"),NULL,NULL,(LPBYTE)cmp,&sizeout);
|
| 266 | + if(err != ERROR_SUCCESS)
|
| 267 | + {
|
| 268 | + RegCloseKey(hKey);
|
| 269 | + return false;
|
| 270 | + }
|
| 271 | + RegCloseKey(hKey);
|
| 272 | + if(!_tcsnicmp(dir,cmp,MAX_PATH)) return true;
|
| 273 | + else return false;
|
| 274 | +}
|
| 275 | +
|
254 | 276 | void GetCurrentConfig(DXGLCFG *cfg)
|
255 | 277 | {
|
256 | 278 | HKEY hKey;
|
257 | 279 | unsigned long crc;
|
| 280 | + tstring regkey;
|
258 | 281 | FILE *file;
|
259 | 282 | TCHAR filename[MAX_PATH+1];
|
260 | 283 | TCHAR crcstr[10];
|
261 | 284 | GetModuleFileName(NULL,filename,MAX_PATH);
|
262 | | - file = _tfopen(filename,_T("rb"));
|
263 | | - if(file != NULL) Crc32_ComputeFile(file,&crc);
|
264 | | - else crc = 0;
|
265 | | - _itot(crc,crcstr,16);
|
266 | | - if(file) fclose(file);
|
267 | | - tstring regkey = regkeybase;
|
268 | | - int i;
|
269 | | - for(i = _tcslen(filename); (i > 0) && (filename[i] != 92) && (filename[i] != 47); i--);
|
270 | | - i++;
|
271 | | - regkey.append(&filename[i]);
|
272 | | - regkey.append(_T("-"));
|
273 | | - regkey.append(crcstr);
|
| 285 | + if(IsInstalledDXGLTest(filename))
|
| 286 | + {
|
| 287 | + regkey = regkeybase;
|
| 288 | + regkey.append(_T("DXGLTestApp"));
|
| 289 | + }
|
| 290 | + else
|
| 291 | + {
|
| 292 | + file = _tfopen(filename,_T("rb"));
|
| 293 | + if(file != NULL) Crc32_ComputeFile(file,&crc);
|
| 294 | + else crc = 0;
|
| 295 | + _itot(crc,crcstr,16);
|
| 296 | + if(file) fclose(file);
|
| 297 | + regkey = regkeybase;
|
| 298 | + int i;
|
| 299 | + for(i = _tcslen(filename); (i > 0) && (filename[i] != 92) && (filename[i] != 47); i--);
|
| 300 | + i++;
|
| 301 | + regkey.append(&filename[i]);
|
| 302 | + regkey.append(_T("-"));
|
| 303 | + regkey.append(crcstr);
|
| 304 | + }
|
274 | 305 | GetGlobalConfig(cfg);
|
275 | 306 | RegCreateKeyEx(HKEY_CURRENT_USER,regkey.c_str(),NULL,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,NULL);
|
276 | 307 | ReadSettings(hKey,cfg,NULL,false,true,NULL);
|
Index: dxglcfg/dxglcfg.cpp |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | LONG error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("Software\\DXGL"),0,KEY_READ,&hKeyInstall);
|
84 | 84 | if(error == ERROR_SUCCESS)
|
85 | 85 | {
|
86 | | - error = RegQueryValueEx(hKeyInstall,_T("InstallPath"),NULL,NULL,(LPBYTE)installpath,&sizeout);
|
| 86 | + error = RegQueryValueEx(hKeyInstall,_T("InstallDir"),NULL,NULL,(LPBYTE)installpath,&sizeout);
|
87 | 87 | if(error == ERROR_SUCCESS) installed = true;
|
88 | 88 | }
|
89 | 89 | if(hKeyInstall) RegCloseKey(hKeyInstall);
|
— | — | @@ -508,7 +508,8 @@ |
509 | 509 | maxapps += 128;
|
510 | 510 | apps = (app_setting *)realloc(apps,maxapps*sizeof(app_setting));
|
511 | 511 | }
|
512 | | - subkey = keyname;
|
| 512 | + if(!_tcscmp(keyname,_T("DXGLTestApp"))) subkey = _T("dxgltest.exe-0");
|
| 513 | + else subkey = keyname;
|
513 | 514 | if(subkey.rfind(_T("-")) != -1) subkey.resize(subkey.rfind(_T("-")));
|
514 | 515 | error = RegOpenKeyEx(hKeyBase,keyname,0,KEY_READ,&hKey);
|
515 | 516 | buffersize = regbuffersize;
|
— | — | @@ -669,6 +670,8 @@ |
670 | 671 | cfg = &apps[current_app].cfg;
|
671 | 672 | cfgmask = &apps[current_app].mask;
|
672 | 673 | dirty = &apps[current_app].dirty;
|
| 674 | + if(current_app) EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),true);
|
| 675 | + else EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),false);
|
673 | 676 | // Set 3-state status
|
674 | 677 | if(current_app && !tristate)
|
675 | 678 | {
|
— | — | @@ -897,19 +900,11 @@ |
898 | 901 |
|
899 | 902 | break;
|
900 | 903 | case IDC_REMOVE:
|
901 | | - if(!(GetWindowLong(hWnd,GWL_STYLE) & WS_DISABLED))
|
| 904 | + if(!(GetWindowLong(GetDlgItem(hWnd,IDC_APPLY),GWL_STYLE) & WS_DISABLED))
|
902 | 905 | {
|
903 | | - switch(MessageBox(hWnd,_T("Do you want to apply settings before continuing?\nIf you answer No, the unsaved settings will be discarded."),
|
904 | | - _T("Unsaved settings detected"),MB_YESNOCANCEL))
|
905 | | - {
|
906 | | - case IDYES:
|
907 | | - SaveChanges(hWnd);
|
908 | | - break;
|
909 | | - case IDNO:
|
910 | | - break;
|
911 | | - default:
|
912 | | - return false;
|
913 | | - }
|
| 906 | + if(MessageBox(hWnd,_T("Do you want to delete the selected application profile and remove DXGL from its installation folder(s)?"),
|
| 907 | + _T("Confirmation"),MB_YESNO|MB_ICONQUESTION) == IDNO) return false;
|
| 908 | +
|
914 | 909 | }
|
915 | 910 | // Delete app profile
|
916 | 911 |
|
Index: dxglcfg/dxglcfg.rc |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | LISTBOX IDC_APPS, 4, 14, 181, 212, WS_TABSTOP | WS_VSCROLL | LBS_NOINTEGRALHEIGHT | LBS_OWNERDRAWFIXED | LBS_NOTIFY
|
41 | 41 | LTEXT "Applications", IDC_STATIC, 4, 4, 39, 8, SS_LEFT
|
42 | 42 | PUSHBUTTON "A&dd...", IDC_ADD, 4, 228, 90, 14
|
43 | | - PUSHBUTTON "&Remove", IDC_REMOVE, 96, 228, 90, 14
|
| 43 | + PUSHBUTTON "&Remove", IDC_REMOVE, 96, 228, 90, 14, WS_DISABLED
|
44 | 44 | GROUPBOX "Graphics", IDC_STATIC, 190, 4, 211, 184
|
45 | 45 | LTEXT "Video mode", IDC_STATIC, 195, 14, 38, 8, SS_LEFT
|
46 | 46 | COMBOBOX IDC_VIDMODE, 195, 24, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
|
Index: dxgltest/dxgltest.cpp |
— | — | @@ -500,6 +500,13 @@ |
501 | 501 |
|
502 | 502 | int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
|
503 | 503 | {
|
| 504 | + if(_tcsstr(lpCmdLine,_T(" install")))
|
| 505 | + {
|
| 506 | + LPDIRECTDRAW lpdd;
|
| 507 | + DirectDrawCreate(NULL,&lpdd,NULL);
|
| 508 | + lpdd->Release();
|
| 509 | + return 0;
|
| 510 | + }
|
504 | 511 | OSVERSIONINFO verinfo;
|
505 | 512 | verinfo.dwOSVersionInfoSize = sizeof(verinfo);
|
506 | 513 | GetVersionEx(&verinfo);
|