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