Changeset 5654
- Timestamp:
- May 4, 2001, 7:01:29 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/shell32/shlfileop.c ¶
r5636 r5654 107 107 PathAddBackslashA(szTemp); 108 108 strcat(szTemp, "*.*"); 109 109 110 110 if (bShowUI && !SHELL_WarnItemDelete(ASK_DELETE_FOLDER, pszDir)) 111 111 return FALSE; … … 174 174 * ANSI. Is this Unicode on NT? 175 175 * 176 */ 176 */ 177 177 178 178 BOOL WINAPI Win32DeleteFile(LPSTR fName) … … 198 198 DWORD FromAttr; 199 199 DWORD ToAttr; 200 LPSTR pTempFrom ;201 LPSTR pTempTo = NULL;200 LPSTR pTempFrom = NULL; 201 LPSTR pTempTo; 202 202 LPSTR pFromFile; 203 203 LPSTR pToFile; … … 228 228 LPSTR pTempTo; 229 229 #endif 230 230 231 231 switch(lpFileOp->wFunc) { 232 232 case FO_COPY: 233 233 TRACE("File Copy:\n"); 234 234 #ifdef __WIN32OS2__ 235 pTemp To= HeapAlloc(GetProcessHeap(), 0, 3 * MAX_PATH+6);236 pTemp From = &pTempTo[2*MAX_PATH+2];235 pTempFrom = HeapAlloc(GetProcessHeap(), 0, 3 * MAX_PATH+6); 236 pTempTo = &pTempFrom[MAX_PATH+4]; 237 237 /* 238 238 * FOF_MULTIDESTFILES, FOF_NOCONFIRMATION, FOF_FILESONLY are implemented … … 267 267 if(!pTo[0]) { 268 268 nlpFileOp.fAnyOperationsAborted=TRUE; 269 where = 13;269 where = 213; 270 270 break; 271 271 } … … 275 275 // fix for more then one source for one target 276 276 pToFile[0] = '\0'; 277 nlpFileOp.pTo = pTo; 277 278 278 279 lenFrom=strlen(pFrom); … … 311 312 (!withFileName && !ToSingle) ) { 312 313 nlpFileOp.fAnyOperationsAborted=TRUE; 313 where = 1;314 where = 201; 314 315 break; 315 316 } … … 329 330 lenTempFrom = strlen(pTempFrom); 330 331 pFromFile=&pTempFrom[lenTempFrom]; 331 332 332 333 if (FromAttr == -1 || 333 334 ((lenTempFrom==lenFrom) && !PathIsRootA(pFrom)) || … … 336 337 retCode=0x402; 337 338 nlpFileOp.fAnyOperationsAborted=TRUE; 338 where = 2 ;339 where = 202; 339 340 break; 340 341 } … … 345 346 nlpFileOp.fAnyOperationsAborted=TRUE; 346 347 retCode=0x79; 347 where = 3;348 where = 203; 348 349 break; 349 350 } … … 369 370 TempretCode = SHFileOperationA (&nlpFileOp); 370 371 371 if (nlpFileOp.fAnyOperationsAborted) {where = 4;break;}372 if (nlpFileOp.fAnyOperationsAborted) {where = 204;break;} 372 373 373 374 } while(FindNextFileA(hFind, &wfd)); 374 375 375 376 FindClose(hFind); 376 if (nlpFileOp.fAnyOperationsAborted) {where = 5;break;}377 if (nlpFileOp.fAnyOperationsAborted) {where = 205;break;} 377 378 continue; 378 379 } 379 380 380 381 381 lenTempTo = strlen(pTempTo); … … 387 387 nlpFileOp.fAnyOperationsAborted=TRUE; 388 388 retCode=0x402; 389 where = 6;389 where = 206; 390 390 break; 391 391 } /* endif */ … … 408 408 if (!pFromFile) { 409 409 nlpFileOp.fAnyOperationsAborted=TRUE; 410 where = 7;410 where = 207; 411 411 break; 412 412 } /* endif */ … … 420 420 ToAttr = GetFileAttributesA(pTempTo); 421 421 422 423 422 if (FromAttr == -1) { 424 423 FIXME(__FUNCTION__" FO_COPY with Source %s not implementiert ,stub\n",pTempFrom); 425 424 nlpFileOp.fAnyOperationsAborted=TRUE; 426 where = 8;425 where = 208; 427 426 break; 428 427 } … … 436 435 nlpFileOp.fAnyOperationsAborted=TRUE; 437 436 retCode=0x10003; 438 where = 9;437 where = 209; 439 438 break; 440 439 } … … 459 458 FIXME(__FUNCTION__" FO_COPY unexpected with %s -> %s ? ,stub\n",pTempFrom,pTo); 460 459 nlpFileOp.fAnyOperationsAborted=TRUE; 461 where = 10;460 where = 210; 462 461 retCode=0x77; 463 462 break; … … 469 468 if (!(ToAttr == -1) && (ToAttr & FILE_ATTRIBUTE_DIRECTORY)) { 470 469 nlpFileOp.fAnyOperationsAborted=TRUE; 471 where = 11;470 where = 211; 472 471 break; 473 472 } … … 475 474 nlpFileOp.fAnyOperationsAborted=TRUE; 476 475 retCode = 0x71; 477 where = 12;476 where = 212; 478 477 break; 479 478 } … … 488 487 489 488 nlpFileOp.fAnyOperationsAborted=TRUE; 489 where = 215; 490 490 } 491 492 if (pTempTo) HeapFree(GetProcessHeap(), 0, pTempTo); 493 494 if (nlpFileOp.fAnyOperationsAborted) { 495 lpFileOp->fAnyOperationsAborted=TRUE; 496 if (TempretCode > retCode) { 497 retCode = TempretCode; 498 } /* endif */ 499 } 500 if (lpFileOp->fAnyOperationsAborted==TRUE) { 501 TRACE(__FUNCTION__" Setting AnyOpsAborted=TRUE ret=0x%x, at=%i with %s -> %s\n",retCode,where,pFrom,pTo); 502 return retCode; 503 } /* endif */ 504 505 TRACE(__FUNCTION__" Setting AnyOpsAborted=FALSE\n"); 506 return 0; 491 break; 507 492 #else 508 493 while(1) { … … 532 517 case FO_DELETE: 533 518 TRACE("File Delete:\n"); 519 #ifdef __WIN32OS2__ 520 while((pFrom+=lenFrom+1)[0] && !nlpFileOp.fAnyOperationsAborted) { 521 lenFrom=strlen(pFrom); 522 FromAttr = GetFileAttributesA(pFrom); 523 if (!(FromAttr & FILE_ATTRIBUTE_DIRECTORY)) { 524 TRACE(" File='%s'\n", pFrom); 525 if (DeleteFileA(pFrom)) continue; 526 nlpFileOp.fAnyOperationsAborted=TRUE; 527 // retCode = 0x71; 528 where = 301; 529 break; 530 } 531 if (!(pTempFrom)) pTempFrom = HeapAlloc(GetProcessHeap(), 0, MAX_PATH+2); 532 strcpy(pTempFrom,pFrom); 533 PathRemoveBackslashA(pTempFrom); 534 FromAttr = GetFileAttributesA(pTempFrom); 535 if (!(FromAttr & FILE_ATTRIBUTE_DIRECTORY) ) { 536 nlpFileOp.fAnyOperationsAborted=TRUE; 537 // retCode = 0x71; 538 where = 302; 539 break; 540 } 541 // is Source an existing directory\*.* ? 542 if (FromAttr == -1) { 543 PathRemoveFileSpecA(pTempFrom); 544 FromAttr = GetFileAttributesA(pTempFrom); 545 } 546 547 PathAddBackslashA(pTempFrom); 548 lenTempFrom = strlen(pTempFrom); 549 pFromFile=&pTempFrom[lenTempFrom]; 550 551 if (FromAttr == -1 || 552 ((lenTempFrom==lenFrom) && !PathIsRootA(pFrom)) || 553 !(FromAttr & FILE_ATTRIBUTE_DIRECTORY) || 554 !(('\0'==pFrom[lenTempFrom]) || (0==strcmp(&pFrom[lenTempFrom],"*.*"))) ) { 555 retCode=0x402; 556 nlpFileOp.fAnyOperationsAborted=TRUE; 557 where = 303; 558 break; 559 } 560 strcpy(pFromFile, "*.*"); 561 lenTempFrom = strlen(pTempFrom); 562 if (lenFrom < lenTempFrom) { 563 // Source is without \*.* 564 pTempFrom[lenTempFrom+1]='\0'; 565 nlpFileOp.pFrom = pTempFrom; 566 567 TRACE(__FUNCTION__" Entering Directory '%s'\n", nlpFileOp.pFrom); 568 TempretCode = SHFileOperationA (&nlpFileOp); 569 570 if (nlpFileOp.fAnyOperationsAborted) {break;} 571 // Call SHELL_DeleteDirectoryA ? 572 if (RemoveDirectoryA(pFrom)) continue; 573 nlpFileOp.fAnyOperationsAborted=TRUE; 574 where = 304; 575 break; 576 } 577 hFind = FindFirstFileA(pTempFrom, &wfd); 578 if (INVALID_HANDLE_VALUE == hFind) { 579 nlpFileOp.fAnyOperationsAborted=TRUE; 580 retCode=0x79; 581 where = 303; 582 break; 583 } 584 585 nlpFileOp.pFrom = pTempFrom; 586 // single copy never with FOF_MULTIDESTFILES, I can use lpFileOp->pTo as nlpFileOp.pTo, 587 // I need no different targetarea for the name 588 nlpFileOp.fFlags = (nlpFileOp.fFlags & (-1 - (FOF_MULTIDESTFILES))); 589 590 TRACE(__FUNCTION__" Delete in Subdir %s'\n", nlpFileOp.pFrom); 591 592 do { 593 TRACE(__FUNCTION__" find '%s'\n", wfd.cFileName); 594 if (0==strcmp(wfd.cFileName,".")) continue; 595 if (0==strcmp(wfd.cFileName,"..")) continue; 596 if ((nlpFileOp.fFlags & FOF_FILESONLY) && (FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes)) { 597 continue; 598 } /* endif */ 599 600 strcpy(pFromFile,wfd.cFileName); 601 pTempFrom[strlen(pTempFrom)+1]='\0'; 602 603 TempretCode = SHFileOperationA (&nlpFileOp); 604 605 if (nlpFileOp.fAnyOperationsAborted) {where = 304;break;} 606 607 } while(FindNextFileA(hFind, &wfd)); 608 609 FindClose(hFind); 610 if (nlpFileOp.fAnyOperationsAborted) {where = 305;break;} 611 continue; 612 } 613 break; 614 case FO_MOVE: 615 TRACE("File\\Tree Move: simply (Copy/Delete)\n"); 616 nlpFileOp.wFunc = FO_COPY; 617 // not delete at error from copy 618 TempretCode = SHFileOperationA (&nlpFileOp); 619 620 if (nlpFileOp.fAnyOperationsAborted) { 621 if (TempretCode == 0x75) { 622 // not all, the most 623 TempretCode = 0xD7; 624 retCode = 0xD7; 625 } /* endif */ 626 break; 627 } 628 629 nlpFileOp.wFunc = FO_DELETE; 630 631 TempretCode = SHFileOperationA (&nlpFileOp); 632 633 case 0: 634 break; 635 #else 534 636 while(1) { 535 637 if(!pFrom[0]) break; … … 541 643 lpFileOp->fAnyOperationsAborted=FALSE; 542 644 return 0; 645 #endif 543 646 544 647 default: 648 #ifdef __WIN32OS2__ 649 FIXME(__FUNCTION__" Unhandled shell file operation %d stub\n", lpFileOp->wFunc); 650 #else 545 651 FIXME("Unhandled shell file operation %d\n", lpFileOp->wFunc); 652 #endif 653 return 1; 546 654 } 547 655 548 return 1; 656 #ifdef __WIN32OS2__ 657 if (pTempFrom) HeapFree(GetProcessHeap(), 0, pTempFrom); 658 659 if (nlpFileOp.fAnyOperationsAborted) { 660 lpFileOp->fAnyOperationsAborted=TRUE; 661 if (TempretCode > retCode) { 662 retCode = TempretCode; 663 } /* endif */ 664 } 665 if (lpFileOp->fAnyOperationsAborted==TRUE) { 666 if (FO_DELETE == lpFileOp->wFunc) { 667 TRACE(__FUNCTION__" Setting AnyOpsAborted=TRUE ret=0x%x, at=%i with %s\n",retCode,where,pFrom); 668 } else { 669 TRACE(__FUNCTION__" Setting AnyOpsAborted=TRUE ret=0x%x, at=%i with %s -> %s\n",retCode,where,pFrom,pTo); 670 } 671 return retCode; 672 } /* endif */ 673 TRACE(__FUNCTION__" Setting AnyOpsAborted=FALSE\n"); 674 return 0; 675 676 #endif 549 677 } 550 678 … … 557 685 DWORD WINAPI SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp) 558 686 { 687 #ifdef __WIN32OS2__ 688 FIXME(__FUNCTION__"(%p) ,stub\n", lpFileOp); 689 #else 559 690 FIXME("(%p):stub.\n", lpFileOp); 691 #endif 560 692 return 1; 561 693 } … … 577 709 */ 578 710 HRESULT WINAPI SheGetDirW(LPWSTR u, LPWSTR v) 711 #ifdef __WIN32OS2__ 712 { FIXME(__FUNCTION__"(%p, %p) ,stub\n",u,v); 713 #else 579 714 { FIXME("%p %p stub\n",u,v); 715 #endif 580 716 return 0; 581 717 } … … 586 722 */ 587 723 HRESULT WINAPI SheChangeDirW(LPWSTR u) 724 #ifdef __WIN32OS2__ 725 { FIXME(__FUNCTION__"(%s),stub\n",debugstr_w(u)); 726 #else 588 727 { FIXME("(%s),stub\n",debugstr_w(u)); 728 #endif 589 729 return 0; 590 730 }
Note:
See TracChangeset
for help on using the changeset viewer.