| [123] | 1 |  | 
|---|
|  | 2 | /*********************************************************************** | 
|---|
|  | 3 |  | 
|---|
|  | 4 | $Id: rename.c 1682 2013-01-07 00:36:38Z gyoung $ | 
|---|
|  | 5 |  | 
|---|
|  | 6 | Copyright (c) 1993-98 M. Kimes | 
|---|
| [1498] | 7 | Copyright (c) 2004, 2010 Steven H.Levine | 
|---|
| [123] | 8 |  | 
|---|
| [574] | 9 | Revisions | 
|---|
|  | 10 | 01 Aug 04 SHL - Rework lstrip/rstrip usage | 
|---|
|  | 11 | 22 Mar 07 GKY Use QWL_USER | 
|---|
| [793] | 12 | 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat | 
|---|
| [846] | 13 | 27 Sep 07 SHL Correct ULONGLONG size formatting | 
|---|
| [897] | 14 | 30 Dec 07 GKY Use TestFDates for comparing dates | 
|---|
| [1358] | 15 | 25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis | 
|---|
| [1395] | 16 | 07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook. | 
|---|
|  | 17 | 07 Feb 09 GKY Add *DateFormat functions to format dates based on locale | 
|---|
| [1400] | 18 | 08 Mar 09 GKY Renamed commafmt.h i18nutil.h | 
|---|
| [1402] | 19 | 08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used) | 
|---|
| [1498] | 20 | 17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *. | 
|---|
| [1545] | 21 | 23 Oct 10 GKY Add ForwardslashToBackslash function to streamline code | 
|---|
| [1664] | 22 | 04 Aug 12 GKY Changes to allow copy and move over readonly files with a warning dialog; also added a warning dialog | 
|---|
|  | 23 | for delete of readonly files | 
|---|
| [1682] | 24 | 06 Jan 13 GKY Added optional confirmation dialogs for delete move and copy to compare dir Ticket 277 | 
|---|
| [123] | 25 |  | 
|---|
|  | 26 | ***********************************************************************/ | 
|---|
|  | 27 |  | 
|---|
| [907] | 28 | #include <string.h> | 
|---|
| [1354] | 29 | #include <ctype.h> | 
|---|
| [907] | 30 |  | 
|---|
| [2] | 31 | #define INCL_WIN | 
|---|
| [841] | 32 | #define INCL_LONGLONG | 
|---|
| [2] | 33 |  | 
|---|
| [1184] | 34 | #include "fm3dll.h" | 
|---|
| [1226] | 35 | #include "fm3dll2.h"                    // #define's for UM_*, control id's, etc. | 
|---|
|  | 36 | #include "worker.h"                     // typedef MOVEIT | 
|---|
|  | 37 | #include "rename.h" | 
|---|
| [1212] | 38 | #include "notebook.h"                   // Data declaration(s) | 
|---|
|  | 39 | #include "init.h"                       // Data declaration(s) | 
|---|
| [2] | 40 | #include "fm3dlg.h" | 
|---|
|  | 41 | #include "fm3str.h" | 
|---|
| [907] | 42 | #include "errutil.h"                    // Dos_Error... | 
|---|
|  | 43 | #include "strutil.h"                    // GetPString | 
|---|
| [1160] | 44 | #include "copyf.h"                      // AdjustWildcardName | 
|---|
|  | 45 | #include "valid.h"                      // TestFDates | 
|---|
| [1184] | 46 | #include "mkdir.h"                      // SetDir | 
|---|
| [1400] | 47 | #include "i18nutil.h"                   // CommaFmtULL | 
|---|
| [1184] | 48 | #include "strips.h"                     // bstrip | 
|---|
| [1354] | 49 | #include "info.h"                       // driveflags | 
|---|
| [1544] | 50 | #include "wrappers.h"                   // xfopen | 
|---|
| [1545] | 51 | #include "pathutil.h"                   // ForwardslashToBackslash | 
|---|
| [2] | 52 |  | 
|---|
| [1544] | 53 | static PSZ pszSrcFile = __FILE__; | 
|---|
|  | 54 |  | 
|---|
| [551] | 55 | MRESULT EXPENTRY RenameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
|  | 56 | { | 
|---|
| [2] | 57 | MOVEIT *mv; | 
|---|
|  | 58 |  | 
|---|
| [551] | 59 | switch (msg) { | 
|---|
|  | 60 | case WM_INITDLG: | 
|---|
|  | 61 | mv = (MOVEIT *) mp2; | 
|---|
| [574] | 62 | WinSetWindowPtr(hwnd, QWL_USER, (PVOID) mv); | 
|---|
| [551] | 63 | if (!mv || !mv->source) { | 
|---|
|  | 64 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 65 | break; | 
|---|
|  | 66 | } | 
|---|
|  | 67 | WinSendDlgItemMsg(hwnd, | 
|---|
|  | 68 | REN_SOURCE, | 
|---|
|  | 69 | EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); | 
|---|
|  | 70 | WinSendDlgItemMsg(hwnd, | 
|---|
|  | 71 | REN_TARGET, | 
|---|
|  | 72 | EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); | 
|---|
|  | 73 | if (!*mv->target) | 
|---|
|  | 74 | strcpy(mv->target, mv->source); | 
|---|
|  | 75 | WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
|  | 76 | if (mv->rename || !stricmp(mv->target, mv->source)) { | 
|---|
| [2] | 77 |  | 
|---|
| [846] | 78 | CHAR *p = strrchr(mv->target, '\\'); | 
|---|
| [551] | 79 | if (p) { | 
|---|
| [2] | 80 |  | 
|---|
| [551] | 81 | USHORT sello, selhi; | 
|---|
| [2] | 82 |  | 
|---|
| [846] | 83 | sello = p - mv->target + 1; | 
|---|
| [551] | 84 | selhi = strlen(mv->target); | 
|---|
| [2] | 85 |  | 
|---|
| [551] | 86 | WinSendDlgItemMsg(hwnd, | 
|---|
|  | 87 | REN_TARGET, | 
|---|
|  | 88 | EM_SETSEL, MPFROM2SHORT(sello, selhi), MPVOID); | 
|---|
|  | 89 | } | 
|---|
|  | 90 | WinShowWindow(WinWindowFromID(hwnd, REN_OVEROLD), FALSE); | 
|---|
|  | 91 | WinShowWindow(WinWindowFromID(hwnd, REN_OVERNEW), FALSE); | 
|---|
| [1664] | 92 | WinShowWindow(WinWindowFromID(hwnd, REN_NOROWARN), FALSE); | 
|---|
| [551] | 93 | } | 
|---|
| [1682] | 94 | if (mv->compare) { | 
|---|
|  | 95 | //WinShowWindow(WinWindowFromID(hwnd, REN_DONTASK), FALSE); | 
|---|
|  | 96 | WinShowWindow(WinWindowFromID(hwnd, REN_OVEROLD), FALSE); | 
|---|
|  | 97 | WinShowWindow(WinWindowFromID(hwnd, REN_OVERNEW), FALSE); | 
|---|
|  | 98 | WinShowWindow(WinWindowFromID(hwnd, REN_NOROWARN), FALSE); | 
|---|
|  | 99 | } | 
|---|
| [551] | 100 | break; | 
|---|
| [2] | 101 |  | 
|---|
| [551] | 102 | case UM_RESCAN: | 
|---|
|  | 103 | { | 
|---|
| [574] | 104 | mv = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| [551] | 105 | if (mv) { | 
|---|
| [2] | 106 |  | 
|---|
| [841] | 107 | FILESTATUS3L fs1, fs2; | 
|---|
| [1397] | 108 | CHAR s[CCHMAXPATH * 2], *p, chkname[CCHMAXPATH], szCmmaFmtFileSize[81], szDate[DATE_BUF_BYTES]; | 
|---|
| [551] | 109 | INT sourceexists = 0, targetexists = 0, | 
|---|
| [846] | 110 | sourcenewer = 0, sourcesmaller = 0; | 
|---|
| [1545] | 111 | ForwardslashToBackslash(mv->target); | 
|---|
| [551] | 112 | if (!MakeFullName(mv->target)) | 
|---|
|  | 113 | WinSetDlgItemText(hwnd, REN_TARGET, mv->target); | 
|---|
|  | 114 | if (!MakeFullName(mv->source)) | 
|---|
|  | 115 | WinSetDlgItemText(hwnd, REN_SOURCE, mv->source); | 
|---|
| [841] | 116 | if (!DosQueryPathInfo(mv->source, FIL_STANDARDL, &fs1, sizeof(fs1))) { | 
|---|
| [897] | 117 | CommaFmtULL(szCmmaFmtFileSize, | 
|---|
|  | 118 | sizeof(szCmmaFmtFileSize), fs1.cbFile, ' '); | 
|---|
| [1395] | 119 | FDateFormat(szDate, fs1.fdateLastWrite); | 
|---|
|  | 120 | sprintf(s, " %s%s %ss %s %02u%s%02u%s%02u", | 
|---|
| [846] | 121 | fs1.attrFile & FILE_DIRECTORY ? | 
|---|
|  | 122 | GetPString(IDS_DIRBRKTTEXT) : NullStr, | 
|---|
| [897] | 123 | szCmmaFmtFileSize, | 
|---|
| [551] | 124 | GetPString(IDS_BYTETEXT), | 
|---|
| [1395] | 125 | szDate, | 
|---|
|  | 126 | fs1.ftimeLastWrite.hours, TimeSeparator, | 
|---|
|  | 127 | fs1.ftimeLastWrite.minutes, TimeSeparator, fs1.ftimeLastWrite.twosecs * 2); | 
|---|
| [551] | 128 | WinSetDlgItemText(hwnd, REN_SOURCEINFO, s); | 
|---|
|  | 129 | sourceexists = 1; | 
|---|
| [846] | 130 | if (fs1.attrFile & FILE_DIRECTORY) | 
|---|
| [551] | 131 | sourceexists = 3; | 
|---|
|  | 132 | } | 
|---|
|  | 133 | else | 
|---|
|  | 134 | WinSetDlgItemText(hwnd, | 
|---|
| [1498] | 135 | REN_SOURCEINFO, (CHAR *) GetPString(IDS_DOESNTEXIST2TEXT)); | 
|---|
| [551] | 136 | strcpy(chkname, mv->target); | 
|---|
|  | 137 | p = strrchr(s, '\\'); | 
|---|
|  | 138 | if (p && (strchr(p, '*') || strchr(p, '?'))) { | 
|---|
|  | 139 | if (!AdjustWildcardName(mv->target, chkname)) | 
|---|
|  | 140 | strcpy(chkname, mv->target); | 
|---|
|  | 141 | } | 
|---|
| [841] | 142 | if (!DosQueryPathInfo(chkname, FIL_STANDARDL, &fs2, sizeof(fs2))) { | 
|---|
| [897] | 143 | CommaFmtULL(szCmmaFmtFileSize, | 
|---|
|  | 144 | sizeof(szCmmaFmtFileSize), fs2.cbFile, ' '); | 
|---|
| [1395] | 145 | FDateFormat(szDate, fs2.fdateLastWrite); | 
|---|
|  | 146 | sprintf(s, " %s%s %ss %s %02u%s%02u%s%02u", | 
|---|
| [846] | 147 | fs2.attrFile & FILE_DIRECTORY ? | 
|---|
|  | 148 | GetPString(IDS_DIRBRKTTEXT) : NullStr, | 
|---|
| [897] | 149 | szCmmaFmtFileSize, | 
|---|
| [551] | 150 | GetPString(IDS_BYTETEXT), | 
|---|
| [1395] | 151 | szDate, | 
|---|
|  | 152 | fs2.ftimeLastWrite.hours, TimeSeparator, | 
|---|
|  | 153 | fs2.ftimeLastWrite.minutes, TimeSeparator, fs2.ftimeLastWrite.twosecs * 2); | 
|---|
| [551] | 154 | WinSetDlgItemText(hwnd, REN_TARGETINFO, s); | 
|---|
|  | 155 | targetexists = 1; | 
|---|
|  | 156 | if (fs2.attrFile & (FILE_DIRECTORY)) | 
|---|
|  | 157 | targetexists = 3; | 
|---|
|  | 158 | WinEnableWindow(WinWindowFromID(hwnd, REN_RENEXIST), TRUE); | 
|---|
|  | 159 | } | 
|---|
|  | 160 | else { | 
|---|
|  | 161 | WinSetDlgItemText(hwnd, | 
|---|
| [1498] | 162 | REN_TARGETINFO, (CHAR *) GetPString(IDS_DOESNTEXIST2TEXT)); | 
|---|
| [551] | 163 | WinEnableWindow(WinWindowFromID(hwnd, REN_RENEXIST), FALSE); | 
|---|
|  | 164 | } | 
|---|
|  | 165 | *s = 0; | 
|---|
|  | 166 | if (sourceexists) | 
|---|
|  | 167 | sprintf(s, | 
|---|
|  | 168 | GetPString(IDS_SOURCEISATEXT), | 
|---|
| [846] | 169 | sourceexists & 2 ? GetPString(IDS_DIRECTORYTEXT) : | 
|---|
|  | 170 | GetPString(IDS_FILETEXT)); | 
|---|
| [551] | 171 | { | 
|---|
| [1544] | 172 | FILE *fp = NULL; | 
|---|
|  | 173 | CHAR *modeab = "ab"; | 
|---|
| [846] | 174 | if (~sourceexists & 2) | 
|---|
| [1544] | 175 | fp = xfopen(mv->source, modeab, pszSrcFile, __LINE__, TRUE); | 
|---|
| [846] | 176 | if ((!fp && ~sourceexists & 2) || !sourceexists) | 
|---|
| [551] | 177 | strcpy(s, GetPString(IDS_CANTACCESSSOURCETEXT)); | 
|---|
|  | 178 | if (fp) | 
|---|
|  | 179 | fclose(fp); | 
|---|
|  | 180 | } | 
|---|
|  | 181 | if (targetexists && stricmp(mv->source, mv->target)) | 
|---|
|  | 182 | sprintf(&s[strlen(s)], | 
|---|
|  | 183 | GetPString(IDS_TARGETEXISTSISATEXT), | 
|---|
| [846] | 184 | targetexists & 2 ? GetPString(IDS_DIRECTORYTEXT) : | 
|---|
|  | 185 | GetPString(IDS_FILETEXT)); | 
|---|
| [551] | 186 | if (targetexists && stricmp(mv->source, mv->target)) | 
|---|
|  | 187 | strcpy(&s[strlen(s)], GetPString(IDS_CLICKOVERWRITETEXT)); | 
|---|
|  | 188 | else if (targetexists && !stricmp(mv->source, mv->target)) | 
|---|
|  | 189 | strcpy(&s[strlen(s)], GetPString(IDS_ENTERNEWTARGETTEXT)); | 
|---|
|  | 190 | WinEnableWindow(WinWindowFromID(hwnd, REN_OVERWRITE), | 
|---|
| [846] | 191 | stricmp(mv->target, mv->source) && | 
|---|
|  | 192 | (!mv->rename || strcmp(mv->target, mv->source))); | 
|---|
| [2] | 193 |  | 
|---|
| [551] | 194 | if (targetexists == 1 && sourceexists == 1) { | 
|---|
| [897] | 195 | sourcenewer = TestFDates(NULL, NULL, | 
|---|
|  | 196 | &fs1.fdateLastWrite, &fs1.ftimeLastWrite, | 
|---|
|  | 197 | &fs2.fdateLastWrite, &fs2.ftimeLastWrite); | 
|---|
| [846] | 198 | sourcesmaller = (fs1.cbFile < fs2.cbFile) ? -1 : | 
|---|
| [897] | 199 | (fs1.cbFile > fs2.cbFile) ? 1 : 0; | 
|---|
| [551] | 200 | sprintf(&s[strlen(s)], GetPString(IDS_SOURCEISTEXT), | 
|---|
| [846] | 201 | (sourcenewer == -1) ? GetPString(IDS_NEWERTEXT) : | 
|---|
|  | 202 | (sourcenewer == 1) ? GetPString(IDS_OLDERTEXT) : | 
|---|
|  | 203 | GetPString(IDS_SAMEDATETEXT), | 
|---|
|  | 204 | (sourcesmaller == -1) ? GetPString(IDS_SMALLERTEXT) : | 
|---|
|  | 205 | (sourcesmaller == 1) ? GetPString(IDS_LARGERTEXT) : | 
|---|
|  | 206 | GetPString(IDS_SAMESIZETEXT)); | 
|---|
| [551] | 207 | } | 
|---|
|  | 208 | WinSetDlgItemText(hwnd, REN_INFORMATION, s); | 
|---|
|  | 209 | if (targetexists && stricmp(mv->source, mv->target)) { | 
|---|
|  | 210 | if (WinQueryButtonCheckstate(hwnd, REN_DONTASK)) | 
|---|
|  | 211 | return 0; | 
|---|
|  | 212 | return MRFROM2SHORT(1, 0); | 
|---|
|  | 213 | } | 
|---|
|  | 214 | else if (targetexists && !stricmp(mv->source, mv->target)) { | 
|---|
|  | 215 | if (mv->rename && strcmp(mv->source, mv->target)) | 
|---|
|  | 216 | return 0; | 
|---|
|  | 217 | WinEnableWindow(WinWindowFromID(hwnd, REN_RENEXIST), FALSE); | 
|---|
|  | 218 | return MRFROM2SHORT(2, 0); | 
|---|
|  | 219 | } | 
|---|
| [2] | 220 | } | 
|---|
| [551] | 221 | } | 
|---|
|  | 222 | return 0; | 
|---|
| [2] | 223 |  | 
|---|
| [551] | 224 | case WM_COMMAND: | 
|---|
|  | 225 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 226 | case DID_CANCEL: | 
|---|
|  | 227 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 228 | break; | 
|---|
| [2] | 229 |  | 
|---|
| [551] | 230 | case IDM_HELP: | 
|---|
|  | 231 | if (hwndHelp) | 
|---|
|  | 232 | WinSendMsg(hwndHelp, | 
|---|
|  | 233 | HM_DISPLAY_HELP, | 
|---|
|  | 234 | MPFROM2SHORT(HELP_RENAME, 0), MPFROMSHORT(HM_RESOURCEID)); | 
|---|
|  | 235 | break; | 
|---|
| [2] | 236 |  | 
|---|
| [551] | 237 | case REN_SKIP: | 
|---|
| [574] | 238 | mv = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| [551] | 239 | if (mv) { | 
|---|
|  | 240 | mv->skip = TRUE; | 
|---|
|  | 241 | *mv->target = 0; | 
|---|
|  | 242 | WinDismissDlg(hwnd, 2); | 
|---|
|  | 243 | } | 
|---|
|  | 244 | else | 
|---|
|  | 245 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 246 | break; | 
|---|
| [2] | 247 |  | 
|---|
| [551] | 248 | case REN_RENEXIST: | 
|---|
| [574] | 249 | mv = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| [551] | 250 | if (mv) { | 
|---|
| [2] | 251 |  | 
|---|
| [551] | 252 | CHAR newexist[CCHMAXPATH], fullname[CCHMAXPATH]; | 
|---|
|  | 253 | INT was; | 
|---|
| [1354] | 254 | APIRET rc; | 
|---|
|  | 255 | BOOL fResetVerify = FALSE; | 
|---|
| [2] | 256 |  | 
|---|
| [551] | 257 | *newexist = 0; | 
|---|
|  | 258 | WinQueryDlgItemText(hwnd, REN_TARGET, CCHMAXPATH, newexist); | 
|---|
|  | 259 | if (*newexist) { | 
|---|
|  | 260 | if (DosQueryPathInfo(newexist, | 
|---|
|  | 261 | FIL_QUERYFULLNAME, fullname, sizeof(fullname))) | 
|---|
|  | 262 | strcpy(fullname, newexist); | 
|---|
|  | 263 | was = IsFile(fullname); | 
|---|
| [1354] | 264 | if (was == -1) { | 
|---|
|  | 265 | if (fVerify && (driveflags[toupper(*mv->target) - 'A'] & DRIVE_WRITEVERIFYOFF || | 
|---|
|  | 266 | driveflags[toupper(*fullname) - 'A'] & DRIVE_WRITEVERIFYOFF)) { | 
|---|
|  | 267 | DosSetVerify(FALSE); | 
|---|
|  | 268 | fResetVerify = TRUE; | 
|---|
|  | 269 | } | 
|---|
| [1402] | 270 | rc = docopyf(MOVE, mv->target, fullname); | 
|---|
| [1354] | 271 | if (fResetVerify) { | 
|---|
|  | 272 | DosSetVerify(fVerify); | 
|---|
|  | 273 | fResetVerify = FALSE; | 
|---|
|  | 274 | } | 
|---|
| [551] | 275 | if (rc) { | 
|---|
|  | 276 | if ((LONG) rc > 0) | 
|---|
|  | 277 | Dos_Error(MB_CANCEL, | 
|---|
|  | 278 | rc, | 
|---|
|  | 279 | hwnd, | 
|---|
|  | 280 | __FILE__, | 
|---|
|  | 281 | __LINE__, | 
|---|
|  | 282 | GetPString(IDS_COMPMOVEFAILEDTEXT), | 
|---|
|  | 283 | mv->target, fullname); | 
|---|
|  | 284 | else | 
|---|
|  | 285 | saymsg(MB_CANCEL | MB_ICONEXCLAMATION, | 
|---|
|  | 286 | hwnd, | 
|---|
|  | 287 | GetPString(IDS_SORRYTEXT), | 
|---|
|  | 288 | GetPString(IDS_COMPMOVEFAILEDTEXT), | 
|---|
|  | 289 | mv->target, fullname); | 
|---|
|  | 290 | } | 
|---|
|  | 291 | else | 
|---|
|  | 292 | saymsg(MB_ENTER, | 
|---|
|  | 293 | hwnd, | 
|---|
|  | 294 | GetPString(IDS_SUCCESSTEXT), | 
|---|
|  | 295 | GetPString(IDS_WASMOVEDTOTEXT), mv->target, fullname); | 
|---|
|  | 296 | } | 
|---|
|  | 297 | else | 
|---|
|  | 298 | saymsg(MB_CANCEL | MB_ICONEXCLAMATION, | 
|---|
|  | 299 | hwnd, | 
|---|
|  | 300 | GetPString(IDS_SORRYTEXT), | 
|---|
|  | 301 | GetPString(IDS_EXISTSASATEXT), | 
|---|
|  | 302 | fullname, | 
|---|
|  | 303 | (was) ? | 
|---|
|  | 304 | GetPString(IDS_FILETEXT) : GetPString(IDS_DIRECTORYTEXT)); | 
|---|
|  | 305 | } | 
|---|
|  | 306 | WinSetDlgItemText(hwnd, REN_TARGET, mv->target); | 
|---|
|  | 307 | } | 
|---|
|  | 308 | break; | 
|---|
| [2] | 309 |  | 
|---|
| [551] | 310 | case REN_OVERWRITE: | 
|---|
|  | 311 | case DID_OK: | 
|---|
| [574] | 312 | mv = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| [551] | 313 | if (mv) { | 
|---|
| [2] | 314 |  | 
|---|
| [551] | 315 | MRESULT mr; | 
|---|
| [2] | 316 |  | 
|---|
| [551] | 317 | if (WinQueryButtonCheckstate(hwnd, REN_DONTASK)) | 
|---|
|  | 318 | mv->dontask = TRUE; | 
|---|
|  | 319 | if (WinQueryButtonCheckstate(hwnd, REN_OVEROLD)) | 
|---|
|  | 320 | mv->overold = TRUE; | 
|---|
|  | 321 | if (WinQueryButtonCheckstate(hwnd, REN_OVERNEW)) | 
|---|
| [1664] | 322 | mv->overnew = TRUE; | 
|---|
|  | 323 | if (WinQueryButtonCheckstate(hwnd,REN_NOROWARN)) | 
|---|
|  | 324 | mv->noreadonlywarn = TRUE; | 
|---|
| [551] | 325 | *mv->target = 0; | 
|---|
|  | 326 | WinQueryDlgItemText(hwnd, REN_TARGET, CCHMAXPATH, mv->target); | 
|---|
|  | 327 | bstrip(mv->target); | 
|---|
|  | 328 | mr = WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
|  | 329 | if (!mr || | 
|---|
|  | 330 | (SHORT1FROMMR(mr) != 2 && SHORT1FROMMP(mp1) == REN_OVERWRITE)) { | 
|---|
| [2] | 331 |  | 
|---|
| [551] | 332 | CHAR path[CCHMAXPATH], *p; | 
|---|
| [2] | 333 |  | 
|---|
| [551] | 334 | mv->overwrite = (SHORT1FROMMP(mp1) == REN_OVERWRITE); | 
|---|
|  | 335 | strcpy(path, mv->target); | 
|---|
|  | 336 | p = strrchr(path, '\\'); | 
|---|
|  | 337 | if (p) { | 
|---|
|  | 338 | p++; | 
|---|
|  | 339 | *p = 0; | 
|---|
|  | 340 | if (SetDir(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), | 
|---|
|  | 341 | QW_OWNER), hwnd, path, 0)) { | 
|---|
| [1395] | 342 | if (!fAlertBeepOff) | 
|---|
|  | 343 | DosBeep(250, 100); | 
|---|
| [551] | 344 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, REN_TARGET)); | 
|---|
|  | 345 | break; | 
|---|
|  | 346 | } | 
|---|
|  | 347 | } | 
|---|
|  | 348 | WinDismissDlg(hwnd, 1); | 
|---|
|  | 349 | } | 
|---|
|  | 350 | else { | 
|---|
| [1395] | 351 | if (!fAlertBeepOff) | 
|---|
|  | 352 | DosBeep(250, 100); | 
|---|
| [551] | 353 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, REN_TARGET)); | 
|---|
|  | 354 | } | 
|---|
| [2] | 355 | } | 
|---|
| [551] | 356 | break; | 
|---|
|  | 357 | } | 
|---|
|  | 358 | return 0; | 
|---|
| [2] | 359 | } | 
|---|
| [551] | 360 | return WinDefDlgProc(hwnd, msg, mp1, mp2); | 
|---|
| [2] | 361 | } | 
|---|
| [793] | 362 |  | 
|---|
|  | 363 | #pragma alloc_text(FMRENAME,RenameProc) | 
|---|