Changeset 1892
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/arccnrs.c
r1878 r1892 6 6 Archive containers 7 7 8 Copyright (c) 1993- 98 M. Kimes9 Copyright (c) 2001 , 2013Steven H. Levine8 Copyright (c) 1993-1998 M. Kimes 9 Copyright (c) 2001-2020 Steven H. Levine 10 10 11 11 11 Jun 02 SHL Ensure archive name not garbage … … 77 77 12 Mar 09 SHL Use common SearchContainer 78 78 13 Dec 09 GKY Fixed separate paramenters. Please note that appname should be used in 79 80 81 82 79 profile calls for user settings that work and are setable in more than one 80 miniapp; FM3Str should be used for setting only relavent to FM/2 or that 81 aren't user settable; realappname should be used for setting applicable to 82 one or more miniapp but not to FM/2 83 83 17 Jan 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *. 84 84 15 Apr 10 JBS Ticket 422: Stop hang when open archive gets deleted or moved 85 85 23 Oct 10 GKY Add ForwardslashToBackslash function to streamline code 86 86 20 Nov 10 GKY Check that pTmpDir IsValid and recreate if not found; Fixes hangs caused 87 87 by temp file creation failures. 88 88 13 Aug 11 GKY Change to Doxygen comment format 89 89 30 Jul 13 GKY Changes to allow 7z archiver to work with AV. 90 90 05 Aug 13 GKY Changes to allow Lzip to work with AV 91 91 11 Aug 13 GKY Removed code that attempted to use the archive name as the extract directory 92 92 It was never fully implemented and doesn't make sense for the container. 93 93 09 Feb 14 GKY Fix trap on opening a file without an extention 94 94 22 Feb 14 GKY Fix warn readonly yes don't ask to work when recursing directories. 95 95 28 Apr 14 JBS Ticket #522: Ensure use of wrapper functions where needed 96 96 01 Mar 14 GKY Fixed error checking in FillArcCnr only to report missing archivers after 97 98 99 97 all entries have been tried. Added a check b/gzip exes for TAR.B/GZ archives. 98 Use the test archive string from the first working archive description. 99 Enhance the error message. Ticket 502 100 100 01 Mar 14 GKY Fix a trap caused by selecting "print" from the arccontainer menu. Ticket 525 101 101 01 Mar 14 GKY Fix the problem with copying text from the test archive window by launching 102 102 it in a command shell (i.e. comspec /k archiver -t archive) Ticket 503 103 103 02 Mar 14 GKY Fixed typo that reversed the function of the saymsg dialog g/bzip check. 104 105 104 Added option to suppress message regarding missing bzip2.exe 105 or gzip.exe on TAR.B/GZ archives. 106 106 06 Apr 14 GKY Removed all BZ/GZ checks 107 107 28 Jun 14 GKY Fix errors identified with CPPCheck; Fix retry to create workdir code 108 108 12 Aug 15 JBS Ticket #522: Ensure no "highmem-unsafe" functions are called directly. 109 Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions. 109 Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions. 110 30 Jan 20 SHL Rework RemoveArcItems like RemoveCnrItems 111 30 Jan 20 SHL Use pai consistently for PARCITEM; 112 30 Jan 20 SHL Clean up some inconsistent formatting 110 113 111 114 ***********************************************************************/ … … 114 117 #include <string.h> 115 118 #include <ctype.h> 116 #include <direct.h> 119 #include <direct.h> // rmdir 117 120 #include <share.h> // SH_DENYWR 118 121 #include <limits.h> // ULONG_MAX … … 145 148 #include "strutil.h" // GetPString 146 149 #include "notebook.h" // CfgDlgProc 147 #include "worker.h" // Action, MassAction150 #include "worker.h" // Action, MassAction 148 151 #include "avv.h" // ArcReviewDlgProc, rewrite_archiverbb2 149 152 #include "chklist.h" // CenterOverWindow, CheckListProc 150 153 #include "common.h" // CommonCreateTextChildren, CommonFrameWndProc, CommonTextPaint 151 // CommonTextButton154 // CommonTextButton 152 155 #include "draglist.h" // DoFileDrag, DragOne 153 156 #include "valid.h" // GetDesktopName, TestCDates … … 159 162 #include "srchpath.h" // RunFM2Util 160 163 #include "misc.h" // Broadcast, CheckMenu, CurrentRecord, SayFilter, SaySort 161 // DrawTargetEmphasis, IsFm2Window164 // DrawTargetEmphasis, IsFm2Window 162 165 #include "select.h" // SelectAll, SelectList 163 166 #include "findrec.h" // ShowCnrRecord … … 186 189 #include "excputil.h" // 06 May 08 SHL added 187 190 188 #define ARCFLAGS_REALDIR 189 #define ARCFLAGS_PSEUDODIR 190 #define CON_COLS 191 #define EXTRA_ARCRECORD_BYTES 191 #define ARCFLAGS_REALDIR 0x00000001 192 #define ARCFLAGS_PSEUDODIR 0x00000002 193 #define CON_COLS 6 194 #define EXTRA_ARCRECORD_BYTES (sizeof(ARCITEM) - sizeof(MINIRECORDCORE)) 192 195 #define NO_START_OF_ARCHIVER_LIST_STRING "None" 193 #define NO_END_OF_ARCHIVER_LIST_STRING 196 #define NO_END_OF_ARCHIVER_LIST_STRING NO_START_OF_ARCHIVER_LIST_STRING 194 197 195 198 #pragma data_seg(DATA1) … … 211 214 typedef struct { 212 215 213 HWND hwndCnr; //hwnd you want the message posted to214 HWND hwndClient; //hwnd calling this thread; NULL will work215 ULONG RunFlags; //runemf2 flags see systemf.h216 ULONG msg; //Message to post216 HWND hwndCnr; // hwnd you want the message posted to 217 HWND hwndClient; // hwnd calling this thread; NULL will work 218 ULONG RunFlags; // runemf2 flags see systemf.h 219 ULONG msg; // Message to post 217 220 UINT uiLineNumber; 218 221 PCSZ pszSrcFile; 219 CHAR filename[CCHMAXPATH]; //file passed as MP1 message parameter (file selected)220 CHAR *pszDirectory; //Execution directory221 CHAR *pszEnvironment; //Enviroment -- NULL passes current222 CHAR *pszCmdLine; //Use sprintf to format multipart command line into single string223 CHAR formatstring[40]; //Usally "%s"222 CHAR filename[CCHMAXPATH]; // file passed as MP1 message parameter (file selected) 223 CHAR *pszDirectory; // Execution directory 224 CHAR *pszEnvironment; // Enviroment -- NULL passes current 225 CHAR *pszCmdLine; // Use sprintf to format multipart command line into single string 226 CHAR formatstring[40]; // Usally "%s" 224 227 } 225 228 WAITCHILD; … … 365 368 PVOID pStorage) 366 369 { 367 PARCITEM pai1 = (PARCITEM) 368 PARCITEM pai2 = (PARCITEM) 370 PARCITEM pai1 = (PARCITEM)pmrc1; 371 PARCITEM pai2 = (PARCITEM)pmrc2; 369 372 DIRCNRDATA *pdcd = (DIRCNRDATA *) pStorage; 370 373 SHORT ret = 0; … … 432 435 } 433 436 if (!ret) 434 ret = (SHORT) 437 ret = (SHORT)stricmp(pai1->pszFileName, pai2->pszFileName); 435 438 if (ret && (sortFlags & SORT_REVERSE)) 436 439 ret = ret > 0 ? -1 : 1; 437 440 return ret; 438 441 } 439 return (SHORT) 442 return (SHORT)stricmp(pai1->pszFileName, pai2->pszFileName); 440 443 } 441 444 … … 448 451 449 452 if (dcd && *dcd->mask.szMask) { 450 r = (PARCITEM) 453 r = (PARCITEM)rmini; 451 454 if (dcd->mask.pszMasks[1]) { 452 455 for (x = 0; dcd->mask.pszMasks[x]; x++) { … … 513 516 /** 514 517 * Remove item(s) from archive container and free associated storage if requested 515 * @param paiFirst points to first item to remove or NULL to remove all 516 * @param usCnt is remove count or 0 to remove all 518 * @param paiFirst points to specific item to remove or NULL to remove all 519 * @param usCnt is 0 to remove all or 1 to remove specific record 520 * @param usFlags for CM_REMOVERECORD 521 * @returns count of items remaining to delete or -1 if error 517 522 */ 518 523 … … 522 527 PARCITEM pai; 523 528 524 if ((usCnt && !paiFirst) || (!usCnt && paiFirst)) 529 // Counted remove requires paiFirst and can only remove 1 specifc record 530 // Remove all does not allow paiFirst 531 if ((usCnt && !paiFirst) || (usCnt != 1 && paiFirst)) { 525 532 Runtime_Error(pszSrcFile, __LINE__, "paiFirst %p usCnt %u mismatch", paiFirst, usCnt); 526 else { 527 // Free our buffers if free requested 528 if (usFlags & CMA_FREE) { 529 if (paiFirst) 530 pai = paiFirst; 531 else { 532 pai = (PARCITEM)WinSendMsg(hwnd, CM_QUERYRECORD, MPVOID, 533 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 534 if ((INT)pai == -1) { 535 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_QUERYRECORD"); 536 remaining = -1; 537 pai = NULL; 538 } 539 } 540 while (pai) { 541 FreeArcItemData(pai); 542 pai = (PARCITEM)pai->rc.preccNextRecord; 543 if (remaining && --remaining == 0) 544 break; 545 } 546 } 533 remaining = -1; 547 534 } 548 if (remaining != - 1) { 549 remaining = (INT)WinSendMsg(hwnd, CM_REMOVERECORD, MPFROMP(&paiFirst), 550 MPFROM2SHORT(usCnt, usFlags)); 551 if (remaining == -1) { 552 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, 553 "CM_REMOVERECORD hwnd %x pai %p cnt %u", 554 hwnd, paiFirst, usCnt); 555 } 535 if (!usFlags & CMA_FREE) { 536 Runtime_Error(pszSrcFile, __LINE__, "usFlags must have CMA_FREE set"); 537 remaining = -1; 538 } 539 if (!paiFirst) { 540 // Removing all - query first 541 paiFirst = (PARCITEM)WinSendMsg(hwnd, CM_QUERYRECORD, MPVOID, 542 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 543 if ((INT)paiFirst == -1) { 544 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_QUERYRECORD"); 545 remaining = -1; 546 } 547 } 548 549 // Free data 550 // 2020-01-28 SHL Rework to use CMA_NEXT - preccNextRecord method was never reliable 551 pai = paiFirst; 552 while (pai && (INT)pai != -1 && remaining > 0) { 553 FreeArcItemData(pai); 554 if (--remaining == 0) 555 break; 556 pai = WinSendMsg(hwnd, CM_QUERYRECORD, MPFROMP(pai), 557 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 558 } // while 559 560 // Free ARCITEM record(s) if OK so far 561 if (remaining != -1 && paiFirst && (INT)paiFirst != -1) { 562 # ifdef PMPRINTF 563 PmPrintf_Report(pszSrcFile, __LINE__, "RemoveArcItems CM_REMOVERECORD paiFirst %p usCnt %d", paiFirst, usCnt); 564 # endif 565 remaining = (INT)WinSendMsg(hwnd, CM_REMOVERECORD, MPFROMP(&paiFirst), MPFROM2SHORT(usCnt, usFlags)); 566 if (remaining == -1) 567 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_REMOVERECORD hwnd %x paiFirst %p cnt %u", hwnd, paiFirst, usCnt); 568 else if (usCnt == 0 && remaining != 0) 569 Runtime_Error(pszSrcFile, __LINE__, "%u records remain after CM_REMOVERECORD", remaining); 556 570 } 557 571 } … … 581 595 } 582 596 583 //== FillArcCnr() generate archive content list and fill container window == 597 /** 598 * FillArcCnr() generate archive content list and fill container window 599 */ 584 600 585 601 static INT FillArcCnr(HWND hwndCnr, CHAR * arcname, ARC_TYPE ** arcinfo, … … 622 638 MakeTempName(arctemp, ArcTempRoot, 2); 623 639 624 625 640 ReTry: 626 641 … … 699 714 return 0; 700 715 } 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 716 else { 717 rc = 0; 718 rc = SearchPathForFile(PCSZ_PATH, s, NULL); 719 if (!rc) { 720 cnter ++; 721 runemf2(SEPARATE | INVISIBLE | MINIMIZED | BACKGROUND | WAIT, 722 hwndCnr, pszSrcFile, __LINE__, NULL, NULL, 723 "%s %s", 724 info->list, 725 BldQuotedFileName(s, arcname)); 726 if (cnter == 1) { 727 if (info->test) 728 strcpy(TestStr, info->test); 729 else { 730 strcpy(TestStr, ""); 731 notest = TRUE; 732 } 733 } 734 else if (notest && info->test) { 735 strcpy(TestStr, info->test); 736 notest = FALSE; 737 } 738 } 724 739 oldstdout = fileno(stdout); 725 740 DosError(FERR_DISABLEHARDERR); … … 737 752 738 753 if (fp) { 739 gotstart = !info->startlist || 754 gotstart = !info->startlist || // If list has no start marker 740 755 !*info->startlist || 741 756 (stricmp(info->startlist, NO_START_OF_ARCHIVER_LIST_STRING) == 0); … … 771 786 p = s; 772 787 for (fieldnum = 0; fieldnum <= highest; fieldnum++) { 773 pp = p; 774 while (*pp && (*pp == ' ' || *pp == '\t')) // skip leading 788 pp = p; 789 // skip leading 790 while (*pp && (*pp == ' ' || *pp == '\t')) 775 791 pp++; 776 777 778 779 780 781 792 if (!*pp) { 793 if (fieldnum == info->fnpos && (!strcmp(strupr(info->ext), "7Z") || 794 !strcmp(strupr(info->signature), "7Z"))) 795 fname = nsize;// GKY 7-30-13 Work around for missing nsize field for some members of archive 796 break; 797 } 782 798 wasquote = FALSE; 783 799 p = pp; 784 800 while (*p && (wasquote || 785 801 ((fieldnum != info->fnpos || !info->nameislast) ? … … 797 813 } 798 814 } 799 815 else if (*p) 800 816 p++; 801 817 } 802 818 if (*p) { 803 819 *p = 0; 804 820 p++; 805 821 } 806 822 if (fieldnum == info->nsizepos) 807 823 nsize = pp; … … 830 846 } 831 847 } 832 848 else if (fieldnum == info->fnpos) { 833 849 fname = pp; 834 if (pp && *pp == '*' && !*(pp + 1)) // workaround for LH.EXE 850 // workaround for LH.EXE 851 if (pp && *pp == '*' && !*(pp + 1)) 835 852 fname = NULL; 836 853 if (info->nameislast) … … 852 869 853 870 RECORDINSERT ri; 854 PARCITEM pai; 855 856 pai = WinSendMsg(hwndCnr, 857 CM_ALLOCRECORD, 858 MPFROMLONG(EXTRA_ARCRECORD_BYTES), 859 MPFROMLONG(1L)); 871 PARCITEM pai = WinSendMsg(hwndCnr, 872 CM_ALLOCRECORD, 873 MPFROMLONG(EXTRA_ARCRECORD_BYTES), 874 MPFROMLONG(1L)); 860 875 if (!pai) { 861 876 Runtime_Error(pszSrcFile, __LINE__, PCSZ_CM_ALLOCRECORD); … … 893 908 pai->cbComp = atol(nsize); 894 909 if (info->datetype && fdate && *fdate) 895 910 ArcDateTime(fdate, info->datetype, &pai->date, &pai->time); 896 911 memset(&ri, 0, sizeof(RECORDINSERT)); 897 912 ri.cb = sizeof(RECORDINSERT); … … 921 936 } 922 937 } 923 } 938 } // while !eof 924 939 925 940 fclose(fp); … … 928 943 numarcfiles = 0; // Request close 929 944 else if (!numarcfiles || !gotstart 930 931 945 || (!gotend && info->endlist && *info->endlist && 946 (stricmp(info->endlist, NO_END_OF_ARCHIVER_LIST_STRING)))) { 932 947 // Oops 933 948 ARCDUMP ad; … … 946 961 goto ReTry; 947 962 } 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 963 } while (tinfo); 964 if (!fAlertBeepOff) 965 DosBeep(750, 50); // wake up user 966 967 if (cnter > 0) { 968 CHAR Temp[CCHMAXPATH + 2]; 969 970 sprintf(errstr, GetPString(IDS_ARCERRORINFOTEXT), 971 arcname, 972 !gotstart ? GetPString(IDS_NOGOTSTARTTEXT) : NullStr, 973 !numarcfiles ? GetPString(IDS_NOARCFILESFOUNDTEXT) : NullStr, 974 !gotend ? GetPString(IDS_NOENDOFLISTTEXT) : NullStr, 975 !notest ? NullStr : GetPString(IDS_ARCNOTEST)); 976 memset(&ad, 0, sizeof(ARCDUMP)); 977 ad.info = info; 978 strcpy(ad.listname, arctemp); 979 strcpy(ad.arcname, arcname); 980 if (!notest) { 981 strcpy(Temp, info->test); 982 info->test = xstrdup(TestStr, pszSrcFile, __LINE__); 983 } 984 else if (rc) { 985 strcpy(Temp, info->test); 986 info->test = NULL; 987 } 988 ad.errmsg = errstr; 989 WinDlgBox(HWND_DESKTOP, 990 hwndCnr, 991 ArcErrProc, FM3ModHandle, ARCERR_FRAME, MPFROMP(&ad)); 992 if (!notest || rc) 993 info->test = xstrdup(Temp, pszSrcFile, __LINE__); 994 } 995 else 996 saymsg(MB_OK, HWND_DESKTOP, GetPString(IDS_ARCMISSINGEXE), 997 GetPString(IDS_ARCMISSINGEXEVERBOSE)); 983 998 } 984 999 else if (!nomove && tinfo) { … … 994 1009 rewrite_archiverbb2(NULL); // Rewrite with warning 995 1010 } 996 } 1011 } // if opened 997 1012 998 1013 DosError(FERR_DISABLEHARDERR); … … 1129 1144 1130 1145 case WM_MENUEND: 1131 if (hwndButtonPopup == (HWND) 1132 lastid = WinQueryWindowUShort((HWND) 1146 if (hwndButtonPopup == (HWND)mp2) { 1147 lastid = WinQueryWindowUShort((HWND)mp2, QWS_ID); 1133 1148 WinDestroyWindow(hwndButtonPopup); 1134 1149 hwndButtonPopup = (HWND) 0; … … 1319 1334 break; 1320 1335 } 1321 cnd.pDragInfo = (PDRAGINFO) 1336 cnd.pDragInfo = (PDRAGINFO)mp1; 1322 1337 cnd.pRecord = NULL; 1323 1338 return WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), … … 1456 1471 1457 1472 cni.pRecord = NULL; 1458 cni.pDragInfo = (PDRAGINFO) 1473 cni.pDragInfo = (PDRAGINFO)mp1; 1459 1474 li = DoFileDrop(dcd->hwndCnr, 1460 1475 dcd->directory, FALSE, MPVOID, MPFROMP(&cni)); … … 1478 1493 if (dcd && dcd->info && dcd->info->extract && dcd->arcname) { 1479 1494 1480 PDRAGTRANSFER pdt = (PDRAGTRANSFER) 1495 PDRAGTRANSFER pdt = (PDRAGTRANSFER)mp1; 1481 1496 CHAR filename[CCHMAXPATH]; 1482 1497 ULONG len; … … 1508 1523 case UM_RENDER: 1509 1524 { 1510 PDRAGTRANSFER pdt = (PDRAGTRANSFER) 1525 PDRAGTRANSFER pdt = (PDRAGTRANSFER)mp1; 1511 1526 USHORT usRes = DMFL_RENDERFAIL; 1512 1527 … … 1572 1587 dcd->hwndObject = hwnd; // pass back hwnd 1573 1588 if (ParentIsDesktop(hwnd, dcd->hwndParent)) 1574 DosSleep(100); //05 Aug 07 GKY 250 // Avoid race?1589 DosSleep(100); // 05 Aug 07 GKY was 250 - avoid race? 1575 1590 } 1576 1591 return 0; … … 1622 1637 { 1623 1638 MASK mask; 1624 PARCITEM p ci = (PARCITEM)mp2;1639 PARCITEM pai = (PARCITEM)mp2; 1625 1640 1626 1641 memset(&mask, 0, sizeof(MASK)); … … 1631 1646 GetPString((SHORT1FROMMP(mp1) == IDM_SELECTMASK) ? 1632 1647 IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT)); 1633 if (p ci && (INT) pci != -1)1634 strcpy(mask.szMask, p ci->pszFileName);1648 if (pai && (INT)pai != -1) 1649 strcpy(mask.szMask, pai->pszFileName); 1635 1650 if (WinDlgBox(HWND_DESKTOP, dcd->hwndCnr, PickMaskDlgProc, 1636 1651 FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) { … … 1640 1655 DeselectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, NULL, FALSE); 1641 1656 } 1642 1643 1657 } 1658 break; 1644 1659 1645 1660 case IDM_INVERT: … … 1654 1669 if (dcd) { 1655 1670 1656 CHAR *s = (CHAR *) mp1, *p, *pp; 1671 CHAR *s = (CHAR *) mp1, *p, *pp; // filename[CCHMAXPATH]; 1657 1672 WAITCHILD *WaitChild; 1658 1673 … … 1683 1698 memmove(s, p + 1, strlen(p + 1)); 1684 1699 } 1685 1686 1700 sprintf(WaitChild->filename, "%s\\%s", dcd->workdir, s); 1701 ForwardslashToBackslash(WaitChild->filename); 1687 1702 free(s); 1688 1703 WaitChild->RunFlags = SEPARATE | ASYNCHRONOUS | WAIT | … … 1736 1751 ad.namecanchange = 0; 1737 1752 ad.fmoving = (li->type == IDM_ARCHIVEM); 1738 1739 1740 !*ad.command)// we blew it1753 if (!WinDlgBox(HWND_DESKTOP, dcd->hwndClient, ArchiveDlgProc, 1754 FM3ModHandle, ARCH_FRAME, (PVOID) & ad) || !*ad.arcname || 1755 !*ad.command) // we blew it 1741 1756 break; 1742 1757 // build the sucker … … 1895 1910 for (x = 0; li->list[x]; x++) { 1896 1911 BldFullPathName(fullname, li->targetpath, li->list[x]); 1897 // Check if file already exists on disk warn if it does.1912 // Check if file already exists on disk warn if it does. 1898 1913 if (IsFile(fullname) != -1) { 1899 1914 AddToList(li->list[x], &exfiles, &numfiles, &numalloc); … … 1945 1960 li->type == IDM_OPENDEFAULT || 1946 1961 li->type == IDM_OPENSETTINGS || 1947 (li->type == IDM_EDITBINARY || 1962 (li->type == IDM_EDITBINARY || // JBS No way for this () to be true?? 1948 1963 li->type == IDM_MCIPLAY)) || 1949 1964 !li->info->exwdirs)) ? … … 1979 1994 CHAR *temp, *p; 1980 1995 1981 1982 1996 temp = li->list[x]; 1997 ForwardslashToBackslash(temp); 1983 1998 p = xmalloc(strlen(temp) + strlen(li->targetpath) + 2, 1984 1999 pszSrcFile, __LINE__); … … 2017 2032 ExecOnList(hwnd, 2018 2033 li->runfile, 2019 2020 2034 WINDOWED | SEPARATEKEEP | PROMPT, 2035 li->targetpath, NULL, NULL, GetPString(IDS_EXECARCFILETITLETEXT), 2021 2036 pszSrcFile, __LINE__); 2022 2037 else if (li->type == IDM_VIRUSSCAN) … … 2078 2093 2079 2094 FILE *fp; 2080 2081 2082 2083 2084 2095 CHAR szTempFile[CCHMAXPATH]; 2096 CHAR *modew = "w"; 2097 2098 if (pTmpDir && !IsValidDir(pTmpDir)) 2099 DosCreateDir(pTmpDir, 0); 2085 2100 BldFullPathName(szTempFile, pTmpDir, PCSZ_FM2PLAYTEMP); 2086 2101 fp = xfopen(szTempFile, modew, pszSrcFile, __LINE__, FALSE); … … 2134 2149 (li->type == IDM_EDITTEXT) ? editor : 2135 2150 bined), 2136 WINDOWED | SEPARATE, NULL, NULL, 2137 2151 WINDOWED | SEPARATE, NULL, NULL, 2152 li->list, 2138 2153 NULL, pszSrcFile, __LINE__); 2139 2154 } … … 2213 2228 CHAR **list2 = NULL, fullname[CCHMAXPATH * 2], *p; 2214 2229 2215 2216 2230 for (x = 0; li->list[x]; x++) { 2231 ForwardslashToBackslash(li->list[x]); 2217 2232 BldFullPathName(fullname, dcd->directory, li->list[x]); 2218 2233 if (IsFile(fullname) != -1) … … 2237 2252 WinSendMsg(dcd->hwndCnr, WM_COMMAND, 2238 2253 MPFROM2SHORT(IDM_COLLECTOR, 0), MPVOID); 2239 DosSleep(10); 2254 DosSleep(10); 2240 2255 if (Collector) { 2241 2256 if (!PostMsg(Collector, WM_COMMAND, … … 2284 2299 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID); 2285 2300 break; 2286 } 2301 } // switch 2287 2302 return WinDefWindowProc(hwnd, msg, mp1, mp2); 2288 2303 } … … 2315 2330 2316 2331 if (SearchContainer(hwnd, msg, mp1, mp2)) 2317 2332 return (MRESULT)TRUE; // Avoid default handler 2318 2333 break; // Let default handler see key too 2319 2334 … … 2382 2397 // Display parsed date/time columns if type specified 2383 2398 AdjustCnrColVis(hwnd, 2384 2385 2399 GetPString(IDS_TIMECOLTEXT), 2400 dcd->info->fdpos != -1 && dcd->info->datetype, FALSE); 2386 2401 AdjustCnrColVis(hwnd, 2387 2388 2402 GetPString(IDS_DATECOLTEXT), 2403 dcd->info->fdpos != -1 && dcd->info->datetype, FALSE); 2389 2404 WinSendMsg(hwnd, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID); 2390 2405 } … … 2395 2410 CNRINFO cnri; 2396 2411 CHAR s[CCHMAXPATH * 2], tb[81], tf[81]; 2397 PARCITEM p ci;2412 PARCITEM pai; 2398 2413 2399 2414 if (mp1) { … … 2432 2447 WinSetWindowText(hwndStatus, s); 2433 2448 if (!ParentIsDesktop(hwnd, dcd->hwndParent)) { 2434 p ci = WinSendMsg(hwnd,2449 pai = WinSendMsg(hwnd, 2435 2450 CM_QUERYRECORDEMPHASIS, 2436 2451 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED)); 2437 if (p ci && (INT) pci != -1) {2452 if (pai && (INT)pai != -1) { 2438 2453 if (fSplitStatus && hwndStatus2) { 2439 2454 if (dcd->ullTotalBytes) 2440 CommaFmtULL(tb, sizeof(tb), p ci->cbFile, ' ');2455 CommaFmtULL(tb, sizeof(tb), pai->cbFile, ' '); 2441 2456 else 2442 2457 *tb = 0; 2443 2458 sprintf(s, "%s%s%s%s", 2444 2459 *tb ? " " : NullStr, 2445 tb, *tb ? " " : NullStr, p ci->pszFileName);2460 tb, *tb ? " " : NullStr, pai->pszFileName); 2446 2461 WinSetWindowText(hwndStatus2, s); 2447 2462 } 2448 2463 if (fMoreButtons) 2449 WinSetWindowText(hwndName, p ci->pszFileName);2464 WinSetWindowText(hwndName, pai->pszFileName); 2450 2465 } 2451 2466 else { … … 2483 2498 if (rc == ERROR_ACCESS_DENIED) { 2484 2499 p = strrchr(dcd->workdir, '.'); 2485 if (p) { /* jbs: What if there is no "."? Give up? */ 2500 // jbs: What if there is no "."? Give up? FIXME 2501 if (p) { 2486 2502 p++; 2487 2503 was = strtoul(p, NULL, 16); … … 2495 2511 } 2496 2512 } 2497 2513 if (rc) { 2498 2514 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); 2499 2500 2515 return 0; 2516 } 2501 2517 } 2502 2518 } … … 2556 2572 fii.cb = sizeof(FIELDINFOINSERT); 2557 2573 fii.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST; 2558 fii.cFieldInfoInsert = (SHORT) 2574 fii.cFieldInfoInsert = (SHORT)numcols; 2559 2575 fii.fInvalidateFieldInfo = TRUE; 2560 2576 WinSendMsg(hwnd, … … 2650 2666 } 2651 2667 WinSetDlgItemText(dcd->hwndClient, ARC_EXTRACTDIR, dcd->directory); 2652 return (MRESULT) 2668 return (MRESULT)ret; 2653 2669 } 2654 2670 return 0; … … 2679 2695 if (dcd) { 2680 2696 2681 HWND hwndMenu = (HWND) 2697 HWND hwndMenu = (HWND)mp2; 2682 2698 2683 2699 if (hwndMenu == ArcCnrMenu || hwndMenu == ArcMenu) { … … 2716 2732 case IDM_FILESMENU: 2717 2733 if (dcd->info) { 2718 WinEnableMenuItem((HWND) 2734 WinEnableMenuItem((HWND)mp2, 2719 2735 IDM_DELETE, dcd->info->delete != NULL); 2720 WinEnableMenuItem((HWND)mp2, IDM_TEST, dcd->info->test != NULL);2721 WinEnableMenuItem((HWND)mp2, IDM_EXTRACT,2722 2723 WinEnableMenuItem((HWND)mp2, IDM_ARCEXTRACT,2724 2725 WinEnableMenuItem((HWND) 2736 WinEnableMenuItem((HWND)mp2, IDM_TEST, dcd->info->test != NULL); 2737 WinEnableMenuItem((HWND)mp2, IDM_EXTRACT, 2738 dcd->info->extract != NULL && !strstr(dcd->info->ext, "TAR")); 2739 WinEnableMenuItem((HWND)mp2, IDM_ARCEXTRACT, 2740 dcd->info->extract != NULL && !strstr(dcd->info->ext, "TAR")); 2741 WinEnableMenuItem((HWND)mp2, 2726 2742 IDM_EXTRACTWDIRS, dcd->info->exwdirs != NULL); 2727 WinEnableMenuItem((HWND) 2743 WinEnableMenuItem((HWND)mp2, 2728 2744 IDM_ARCEXTRACTWDIRS, dcd->info->exwdirs != NULL); 2729 WinEnableMenuItem((HWND) 2745 WinEnableMenuItem((HWND)mp2, 2730 2746 IDM_ARCEXTRACTWDIRSEXIT, 2731 2747 dcd->info->exwdirs != NULL); … … 2734 2750 2735 2751 case IDM_VIEWSMENU: 2736 WinEnableMenuItem((HWND)mp2, IDM_TEST, dcd->info->test != NULL);2737 WinEnableMenuItem((HWND)mp2, IDM_ARCEXTRACT,2738 2739 WinCheckMenuItem((HWND) 2752 WinEnableMenuItem((HWND)mp2, IDM_TEST, dcd->info->test != NULL); 2753 WinEnableMenuItem((HWND)mp2, IDM_ARCEXTRACT, 2754 dcd->info->extract != NULL && !strstr(dcd->info->ext, "TAR")); 2755 WinCheckMenuItem((HWND)mp2, 2740 2756 IDM_MINIICONS, (dcd->flWindowAttr & CV_MINI) != 0); 2741 WinEnableMenuItem((HWND) 2757 WinEnableMenuItem((HWND)mp2, 2742 2758 IDM_RESELECT, (dcd->lastselection != NULL)); 2743 2759 break; 2744 2760 2745 2761 case IDM_COMMANDSMENU: 2746 SetupCommandMenu((HWND) 2762 SetupCommandMenu((HWND)mp2, hwnd); 2747 2763 break; 2748 2764 2749 2765 case IDM_SORTSUBMENU: 2750 SetSortChecks((HWND) 2766 SetSortChecks((HWND)mp2, dcd->sortFlags); 2751 2767 break; 2752 2768 … … 2759 2775 break; 2760 2776 } 2761 dcd->hwndLastMenu = (HWND) 2777 dcd->hwndLastMenu = (HWND)mp2; 2762 2778 } 2763 2779 if (msg == WM_INITMENU) … … 2920 2936 case IDM_INVERT: 2921 2937 { 2922 PARCITEM pci; 2923 2924 pci = (PARCITEM) WinSendMsg(hwnd, 2925 CM_QUERYRECORDEMPHASIS, 2926 MPFROMLONG(CMA_FIRST), 2927 MPFROMSHORT(CRA_CURSORED)); 2928 if ((INT) pci == -1) 2929 pci = NULL; 2938 PARCITEM pai = (PARCITEM)WinSendMsg(hwnd, 2939 CM_QUERYRECORDEMPHASIS, 2940 MPFROMLONG(CMA_FIRST), 2941 MPFROMSHORT(CRA_CURSORED)); 2942 if ((INT)pai == -1) 2943 pai = NULL; 2930 2944 if (SHORT1FROMMP(mp1) == IDM_HIDEALL) { 2931 if (p ci) {2932 if (!(p ci->rc.flRecordAttr & CRA_SELECTED))2933 p ci->rc.flRecordAttr |= CRA_FILTERED;2945 if (pai) { 2946 if (!(pai->rc.flRecordAttr & CRA_SELECTED)) 2947 pai->rc.flRecordAttr |= CRA_FILTERED; 2934 2948 WinSendMsg(hwnd, 2935 2949 CM_INVALIDATERECORD, 2936 MPFROMP(&p ci),2950 MPFROMP(&pai), 2937 2951 MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION)); 2938 2952 break; 2939 2953 } 2940 2954 } 2941 PostMsg(dcd->hwndObject, UM_SELECT, mp1, MPFROMP(p ci));2955 PostMsg(dcd->hwndObject, UM_SELECT, mp1, MPFROMP(pai)); 2942 2956 } 2943 2957 break; … … 3013 3027 } 3014 3028 WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE); 3015 DosSleep(100); 3029 DosSleep(100); 3016 3030 } 3017 3031 } … … 3024 3038 if (dcd->directory && fFileNameCnrPath && 3025 3039 stricmp(lastextractpath, dcd->directory)) { 3026 3040 strcpy(lastextractpath, dcd->directory); 3027 3041 SetDir(dcd->hwndParent, hwnd, dcd->directory, 1); 3028 3042 } … … 3062 3076 { 3063 3077 BOOL empty = FALSE; 3064 PARCITEM p ci;3078 PARCITEM pai; 3065 3079 3066 3080 if (!*dcd->mask.szMask) { 3067 3081 empty = TRUE; 3068 p ci = (PARCITEM) CurrentRecord(hwnd);3069 if (p ci && (INT) pci != -1 && strchr(pci->pszFileName, '.'))3070 strcpy(dcd->mask.szMask, p ci->pszFileName);3082 pai = (PARCITEM) CurrentRecord(hwnd); 3083 if (pai && (INT)pai != -1 && strchr(pai->pszFileName, '.')) 3084 strcpy(dcd->mask.szMask, pai->pszFileName); 3071 3085 } 3072 3086 … … 3150 3164 li->type = SHORT1FROMMP(mp1); 3151 3165 li->hwnd = hwnd; 3152 3153 3154 3166 li->list = BuildArcList(hwnd); 3167 if (li->type == IDM_DELETE) 3168 ignorereadonly = FALSE; 3155 3169 if (li->type == IDM_REFRESH) { 3156 3170 … … 3177 3191 } 3178 3192 } 3179 } 3193 } // for 3180 3194 } 3181 3195 strcpy(li->arcname, dcd->arcname); … … 3190 3204 MPFROMLONG(CMA_FIRST), 3191 3205 MPFROMSHORT(CRA_CURSORED)); 3192 if (pai && (INT) 3206 if (pai && (INT)pai != -1) 3193 3207 strcpy(li->runfile, pai->pszFileName); 3194 3208 else … … 3245 3259 3246 3260 case CN_ENDEDIT: 3247 if (!((PCNREDITDATA) 3248 3249 PFIELDINFO pfi = ((PCNREDITDATA) 3261 if (!((PCNREDITDATA)mp2)->pRecord) { 3262 3263 PFIELDINFO pfi = ((PCNREDITDATA)mp2)->pFieldInfo; 3250 3264 USHORT cmd = 0; 3251 3265 … … 3276 3290 PDRAGINFO pDInfo; 3277 3291 3278 pDInfo = ((PCNRDRAGINFO) 3292 pDInfo = ((PCNRDRAGINFO)mp2)->pDragInfo; 3279 3293 DrgAccessDraginfo(pDInfo); // Access DRAGINFO 3280 3294 DrgFreeDraginfo(pDInfo); // Free DRAGINFO … … 3288 3302 PDRAGITEM pDItem; // Pointer to DRAGITEM 3289 3303 PDRAGINFO pDInfo; // Pointer to DRAGINFO 3290 PARCITEM pci; 3291 3292 pci = (PARCITEM) ((PCNRDRAGINFO) mp2)->pRecord; 3304 PARCITEM pai = (PARCITEM)((PCNRDRAGINFO)mp2)->pRecord; 3305 3293 3306 if (SHORT1FROMMP(mp1) == CN_DRAGAFTER) 3294 p ci = NULL;3295 pDInfo = ((PCNRDRAGINFO) 3307 pai = NULL; 3308 pDInfo = ((PCNRDRAGINFO)mp2)->pDragInfo; 3296 3309 DrgAccessDraginfo(pDInfo); // Access DRAGINFO 3297 3310 if (*dcd->arcname) { … … 3302 3315 } 3303 3316 } 3304 if (p ci && (INT) pci != -1) {3317 if (pai && (INT)pai != -1) { 3305 3318 DrgFreeDraginfo(pDInfo); 3306 3319 return MRFROM2SHORT(DOR_NODROP, 0); 3307 3320 } 3308 pDItem = DrgQueryDragitemPtr(pDInfo, // Access DRAGITEM 3309 0); // Index to DRAGITEM 3310 if (DrgVerifyRMF(pDItem, // Check valid rendering 3321 pDItem = DrgQueryDragitemPtr(pDInfo, // Access DRAGITEM 3322 0); // Index to DRAGITEM 3323 // Check valid rendering 3324 if (DrgVerifyRMF(pDItem, 3311 3325 (CHAR *) DRM_OS2FILE, // mechanisms and data 3312 3326 NULL) && !(pDItem->fsControl & DC_PREPARE)) { … … 3323 3337 3324 3338 BOOL wasemphasized = FALSE; 3325 PCNRDRAGINIT pcd = (PCNRDRAGINIT) 3326 PARCITEM p ci;3339 PCNRDRAGINIT pcd = (PCNRDRAGINIT)mp2; 3340 PARCITEM pai; 3327 3341 3328 3342 if (pcd) { 3329 p ci = (PARCITEM)pcd->pRecord;3330 if (p ci && (INT) pci != -1) {3331 if (p ci->rc.flRecordAttr & CRA_SELECTED)3343 pai = (PARCITEM)pcd->pRecord; 3344 if (pai && (INT)pai != -1) { 3345 if (pai->rc.flRecordAttr & CRA_SELECTED) 3332 3346 wasemphasized = TRUE; 3333 3347 if (!ParentIsDesktop(hwnd, dcd->hwndParent) && … … 3379 3393 case CN_CONTEXTMENU: 3380 3394 { 3381 PARCITEM p ci = (PARCITEM)mp2;3382 3383 if (p ci && (INT) pci != -1) {3384 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(p ci),3395 PARCITEM pai = (PARCITEM)mp2; 3396 3397 if (pai && (INT)pai != -1) { 3398 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pai), 3385 3399 MPFROM2SHORT(TRUE, CRA_CURSORED)); 3386 3400 MarkAll(hwnd, FALSE, FALSE, TRUE); … … 3418 3432 3419 3433 PNOTIFYRECORDEMPHASIS pre = mp2; 3420 PARCITEM pci;3421 3434 CHAR s[CCHMAXPATHCOMP + 91], tf[81], tb[81]; 3422 3423 pci = (PARCITEM)(pre ? pre->pRecord : NULL); 3424 if (!p ci) {3435 PARCITEM pai = (PARCITEM)(pre ? pre->pRecord : NULL); 3436 3437 if (!pai) { 3425 3438 if (!ParentIsDesktop(hwnd, dcd->hwndParent)) { 3426 3439 if (hwndStatus2) … … 3432 3445 } 3433 3446 if (pre->fEmphasisMask & CRA_SELECTED) { 3434 if (p ci->rc.flRecordAttr & CRA_SELECTED) {3435 dcd->selectedbytes += p ci->cbFile;3447 if (pai->rc.flRecordAttr & CRA_SELECTED) { 3448 dcd->selectedbytes += pai->cbFile; 3436 3449 dcd->selectedfiles++; 3437 3450 } 3438 3451 else if (dcd->selectedfiles) { 3439 dcd->selectedbytes -= p ci->cbFile;3452 dcd->selectedbytes -= pai->cbFile; 3440 3453 dcd->selectedfiles--; 3441 3454 } … … 3452 3465 !ParentIsDesktop(hwnd, dcd->hwndParent)) { 3453 3466 if (pre->fEmphasisMask & CRA_CURSORED) { 3454 if (p ci->rc.flRecordAttr & CRA_CURSORED) {3467 if (pai->rc.flRecordAttr & CRA_CURSORED) { 3455 3468 if (fSplitStatus && hwndStatus2) { 3456 3469 if (dcd->ullTotalBytes) 3457 CommaFmtULL(tb, sizeof(tb), p ci->cbFile, ' ');3470 CommaFmtULL(tb, sizeof(tb), pai->cbFile, ' '); 3458 3471 else 3459 3472 *tb = 0; 3460 3473 sprintf(s, "%s%s%s%s", 3461 3474 *tb ? " " : NullStr, 3462 tb, *tb ? " " : NullStr, p ci->pszFileName);3475 tb, *tb ? " " : NullStr, pai->pszFileName); 3463 3476 WinSetWindowText(hwndStatus2, s); 3464 3477 } 3465 3478 if (fMoreButtons) 3466 WinSetWindowText(hwndName, p ci->pszFileName);3479 WinSetWindowText(hwndName, pai->pszFileName); 3467 3480 } 3468 3481 } … … 3474 3487 if (mp2) { 3475 3488 3476 PARCITEM p ci = (PARCITEM) ((PNOTIFYRECORDENTER)mp2)->pRecord;3477 3478 if (p ci && (INT) pci != -1) {3489 PARCITEM pai = (PARCITEM)((PNOTIFYRECORDENTER)mp2)->pRecord; 3490 3491 if (pai && (INT)pai != -1) { 3479 3492 3480 3493 CHAR *s; 3481 3494 3482 if ((p ci->rc.flRecordAttr & CRA_INUSE) ||3483 (p ci->flags & (ARCFLAGS_REALDIR | ARCFLAGS_PSEUDODIR)))3495 if ((pai->rc.flRecordAttr & CRA_INUSE) || 3496 (pai->flags & (ARCFLAGS_REALDIR | ARCFLAGS_PSEUDODIR))) 3484 3497 break; 3485 s = xstrdup(p ci->pszFileName, pszSrcFile, __LINE__);3498 s = xstrdup(pai->pszFileName, pszSrcFile, __LINE__); 3486 3499 if (s) { 3487 3500 if (!PostMsg(dcd->hwndObject, UM_ENTER, MPFROMP(s), MPVOID)) { … … 3578 3591 PCSZ szHelpString = NULL; 3579 3592 3580 3581 3593 for (i=0; i<MenuItems; i++) { 3582 3594 sCurrentMenuitem = asMenuIDs[i]; … … 3590 3602 MOUSEMSG(&msg)->y < rectl.yTop) 3591 3603 break; 3592 } // for 3593 3604 } // for 3594 3605 3595 3606 switch (sCurrentMenuitem) { … … 3711 3722 dcd->id = id; 3712 3723 dcd->type = ARC_FRAME; 3713 3714 3724 if (pTmpDir && !IsValidDir(pTmpDir)) 3725 DosCreateDir(pTmpDir, 0); 3715 3726 MakeTempName(dcd->workdir, ArcTempRoot, 2); 3716 3727 strcpy(dcd->arcname, fullname); … … 3729 3740 else 3730 3741 strcpy(dcd->directory, extractpath); 3731 3742 } 3732 3743 if (!*dcd->directory && *lastextractpath) { 3733 3744 DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT); … … 3765 3776 3766 3777 oldproc = WinSubclassWindow(hwndFrame, (PFNWP) ArcFrameWndProc); 3767 WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) 3778 WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID)oldproc); 3768 3779 } 3769 3780 dcd->hwndCnr = WinCreateWindow(hwndClient, … … 3787 3798 } 3788 3799 else { 3789 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) 3800 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID)dcd); 3790 3801 dcd->oldproc = WinSubclassWindow(dcd->hwndCnr, 3791 3802 (PFNWP) ArcCnrWndProc); … … 3820 3831 3821 3832 oldmenuproc = WinSubclassWindow(hwndMenu, (PFNWP) ArcCnrMenuProc); 3822 WinSetWindowPtr(hwndMenu, QWL_USER, (PVOID) 3833 WinSetWindowPtr(hwndMenu, QWL_USER, (PVOID)oldmenuproc); 3823 3834 if (!fToolbar) { 3824 3835 -
trunk/dll/filldir.c
r1891 r1892 125 125 26 Sep 15 GKY Remove fInitialDriveScan code 126 126 28 Jan 20 SHL EmptyCnr: report more errors 127 29 Jan 20 SHL RemoveCnrItems: rework removal from prev/next chain 127 29 Jan 20 SHL Rework RemoveCnrItems removal to not use prev/next chain 128 30 Jan 20 SHL Rework RemoveCnrItems to avoid possible traps on bad input 129 30 Jan 20 SHL Clean up some inconsistent formatting 128 130 129 131 ***********************************************************************/ … … 297 299 hptr = hptrArt; 298 300 else 299 hptr = (HPOINTER) 301 hptr = (HPOINTER)0; 300 302 } 301 303 else 302 hptr = (HPOINTER) 304 hptr = (HPOINTER)0; 303 305 304 306 return hptr; … … 319 321 320 322 // try to guess WPS default file icon 321 hptr2 = (HPOINTER) 323 hptr2 = (HPOINTER)0; 322 324 for (u = 0; !hptrWPSFile && u < 10; u++) { 323 325 char szFileName[CCHMAXPATH]; … … 367 369 ULONG flags = driveflags[toupper(*pci->pszFileName) - 'A']; 368 370 BOOL fLoadSubjectForDrive = fLoadSubject && ~flags & DRIVE_NOLOADSUBJS; 369 BOOL fLoadLongNameForDrive = fLoadLongnames && 371 BOOL fLoadLongNameForDrive = fLoadLongnames && // ~flags & DRIVE_NOLONGNAMES && 370 372 ~flags & DRIVE_NOLOADLONGS; 371 373 if (fLoadSubjectForDrive || fLoadLongNameForDrive) { … … 411 413 eaop.fpFEA2List = pfealist; 412 414 eaop.oError = 0; 413 rc = DosQueryPathInfo(pci->pszFileName, FIL_QUERYEASFROMLIST, 414 (PVOID) &eaop, (ULONG) sizeof(EAOP2)); 415 rc = DosQueryPathInfo(pci->pszFileName, 416 FIL_QUERYEASFROMLIST, 417 (PVOID)&eaop, 418 (ULONG)sizeof(EAOP2)); 415 419 // Prevent this error from occuring when scanning a directory 416 420 // that contains a locked data file … … 533 537 (flags & DRIVE_NOLOADICONS) || 534 538 !isalpha(*pci->pszFileName)) { 535 hptr = (HPOINTER) 539 hptr = (HPOINTER)0; 536 540 } 537 541 else … … 543 547 (flags & DRIVE_NOLOADICONS) || 544 548 !isalpha(*pci->pszFileName)) { 545 hptr = (HPOINTER) 549 hptr = (HPOINTER)0; 546 550 } 547 551 else … … 630 634 != (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)))) { 631 635 if (*dcd->mask.szMask || dcd->mask.antiattr) { 632 if (!Filter((PMINIRECORDCORE) pci, (PVOID) &dcd->mask))636 if (!Filter((PMINIRECORDCORE)pci, (PVOID)&dcd->mask)) 633 637 pci->rc.flRecordAttr |= CRA_FILTERED; 634 638 } … … 792 796 (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)))) { 793 797 if (*dcd->mask.szMask || dcd->mask.antiattr) { 794 if (!Filter((PMINIRECORDCORE) pci, (PVOID) &dcd->mask))798 if (!Filter((PMINIRECORDCORE)pci, (PVOID)&dcd->mask)) 795 799 pci->rc.flRecordAttr |= CRA_FILTERED; 796 800 } … … 954 958 pffbFile, partial, dcd); 955 959 pciNext = pci; 956 pci = (PCNRITEM) 960 pci = (PCNRITEM)pci->rc.preccNextRecord; 957 961 ullTotalBytes += ullBytes; 958 962 } // for … … 960 964 memset(&ri, 0, sizeof(RECORDINSERT)); 961 965 ri.cb = sizeof(RECORDINSERT); 962 ri.pRecordOrder = (PRECORDCORE) 963 ri.pRecordParent = (PRECORDCORE) 964 ri.zOrder = (ULONG) 966 ri.pRecordOrder = (PRECORDCORE)CMA_END; 967 ri.pRecordParent = (PRECORDCORE)pciParent; 968 ri.zOrder = (ULONG)CMA_TOP; 965 969 ri.cRecordsInsert = ulSelCnt; 966 970 ri.fInvalidateRecord = TRUE; … … 978 982 ok = FALSE; 979 983 ullTotalBytes = 0; 980 if (WinIsWindow((HAB) 984 if (WinIsWindow((HAB)0, hwndCnr)) 981 985 FreeCnrItemList(hwndCnr, pciFirst); 982 986 } … … 1093 1097 ullBytes = FillInRecordFromFFB(hwndCnr, pci, pszFileSpec, 1094 1098 pffbFile, partial, dcd); 1095 pci = (PCNRITEM) 1099 pci = (PCNRITEM)pci->rc.preccNextRecord; 1096 1100 ullTotalBytes += ullBytes; 1097 1101 DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT); … … 1113 1117 memset(&ri, 0, sizeof(RECORDINSERT)); 1114 1118 ri.cb = sizeof(RECORDINSERT); 1115 ri.pRecordOrder = (PRECORDCORE) 1116 ri.pRecordParent = (PRECORDCORE) 1117 ri.zOrder = (ULONG) 1119 ri.pRecordOrder = (PRECORDCORE)CMA_END; 1120 ri.pRecordParent = (PRECORDCORE)pciParent; 1121 ri.zOrder = (ULONG)CMA_TOP; 1118 1122 ri.cRecordsInsert = ulRecsToInsert; 1119 1123 ri.fInvalidateRecord = (!fSyncUpdates && dcd && … … 1130 1134 ok = FALSE; 1131 1135 ullTotalBytes = 0; 1132 if (WinIsWindow((HAB) 1136 if (WinIsWindow((HAB)0, hwndCnr)) 1133 1137 FreeCnrItemList(hwndCnr, pciFirst); 1134 1138 pciFirst = NULL; … … 1271 1275 if (!DosQuerySysInfo(QSV_BOOT_DRIVE, 1272 1276 QSV_BOOT_DRIVE, 1273 (PVOID) 1274 (ULONG) 1277 (PVOID)&startdrive, 1278 (ULONG)sizeof(ULONG)) && 1275 1279 startdrive) 1276 1280 { … … 1306 1310 CM_ALLOCRECORD, 1307 1311 MPFROMLONG(EXTRA_RECORD_BYTES), 1308 MPFROMLONG((ULONG) 1312 MPFROMLONG((ULONG)numtoinsert)); 1309 1313 } 1310 1314 … … 1351 1355 CHAR Key[80]; 1352 1356 1353 sprintf(Key, "%c.VerifyOffChecked", (CHAR) 1357 sprintf(Key, "%c.VerifyOffChecked", (CHAR)(iDrvNum + 'A')); 1354 1358 fVerifyOffChecked[iDrvNum] = TRUE; 1355 1359 PrfWriteProfileData(fmprof, appname, Key, &fVerifyOffChecked[iDrvNum], sizeof(BOOL)); … … 1370 1374 rc = DosQueryPathInfo(szDrive, 1371 1375 FIL_QUERYEASIZEL, 1372 &fsa4, (ULONG) sizeof(FILESTATUS4L)); 1376 &fsa4, 1377 (ULONG)sizeof(FILESTATUS4L)); 1373 1378 if (rc == ERROR_BAD_NET_RESP) { 1374 1379 DosError(FERR_DISABLEHARDERR); 1375 1380 rc = DosQueryPathInfo(szDrive, 1376 1381 FIL_STANDARDL, 1377 &fsa4, (ULONG) sizeof(FILESTATUS4L)); 1382 &fsa4, 1383 (ULONG)sizeof(FILESTATUS4L)); 1378 1384 fsa4.cbList = 0; 1379 1385 } … … 1449 1455 } 1450 1456 pci->rc.flRecordAttr |= CRA_RECORDREADONLY; 1451 pci = (PCNRITEM) 1457 pci = (PCNRITEM)pci->rc.preccNextRecord; // next rec 1452 1458 } 1453 1459 else if (~ulDriveMap & ulDriveMapMask) … … 1482 1488 memset(&ri, 0, sizeof(RECORDINSERT)); 1483 1489 ri.cb = sizeof(RECORDINSERT); 1484 ri.pRecordOrder = (PRECORDCORE) 1485 ri.pRecordParent = (PRECORDCORE) 1486 ri.zOrder = (ULONG) 1490 ri.pRecordOrder = (PRECORDCORE)CMA_END; 1491 ri.pRecordParent = (PRECORDCORE)NULL; 1492 ri.zOrder = (ULONG)CMA_TOP; 1487 1493 ri.cRecordsInsert = numtoinsert; 1488 1494 ri.fInvalidateRecord = FALSE; … … 1496 1502 1497 1503 // move cursor onto the default drive rather than the first drive 1498 pci = (PCNRITEM) 1499 1500 1501 1504 pci = (PCNRITEM)WinSendMsg(hwndCnr, 1505 CM_QUERYRECORD, 1506 MPVOID, 1507 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 1502 1508 while (pci && (INT)pci != -1) { 1503 if ((ULONG) 1509 if ((ULONG)(toupper(*pci->pszFileName) - '@') == ulCurDriveNum) { 1504 1510 WinSendMsg(hwndCnr, 1505 1511 CM_SETRECORDEMPHASIS, … … 1507 1513 break; 1508 1514 } 1509 pci = (PCNRITEM) 1510 1511 1512 1515 pci = (PCNRITEM)WinSendMsg(hwndCnr, 1516 CM_QUERYRECORD, 1517 MPFROMP(pci), 1518 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 1513 1519 } 1514 1520 … … 1528 1534 memset(&ri, 0, sizeof(RECORDINSERT)); 1529 1535 ri.cb = sizeof(RECORDINSERT); 1530 ri.pRecordOrder = (PRECORDCORE) 1531 ri.pRecordParent = (PRECORDCORE) 1532 ri.zOrder = (ULONG) 1536 ri.pRecordOrder = (PRECORDCORE)CMA_END; 1537 ri.pRecordParent = (PRECORDCORE)NULL; 1538 ri.zOrder = (ULONG)CMA_TOP; 1533 1539 ri.cRecordsInsert = 1; 1534 1540 ri.fInvalidateRecord = FALSE; … … 1565 1571 memset(&ri, 0, sizeof(RECORDINSERT)); 1566 1572 ri.cb = sizeof(RECORDINSERT); 1567 ri.pRecordOrder = (PRECORDCORE) 1568 ri.pRecordParent = (PRECORDCORE) 1569 ri.zOrder = (ULONG) 1573 ri.pRecordOrder = (PRECORDCORE)CMA_END; 1574 ri.pRecordParent = (PRECORDCORE)pciParent; 1575 ri.zOrder = (ULONG)CMA_TOP; 1570 1576 ri.cRecordsInsert = 1; 1571 1577 ri.fInvalidateRecord = FALSE; … … 1591 1597 1592 1598 // Run Stubby on each hard drive to ensure expand/collapse buttons correct 1593 pci = (PCNRITEM) 1594 1595 1596 1599 pci = (PCNRITEM)WinSendMsg(hwndCnr, 1600 CM_QUERYRECORD, 1601 MPVOID, 1602 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 1597 1603 while (pci && (INT)pci != -1) { 1598 pciNext = (PCNRITEM) 1599 1600 1601 1604 pciNext = (PCNRITEM)WinSendMsg(hwndCnr, 1605 CM_QUERYRECORD, 1606 MPFROMP(pci), 1607 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 1602 1608 if (~pci->flags & RECFLAGS_ENV) { 1603 1609 iDrvNum = toupper(*pci->pszFileName) - 'A'; // 0..25 … … 1627 1633 1628 1634 // Fill in environment CNRITEMs, if any 1629 pci = (PCNRITEM) 1630 1631 1632 1635 pci = (PCNRITEM)WinSendMsg(hwndCnr, 1636 CM_QUERYRECORD, 1637 MPVOID, 1638 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 1633 1639 while (pci && (INT)pci != -1) { 1634 pciNext = (PCNRITEM) 1635 1636 1637 1640 pciNext = (PCNRITEM)WinSendMsg(hwndCnr, 1641 CM_QUERYRECORD, 1642 MPFROMP(pci), 1643 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 1638 1644 if (pci->flags & RECFLAGS_ENV) { 1639 1645 pci = (PCNRITEM) WinSendMsg(hwndCnr, … … 1645 1651 if (pci->flags & RECFLAGS_ENV) 1646 1652 AddFleshWorkRequest(hwndCnr, pci, eFleshEnv); 1647 pci = (PCNRITEM) 1648 1649 1650 1653 pci = (PCNRITEM)WinSendMsg(hwndCnr, 1654 CM_QUERYRECORD, 1655 MPFROMP(pci), 1656 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 1651 1657 } 1652 1658 break; 1653 1659 } 1654 pci = (PCNRITEM) 1655 1656 1657 1660 pci = (PCNRITEM)WinSendMsg(hwndCnr, 1661 CM_QUERYRECORD, 1662 MPFROMP(pci), 1663 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 1658 1664 } // while pci 1659 1665 … … 1763 1769 1764 1770 // Remove field info descriptors 1765 pfi = (PFIELDINFO) WinSendMsg(hwnd, CM_QUERYDETAILFIELDINFO, MPVOID, 1766 MPFROMSHORT(CMA_FIRST)); 1771 pfi = (PFIELDINFO)WinSendMsg(hwnd, 1772 CM_QUERYDETAILFIELDINFO, 1773 MPVOID, 1774 MPFROMSHORT(CMA_FIRST)); 1767 1775 if (pfi && 1768 1776 (INT)WinSendMsg(hwnd, CM_REMOVEDETAILFIELDINFO, MPVOID, … … 1955 1963 InitITimer(&itdSleep, 500); 1956 1964 for (usCount = 0; pci; usCount++) { 1957 pciNext = (PCNRITEM) 1965 pciNext = (PCNRITEM)pci->rc.preccNextRecord; 1958 1966 FreeCnrItemData(pci); 1959 1967 pci = pciNext; 1960 1968 if (!IdleIfNeeded(&itdSleep, 30)) { 1961 1969 for (usCount = usCount + 1; pci; usCount++) { 1962 pciNext = (PCNRITEM) 1970 pciNext = (PCNRITEM)pci->rc.preccNextRecord; 1963 1971 FreeCnrItemData(pci); 1964 1972 pci = pciNext; … … 1978 1986 /** 1979 1987 * Remove item(s) from container and free associated storage if requested 1980 * @param pciFirst points to firstitem to remove or NULL to remove all1988 * @param pciFirst points to specific item to remove or NULL to remove all 1981 1989 * @param usCnt is 0 to remove all or 1 to remove specific record 1982 1990 * @param usFlags for CM_REMOVERECORD … … 1997 2005 remaining = -1; 1998 2006 } 1999 elseif (!usFlags & CMA_FREE) {2007 if (!usFlags & CMA_FREE) { 2000 2008 Runtime_Error(pszSrcFile, __LINE__, "usFlags must have CMA_FREE set"); 2001 2009 remaining = -1; 2002 2010 } 2003 elseif (!pciFirst) {2011 if (!pciFirst) { 2004 2012 // Removing all - query first 2005 2013 pciFirst = (PCNRITEM)WinSendMsg(hwnd, CM_QUERYRECORD, MPVOID, … … 2021 2029 // 2020-01-28 SHL Rework to use CMA_NEXT - preccNextRecord method was never reliable 2022 2030 pci = pciFirst; 2023 while (pci && (INT)pci != -1 ) {2031 while (pci && (INT)pci != -1 && remaining > 0) { 2024 2032 FreeCnrItemData(pci); 2025 if ( remaining &&--remaining == 0)2026 break; // pci point to last CNRITEM to be deleted2033 if (--remaining == 0) 2034 break; 2027 2035 pci = WinSendMsg(hwnd, CM_QUERYRECORD, MPFROMP(pci), 2028 2036 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); … … 2043 2051 remaining = (INT)WinSendMsg(hwnd, CM_REMOVERECORD, MPFROMP(&pciFirst), MPFROM2SHORT(usCnt, usFlags)); 2044 2052 if (remaining == -1) 2045 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_REMOVERECORD hwnd %x pci %p cnt %u", hwnd, pciFirst, usCnt);2053 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_REMOVERECORD hwnd %x pciFirst %p cnt %u", hwnd, pciFirst, usCnt); 2046 2054 else if (usCnt == 0 && remaining != 0) 2047 2055 Runtime_Error(pszSrcFile, __LINE__, "%u records remain after CM_REMOVERECORD", remaining);
Note:
See TracChangeset
for help on using the changeset viewer.