Changeset 1664 for trunk/dll/copyf.c
- Timestamp:
- Aug 5, 2012, 2:11:07 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/copyf.c
r1628 r1664 29 29 26 Aug 11 GKY Add a low mem version of xDosAlloc* wrappers; move error checking into all the 30 30 xDosAlloc* wrappers. 31 04 Aug 12 GKY Changes to use Unlock to unlock files if Unlock.exe is in path both from menu/toolbar and as part of copy, move and 32 delete operations 33 04 Aug 12 GKY Changes to allow copy and move over readonly files with a warning dialog; also added a warning dialog for delete of 34 readonly files 31 35 32 36 ***********************************************************************/ … … 60 64 #include "fortify.h" 61 65 #include "pathutil.h" // AddBackslashToPath 66 #include "worker.h" 67 #include "systemf.h" 62 68 63 69 static PSZ pszSrcFile = __FILE__; … … 525 531 DosError(FERR_DISABLEHARDERR); 526 532 if (DosDeleteDir(dir)) { 527 make_deleteable(dir );533 make_deleteable(dir, 0); 528 534 DosDeleteDir(dir); 529 535 } 530 536 } 531 else if (IsFile(dir) > 0) { 532 DosError(FERR_DISABLEHARDERR); 533 if (DosForceDelete(dir)) { 534 make_deleteable(dir); 537 else if (IsFile(dir) > 0) { 538 APIRET error; 539 540 DosError(FERR_DISABLEHARDERR); 541 error = DosForceDelete(dir); 542 if (error) { 543 make_deleteable(dir, error); 535 544 DosForceDelete(dir); 536 545 } … … 609 618 DosError(FERR_DISABLEHARDERR); 610 619 if (DosDeleteDir(oldname)) { 611 make_deleteable(oldname );620 make_deleteable(oldname, 0); 612 621 DosDeleteDir(oldname); 613 622 } … … 666 675 } 667 676 668 INT make_deleteable(CHAR * filename) 669 { 677 INT make_deleteable(CHAR * filename, INT error) 678 { 679 APIRET rc; 670 680 INT ret = -1; 681 INT retrn; 671 682 FILESTATUS3 fsi; 672 683 684 if (error == ERROR_SHARING_VIOLATION && fUnlock) { 685 retrn = saymsg(MB_YESNO | MB_DEFBUTTON2, 686 HWND_DESKTOP, 687 GetPString(IDS_LOCKEDFILEWARNINGTITLE), 688 GetPString(IDS_LOCKEDFILEWARNING), 689 filename); 690 if (retrn == MBID_YES) { 691 runemf2(SEPARATE | INVISIBLE | BACKGROUND | WAIT, 692 HWND_DESKTOP, pszSrcFile, __LINE__, 693 NULL, NULL, "%s %s", PCSZ_UNLOCKEXE, filename); 694 } 695 } 673 696 DosError(FERR_DISABLEHARDERR); 674 if (!DosQueryPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi))) { 675 fsi.attrFile = 0; 676 DosError(FERR_DISABLEHARDERR); 677 if (!xDosSetPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi), 0)) 678 ret = 0; 679 } 697 rc = DosQueryPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi)); 698 if (!rc) { 699 if (fsi.attrFile & 0x00000001) { 700 if (fWarnReadOnly && error != -1) { 701 retrn = saymsg(MB_YESNO | MB_DEFBUTTON2, 702 HWND_DESKTOP, 703 GetPString(IDS_READONLYFILEWARNINGTITLE), 704 GetPString(IDS_READONLYFILEWARNING), 705 filename); 706 if (retrn == MBID_YES) { 707 fsi.attrFile = 0; 708 DosError(FERR_DISABLEHARDERR); 709 if (!xDosSetPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi), 0)) 710 ret = 0; 711 } 712 else 713 ret = 0; 714 } 715 else 716 fsi.attrFile = 0; 717 DosError(FERR_DISABLEHARDERR); 718 if (!xDosSetPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi), 0)) 719 ret = 0; 720 } 721 } 722 680 723 return ret; 681 724 } … … 772 815 // remove directory 773 816 if (DosDeleteDir(ss)) { 774 make_deleteable(ss ); // Try harder817 make_deleteable(ss, 0); // Try harder 775 818 DosError(FERR_DISABLEHARDERR); 776 819 DosDeleteDir(ss); … … 779 822 } 780 823 else { 781 DosError(FERR_DISABLEHARDERR); 782 if (DosForceDelete(ss)) { 783 make_deleteable(ss); 824 APIRET error; 825 826 DosError(FERR_DISABLEHARDERR); 827 error = DosForceDelete(ss); 828 if (error) { 829 make_deleteable(ss, error); 784 830 DosError(FERR_DISABLEHARDERR); 785 831 rc = (INT) DosForceDelete(ss); … … 884 930 DosError(FERR_DISABLEHARDERR); 885 931 if (DosDelete(string)) { 886 make_deleteable(string );932 make_deleteable(string, -1); 887 933 DosError(FERR_DISABLEHARDERR); 888 934 return DosDelete(string); … … 890 936 } 891 937 else { 938 APIRET error; 939 892 940 DosError(FERR_DISABLEHARDERR); 893 if (DosForceDelete(string)) { 894 make_deleteable(string); 941 error = DosForceDelete(string); 942 if (error) { 943 make_deleteable(string, error); 895 944 DosError(FERR_DISABLEHARDERR); 896 945 return DosForceDelete(string);
Note:
See TracChangeset
for help on using the changeset viewer.