Changeset 1335 for trunk/dll/arccnrs.c
- Timestamp:
- Dec 13, 2008, 12:49:02 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/arccnrs.c
r1334 r1335 58 58 19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory 59 59 25 Aug 08 GKY Check TMP directory space warn if lee than 5 MiB prevent archiver from opening if 60 60 less than 10 KiB (It hangs and can't be closed) 61 61 08 Nov 08 GKY Add WaitChildThread to fix hang caused by viewer trying to open a file before 62 62 the archiver process closes. (Ticket 58) 63 63 23 Nov 08 JBS Ticket 284: Support archivers with no Start or End of list strings 64 64 29 Nov 08 GKY Add flag to tell CheckListProc file is in an archive so it won't try to open it. 65 65 29 Nov 08 GKY Remove or replace with a mutex semaphore DosEnterCriSec where appropriate. 66 66 30 Nov 08 GKY Add the option of creating a subdirectory from the arcname 67 67 for the extract path to arc container. 68 68 02 Dec 08 JBS Ticket 284: Changed string indicating no Start/End of list strings. 69 69 03 Dec 08 GKY Subdirectory from the arcname for the extract path only created if an "extract" 70 menu option is selected. 70 menu option is selected. 71 10 Dec 08 SHL Integrate exception handler support 71 72 72 73 ***********************************************************************/ … … 78 79 #include <share.h> // SH_DENYWR 79 80 #include <limits.h> // ULONG_MAX 80 #include <process.h> // _beginthread 81 // #include <process.h> // _beginthread // 10 Dec 08 SHL 81 82 82 83 #if 0 … … 107 108 #include "strutil.h" // GetPString 108 109 #include "notebook.h" // CfgDlgProc 109 #include "worker.h" 110 #include "worker.h" // Action, MassAction 110 111 #include "avv.h" // ArcReviewDlgProc, rewrite_archiverbb2 111 112 #include "chklist.h" // CenterOverWindow, CheckListProc 112 113 #include "common.h" // CommonCreateTextChildren, CommonFrameWndProc, CommonTextPaint 113 114 // CommonTextButton 114 115 #include "draglist.h" // DoFileDrag, DragOne 115 116 #include "valid.h" // GetDesktopName, TestCDates … … 121 122 #include "srchpath.h" // RunFM2Util 122 123 #include "misc.h" // Broadcast, CheckMenu, CurrentRecord, SayFilter, SaySort 123 124 // DrawTargetEmphasis, IsFm2Window 124 125 #include "select.h" // SelectAll, SelectList 125 126 #include "findrec.h" // ShowCnrRecord … … 141 142 #include "literal.h" // wildcard 142 143 #include "wrappers.h" // xrealloc 143 #include "misc.h" 144 #include "misc.h" // AdjustCnrColVis, QuickPopup, SetSortChecks, SwitchCommand 144 145 #include "select.h" // DeselectAll, InvertAll 145 146 #include "strips.h" // bstrip 146 147 #include "dirs.h" // save_dir2 147 148 #include "fortify.h" 149 #include "excputil.h" // 06 May 08 SHL added 148 150 149 151 #define ARCFLAGS_REALDIR 0x00000001 … … 207 209 priority_normal(); 208 210 ret = runemf2(WaitChild->RunFlags, WaitChild->hwndClient, pszSrcFile, __LINE__, 209 210 211 WaitChild->pszDirectory, WaitChild->pszEnvironment, 212 WaitChild->formatstring, WaitChild->CmdLine); 211 213 if (ret != -1) { 212 213 214 if (IsFile(WaitChild->filename) == 1) 215 PostMsg(WaitChild->hwndCnr, UM_ENTER, MPFROMP(filename), MPVOID); 214 216 } 215 217 DecrThreadUsage(); … … 223 225 Fortify_LeaveScope(); 224 226 # endif 225 _endthread();227 // _endthread(); // 10 Dec 08 SHL 226 228 } 227 229 … … 578 580 if (CheckDriveSpaceAvail(ArcTempRoot, ullDATFileSpaceNeeded, ullTmpSpaceNeeded) == 1) 579 581 saymsg(MB_OK, 580 581 582 583 582 HWND_DESKTOP, 583 NullStr, 584 GetPString(IDS_ARCTMPDRIVESPACELIMITED), 585 ArcTempRoot); 584 586 MakeTempName(arctemp, ArcTempRoot, 2); 585 587 … … 681 683 if (fp) { 682 684 gotstart = !info->startlist || // If list has no start marker 683 684 685 !*info->startlist || 686 (stricmp(info->startlist, NO_START_OF_ARCHIVER_LIST_STRING) == 0); 685 687 686 688 while (!feof(fp) && !gotend && !*pStopFlag) { … … 1581 1583 CHAR *s = (CHAR *) mp1, *p, *pp; // filename[CCHMAXPATH]; 1582 1584 WAITCHILD *WaitChild; 1583 APIRET rc;1584 1585 1585 1586 WaitChild = xmallocz(sizeof(WAITCHILD), pszSrcFile, __LINE__); 1586 1587 if (!WaitChild) 1587 1588 return 0; 1588 1589 if (s) { 1589 1590 if (!dcd->info->extract) { … … 1592 1593 return 0; 1593 1594 } 1594 1595 1595 sprintf(WaitChild->CmdLine, "%s %s %s", 1596 dcd->info->exwdirs ? dcd->info->exwdirs : 1596 1597 dcd->info->extract, 1597 1598 1599 1600 1598 BldQuotedFileName(szQuotedArcName, dcd->arcname), 1599 BldQuotedFileName(szQuotedMemberName, s)); 1600 /*runemf2(SEPARATE | ASYNCHRONOUS | WAIT | 1601 (fArcStuffVisible ? 0 : BACKGROUND), 1601 1602 , pszSrcFile, __LINE__, dcd->workdir, NULL, 1602 1603 "%s %s %s", … … 1623 1624 p++; 1624 1625 } 1625 free(s); 1626 WaitChild->RunFlags = SEPARATE | ASYNCHRONOUS | WAIT | 1627 (fArcStuffVisible ? 0 : BACKGROUND); 1628 WaitChild->hwndClient = dcd->hwndClient; 1629 WaitChild->pszDirectory = xstrdup(dcd->workdir, pszSrcFile, __LINE__); 1630 WaitChild->pszEnvironment = NULL; 1631 strcpy(WaitChild->formatstring, "%s"); 1632 WaitChild->hwndCnr = dcd->hwndCnr; 1633 rc = _beginthread(WaitChildThread, NULL, 65536, WaitChild); 1634 if (rc == -1) 1635 Runtime_Error(pszSrcFile, __LINE__, 1636 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 1637 //if (IsFile(filename) == 1) { 1638 #if 0 // 06 Oct 07 SHL fixme to be gone - set to 0 for ticket #58 testing 1639 if (fViewChild && fArcStuffVisible) 1640 DosSleep(100); // Allow unzip session to finish closing 14 Mar 07 SHL 1641 #endif 1642 //WinSendMsg(WaitChild->hwndCnr, UM_ENTER, MPFROMP(filename), MPVOID); 1643 1626 free(s); 1627 WaitChild->RunFlags = SEPARATE | ASYNCHRONOUS | WAIT | 1628 (fArcStuffVisible ? 0 : BACKGROUND); 1629 WaitChild->hwndClient = dcd->hwndClient; 1630 WaitChild->pszDirectory = xstrdup(dcd->workdir, pszSrcFile, __LINE__); 1631 WaitChild->pszEnvironment = NULL; 1632 strcpy(WaitChild->formatstring, "%s"); 1633 WaitChild->hwndCnr = dcd->hwndCnr; 1634 xbeginthread(WaitChildThread, 1635 65536, 1636 WaitChild, 1637 pszSrcFile, 1638 __LINE__); 1644 1639 } 1645 1640 } … … 1707 1702 strlen(li->list[x]) + 5 > MaxComLineStrg) { 1708 1703 runemf2(SEPARATE | WINDOWED | ASYNCHRONOUS | 1709 1710 1704 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED), 1705 hwnd, pszSrcFile, __LINE__, 1711 1706 NULL, NULL, "%s", szBuffer); 1712 1707 *p = 0; … … 1739 1734 ck.list = li->list; 1740 1735 ck.cmd = li->type; 1741 1742 1736 ck.prompt = prompt; 1737 ck.flags = CHECK_ARCHIVE; 1743 1738 sprintf(prompt, GetPString(IDS_ARCCNRDELREFTEXT), 1744 1739 (li->type == IDM_DELETE) ? … … 1827 1822 UINT numfiles = 0, numalloc = 0; 1828 1823 1829 1830 1831 1832 1833 1824 if (li->targetpath && fFileNameCnrPath && 1825 stricmp(lastextractpath, li->targetpath)) { 1826 strcpy(lastextractpath, li->targetpath); 1827 SetDir(dcd->hwndParent, hwnd, li->targetpath, 1); 1828 } 1834 1829 for (x = 0; li->list[x]; x++) { 1835 1836 1830 BldFullPathName(fullname, li->targetpath, li->list[x]); 1831 //Check if file already exists on disk warn if it does. 1837 1832 if (IsFile(fullname) != -1) { 1838 1833 AddToList(li->list[x], &exfiles, &numfiles, &numalloc); … … 1843 1838 } 1844 1839 } 1845 1840 if (exfiles && numfiles) { 1846 1841 1847 1842 CHECKLIST ckl; … … 1852 1847 ckl.list = exfiles; 1853 1848 ckl.prompt = prompt; 1854 1855 1849 ckl.cmd = li->type; 1850 ckl.flags = CHECK_ARCHIVE; 1856 1851 sprintf(prompt, 1857 1852 GetPString(IDS_REPLACEWARNTEXT), … … 1907 1902 z = x; 1908 1903 runemf2(SEPARATE | WINDOWED | WAIT | 1909 1910 1904 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED), 1905 hwnd, pszSrcFile, __LINE__, 1911 1906 li->targetpath, NULL, "%s", pszCmdLine); 1912 1907 *endofit = 0; … … 2041 2036 else if (li->type == IDM_PRINT) { 2042 2037 strcpy(li->targetpath, printer); 2043 if (_beginthread(PrintListThread, NULL, 65536, (PVOID) li) != 2044 -1) { 2045 Runtime_Error(pszSrcFile, __LINE__, 2046 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2047 li = NULL; 2038 // 10 Dec 08 SHL correct error handling - looked backward 2039 if (xbeginthread(PrintListThread, 2040 65536, 2041 li, 2042 pszSrcFile, 2043 __LINE__) != -1) 2044 { 2045 li = NULL; // Ensure not freed here 2048 2046 } 2047 2049 2048 } 2050 2049 else if (li->type == IDM_VIEWARCHIVE) { … … 2093 2092 wk->li = li; 2094 2093 strcpy(wk->directory, dcd->directory); 2095 if (_beginthread(Action, NULL, 122880, (PVOID) wk) == -1) { 2096 Runtime_Error(pszSrcFile, __LINE__, 2097 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2094 if (xbeginthread(Action, 2095 122880, 2096 wk, 2097 pszSrcFile, 2098 __LINE__) == -1) 2099 { 2098 2100 free(wk); 2099 2101 FreeListInfo((LISTINFO *) mp1); … … 2188 2190 } 2189 2191 break; 2190 } 2192 } // switch 2191 2193 } 2192 2194 if (li->type != IDM_OPENDEFAULT && li->type != IDM_OPENSETTINGS) … … 2294 2296 CM_SEARCHSTRING, 2295 2297 MPFROMP(&srch), MPFROMLONG(CMA_FIRST)); 2296 2297 2298 2298 if (pci && (INT) pci != -1) { 2299 2300 USHORT attrib = CRA_CURSORED; 2299 2301 2300 2302 … … 2441 2443 CM_QUERYRECORDEMPHASIS, 2442 2444 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED)); 2443 2445 if (pci && (INT) pci != -1) { 2444 2446 if (fSplitStatus && hwndStatus2) { 2445 2447 if (dcd->ullTotalBytes) … … 2594 2596 } 2595 2597 WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(ArcSort), MPFROMP(dcd)); 2596 if (_beginthread(MakeObjWin, NULL, 245760, (PVOID) dcd) == -1) { 2597 Runtime_Error(pszSrcFile, __LINE__, 2598 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2598 if (xbeginthread(MakeObjWin, 2599 245760, 2600 dcd, 2601 pszSrcFile, 2602 __LINE__) == -1) 2603 { 2599 2604 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); 2600 2605 return 0; … … 2637 2642 if (!SetDir(dcd->hwndParent, hwnd, s, 0)) { 2638 2643 if (stricmp(dcd->directory, s)) { 2639 2640 2641 2642 2644 //DosEnterCritSec(); //GKY 11-29-08 2645 DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT); 2646 strcpy(lastextractpath, s); 2647 DosReleaseMutexSem(hmtxFM2Globals); 2643 2648 //DosExitCritSec(); 2644 2649 } … … 2671 2676 printf("%s %d UM_ENTER %s\n",__FILE__, __LINE__, filename); fflush(stdout); 2672 2677 if (IsFile(filename) != 1) { 2673 2674 2678 free(mp1); 2679 return 0; 2675 2680 } 2676 2681 WinQueryWindowPos(dcd->hwndFrame, &swp); … … 2803 2808 } 2804 2809 else if (mp1 && IsFile(mp1) == 1 && 2805 2810 CheckDriveSpaceAvail(ArcTempRoot, ullDATFileSpaceNeeded, ullTmpSpaceNeeded) != 2) { 2806 2811 StartArcCnr(HWND_DESKTOP, 2807 2812 dcd->hwndFrame, (CHAR *) mp1, 4, (ARC_TYPE *) mp2); … … 3023 3028 case IDM_ARCEXTRACTEXIT: 3024 3029 case IDM_ARCEXTRACT: 3025 3026 3027 3028 3029 3030 if (dcd->directory && fFileNameCnrPath && 3031 stricmp(lastextractpath, dcd->directory)) { 3032 strcpy(lastextractpath, dcd->directory); 3033 SetDir(dcd->hwndParent, hwnd, dcd->directory, 1); 3034 } 3030 3035 if (dcd->info->extract) 3031 3036 runemf2(SEPARATE | WINDOWED | ASYNCHRONOUS | … … 3040 3045 case IDM_ARCEXTRACTWDIRSEXIT: 3041 3046 case IDM_ARCEXTRACTWDIRS: 3042 3043 3044 3045 3046 3047 if (dcd->directory && fFileNameCnrPath && 3048 stricmp(lastextractpath, dcd->directory)) { 3049 strcpy(lastextractpath, dcd->directory); 3050 SetDir(dcd->hwndParent, hwnd, dcd->directory, 1); 3051 } 3047 3052 if (dcd->info->exwdirs) 3048 3053 runemf2(SEPARATE | WINDOWED | ASYNCHRONOUS | … … 3087 3092 if (mp2) { 3088 3093 if (stricmp(dcd->directory, (CHAR *) mp2)) { 3089 3090 3094 //DosEnterCritSec(); //GKY 11-29-08 3095 DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT); 3091 3096 strcpy(lastextractpath, (CHAR *) mp2); 3092 3093 3097 MakeValidDir(lastextractpath); 3098 DosReleaseMutexSem(hmtxFM2Globals); 3094 3099 //DosExitCritSec(); 3095 3100 } … … 3746 3751 else 3747 3752 strcpy(dcd->directory, extractpath); 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3753 } 3754 if (!*dcd->directory && fFileNameCnrPath && dcd->arcname) { 3755 strcpy(fullname, dcd->arcname); 3756 p = strrchr(fullname, '.'); 3757 if (p) 3758 *p = 0; 3759 else { 3760 p = fullname + strlen(fullname); 3761 p--; 3762 *p = 0; 3763 } 3764 strcpy(dcd->directory, fullname); 3765 } 3761 3766 if (!*dcd->directory && *lastextractpath) { 3762 3763 3764 3765 3767 //DosEnterCritSec(); //GKY 11-29-08 3768 DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT); 3769 strcpy(dcd->directory, lastextractpath); 3770 DosReleaseMutexSem(hmtxFM2Globals); 3766 3771 //DosExitCritSec(); 3767 3772 } … … 3791 3796 dcd->dontclose = (flags & 4) != 0; 3792 3797 dcd->info = info; 3793 3798 dcd->sortFlags = DefArcSortFlags; 3794 3799 { 3795 3800 PFNWP oldproc; … … 3903 3908 SWP_ACTIVATE); 3904 3909 } 3905 3910 } 3906 3911 } 3907 3912 # ifdef FORTIFY
Note:
See TracChangeset
for help on using the changeset viewer.