DXGL r140 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r139‎ | r140 | r141 >
Date:20:48, 16 April 2012
Author:admin
Status:new
Tags:
Comment:
Fix dxglcfg profile creation and deletion.
Fix dxglcfg UAC integration.
Fix dxglcfg "Adjust Primary Resolution" checkbox
Modified paths:
  • /dxglcfg/dxglcfg.cpp (modified) (history)

Diff [purge]

Index: dxglcfg/dxglcfg.cpp
@@ -89,6 +89,7 @@
9090 {
9191 DWORD sizeout = (MAX_PATH+1)*sizeof(TCHAR);
9292 TCHAR installpath[MAX_PATH+1];
 93+ TCHAR srcpath[MAX_PATH+1];
9394 TCHAR destpath[MAX_PATH+1];
9495 HKEY hKeyInstall;
9596 LONG error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("Software\\DXGL"),0,KEY_READ,&hKeyInstall);
@@ -105,11 +106,12 @@
106107 }
107108 if(dxgl_installdir) _tcscat(installpath,_T("\\"));
108109 else (_tcsrchr(installpath,_T('\\')))[1] = 0;
109 - _tcscat(installpath,_T("ddraw.dll"));
 110+ _tcsncpy(srcpath,installpath,MAX_PATH+1);
 111+ _tcscat(srcpath,_T("ddraw.dll"));
110112 _tcsncpy(destpath,path,MAX_PATH+1);
111113 (_tcsrchr(destpath,_T('\\')))[1] = 0;
112114 _tcscat(destpath,_T("ddraw.dll"));
113 - error = CopyFile(installpath,destpath,TRUE);
 115+ error = CopyFile(srcpath,destpath,TRUE);
114116 error_loop:
115117 if(!error)
116118 {
@@ -124,7 +126,7 @@
125127 }
126128 if(old_dxgl)
127129 {
128 - error = CopyFile(installpath,destpath,FALSE);
 130+ error = CopyFile(srcpath,destpath,FALSE);
129131 goto error_loop;
130132 }
131133 }
@@ -136,7 +138,9 @@
137139 ZeroMemory(&shex,sizeof(SHELLEXECUTEINFO));
138140 shex.cbSize = sizeof(SHELLEXECUTEINFO);
139141 shex.lpVerb = _T("runas");
140 - shex.lpFile = destpath;
 142+ shex.fMask = SEE_MASK_NOCLOSEPROCESS;
 143+ _tcscat(installpath,_T("\\dxglcfg.exe"));
 144+ shex.lpFile = installpath;
141145 shex.lpParameters = command.c_str();
142146 ShellExecuteEx(&shex);
143147 WaitForSingleObject(shex.hProcess,INFINITE);
@@ -175,7 +179,7 @@
176180 if(!GetProcAddress(hmod,"IsDXGLDDraw")) old_dxgl = false;
177181 FreeLibrary(hmod);
178182 }
179 - if(old_dxgl) return 0;
 183+ if(!old_dxgl) return 0;
180184 if(!DeleteFile(path))
181185 {
182186 error = GetLastError();
@@ -188,6 +192,7 @@
189193 ZeroMemory(&shex,sizeof(SHELLEXECUTEINFO));
190194 shex.cbSize = sizeof(SHELLEXECUTEINFO);
191195 shex.lpVerb = _T("runas");
 196+ shex.fMask = SEE_MASK_NOCLOSEPROCESS;
192197 _tcscat(installpath,_T("\\dxglcfg.exe"));
193198 shex.lpFile = installpath;
194199 shex.lpParameters = command.c_str();
@@ -861,7 +866,7 @@
862867 *dirty = true;
863868 break;
864869 case IDC_HIGHRES:
865 - cfg->highres = GetCheck(hWnd,IDC_COLOR,cfgmask->highres);
 870+ cfg->highres = GetCheck(hWnd,IDC_HIGHRES,cfgmask->highres);
866871 EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
867872 *dirty = true;
868873 break;