[29] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: copyf.c 959 2008-02-18 00:47:31Z gyoung $
|
---|
| 5 |
|
---|
| 6 | Copy functions
|
---|
| 7 |
|
---|
| 8 | Copyright (c) 1993-98 M. Kimes
|
---|
[347] | 9 | Copyright (c) 2001, 2006 Steven H.Levine
|
---|
[29] | 10 |
|
---|
[173] | 11 | 14 Sep 02 SHL Drop obsolete debug code
|
---|
| 12 | 14 Oct 02 SHL Drop obsolete debug code
|
---|
| 13 | 10 Nov 02 SHL docopyf - don't forget to terminate longname
|
---|
[347] | 14 | optimize longname logic
|
---|
[173] | 15 | 01 Aug 04 SHL Rework lstrip/rstrip usage
|
---|
| 16 | 28 May 05 SHL Drop debug code
|
---|
[347] | 17 | 14 Jul 06 SHL Use Runtime_Error
|
---|
[793] | 18 | 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
|
---|
[827] | 19 | 01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry
|
---|
[29] | 20 |
|
---|
| 21 | ***********************************************************************/
|
---|
| 22 |
|
---|
[907] | 23 | #include <stdlib.h>
|
---|
| 24 | #include <string.h>
|
---|
| 25 | #include <stdarg.h>
|
---|
| 26 | #include <ctype.h>
|
---|
| 27 |
|
---|
[2] | 28 | #define INCL_DOS
|
---|
| 29 | #define INCL_DOSERRORS
|
---|
| 30 | #define INCL_WIN
|
---|
[841] | 31 | #define INCL_LONGLONG
|
---|
[2] | 32 |
|
---|
[907] | 33 | #include "fm3str.h"
|
---|
| 34 | #include "errutil.h" // Dos_Error...
|
---|
| 35 | #include "strutil.h" // GetPString
|
---|
[2] | 36 | #include "fm3dll.h"
|
---|
| 37 |
|
---|
[347] | 38 | static PSZ pszSrcFile = __FILE__;
|
---|
| 39 |
|
---|
[2] | 40 | #ifndef WinMoveObject
|
---|
[551] | 41 | HOBJECT APIENTRY WinMoveObject(HOBJECT hObjectofObject,
|
---|
| 42 | HOBJECT hObjectofDest, ULONG ulReserved);
|
---|
[2] | 43 | #endif
|
---|
| 44 | #ifndef WinCopyObject
|
---|
[551] | 45 | HOBJECT APIENTRY WinCopyObject(HOBJECT hObjectofObject,
|
---|
| 46 | HOBJECT hObjectofDest, ULONG ulReserved);
|
---|
[2] | 47 | #endif
|
---|
| 48 |
|
---|
[551] | 49 | char *MakeTempName(char *buffer)
|
---|
[347] | 50 | {
|
---|
[843] | 51 | FILESTATUS3 fs3;
|
---|
[551] | 52 | APIRET rc;
|
---|
| 53 | char *p, *o;
|
---|
[2] | 54 |
|
---|
| 55 | p = o = buffer + strlen(buffer);
|
---|
[551] | 56 | sprintf(p, "%08lx.%03lx", clock(), mypid);
|
---|
[2] | 57 | p = buffer + (strlen(buffer) - 1);
|
---|
[551] | 58 | for (;;) {
|
---|
[2] | 59 | DosError(FERR_DISABLEHARDERR);
|
---|
[843] | 60 | rc = DosQueryPathInfo(buffer, FIL_STANDARD, &fs3, sizeof(fs3));
|
---|
[551] | 61 | if (rc == ERROR_DISK_CHANGE) {
|
---|
[2] | 62 | DosError(FERR_ENABLEHARDERR);
|
---|
[843] | 63 | rc = DosQueryPathInfo(buffer, FIL_STANDARD, &fs3, sizeof(fs3));
|
---|
[2] | 64 | }
|
---|
[551] | 65 | if (rc)
|
---|
[2] | 66 | break;
|
---|
[551] | 67 | Loop:
|
---|
| 68 | if (p < o) {
|
---|
[2] | 69 | *buffer = 0;
|
---|
| 70 | return NULL;
|
---|
| 71 | }
|
---|
[551] | 72 | if ((*p) + 1 < 'Z' + 1) {
|
---|
[2] | 73 | (*p)++;
|
---|
[551] | 74 | while (strchr("*?<>\":/\\|+=;,[]. ", *p))
|
---|
| 75 | (*p)++;
|
---|
[2] | 76 | *p = toupper(*p);
|
---|
| 77 | }
|
---|
| 78 | else {
|
---|
| 79 | p--;
|
---|
[551] | 80 | if (p >= o && *p == '.')
|
---|
| 81 | p--;
|
---|
[2] | 82 | goto Loop;
|
---|
| 83 | }
|
---|
| 84 | }
|
---|
| 85 | return buffer;
|
---|
| 86 | }
|
---|
| 87 |
|
---|
[551] | 88 | CHAR *TruncName(CHAR * oldname, CHAR * buffer)
|
---|
[347] | 89 | {
|
---|
[551] | 90 | CHAR *p, *f, *s, *o;
|
---|
[843] | 91 | FILESTATUS3 fs3;
|
---|
[551] | 92 | APIRET rc;
|
---|
[2] | 93 |
|
---|
[551] | 94 | if (!buffer || !oldname || !*oldname) {
|
---|
| 95 | if (buffer)
|
---|
[2] | 96 | *buffer = 0;
|
---|
| 97 | return NULL;
|
---|
| 98 | }
|
---|
[551] | 99 | strcpy(buffer, oldname);
|
---|
| 100 | f = strrchr(buffer, '\\');
|
---|
| 101 | if (!f)
|
---|
| 102 | f = strrchr(buffer, '/');
|
---|
| 103 | if (!f)
|
---|
[2] | 104 | f = buffer;
|
---|
| 105 | else
|
---|
| 106 | f++;
|
---|
| 107 | p = f;
|
---|
| 108 | o = p;
|
---|
| 109 | f = oldname + (f - buffer);
|
---|
| 110 | strupr(buffer);
|
---|
[551] | 111 | while (*f == '.') /* skip leading '.'s */
|
---|
[2] | 112 | f++;
|
---|
| 113 | s = f;
|
---|
[551] | 114 | while (*f && *f != '.' && f < s + 8) { /* skip past rootname */
|
---|
[2] | 115 | *p = toupper(*f);
|
---|
| 116 | p++;
|
---|
| 117 | f++;
|
---|
| 118 | }
|
---|
[551] | 119 | while (*f == '.')
|
---|
[2] | 120 | f++;
|
---|
| 121 | s = f;
|
---|
[551] | 122 | f = strrchr(f, '.');
|
---|
| 123 | if (f) {
|
---|
| 124 | while (*f == '.')
|
---|
[2] | 125 | f++;
|
---|
| 126 | }
|
---|
[551] | 127 | if (f && *(f + 1))
|
---|
[2] | 128 | s = f;
|
---|
| 129 | else
|
---|
| 130 | f = s;
|
---|
[551] | 131 | if (*f) {
|
---|
[2] | 132 | *p = '.';
|
---|
| 133 | p++;
|
---|
[551] | 134 | while (*f && *f != '.' && f < s + 3) {
|
---|
[2] | 135 | *p = toupper(*f);
|
---|
| 136 | p++;
|
---|
| 137 | f++;
|
---|
| 138 | }
|
---|
| 139 | }
|
---|
| 140 | *p = 0;
|
---|
| 141 |
|
---|
| 142 | p = o;
|
---|
[551] | 143 | while (*p) {
|
---|
| 144 | if (strchr("*?<>\":/\\|+=;,[] ", *p) || *p < 0x20)
|
---|
[2] | 145 | *p = '_';
|
---|
[551] | 146 | if (*p == '.' && *(p + 1) == '.')
|
---|
[2] | 147 | *(p + 1) = '_';
|
---|
| 148 | p++;
|
---|
| 149 | }
|
---|
| 150 |
|
---|
| 151 | p = o + (strlen(o) - 1);
|
---|
[551] | 152 | for (;;) {
|
---|
[2] | 153 | DosError(FERR_DISABLEHARDERR);
|
---|
[843] | 154 | rc = DosQueryPathInfo(buffer, FIL_STANDARD, &fs3, sizeof(fs3));
|
---|
[551] | 155 | if (rc == ERROR_DISK_CHANGE) {
|
---|
[2] | 156 | DosError(FERR_ENABLEHARDERR);
|
---|
[843] | 157 | rc = DosQueryPathInfo(buffer, FIL_STANDARD, &fs3, sizeof(fs3));
|
---|
[2] | 158 | }
|
---|
[551] | 159 | if (rc)
|
---|
[2] | 160 | break;
|
---|
[551] | 161 | Loop:
|
---|
| 162 | if (p < o) {
|
---|
[2] | 163 | *buffer = 0;
|
---|
| 164 | return NULL;
|
---|
| 165 | }
|
---|
[551] | 166 | if ((*p) + 1 < 'Z' + 1) {
|
---|
[2] | 167 | (*p)++;
|
---|
[551] | 168 | while (strchr("*?<>\":/\\|+=;,[]. ", *p))
|
---|
| 169 | (*p)++;
|
---|
[2] | 170 | *p = toupper(*p);
|
---|
| 171 | }
|
---|
| 172 | else {
|
---|
| 173 | p--;
|
---|
[551] | 174 | if (p >= o && *p == '.')
|
---|
| 175 | p--;
|
---|
[2] | 176 | goto Loop;
|
---|
| 177 | }
|
---|
| 178 | }
|
---|
| 179 | return buffer;
|
---|
| 180 | }
|
---|
| 181 |
|
---|
[551] | 182 | CHAR *GetLongName(CHAR * oldname, CHAR * longname)
|
---|
[347] | 183 | {
|
---|
[551] | 184 | if (!longname)
|
---|
[2] | 185 | return NULL;
|
---|
| 186 | *longname = 0;
|
---|
[551] | 187 | if (!oldname || !*oldname)
|
---|
[2] | 188 | return NULL;
|
---|
[551] | 189 | if (IsFullName(oldname)) {
|
---|
[2] | 190 |
|
---|
[551] | 191 | APIRET rc;
|
---|
| 192 | EAOP2 eaop;
|
---|
[2] | 193 | PGEA2LIST pgealist;
|
---|
| 194 | PFEA2LIST pfealist;
|
---|
[551] | 195 | PGEA2 pgea;
|
---|
| 196 | PFEA2 pfea;
|
---|
| 197 | CHAR *value;
|
---|
[2] | 198 |
|
---|
[551] | 199 | strcpy(longname, oldname);
|
---|
[2] | 200 | value = longname;
|
---|
[551] | 201 | while (*value) {
|
---|
| 202 | if (*value == '/')
|
---|
| 203 | *value = '\\';
|
---|
[2] | 204 | value++;
|
---|
| 205 | }
|
---|
[551] | 206 | value = strrchr(longname, '\\');
|
---|
| 207 | if (value) {
|
---|
[2] | 208 | value++;
|
---|
| 209 | *value = 0;
|
---|
| 210 | }
|
---|
[551] | 211 | pgealist = xmallocz(sizeof(GEA2LIST) + 32, pszSrcFile, __LINE__);
|
---|
[347] | 212 | if (pgealist) {
|
---|
[2] | 213 | pgea = &pgealist->list[0];
|
---|
[551] | 214 | strcpy(pgea->szName, LONGNAME);
|
---|
[2] | 215 | pgea->cbName = strlen(pgea->szName);
|
---|
| 216 | pgea->oNextEntryOffset = 0L;
|
---|
| 217 | pgealist->cbList = (sizeof(GEA2LIST) + pgea->cbName);
|
---|
[551] | 218 | pfealist = xmallocz(1536, pszSrcFile, __LINE__);
|
---|
[347] | 219 | if (pfealist) {
|
---|
[551] | 220 | pfealist->cbList = 1024;
|
---|
| 221 | eaop.fpGEA2List = pgealist;
|
---|
| 222 | eaop.fpFEA2List = pfealist;
|
---|
| 223 | eaop.oError = 0L;
|
---|
| 224 | DosError(FERR_DISABLEHARDERR);
|
---|
| 225 | rc = DosQueryPathInfo(oldname,
|
---|
| 226 | FIL_QUERYEASFROMLIST,
|
---|
| 227 | (PVOID) & eaop, (ULONG) sizeof(EAOP2));
|
---|
| 228 | if (!rc) {
|
---|
| 229 | pfea = &eaop.fpFEA2List->list[0];
|
---|
| 230 | value = pfea->szName + pfea->cbName + 1;
|
---|
| 231 | value[pfea->cbValue] = 0;
|
---|
| 232 | if (*(USHORT *) value == EAT_ASCII)
|
---|
| 233 | strncat(longname,
|
---|
| 234 | value + (sizeof(USHORT) * 2),
|
---|
| 235 | CCHMAXPATH - strlen(longname));
|
---|
| 236 | longname[CCHMAXPATH - 1] = 0;
|
---|
| 237 | }
|
---|
| 238 | free(pfealist);
|
---|
[2] | 239 | }
|
---|
| 240 | free(pgealist);
|
---|
| 241 | }
|
---|
| 242 | }
|
---|
| 243 | return longname;
|
---|
| 244 | }
|
---|
| 245 |
|
---|
[551] | 246 | BOOL ZapLongName(char *filename)
|
---|
[347] | 247 | {
|
---|
[29] | 248 | return WriteLongName(filename, "");
|
---|
[2] | 249 | }
|
---|
| 250 |
|
---|
[551] | 251 | BOOL WriteLongName(CHAR * filename, CHAR * longname)
|
---|
[347] | 252 | {
|
---|
[551] | 253 | APIRET rc;
|
---|
| 254 | EAOP2 eaop;
|
---|
[2] | 255 | PFEA2LIST pfealist = NULL;
|
---|
[551] | 256 | ULONG ealen;
|
---|
| 257 | USHORT len;
|
---|
| 258 | CHAR *eaval, *p;
|
---|
[2] | 259 |
|
---|
[551] | 260 | if (!filename || !*filename || !longname)
|
---|
[2] | 261 | return FALSE;
|
---|
[551] | 262 | p = strrchr(longname, '\\');
|
---|
| 263 | if (p)
|
---|
| 264 | memmove(longname, p + 1, strlen(p + 1) + 1);
|
---|
| 265 | p = strrchr(longname, '/');
|
---|
| 266 | if (p)
|
---|
| 267 | memmove(longname, p + 1, strlen(p + 1) + 1);
|
---|
[123] | 268 | bstrip(longname);
|
---|
[2] | 269 | len = strlen(longname);
|
---|
[551] | 270 | if (len)
|
---|
[2] | 271 | ealen = sizeof(FEA2LIST) + 10 + len + 4;
|
---|
| 272 | else
|
---|
| 273 | ealen = sizeof(FEALIST) + 10;
|
---|
[551] | 274 | rc = DosAllocMem((PPVOID) & pfealist,
|
---|
| 275 | ealen + 32L, OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
|
---|
[347] | 276 | if (rc)
|
---|
[551] | 277 | Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 278 | GetPString(IDS_OUTOFMEMORY));
|
---|
[347] | 279 | else {
|
---|
[551] | 280 | memset(pfealist, 0, ealen + 1);
|
---|
[2] | 281 | pfealist->cbList = ealen;
|
---|
[841] | 282 | pfealist->list[0].oNextEntryOffset = 0;
|
---|
[2] | 283 | pfealist->list[0].fEA = 0;
|
---|
| 284 | pfealist->list[0].cbName = 9;
|
---|
[551] | 285 | strcpy(pfealist->list[0].szName, LONGNAME);
|
---|
| 286 | if (len) {
|
---|
[2] | 287 | eaval = pfealist->list[0].szName + 10;
|
---|
[551] | 288 | *(USHORT *) eaval = (USHORT) EAT_ASCII;
|
---|
[2] | 289 | eaval += sizeof(USHORT);
|
---|
[551] | 290 | *(USHORT *) eaval = (USHORT) len;
|
---|
[2] | 291 | eaval += sizeof(USHORT);
|
---|
[551] | 292 | memcpy(eaval, longname, len);
|
---|
[2] | 293 | pfealist->list[0].cbValue = len + (sizeof(USHORT) * 2);
|
---|
| 294 | }
|
---|
| 295 | else
|
---|
| 296 | pfealist->list[0].cbValue = 0;
|
---|
[551] | 297 | eaop.fpGEA2List = (PGEA2LIST) 0;
|
---|
[2] | 298 | eaop.fpFEA2List = pfealist;
|
---|
| 299 | eaop.oError = 0L;
|
---|
| 300 | DosError(FERR_DISABLEHARDERR);
|
---|
[827] | 301 | rc = xDosSetPathInfo(filename, FIL_QUERYEASIZE,
|
---|
| 302 | &eaop, sizeof(eaop), DSPI_WRTTHRU);
|
---|
[2] | 303 | DosFreeMem(pfealist);
|
---|
[551] | 304 | if (rc)
|
---|
[2] | 305 | return FALSE;
|
---|
| 306 | }
|
---|
| 307 | return TRUE;
|
---|
| 308 | }
|
---|
| 309 |
|
---|
[551] | 310 | BOOL AdjustWildcardName(CHAR * oldname, CHAR * newname)
|
---|
[347] | 311 | {
|
---|
[2] | 312 | BOOL ret = FALSE;
|
---|
| 313 |
|
---|
[827] | 314 | /* NOTE: newname should be CCHMAXPATH chars long! */
|
---|
[2] | 315 |
|
---|
[551] | 316 | if (strchr(newname, '*') || strchr(newname, '?')) {
|
---|
[2] | 317 |
|
---|
[551] | 318 | CHAR srce[CCHMAXPATHCOMP], dest[CCHMAXPATHCOMP], result[CCHMAXPATHCOMP],
|
---|
| 319 | *p;
|
---|
[2] | 320 |
|
---|
[551] | 321 | p = strrchr(newname, '\\');
|
---|
| 322 | if (p && *(p + 1)) {
|
---|
| 323 | strcpy(dest, p + 1);
|
---|
| 324 | p = strrchr(oldname, '\\');
|
---|
| 325 | if (p && *(p + 1)) {
|
---|
| 326 | strcpy(srce, p + 1);
|
---|
| 327 | DosError(FERR_DISABLEHARDERR);
|
---|
| 328 | if (!DosEditName(1L, srce, dest, result, (ULONG) sizeof(result))) {
|
---|
| 329 | p = strrchr(newname, '\\');
|
---|
| 330 | p++;
|
---|
| 331 | strcpy(p, result);
|
---|
| 332 | ret = TRUE;
|
---|
| 333 | }
|
---|
[2] | 334 | }
|
---|
| 335 | }
|
---|
| 336 | }
|
---|
| 337 | return ret;
|
---|
| 338 | }
|
---|
| 339 |
|
---|
[551] | 340 | CHAR default_disk(VOID)
|
---|
[347] | 341 | {
|
---|
[551] | 342 | ULONG ulDriveNum, ulDriveMap;
|
---|
[2] | 343 |
|
---|
| 344 | DosError(FERR_DISABLEHARDERR);
|
---|
[551] | 345 | DosQCurDisk(&ulDriveNum, &ulDriveMap);
|
---|
| 346 | return (CHAR) toupper((INT) ulDriveNum) + '@';
|
---|
[2] | 347 | }
|
---|
| 348 |
|
---|
| 349 | #ifdef NEVER
|
---|
| 350 |
|
---|
[551] | 351 | APIRET docopyallf(INT type, CHAR * oldname, CHAR * newname, ...)
|
---|
[347] | 352 | {
|
---|
[847] | 353 | FILEFINDBUF3 fb;
|
---|
[551] | 354 | ULONG nm;
|
---|
| 355 | HDIR hdir;
|
---|
| 356 | APIRET rc = 0;
|
---|
| 357 | CHAR *enddir, fullname[CCHMAXPATH];
|
---|
[2] | 358 |
|
---|
[551] | 359 | va_start(ap, newname);
|
---|
| 360 | vsprintf(fullname, newname, ap);
|
---|
[2] | 361 | va_end(ap);
|
---|
| 362 |
|
---|
| 363 | DosError(FERR_DISABLEHARDERR);
|
---|
[847] | 364 | if (!DosFindFirst(oldname)) {
|
---|
[2] | 365 | do {
|
---|
| 366 |
|
---|
| 367 | /* build target name */
|
---|
| 368 |
|
---|
[551] | 369 | if (fb.attrFile & FILE_DIRECTORY) {
|
---|
| 370 | DosError(FERR_ENABLEHARDERR);
|
---|
| 371 | rc = DosCreateDir();
|
---|
| 372 | if (rc == ERROR_INVALID_NAME || rc == ERROR_FILENAME_EXCED_RANGE) {
|
---|
[2] | 373 |
|
---|
[551] | 374 | /* truncate directory name */
|
---|
[827] | 375 | /* create that directory */
|
---|
[551] | 376 | /* update containers for name used */
|
---|
[2] | 377 |
|
---|
[551] | 378 | }
|
---|
| 379 | rc = docopyallf(type,, "%s",); /* recurse */
|
---|
[2] | 380 | }
|
---|
| 381 | else
|
---|
[551] | 382 | rc = docopyf(type,, "%s",); /* copy file */
|
---|
[2] | 383 | DosError(FERR_DISABLEHARDERR);
|
---|
[847] | 384 | } while (!rc && !DosFindNext());
|
---|
[2] | 385 | DosFindClose(hdir);
|
---|
| 386 | }
|
---|
| 387 | else
|
---|
| 388 | rc = ERROR_FILE_NOT_FOUND;
|
---|
| 389 | return rc;
|
---|
| 390 | }
|
---|
| 391 |
|
---|
| 392 | #endif
|
---|
| 393 |
|
---|
[551] | 394 | APIRET docopyf(INT type, CHAR * oldname, CHAR * newname, ...)
|
---|
[347] | 395 | {
|
---|
[2] | 396 | /*
|
---|
| 397 | * returns:
|
---|
| 398 | * 0: success
|
---|
| 399 | * -1: bad string parameter(s)
|
---|
| 400 | * -2: source didn't exist
|
---|
| 401 | * -3: bad type
|
---|
[827] | 402 | * anything else: API return
|
---|
[2] | 403 | */
|
---|
| 404 |
|
---|
[551] | 405 | CHAR fullnewname[CCHMAXPATH + 1], longname[CCHMAXPATH],
|
---|
| 406 | shortname[CCHMAXPATH];
|
---|
| 407 | CHAR olddisk, newdisk, dir[CCHMAXPATH], *p, *pp;
|
---|
| 408 | APIRET ret = -1, rc;
|
---|
[841] | 409 | FILESTATUS3L st, st2, dummy;
|
---|
[551] | 410 | BOOL diskchange = FALSE, zaplong = FALSE;
|
---|
| 411 | va_list ap;
|
---|
[2] | 412 |
|
---|
[45] | 413 | *fullnewname = *shortname = *dir = 0;
|
---|
[2] | 414 |
|
---|
[551] | 415 | va_start(ap, newname);
|
---|
| 416 | vsprintf(fullnewname, newname, ap);
|
---|
[2] | 417 | va_end(ap);
|
---|
| 418 |
|
---|
[551] | 419 | if (!oldname || !*oldname || !*fullnewname) /* bad string args */
|
---|
| 420 | return (APIRET) - 1;
|
---|
[29] | 421 |
|
---|
[2] | 422 | DosError(FERR_DISABLEHARDERR);
|
---|
[841] | 423 | if (DosQueryPathInfo(oldname, FIL_STANDARDL, &st, sizeof(FILESTATUS3L)))
|
---|
[551] | 424 | return (APIRET) - 2; /* no source */
|
---|
[29] | 425 |
|
---|
[551] | 426 | AdjustWildcardName(oldname, fullnewname);
|
---|
[2] | 427 | MakeFullName(oldname);
|
---|
| 428 | MakeFullName(fullnewname);
|
---|
[551] | 429 | olddisk = toupper(*oldname); /* source drive */
|
---|
| 430 | newdisk = toupper(*fullnewname); /* destination drive */
|
---|
| 431 | if (!(driveflags[toupper(*oldname) - 'A'] & DRIVE_NOLONGNAMES))
|
---|
[45] | 432 | *longname = 0;
|
---|
[551] | 433 | else {
|
---|
[45] | 434 | GetLongName(oldname, longname);
|
---|
[551] | 435 | if (*longname) {
|
---|
[2] | 436 | p = RootName(longname);
|
---|
[551] | 437 | if (p != longname)
|
---|
| 438 | memmove(longname, p, strlen(p) + 1);
|
---|
[2] | 439 | }
|
---|
[45] | 440 | }
|
---|
| 441 | /* If root name changed make sure longname EA goes away */
|
---|
| 442 | p = RootName(oldname);
|
---|
| 443 | pp = RootName(fullnewname);
|
---|
[551] | 444 | if (stricmp(p, pp)) {
|
---|
[45] | 445 | zaplong = TRUE;
|
---|
[2] | 446 | }
|
---|
| 447 |
|
---|
| 448 | DosError(FERR_DISABLEHARDERR);
|
---|
[551] | 449 | switch (type) {
|
---|
| 450 | case WPSMOVE:
|
---|
| 451 | {
|
---|
| 452 | HOBJECT hobjsrc;
|
---|
| 453 | HOBJECT hobjdest;
|
---|
[2] | 454 |
|
---|
[551] | 455 | ret = ERROR_FILE_NOT_FOUND;
|
---|
| 456 | hobjsrc = WinQueryObject(oldname);
|
---|
| 457 | if (hobjsrc) {
|
---|
| 458 | strcpy(dir, fullnewname);
|
---|
| 459 | p = strrchr(dir, '\\');
|
---|
| 460 | if (p < dir + 3)
|
---|
| 461 | p++;
|
---|
| 462 | *p = 0;
|
---|
| 463 | ret = ERROR_PATH_NOT_FOUND;
|
---|
| 464 | hobjdest = WinQueryObject(dir);
|
---|
| 465 | if (hobjdest) {
|
---|
| 466 | ret = ERROR_GEN_FAILURE;
|
---|
| 467 | hobjsrc = WinMoveObject(hobjsrc, hobjdest, 0);
|
---|
| 468 | if (hobjsrc)
|
---|
| 469 | ret = 0;
|
---|
| 470 | }
|
---|
[2] | 471 | }
|
---|
[551] | 472 | }
|
---|
| 473 | return ret;
|
---|
[2] | 474 |
|
---|
[551] | 475 | case WPSCOPY:
|
---|
| 476 | {
|
---|
| 477 | HOBJECT hobjsrc;
|
---|
| 478 | HOBJECT hobjdest;
|
---|
[2] | 479 |
|
---|
[551] | 480 | ret = ERROR_FILE_NOT_FOUND;
|
---|
| 481 | hobjsrc = WinQueryObject(oldname);
|
---|
| 482 | if (hobjsrc) {
|
---|
| 483 | strcpy(dir, fullnewname);
|
---|
| 484 | p = strrchr(dir, '\\');
|
---|
| 485 | if (p < dir + 3)
|
---|
| 486 | p++;
|
---|
| 487 | *p = 0;
|
---|
| 488 | ret = ERROR_PATH_NOT_FOUND;
|
---|
| 489 | hobjdest = WinQueryObject(dir);
|
---|
| 490 | if (hobjdest) {
|
---|
| 491 | ret = ERROR_GEN_FAILURE;
|
---|
| 492 | hobjsrc = WinCopyObject(hobjsrc, hobjdest, 0);
|
---|
| 493 | if (hobjsrc)
|
---|
| 494 | ret = 0;
|
---|
| 495 | }
|
---|
[2] | 496 | }
|
---|
[551] | 497 | }
|
---|
| 498 | return ret;
|
---|
[2] | 499 |
|
---|
[551] | 500 | case MOVE:
|
---|
| 501 | *dir = 0;
|
---|
| 502 | if (olddisk == newdisk) { /* same drive */
|
---|
| 503 | /* make temporary copy in case move fails */
|
---|
| 504 | if (IsFile(fullnewname) != -1 && stricmp(oldname, fullnewname)) {
|
---|
| 505 | strcpy(dir, fullnewname);
|
---|
| 506 | p = strrchr(dir, '\\');
|
---|
| 507 | if (p)
|
---|
| 508 | *p = 0;
|
---|
| 509 | strcat(dir, "\\");
|
---|
| 510 | MakeTempName(dir);
|
---|
| 511 | if (DosMove(fullnewname, dir))
|
---|
| 512 | *dir = 0;
|
---|
[2] | 513 | }
|
---|
[551] | 514 | DosError(FERR_DISABLEHARDERR);
|
---|
| 515 | ret = DosMove(oldname, fullnewname); /* move it */
|
---|
| 516 | if (ret && *dir) { /* failed -- clean up */
|
---|
| 517 | DosError(FERR_DISABLEHARDERR);
|
---|
| 518 | if (!DosMove(dir, fullnewname))
|
---|
| 519 | Broadcast((HAB) 0, hwndMain, UM_UPDATERECORD, MPFROMP(dir), MPVOID);
|
---|
| 520 | }
|
---|
| 521 | else if (!ret && *dir) {
|
---|
| 522 | if (!IsFile(dir)) {
|
---|
| 523 | if (!strchr(dir, '?') && !strchr(dir, '*'))
|
---|
| 524 | wipeallf("%s\\*", dir);
|
---|
| 525 | DosError(FERR_DISABLEHARDERR);
|
---|
| 526 | if (DosDeleteDir(dir)) {
|
---|
| 527 | make_deleteable(dir);
|
---|
| 528 | DosDeleteDir(dir);
|
---|
| 529 | }
|
---|
| 530 | }
|
---|
| 531 | else if (IsFile(dir) > 0) {
|
---|
| 532 | DosError(FERR_DISABLEHARDERR);
|
---|
| 533 | if (DosForceDelete(dir)) {
|
---|
| 534 | make_deleteable(dir);
|
---|
| 535 | DosForceDelete(dir);
|
---|
| 536 | }
|
---|
| 537 | if (zaplong)
|
---|
| 538 | ZapLongName(dir);
|
---|
| 539 | Broadcast((HAB) 0, hwndMain, UM_UPDATERECORD, MPFROMP(dir), MPVOID);
|
---|
| 540 | }
|
---|
| 541 | }
|
---|
| 542 | }
|
---|
| 543 | else { /* different drives */
|
---|
| 544 | DosError(FERR_DISABLEHARDERR);
|
---|
| 545 | ret = DosCopy(oldname, fullnewname, DCPY_EXISTING); /* <=-NOTE! */
|
---|
| 546 | if (ret == ERROR_DISK_CHANGE) {
|
---|
| 547 | DosError(FERR_ENABLEHARDERR);
|
---|
| 548 | ret = DosCopy(oldname, fullnewname, DCPY_EXISTING);
|
---|
| 549 | diskchange = TRUE;
|
---|
| 550 | }
|
---|
| 551 | if (ret == ERROR_INVALID_NAME || ret == ERROR_FILENAME_EXCED_RANGE) {
|
---|
| 552 | if (TruncName(fullnewname, shortname)) { /* make 8.3 filename */
|
---|
| 553 | DosError(FERR_DISABLEHARDERR);
|
---|
| 554 | ret = DosCopy(oldname, shortname, DCPY_EXISTING);
|
---|
| 555 | if (!ret) { /* success -- write longname ea */
|
---|
| 556 | WriteLongName(shortname, fullnewname);
|
---|
| 557 | strcpy(fullnewname, shortname);
|
---|
| 558 | /* broadcast fixup msg to windows */
|
---|
| 559 | Broadcast((HAB) 0,
|
---|
| 560 | hwndMain, UM_UPDATERECORD, MPFROMP(shortname), MPVOID);
|
---|
| 561 | }
|
---|
| 562 | }
|
---|
| 563 | }
|
---|
| 564 | else if (!ret && *longname) {
|
---|
[2] | 565 |
|
---|
[551] | 566 | CHAR fixname[CCHMAXPATH];
|
---|
[2] | 567 |
|
---|
[551] | 568 | strcpy(fixname, fullnewname);
|
---|
| 569 | p = strrchr(fixname, '\\');
|
---|
| 570 | if (p) {
|
---|
| 571 | p++;
|
---|
| 572 | *p = 0;
|
---|
| 573 | }
|
---|
| 574 | strcat(fixname, longname);
|
---|
| 575 | DosError(FERR_DISABLEHARDERR);
|
---|
| 576 | DosMove(fullnewname, fixname);
|
---|
| 577 | strcpy(fullnewname, fixname);
|
---|
| 578 | if (zaplong)
|
---|
| 579 | ZapLongName(fixname);
|
---|
| 580 | Broadcast((HAB) 0,
|
---|
| 581 | hwndMain, UM_UPDATERECORD, MPFROMP(fixname), MPVOID);
|
---|
[2] | 582 | }
|
---|
[551] | 583 | if (!ret) { /* double-check success */
|
---|
| 584 | DosError(FERR_DISABLEHARDERR);
|
---|
| 585 | rc = DosQueryPathInfo(fullnewname,
|
---|
[841] | 586 | FIL_STANDARDL, &st2, sizeof(FILESTATUS3L));
|
---|
[551] | 587 | if (rc == ERROR_DISK_CHANGE) {
|
---|
| 588 | DosError(FERR_ENABLEHARDERR);
|
---|
| 589 | rc = DosQueryPathInfo(fullnewname,
|
---|
[841] | 590 | FIL_STANDARDL, &st2, sizeof(FILESTATUS3L));
|
---|
[551] | 591 | }
|
---|
| 592 | if (!rc && st2.cbFile == st.cbFile) { /* seems to have worked... */
|
---|
| 593 | DosError(FERR_DISABLEHARDERR);
|
---|
| 594 | if (diskchange) {
|
---|
| 595 | DosError(FERR_ENABLEHARDERR);
|
---|
[841] | 596 | DosQueryPathInfo(oldname, FIL_STANDARDL, &dummy, sizeof(FILESTATUS3L)); /* force disk change */
|
---|
[551] | 597 | }
|
---|
| 598 | if (!(st2.attrFile & FILE_DIRECTORY)) /* erase file */
|
---|
| 599 | unlinkf("%s", oldname);
|
---|
| 600 | else { /* remove directory */
|
---|
| 601 | wipeallf("%s\\*", oldname);
|
---|
| 602 | DosError(FERR_DISABLEHARDERR);
|
---|
| 603 | if (DosDeleteDir(oldname)) {
|
---|
| 604 | make_deleteable(oldname);
|
---|
| 605 | DosDeleteDir(oldname);
|
---|
| 606 | }
|
---|
| 607 | }
|
---|
| 608 | }
|
---|
| 609 | }
|
---|
| 610 | }
|
---|
| 611 | return ret;
|
---|
[2] | 612 |
|
---|
[551] | 613 | case COPY:
|
---|
| 614 | DosError(FERR_DISABLEHARDERR);
|
---|
| 615 | ret = DosCopy(oldname, fullnewname, DCPY_EXISTING); /* <=-NOTE! */
|
---|
| 616 | if (ret == ERROR_DISK_CHANGE) {
|
---|
| 617 | DosError(FERR_ENABLEHARDERR);
|
---|
| 618 | ret = DosCopy(oldname, fullnewname, DCPY_EXISTING);
|
---|
| 619 | diskchange = TRUE;
|
---|
| 620 | }
|
---|
| 621 | if (ret == ERROR_INVALID_NAME || ret == ERROR_FILENAME_EXCED_RANGE) {
|
---|
| 622 | if (TruncName(fullnewname, shortname)) {
|
---|
| 623 | DosError((diskchange) ? FERR_ENABLEHARDERR : FERR_DISABLEHARDERR);
|
---|
| 624 | ret = DosCopy(oldname, shortname, DCPY_EXISTING);
|
---|
| 625 | if (!ret) {
|
---|
| 626 | WriteLongName(shortname, fullnewname);
|
---|
| 627 | strcpy(fullnewname, shortname);
|
---|
| 628 | Broadcast((HAB) 0,
|
---|
| 629 | hwndMain, UM_UPDATERECORD, MPFROMP(shortname), MPVOID);
|
---|
| 630 | }
|
---|
[2] | 631 | }
|
---|
[551] | 632 | }
|
---|
| 633 | else if (!ret && *longname) {
|
---|
[2] | 634 |
|
---|
[551] | 635 | CHAR fixname[CCHMAXPATH];
|
---|
[2] | 636 |
|
---|
[551] | 637 | strcpy(fixname, fullnewname);
|
---|
| 638 | p = strrchr(fixname, '\\');
|
---|
| 639 | if (p) {
|
---|
| 640 | p++;
|
---|
| 641 | *p = 0;
|
---|
[2] | 642 | }
|
---|
[551] | 643 | strcat(fixname, longname);
|
---|
| 644 | DosError(FERR_DISABLEHARDERR);
|
---|
| 645 | DosMove(fullnewname, fixname);
|
---|
| 646 | if (zaplong)
|
---|
| 647 | ZapLongName(fixname);
|
---|
| 648 | Broadcast((HAB) 0, hwndMain, UM_UPDATERECORD, MPFROMP(fixname), MPVOID);
|
---|
| 649 | }
|
---|
| 650 | return ret;
|
---|
[2] | 651 |
|
---|
[551] | 652 | default: /* shouldn't happen */
|
---|
| 653 | Runtime_Error(pszSrcFile, __LINE__, "bad case %u", type);
|
---|
| 654 | break;
|
---|
[2] | 655 | }
|
---|
[551] | 656 | return (APIRET) - 3; /* bad type */
|
---|
[2] | 657 | }
|
---|
| 658 |
|
---|
[551] | 659 | INT make_deleteable(CHAR * filename)
|
---|
[347] | 660 | {
|
---|
[2] | 661 | INT ret = -1;
|
---|
[847] | 662 | FILESTATUS3 fsi;
|
---|
[2] | 663 |
|
---|
| 664 | DosError(FERR_DISABLEHARDERR);
|
---|
[847] | 665 | if (!DosQueryPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi))) {
|
---|
[2] | 666 | fsi.attrFile = 0;
|
---|
| 667 | DosError(FERR_DISABLEHARDERR);
|
---|
[847] | 668 | if (!xDosSetPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi), 0))
|
---|
[2] | 669 | ret = 0;
|
---|
| 670 | }
|
---|
| 671 | return ret;
|
---|
| 672 | }
|
---|
| 673 |
|
---|
[827] | 674 | INT wipeallf(CHAR *string, ...)
|
---|
[347] | 675 | {
|
---|
[2] | 676 | /* unlink everything from directory on down... */
|
---|
| 677 |
|
---|
[847] | 678 | FILEFINDBUF3 *f;
|
---|
[551] | 679 | HDIR search_handle;
|
---|
| 680 | ULONG num_matches;
|
---|
| 681 | CHAR *p, *ss, *str;
|
---|
| 682 | CHAR s[CCHMAXPATH], mask[257];
|
---|
| 683 | va_list ap;
|
---|
| 684 | INT rc;
|
---|
[2] | 685 |
|
---|
[551] | 686 | va_start(ap, string);
|
---|
| 687 | vsprintf(s, string, ap);
|
---|
[2] | 688 | va_end(ap);
|
---|
| 689 |
|
---|
[551] | 690 | if (!*s)
|
---|
[2] | 691 | return -1;
|
---|
| 692 | p = s;
|
---|
[551] | 693 | while ((p = strchr(p, '/')) != NULL) {
|
---|
[2] | 694 | *p = '\\';
|
---|
| 695 | p++;
|
---|
| 696 | }
|
---|
| 697 |
|
---|
[551] | 698 | str = xstrdup(s, pszSrcFile, __LINE__);
|
---|
| 699 | if (!str)
|
---|
[2] | 700 | return -1;
|
---|
| 701 |
|
---|
[551] | 702 | { /* safety net -- disallow deleting a root dir or partial name */
|
---|
[2] | 703 | CHAR temp;
|
---|
| 704 |
|
---|
[551] | 705 | p = strrchr(str, '\\');
|
---|
| 706 | if (p) {
|
---|
[2] | 707 | p++;
|
---|
| 708 | temp = *p;
|
---|
| 709 | *p = 0;
|
---|
[551] | 710 | if (IsRoot(str) || !IsFullName(str)) {
|
---|
| 711 | /* under no circumstances! */
|
---|
| 712 | Runtime_Error(pszSrcFile, __LINE__, "bad name %s", str);
|
---|
| 713 | free(str);
|
---|
| 714 | return -1;
|
---|
[2] | 715 | }
|
---|
| 716 | *p = temp;
|
---|
| 717 | }
|
---|
| 718 | }
|
---|
| 719 |
|
---|
| 720 | p = s;
|
---|
[551] | 721 | p = strrchr(s, '\\'); /* strip s to just path */
|
---|
| 722 | if (!p)
|
---|
| 723 | p = strrchr(s, ':');
|
---|
| 724 | if (p) {
|
---|
[2] | 725 | p++;
|
---|
[551] | 726 | strncpy(mask, p, 256);
|
---|
[2] | 727 | mask[256] = 0;
|
---|
| 728 | *p = 0;
|
---|
| 729 | }
|
---|
| 730 | else {
|
---|
| 731 | *mask = 0;
|
---|
| 732 | *s = 0;
|
---|
| 733 | }
|
---|
| 734 |
|
---|
[551] | 735 | ss = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__);
|
---|
[847] | 736 | f = xmalloc(sizeof(FILEFINDBUF3), pszSrcFile, __LINE__);
|
---|
[347] | 737 | if (!ss || !f) {
|
---|
| 738 | xfree(ss);
|
---|
| 739 | xfree(f);
|
---|
[2] | 740 | free(str);
|
---|
| 741 | return -1;
|
---|
| 742 | }
|
---|
| 743 |
|
---|
| 744 | search_handle = HDIR_CREATE;
|
---|
[841] | 745 | num_matches = 1;
|
---|
[2] | 746 |
|
---|
| 747 | DosError(FERR_DISABLEHARDERR);
|
---|
[847] | 748 | if (!DosFindFirst(str, &search_handle, FILE_NORMAL | FILE_DIRECTORY |
|
---|
[838] | 749 | FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN | FILE_ARCHIVED,
|
---|
[847] | 750 | f, sizeof(FILEFINDBUF3), &num_matches, FIL_STANDARD)) {
|
---|
[2] | 751 |
|
---|
[551] | 752 | strcpy(ss, s);
|
---|
[2] | 753 | p = &ss[strlen(ss)];
|
---|
| 754 |
|
---|
| 755 | do {
|
---|
[551] | 756 | strcpy(p, f->achName);
|
---|
| 757 | if (f->attrFile & FILE_DIRECTORY) {
|
---|
| 758 | if (strcmp(f->achName, ".") && strcmp(f->achName, "..")) {
|
---|
| 759 | wipeallf("%s/%s", ss, mask); /* recurse to wipe files */
|
---|
| 760 | DosError(FERR_DISABLEHARDERR);
|
---|
| 761 | if (DosDeleteDir(ss)) { /* remove directory */
|
---|
| 762 | make_deleteable(ss);
|
---|
| 763 | DosError(FERR_DISABLEHARDERR);
|
---|
| 764 | DosDeleteDir(ss);
|
---|
| 765 | }
|
---|
| 766 | }
|
---|
[2] | 767 | }
|
---|
| 768 | else {
|
---|
[551] | 769 | DosError(FERR_DISABLEHARDERR);
|
---|
| 770 | if (DosForceDelete(ss)) {
|
---|
| 771 | make_deleteable(ss);
|
---|
| 772 | DosError(FERR_DISABLEHARDERR);
|
---|
| 773 | rc = (INT) DosForceDelete(ss);
|
---|
| 774 | if (rc)
|
---|
| 775 | return rc;
|
---|
| 776 | }
|
---|
[2] | 777 | }
|
---|
[847] | 778 | num_matches = 1;
|
---|
[2] | 779 | DosError(FERR_DISABLEHARDERR);
|
---|
[847] | 780 | } while (!DosFindNext(search_handle, f, sizeof(FILEFINDBUF3),
|
---|
| 781 | &num_matches));
|
---|
[2] | 782 | DosFindClose(search_handle);
|
---|
| 783 | }
|
---|
| 784 |
|
---|
[959] | 785 | xfree(f);
|
---|
| 786 | xfree(ss);
|
---|
[2] | 787 | free(str);
|
---|
| 788 | return 0;
|
---|
| 789 | }
|
---|
| 790 |
|
---|
[551] | 791 | INT unlink_allf(CHAR * string, ...)
|
---|
[347] | 792 | {
|
---|
[2] | 793 | /* wildcard delete */
|
---|
| 794 |
|
---|
[847] | 795 | FILEFINDBUF3 *f;
|
---|
[551] | 796 | HDIR search_handle;
|
---|
[2] | 797 | ULONG num_matches;
|
---|
[551] | 798 | CHAR *p, *ss, *str;
|
---|
| 799 | CHAR s[CCHMAXPATH];
|
---|
[2] | 800 | va_list ap;
|
---|
| 801 |
|
---|
[551] | 802 | va_start(ap, string);
|
---|
| 803 | vsprintf(s, string, ap);
|
---|
[2] | 804 | va_end(ap);
|
---|
| 805 |
|
---|
[551] | 806 | if (!*s)
|
---|
[2] | 807 | return -1;
|
---|
| 808 | p = s;
|
---|
[551] | 809 | while ((p = strchr(p, '/')) != NULL) {
|
---|
[2] | 810 | *p = '\\';
|
---|
| 811 | p++;
|
---|
| 812 | }
|
---|
| 813 |
|
---|
[551] | 814 | str = xstrdup(s, pszSrcFile, __LINE__);
|
---|
[347] | 815 | if (!str)
|
---|
[2] | 816 | return -1;
|
---|
| 817 |
|
---|
| 818 | p = s;
|
---|
[551] | 819 | p = strrchr(s, '\\'); /* strip s to just path */
|
---|
| 820 | if (!p)
|
---|
| 821 | p = strrchr(s, ':');
|
---|
| 822 | if (p) {
|
---|
[2] | 823 | p++;
|
---|
| 824 | *p = 0;
|
---|
| 825 | }
|
---|
| 826 | else
|
---|
| 827 | *s = 0;
|
---|
| 828 |
|
---|
[551] | 829 | ss = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__);
|
---|
[847] | 830 | f = xmalloc(sizeof(FILEFINDBUF3), pszSrcFile, __LINE__);
|
---|
[347] | 831 | if (!ss || !f) {
|
---|
| 832 | xfree(ss);
|
---|
| 833 | xfree(f);
|
---|
[2] | 834 | free(str);
|
---|
| 835 | return -1;
|
---|
| 836 | }
|
---|
| 837 |
|
---|
| 838 | search_handle = HDIR_CREATE;
|
---|
[838] | 839 | num_matches = 1;
|
---|
[2] | 840 |
|
---|
| 841 | DosError(FERR_DISABLEHARDERR);
|
---|
[847] | 842 | if (!DosFindFirst(str, &search_handle, FILE_NORMAL, f,
|
---|
| 843 | sizeof(FILEFINDBUF3), &num_matches, FIL_STANDARD)) {
|
---|
[2] | 844 |
|
---|
[551] | 845 | strcpy(ss, s);
|
---|
[2] | 846 | p = &ss[strlen(ss)];
|
---|
| 847 |
|
---|
| 848 | do {
|
---|
[551] | 849 | strcpy(p, f->achName);
|
---|
| 850 | unlinkf("%s", ss);
|
---|
[838] | 851 | num_matches = 1;
|
---|
[2] | 852 | DosError(FERR_DISABLEHARDERR);
|
---|
[847] | 853 | } while (!DosFindNext(search_handle, f, sizeof(FILEFINDBUF3),
|
---|
| 854 | &num_matches));
|
---|
[2] | 855 | DosFindClose(search_handle);
|
---|
| 856 | }
|
---|
| 857 |
|
---|
[959] | 858 | xfree(f);
|
---|
| 859 | xfree(ss);
|
---|
[2] | 860 | free(str);
|
---|
| 861 | return 0;
|
---|
| 862 | }
|
---|
| 863 |
|
---|
[551] | 864 | INT unlinkf(CHAR * string, ...)
|
---|
[347] | 865 | {
|
---|
[2] | 866 | CHAR buffer[CCHMAXPATH];
|
---|
| 867 | va_list ap;
|
---|
| 868 |
|
---|
[551] | 869 | va_start(ap, string);
|
---|
| 870 | vsprintf(buffer, string, ap);
|
---|
[2] | 871 | va_end(ap);
|
---|
| 872 |
|
---|
[551] | 873 | if (!strstr(buffer, ArcTempRoot)) {
|
---|
[2] | 874 | DosError(FERR_DISABLEHARDERR);
|
---|
[551] | 875 | if (DosDelete(buffer)) {
|
---|
[2] | 876 | make_deleteable(buffer);
|
---|
| 877 | DosError(FERR_DISABLEHARDERR);
|
---|
| 878 | return DosDelete(buffer);
|
---|
| 879 | }
|
---|
| 880 | }
|
---|
| 881 | else {
|
---|
| 882 | DosError(FERR_DISABLEHARDERR);
|
---|
[551] | 883 | if (DosForceDelete(buffer)) {
|
---|
[2] | 884 | make_deleteable(buffer);
|
---|
| 885 | DosError(FERR_DISABLEHARDERR);
|
---|
| 886 | return DosForceDelete(buffer);
|
---|
| 887 | }
|
---|
| 888 | }
|
---|
| 889 | return 0;
|
---|
| 890 | }
|
---|
[793] | 891 |
|
---|
| 892 | #pragma alloc_text(LONGNAMES,TruncName,GetLongName,WriteLongName)
|
---|
| 893 | #pragma alloc_text(LONGNAMES,ZapLongName,AdjustWildcardName)
|
---|
| 894 | #pragma alloc_text(COPYF,default_disk,docopyf)
|
---|
| 895 | #pragma alloc_text(UNLINKF,unlinkf,unlink_allf,make_deleteable,wipeallf)
|
---|