- Timestamp:
- Mar 31, 2003, 12:27:55 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shell32/shlfileop.c
r9833 r9959 492 492 } 493 493 494 /************************************************************************** 495 * SHELL_FileNamesMatch() 496 * 497 * Accepts two \0 delimited lists of the file names. Checks whether number of 498 * files in the both lists is the same, 499 * and checks also if source-name exists. 500 */ 501 BOOL SHELL_FileNamesMatch(LPCWSTR pszFiles1, LPCWSTR pszFiles2, BOOL B_OnlyFrom) 502 { 503 while ( (pszFiles1[0] != '\0') && 504 (B_OnlyFrom || (pszFiles2[0] != '\0'))) 505 { 506 if (NULL == StrPBrkW(pszFiles1, wWildcardChars)) 507 { 508 if (-1 == GetFileAttributesW(pszFiles1)) 509 return FALSE; 510 } 511 pszFiles1 += lstrlenW(pszFiles1) + 1; 512 if (!B_OnlyFrom) 513 pszFiles2 += lstrlenW(pszFiles2) + 1; 514 } 515 return 516 ( (pszFiles1[0] == '\0') && 517 (B_OnlyFrom || (pszFiles2[0] == '\0'))); 518 } 519 494 520 /************************************************************************* 495 521 * … … 546 572 { 547 573 retCode = ERROR_OUTOFMEMORY; 574 SetLastError(retCode); 548 575 goto shfileop_error; 549 576 } … … 564 591 { 565 592 nFileOp.fAnyOperationsAborted = TRUE; 566 SetLastError(retCode);567 593 } 568 594 lpFileOp->hNameMappings = nFileOp.hNameMappings; … … 577 603 * exported by name 578 604 */ 605 606 /* in w98 brings shell32_test.exe this 4 failures 607 shlfileop.c:177: Test failed: Can't rename many files 608 * W98 return 0 without action 609 shlfileop.c:185: Test failed: Can't rename many files 610 * W98 return 0 without action 611 shlfileop.c:286: Test failed: Files are copied to other directory 612 shlfileop.c:287: Test failed: The file is copied 613 * This two messages are in W98 / W2K also 614 shlfileop: 121 tests executed, 0 marked as todo, 4 failures. 615 * this implementation has only the last 2 messages (W2K lyke) 616 */ 617 579 618 DWORD WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp) 580 619 { … … 585 624 LPCWSTR pFrom = pNextFrom; 586 625 LPCWSTR pTo = NULL; 626 LPCSTR Debug_pFrom; 627 LPCSTR Debug_pTo; 587 628 HANDLE hFind = INVALID_HANDLE_VALUE; 588 629 WIN32_FIND_DATAW wfd; … … 595 636 DWORD ToAttr; 596 637 DWORD ToPathAttr; 638 DWORD FromPathAttr; 597 639 FILEOP_FLAGS OFl = ((FILEOP_FLAGS)lpFileOp->fFlags & 0x7ff); 598 640 … … 600 642 601 643 BOOL b_MultiTo = (FO_DELETE != (lpFileOp->wFunc & 0xf)); 644 BOOL b_MultiPaired = (!b_MultiTo); 602 645 BOOL b_MultiFrom = FALSE; 603 646 BOOL not_overwrite; … … 665 708 /* OFl ^= (FOF_SILENT | FOF_NOCONFIRMATION | FOF_SIMPLEPROGRESS | FOF_NOCONFIRMMKDIR); */ 666 709 OFl &= (~(FOF_MULTIDESTFILES | FOF_NOCONFIRMATION | FOF_FILESONLY)); /* implemented */ 667 OFl ^= (FOF_SILENT | FOF_NOCONFIRMMKDIR );/* ignored, if one */710 OFl ^= (FOF_SILENT | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI); /* ignored, if one */ 668 711 OFl &= (~FOF_SIMPLEPROGRESS); /* ignored, only with FOF_SILENT */ 669 712 if (OFl) 670 713 { 671 if (OFl & ( ~ (FOF_CONFIRMMOUSE | FOF_SILENT | FOF_RENAMEONCOLLISION | FOF_NOCONFIRMMKDIR )))714 if (OFl & ( ~ (FOF_CONFIRMMOUSE | FOF_SILENT | FOF_RENAMEONCOLLISION | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI))) 672 715 { 673 716 TRACE("%s level=%d lpFileOp->fFlags=0x%x not implemented, Aborted=TRUE, stub\n", cFO_Name[0], level, OFl); … … 684 727 { 685 728 nFileOp.pFrom = pTempFrom = HeapAlloc(GetProcessHeap(), 0, ((1 + 2 * (b_MultiTo)) * MAX_PATH + 6) * sizeof(WCHAR)); 729 if (!pTempFrom) 730 { 731 retCode = ERROR_OUTOFMEMORY; 732 SetLastError(retCode); 733 goto shfileop_error; 734 } 686 735 if (b_MultiTo) 687 736 pTempTo = &pTempFrom[MAX_PATH + 4]; … … 715 764 pFromFile = SHFileStrCpyCatW(pTempFrom, pFrom, NULL); 716 765 766 /* for seeing in debugger outside from TRACE */ 767 Debug_pFrom = debugstr_w(pFrom); 768 Debug_pTo = debugstr_w(pTo); 769 TRACE("%s level=%d with %s %s%s\n", 770 cFO_Name[0], level, Debug_pFrom, pTo ? "-> ":"", Debug_pTo); 771 717 772 if (pTo) 718 773 { 719 774 pToFile = SHFileStrCpyCatW(pTempTo, pTo, NULL); 720 775 } 721 if (!(pFromFile) || !(pFromFile[1]) || ((pTo) && !(pToFile))) 776 if (!b_MultiPaired) 777 { 778 b_MultiPaired = 779 SHELL_FileNamesMatch(lpFileOp->pFrom, lpFileOp->pTo, (!b_Multi || b_MultiFrom)); 780 } /* endif */ 781 if (!(b_MultiPaired) || !(pFromFile) || !(pFromFile[1]) || ((pTo) && !(pToFile))) 722 782 { 723 783 retCode = 0x402; /* 1026 */ … … 748 808 /* no work, only RC=0 */ 749 809 /* ??? nFileOp.fAnyOperationsAborted = TRUE; */ 810 //#define W98_FO_RENEME 811 #ifdef W98_FO_RENEME 750 812 goto shfileop_normal; 813 #endif 814 retCode = 0x1; /* 1 value unknown, W98 returns no error */ 815 goto shfileop_error; 751 816 } 752 817 } … … 755 820 if (INVALID_HANDLE_VALUE == hFind) 756 821 { 822 if ((FO_DELETE == FuncSwitch) && (b_Mask)) 823 { 824 pFromFile[0] = '\0'; 825 FromPathAttr = GetFileAttributesW(pTempFrom); 826 pFromFile[0] = '\\'; 827 if (IsAttribDir(FromPathAttr)) 828 { 829 /* FO_DELETE with mask and without found is valid */ 830 goto shfileop_normal; 831 } /* endif */ 832 } /* endif */ 757 833 /* root (without mask) is also not allowed as source, tested in W98 */ 758 834 retCode = 0x402; /* 1026 */ … … 772 848 if (!lpFileName[0]) 773 849 lpFileName = wfd.cFileName; 774 if (IsDotDir(lpFileName)) 775 continue; 850 if (IsDotDir(lpFileName) || 851 ((b_Mask) && IsAttribDir(wfd.dwFileAttributes) && (nFileOp.fFlags & FOF_FILESONLY))) 852 continue; /* next name in pTempFrom(dir) */ 776 853 SHFileStrCpyCatW(&pFromFile[1], lpFileName, NULL); 777 854 /* TODO: Check the SHELL_DeleteFileOrDirectoryW() function in shell32.dll */ … … 1026 1103 { 1027 1104 nFileOp.fAnyOperationsAborted = TRUE; 1028 SetLastError(retCode); 1029 } 1030 TRACE("%s level=%d AnyOpsAborted=%s ret=0x%x, with %s%s%s\n", 1105 } 1106 TRACE("%s level=%d AnyOpsAborted=%s ret=0x%x, with %s %s%s\n", 1031 1107 cFO_Name[0], level, nFileOp.fAnyOperationsAborted ? "TRUE":"FALSE", 1032 retCode, debugstr_w(pFrom), pTo ? " 1108 retCode, debugstr_w(pFrom), pTo ? "-> ":"", debugstr_w(pTo)); 1033 1109 1034 1110 lpFileOp->fAnyOperationsAborted = nFileOp.fAnyOperationsAborted; … … 1079 1155 1080 1156 1157
Note:
See TracChangeset
for help on using the changeset viewer.