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