Index: dxglcfg/dxglcfg.cpp |
— | — | @@ -89,6 +89,7 @@ |
90 | 90 | {
|
91 | 91 | DWORD sizeout = (MAX_PATH+1)*sizeof(TCHAR);
|
92 | 92 | TCHAR installpath[MAX_PATH+1];
|
| 93 | + TCHAR srcpath[MAX_PATH+1];
|
93 | 94 | TCHAR destpath[MAX_PATH+1];
|
94 | 95 | HKEY hKeyInstall;
|
95 | 96 | LONG error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("Software\\DXGL"),0,KEY_READ,&hKeyInstall);
|
— | — | @@ -105,11 +106,12 @@ |
106 | 107 | }
|
107 | 108 | if(dxgl_installdir) _tcscat(installpath,_T("\\"));
|
108 | 109 | 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"));
|
110 | 112 | _tcsncpy(destpath,path,MAX_PATH+1);
|
111 | 113 | (_tcsrchr(destpath,_T('\\')))[1] = 0;
|
112 | 114 | _tcscat(destpath,_T("ddraw.dll"));
|
113 | | - error = CopyFile(installpath,destpath,TRUE);
|
| 115 | + error = CopyFile(srcpath,destpath,TRUE);
|
114 | 116 | error_loop:
|
115 | 117 | if(!error)
|
116 | 118 | {
|
— | — | @@ -124,7 +126,7 @@ |
125 | 127 | }
|
126 | 128 | if(old_dxgl)
|
127 | 129 | {
|
128 | | - error = CopyFile(installpath,destpath,FALSE);
|
| 130 | + error = CopyFile(srcpath,destpath,FALSE);
|
129 | 131 | goto error_loop;
|
130 | 132 | }
|
131 | 133 | }
|
— | — | @@ -136,7 +138,9 @@ |
137 | 139 | ZeroMemory(&shex,sizeof(SHELLEXECUTEINFO));
|
138 | 140 | shex.cbSize = sizeof(SHELLEXECUTEINFO);
|
139 | 141 | shex.lpVerb = _T("runas");
|
140 | | - shex.lpFile = destpath;
|
| 142 | + shex.fMask = SEE_MASK_NOCLOSEPROCESS;
|
| 143 | + _tcscat(installpath,_T("\\dxglcfg.exe"));
|
| 144 | + shex.lpFile = installpath;
|
141 | 145 | shex.lpParameters = command.c_str();
|
142 | 146 | ShellExecuteEx(&shex);
|
143 | 147 | WaitForSingleObject(shex.hProcess,INFINITE);
|
— | — | @@ -175,7 +179,7 @@ |
176 | 180 | if(!GetProcAddress(hmod,"IsDXGLDDraw")) old_dxgl = false;
|
177 | 181 | FreeLibrary(hmod);
|
178 | 182 | }
|
179 | | - if(old_dxgl) return 0;
|
| 183 | + if(!old_dxgl) return 0;
|
180 | 184 | if(!DeleteFile(path))
|
181 | 185 | {
|
182 | 186 | error = GetLastError();
|
— | — | @@ -188,6 +192,7 @@ |
189 | 193 | ZeroMemory(&shex,sizeof(SHELLEXECUTEINFO));
|
190 | 194 | shex.cbSize = sizeof(SHELLEXECUTEINFO);
|
191 | 195 | shex.lpVerb = _T("runas");
|
| 196 | + shex.fMask = SEE_MASK_NOCLOSEPROCESS;
|
192 | 197 | _tcscat(installpath,_T("\\dxglcfg.exe"));
|
193 | 198 | shex.lpFile = installpath;
|
194 | 199 | shex.lpParameters = command.c_str();
|
— | — | @@ -861,7 +866,7 @@ |
862 | 867 | *dirty = true;
|
863 | 868 | break;
|
864 | 869 | case IDC_HIGHRES:
|
865 | | - cfg->highres = GetCheck(hWnd,IDC_COLOR,cfgmask->highres);
|
| 870 | + cfg->highres = GetCheck(hWnd,IDC_HIGHRES,cfgmask->highres);
|
866 | 871 | EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
867 | 872 | *dirty = true;
|
868 | 873 | break;
|