Changeset 1865


Ignore:
Timestamp:
Aug 23, 2015, 10:36:02 PM (10 years ago)
Author:
Steven Levine
Message:

Correct WaitFleshWorkListEmpty typo that could corrupt heap
Protect some read-only strings from overwriting

Location:
trunk/dll
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/filldir.c

    r1863 r1865  
    9696  31 May 11 SHL Disable antique debug code in RemoveCnrItems - really speeds up container close
    9797  12 Jun 11 GKY Added IdleIfNeeded to the container "free" loops to improve system
    98                 responsiveness when closing containers with large numbers of items
     98                responsiveness when closing containers with large numbers of items
    9999  12 Jun 11 GKY Replaced SleepIfNeeded with IdleIfNeeded in the container loade loop
    100100  22 Oct 11 GKY Removing unneeded UnFlesh call from StubbyThread appears to significantly speed opening of FM/2
    101101  02 Mar 14 GKY !didone for fFirstTime so the suggest code works again. Also clear out the
    102                 garbage that was appearing in the string.
     102                garbage that was appearing in the string.
    103103  02 Mar 14 GKY Speed up intial drive scans Ticket 528
    104104  19 Mar 14 SHL RemoveCnrItems: clean up odd code
    105105  22 Mar 14 GKY Reverted some code from the RemoveCnrItems changes adding a previously
    106                 missing break and comments explaining the code structure.
     106                missing break and comments explaining the code structure.
    107107  28 Jun 14 GKY Fix errors identified with CPPCheck
    108108  30 Aug 14 GKY Use saymsg2 for Suggest dialog
     
    110110  19 Jun 15 JBS Ticket 514: Double free fix (which also fixes a memory leak)
    111111  02 Aug 15 GKY Serialize local hard drive scanning to reduce drive thrashing continue to scan
    112                 all other drive types in separate threads.
     112                all other drive types in separate threads.
    113113  02 Aug 15 GKY Remove unneeded SubbyScan code and improve suppression of blank lines and
    114                 duplicate subdirectory name caused by running Stubby in worker threads.
     114                duplicate subdirectory name caused by running Stubby in worker threads.
    115115  04 Aug 15 SHL Comments
    116116  04 Aug 15 SHL Move StubbyThread to flesh.c
     
    118118  22 Aug 15 GKY Remove recurse scan code.
    119119  22 Aug 15 GKY Minimize the occurence of an A:\ Drive not ready error by moving the cursor
    120                 to the default drive.
     120                to the default drive.
    121121
    122122***********************************************************************/
     
    366366  BOOL fLoadSubjectForDrive = fLoadSubject && ~flags & DRIVE_NOLOADSUBJS;
    367367  BOOL fLoadLongNameForDrive = fLoadLongnames &&  //~flags & DRIVE_NOLONGNAMES &&
    368                                ~flags & DRIVE_NOLOADLONGS;
     368                               ~flags & DRIVE_NOLOADLONGS;
    369369  if (fLoadSubjectForDrive || fLoadLongNameForDrive) {
    370370    // Allocate space to hold GEA2s and .SUBJECT and .LONGNAME strings
    371371      PGEA2LIST pgealist = xmallocz(sizeof(GEA2LIST) + (sizeof(GEA2) * 2) + 32,
    372                                     pszSrcFile, __LINE__);
     372                                    pszSrcFile, __LINE__);
    373373    if (pgealist) {
    374374      APIRET rc;
     
    379379      EAOP2 eaop;
    380380      UINT state;
    381       //DbgMsg(pszSrcFile, __LINE__, "pszFileName %s", pci->pszFileName);
    382381      for (state = 0; state < 2; state++) {
    383382        PCSZ pcsz;
     
    457456            pfea = (PFEA2)((PSZ)pfea + pfea->oNextEntryOffset);
    458457          } // while
    459         }
     458        }
    460459        free(pfealist);
    461460      }
     
    589588  pci->pszDisplayName = p;
    590589
    591   //comma format the file size for large file support
     590  // Comma format the file size for large file support
    592591  {
    593592    CHAR szBuf[30];
     
    640639    if (*dcd->mask.szMask || dcd->mask.antiattr) {
    641640      if (!Filter((PMINIRECORDCORE) pci, (PVOID) & dcd->mask))
    642         pci->rc.flRecordAttr |= CRA_FILTERED;
     641        pci->rc.flRecordAttr |= CRA_FILTERED;
    643642    }
    644643    else if ((!(dcd->mask.attrFile & FILE_HIDDEN) &&
     
    803802    if (*dcd->mask.szMask || dcd->mask.antiattr) {
    804803      if (!Filter((PMINIRECORDCORE) pci, (PVOID) & dcd->mask))
    805         pci->rc.flRecordAttr |= CRA_FILTERED;
     804        pci->rc.flRecordAttr |= CRA_FILTERED;
    806805    }
    807806    else if ((!(dcd->mask.attrFile & FILE_HIDDEN) &&
     
    914913        pffbFile = paffbFound;
    915914        ulSelCnt = 0;
    916         for (;;) {
     915        for (;;) {
    917916          if (!*pffbFile->achName ||
    918917              (!filestoo && ~pffbFile->attrFile & FILE_DIRECTORY) ||
     
    935934          if (stopflag && *stopflag)
    936935            goto Abort;
    937           if (fSyncUpdates) {
    938             if (!WinIsWindow(WinQueryAnchorBlock(hwndCnr), hwndCnr)) {
    939               ok = FALSE;
     936          if (fSyncUpdates) {
     937            if (!WinIsWindow(WinQueryAnchorBlock(hwndCnr), hwndCnr)) {
     938              ok = FALSE;
    940939              ullTotalBytes = 0;
    941940              break;
     
    956955              // Finish filling pci items
    957956              for (x = 0; x < ulSelCnt; x++) {
    958                 pffbFile = papffbSelected[x];
     957                pffbFile = papffbSelected[x];
    959958                ullBytes = FillInRecordFromFFB(hwndCnr, pci, pszFileSpec,
    960                                                pffbFile, partial, dcd);
     959                                               pffbFile, partial, dcd);
    961960                pci = (PCNRITEM) pci->rc.preccNextRecord;
    962961                ullTotalBytes += ullBytes;
     
    990989            if (ok) {
    991990              ullReturnBytes += ullTotalBytes;
    992               ulReturnFiles += ulSelCnt;
    993               DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
     991              ulReturnFiles += ulSelCnt;
     992              DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
    994993              if (dcd) {
    995994                dcd->totalfiles += ulSelCnt;
    996995                dcd->ullTotalBytes += ullTotalBytes;
    997               }
    998               DosReleaseMutexSem(hmtxFiltering);
     996              }
     997              DosReleaseMutexSem(hmtxFiltering);
    999998            }
    1000999          } // if sync updates
     
    10101009              for (x = 0; x < ulSelCnt; x++) {
    10111010                paffbTotal[x + cAffbTotal] = *papffbSelected[x];
    1012                 ullTotalBytes += papffbSelected[x]->cbFile;     // 15 Sep 09 SHL
     1011                ullTotalBytes += papffbSelected[x]->cbFile;
    10131012              }
    10141013              cAffbTotal += ulSelCnt;
     
    10511050          ULONG ulRecsToInsert;
    10521051
    1053           if (pci ==NULL) {
    1054             if (!WinIsWindow(WinQueryAnchorBlock(hwndCnr), hwndCnr)) {
    1055               ok = FALSE;
     1052          if (pci ==NULL) {
     1053            if (!WinIsWindow(WinQueryAnchorBlock(hwndCnr), hwndCnr)) {
     1054              ok = FALSE;
    10561055              ullTotalBytes = 0;
    10571056              break;
     
    10611060                                  MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(ulRecsToInsert));
    10621061
    1063             if (!pciFirst) {
    1064               //ERRORID erridErrorCode = WinGetLastError(WinQueryAnchorBlock(hwndCnr));
    1065               //PmpfF(("Allocation failed %i", erridErrorCode));
     1062            if (!pciFirst) {
     1063              //ERRORID erridErrorCode = WinGetLastError(WinQueryAnchorBlock(hwndCnr));
     1064              //PmpfF(("Allocation failed %i", erridErrorCode));
    10661065              Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__,
    10671066                        GetPString(IDS_CMALLOCRECERRTEXT));
     
    10781077              pci = pciFirst;
    10791078            }
    1080           }
     1079          }
    10811080          ullBytes = FillInRecordFromFFB(hwndCnr, pci, pszFileSpec,
    1082                                         pffbFile, partial, dcd);
     1081                                        pffbFile, partial, dcd);
    10831082          pci = (PCNRITEM) pci->rc.preccNextRecord;
    10841083          ullTotalBytes += ullBytes;
    1085           // 15 Sep 09 SHL allow timed updates to see
    1086           DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
     1084          // 15 Sep 09 SHL allow timed updates to see
     1085          DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
    10871086          if (dcd) {
    10881087            dcd->totalfiles = x;
    10891088            dcd->ullTotalBytes = ullTotalBytes;
    1090           }
    1091           DosReleaseMutexSem(hmtxFiltering);
     1089          }
     1090          DosReleaseMutexSem(hmtxFiltering);
    10921091          // Can not use offset since we have merged lists - this should be equivalent
    10931092          pffbFile = (PFILEFINDBUF4L)((PBYTE)pffbFile + sizeof(FILEFINDBUF4L));
    10941093
    1095           if (!IdleIfNeeded(&itdSleep, 30)) {
    1096             for (x = x+1; x < cAffbTotal; x++) {
     1094          if (!IdleIfNeeded(&itdSleep, 30)) {
     1095            for (x = x+1; x < cAffbTotal; x++) {
    10971096              ullBytes = FillInRecordFromFFB(hwndCnr, pci, pszFileSpec,
    1098                                           pffbFile, partial, dcd);
     1097                                          pffbFile, partial, dcd);
    10991098              pci = (PCNRITEM) pci->rc.preccNextRecord;
    1100               ullTotalBytes += ullBytes;
    1101               DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
     1099              ullTotalBytes += ullBytes;
     1100              DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
    11021101              if (dcd) {
    1103                 dcd->totalfiles = x;
    1104                 dcd->ullTotalBytes = ullTotalBytes;
    1105               }
    1106               DosReleaseMutexSem(hmtxFiltering);
    1107               pffbFile = (PFILEFINDBUF4L)((PBYTE)pffbFile + sizeof(FILEFINDBUF4L));
     1102                dcd->totalfiles = x;
     1103                dcd->ullTotalBytes = ullTotalBytes;
     1104              }
     1105              DosReleaseMutexSem(hmtxFiltering);
     1106              pffbFile = (PFILEFINDBUF4L)((PBYTE)pffbFile + sizeof(FILEFINDBUF4L));
    11081107              if (pci == NULL) {
    1109                 priority_normal();
    1110                 InitITimer(&itdSleep, 500);
    1111                 break;
     1108                priority_normal();
     1109                InitITimer(&itdSleep, 500);
     1110                break;
    11121111              }
    11131112            }
     
    11891188    while (pci && (INT)pci != -1) {
    11901189      if (!pci->pszFileName || !strcmp(pci->pszFileName, NullStr)) {
    1191         Runtime_Error(pszSrcFile, __LINE__, "pci->pszFileName NULL for %p", pci);
    1192         return;
     1190        // 2015-08-23 SHL FIXME debug
     1191        DbgMsg(pszSrcFile, __LINE__, "ProcessDirectory pci %p pci->pszFileName %p %s",
     1192               pci, pci->pszFileName,
     1193               pci->pszFileName == NullStr ? "NullStr" : "NULL");
     1194        Runtime_Error(pszSrcFile, __LINE__, "pci->pszFileName NULL for %p", pci);
     1195        return;
    11931196      }
    11941197      if ((pci->attrFile & FILE_DIRECTORY))
    1195         AddFleshWorkRequest(hwndCnr, pci, eStubby);
     1198        AddFleshWorkRequest(hwndCnr, pci, eStubby);
    11961199      pci = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
    1197                        MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
     1200                       MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    11981201    }
    11991202  }
     
    12541257  ULONG ulDriveMapMask;
    12551258  CHAR szSuggest[32] = {0};                     // Suggested startup command line parameters
    1256   CHAR szDrive[CCHMAXPATH] = " :\\";    // 13 Oct 09 SHL
     1259  CHAR szDrive[CCHMAXPATH] = " :\\";
    12571260  CHAR szFSType[CCHMAXPATH];
    12581261  FILESTATUS4L fsa4;
     
    14621465      driveflags[iDrvNum] |= DRIVE_INVALID;
    14631466
    1464     // 13 Oct 09 SHL
    14651467    // Update drives list dropdown
    14661468    if ((ulDriveMap ^ ulLastDriveMap) & ulDriveMapMask) {
     
    14831485  } // for drives
    14841486
    1485   ulLastDriveMap = ulDriveMap;          // 13 Oct 09 SHL
     1487  ulLastDriveMap = ulDriveMap;
    14861488
    14871489  // insert the drives in container
     
    15061508  // move cursor onto the default drive rather than the first drive
    15071509  pci = (PCNRITEM) WinSendMsg(hwndCnr,
    1508                               CM_QUERYRECORD,
    1509                               MPVOID,
    1510                               MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
     1510                              CM_QUERYRECORD,
     1511                              MPVOID,
     1512                              MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    15111513  while (pci && (INT)pci != -1) {
    15121514    if ((ULONG) (toupper(*pci->pszFileName) - '@') == ulCurDriveNum) {
    15131515      WinSendMsg(hwndCnr,
    1514                 CM_SETRECORDEMPHASIS,
    1515                 MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_CURSORED));
     1516                CM_SETRECORDEMPHASIS,
     1517                MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_CURSORED));
    15161518      break;
    15171519    }
    15181520    pci = (PCNRITEM) WinSendMsg(hwndCnr,
    1519                                 CM_QUERYRECORD,
    1520                                 MPFROMP(pci),
    1521                                 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
     1521                                CM_QUERYRECORD,
     1522                                MPFROMP(pci),
     1523                                MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    15221524  }
    15231525
     
    15311533      pciParent->flags |= RECFLAGS_ENV;
    15321534      pciParent->pszFileName = xstrdup(GetPString(IDS_ENVVARSTEXT), pszSrcFile, __LINE__);
    1533       pciParent->pszDisplayName = pciParent->pszFileName;       // 03 Aug 07 SHL
     1535      pciParent->pszDisplayName = pciParent->pszFileName;
    15341536      pciParent->rc.hptrIcon = hptrEnv;
    15351537      pciParent->rc.pszIcon = pciParent->pszFileName;
     
    17041706      strcat(szSuggest, " %*");
    17051707      rc = saymsg2(NULL, 3, HWND_DESKTOP,
    1706               GetPString(IDS_SUGGESTTITLETEXT),
    1707               GetPString(IDS_SUGGEST1TEXT),
    1708               (includesyours) ? GetPString(IDS_SUGGEST2TEXT) : NullStr,
     1708              GetPString(IDS_SUGGESTTITLETEXT),
     1709              GetPString(IDS_SUGGEST1TEXT),
     1710              (includesyours) ? GetPString(IDS_SUGGEST2TEXT) : NullStr,
    17091711              szSuggest);
    17101712      if (rc == SM2_YES || rc == SM2_DONTASK) {
     
    17471749     if (rc == SM2_NO || rc == SM2_DONTASK) {
    17481750        fDontSuggestAgain = TRUE;
    1749         PrfWriteProfileData(fmprof, FM3Str, "DontSuggestAgain",
    1750                             &fDontSuggestAgain, sizeof(BOOL));
     1751        PrfWriteProfileData(fmprof, FM3Str, "DontSuggestAgain",
     1752                            &fDontSuggestAgain, sizeof(BOOL));
    17511753      }
    17521754    } // if suggest
     
    17951797VOID FreeCnrItemData(PCNRITEM pci)
    17961798{
    1797  
     1799
     1800  // 2015-08-23 SHL FIXME debug
     1801  if ((pci->pszSubject && (ULONG)pci->pszSubject < 0x10000) ||
     1802      (pci->pszLongName && (ULONG)pci->pszLongName < 0x10000) ||
     1803      (pci->pszDisplayName && (ULONG)pci->pszDisplayName < 0x10000) ||
     1804      (pci->pszFileName && (ULONG)pci->pszFileName < 0x10000) ||
     1805      (pci->pszLongName && (ULONG)pci->pszLongName < 0x10000) ||
     1806      (pci->pszFmtFileSize && (ULONG)pci->pszFmtFileSize < 0x10000))
     1807  {
     1808    Runtime_Error(pszSrcFile, __LINE__, "FreeCnrItemData attempting to free bogus %p", pci);
     1809  }
     1810
    17981811  if (pci->pszSubject) {
    17991812    if (pci->pszSubject != NullStr)
     
    18011814    pci->pszSubject = NULL;             // Catch illegal references
    18021815  }
    1803  
    1804   // 08 Sep 08 SHL Remove excess logic
     1816
    18051817  if (pci->pszLongName) {
    18061818    if (pci->pszLongName != NullStr)
     
    18081820    pci->pszLongName = NULL;            // Catch illegal references
    18091821  }
    1810  
     1822
    18111823  // Bypass free if pszDisplayName points into pszFileName buffer
    1812   // 05 Sep 08 SHL Correct pointer overlap compare logic
    18131824  if (pci->pszDisplayName) {
    18141825    if (pci->pszDisplayName != NullStr) {
     
    18171828          pci->pszDisplayName >= pci->pszFileName + _msize(pci->pszFileName))
    18181829      {
    1819         free(pci->pszDisplayName);
     1830        free(pci->pszDisplayName);
    18201831      }
    18211832    }
     
    18231834  }
    18241835
    1825 #if 0 // 26 Sep 09 SHL debug dup free complaints
     1836#if 1 // 2009-09-26 SHL FIXME debug dup free complaints
    18261837  if (!pci->pszFileName)
    18271838    Runtime_Error(pszSrcFile, __LINE__, "FreeCnrItemData attempting to free %p data twice", pci);
     
    18331844#else
    18341845  {
     1846    // 2015-08-23 SHL FIXME to work again now that Flesh/Stubby on thread
    18351847    #define HIST_COUNT 50
    18361848    static struct {
     
    18801892  }
    18811893
    1882 
    1883 #endif
    1884 
    1885   // 08 Sep 08 SHL Remove excess logic
     1894#endif // FIXME debug dup free
     1895
    18861896  if (pci->pszLongName) {
    18871897    if (pci->pszLongName != NullStr)
     
    19601970  INT remaining = usCnt;
    19611971  BOOL bIdlePrioritySet = FALSE;
    1962 // #define RCI_ITEMS_PER_TIMER_CHECK (10)
    1963 // 10 seems a very conservative number
    1964 //   USHORT usTimerCheckCountdown       = RCI_ITEMS_PER_TIMER_CHECK;
     1972  // #define RCI_ITEMS_PER_TIMER_CHECK (10)
     1973  // 10 seems a very conservative number
     1974  //  USHORT usTimerCheckCountdown      = RCI_ITEMS_PER_TIMER_CHECK;
    19651975  PCNRITEM pci;
    19661976  ITIMER_DESC itdSleep = { 0 };         // 30 May 11 GKY
     
    19861996      InitITimer(&itdSleep, 500);
    19871997      while (pci) {
    1988         FreeCnrItemData(pci);
     1998        FreeCnrItemData(pci);
    19891999        pci = (PCNRITEM)pci->rc.preccNextRecord;
    19902000        if (!pci)
    19912001          break;
    1992         if (remaining && --remaining == 0)
    1993           break;
    1994         if (!bIdlePrioritySet /* && --usTimerCheckCountdown == 0 */) {
    1995           bIdlePrioritySet = !IdleIfNeeded(&itdSleep, 30);
    1996 //          usTimerCheckCountdown = RCI_ITEMS_PER_TIMER_CHECK;
    1997         }
     2002        if (remaining && --remaining == 0)
     2003          break;
     2004        if (!bIdlePrioritySet /* && --usTimerCheckCountdown == 0 */) {
     2005          bIdlePrioritySet = !IdleIfNeeded(&itdSleep, 30);
     2006          // usTimerCheckCountdown = RCI_ITEMS_PER_TIMER_CHECK;
     2007        }
    19982008      } // while
    19992009      if (bIdlePrioritySet)
    2000         priority_normal();
     2010        priority_normal();
    20012011
    20022012      DosPostEventSem(CompactSem);
  • trunk/dll/findrec.c

    r1854 r1865  
    1111  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    1212  28 Dec 08 GKY Containers will only scroll to the right if needed to show end of selected
    13                 item and will scroll left to eliminate space after a selected item. Ticket 204
     13                item and will scroll left to eliminate space after a selected item. Ticket 204
    1414  06 Aug 15 SHL Clean up and comment
     15  23 Aug 15 SHL Protect FindCnrRecord filename arg
    1516
    1617***********************************************************************/
     
    2728//static PSZ pszSrcFile = __FILE__;
    2829
    29 PCNRITEM FindCnrRecord(HWND hwndCnr, CHAR *filename, PCNRITEM pciParent,
     30PCNRITEM FindCnrRecord(HWND hwndCnr, PCSZ filename, PCNRITEM pciParent,
    3031                       BOOL partial, BOOL partmatch, BOOL noenv)
    3132{
    3233  SEARCHSTRING srch;
    3334  PCNRITEM pci;
    34   register CHAR *file, *p;
     35  PCSZ file;
     36  PCSZ p;
    3537
    3638  if (partial) {
     
    127129  qrecrct.fsExtent = (CMA_ICON | CMA_TEXT | CMA_TREEICON);
    128130  if (!WinSendMsg(hwndCnr,
    129                   CM_QUERYRECORDRECT, MPFROMP(&rcl), MPFROMP(&qrecrct))) {
     131                  CM_QUERYRECORDRECT, MPFROMP(&rcl), MPFROMP(&qrecrct))) {
    130132    qrecrct.fsExtent = CMA_TEXT | CMA_TREEICON;
    131133    WinSendMsg(hwndCnr, CM_QUERYRECORDRECT, MPFROMP(&rcl), MPFROMP(&qrecrct));
  • trunk/dll/findrec.h

    r1223 r1865  
    44  $Id$
    55
    6   <<<description here>>>
     6  Find records
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2008 Steven H. Levine
     9  Copyright (c) 2008, 2015 Steven H. Levine
    1010
    11   Change log
     11  23 Aug 15 SHL Protect FindCnrRecord filename arg
    1212
    1313***********************************************************************/
     
    1818#include "dircnrs.h"                    // typedef for CNRITEM, PCNRITEM
    1919
    20 PCNRITEM FindCnrRecord(HWND hwndCnr, CHAR * filename, PCNRITEM pciParent,
     20PCNRITEM FindCnrRecord(HWND hwndCnr, PCSZ filename, PCNRITEM pciParent,
    2121                       BOOL partial, BOOL partmatch, BOOL noenv);
    2222PCNRITEM FindParentRecord(HWND hwndCnr, PCNRITEM pciC);
  • trunk/dll/flesh.c

    r1864 r1865  
    250250                              CM_QUERYRECORD,
    251251                              MPFROMP(pciParent),
    252                               MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
     252                              MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
    253253
    254254  // 2015-08-06 SHL allow pciL -1
     
    296296/**
    297297 * Remove children from container
    298  * @parame pciParent is parent of children to be removed
     298 * @param pciParent is parent of children to be removed
    299299 */
    300300
     
    308308
    309309  if (!fNoFleshDbgMsg)
    310     DbgMsg(pszSrcFile, __LINE__, "UnFlesh pciParent %p pszFileName %s", pciParent, pciParent->pszFileName ? pciParent->pszFileName : "(null)"); // 2015-08-03 SHL FIXME debug
     310    DbgMsg(pszSrcFile, __LINE__, "UnFlesh pciParent %p pszFileName \"%s\"", pciParent, pciParent->pszFileName ? pciParent->pszFileName : "(null)"); // 2015-08-03 SHL FIXME debug
    311311
    312312  for (;;) {
     
    319319
    320320    if (!fNoFleshDbgMsg)
    321       DbgMsg(pszSrcFile, __LINE__, "UnFlesh RemoveCnrItems() pciL %p %s", pciL, pciL->pszFileName ? pciL->pszFileName : "(null)"); // 2015-08-03 SHL FIXME debug
     321      DbgMsg(pszSrcFile, __LINE__, "UnFlesh RemoveCnrItems() pciL %p \"%s\"", pciL, pciL->pszFileName ? pciL->pszFileName : "(null)"); // 2015-08-03 SHL FIXME debug
    322322    RemoveCnrItems(hwndCnr, pciL, 1, CMA_FREE);
    323323    removed = TRUE;
     
    606606  } // if !rc
    607607  else if (toupper(*wildcard) > 'B' && wildcard[1] == ':' && wildcard[2] == '\\' &&
    608            wildcard[3] == '*' && !wildcard[4]) {
     608           wildcard[3] == '*' && !wildcard[4]) {
    609609    // Is root and no subdirectories
    610610    CHAR s[162];
    611    
     611
    612612    sprintf(s,
    613             GetPString(IDS_NOSUBDIRS2TEXT),
    614             nm,
    615             toupper(*pciParent->pszFileName),
    616             isremote ? GetPString(IDS_NOSUBDIRS3TEXT) : NullStr);
     613            GetPString(IDS_NOSUBDIRS2TEXT),
     614            nm,
     615            toupper(*pciParent->pszFileName),
     616            isremote ? GetPString(IDS_NOSUBDIRS3TEXT) : NullStr);
    617617    Notify(s);
    618618  }
     
    684684 */
    685685
    686 #if 0 // 2015-08-03 SHL FIXME debug
     686#ifndef AddFleshWorkRequest // 2015-08-03 SHL FIXME debug
    687687BOOL AddFleshWorkRequest(HWND hwndCnr, PCNRITEM pci, FLESHWORKACTION action)
    688688#else
     
    784784  }
    785785  c = strlen(((PFLESHWORKITEM)item)->pci->pszFileName);
    786     return FALSE; //strncmp(((PFLESHWORKITEM)item)->pci->pszFileName, (PCSZ)data, c) == 0;
     786  // 2015-08-23 SHL FIXME to not trap for Gregg
     787  return strncmp(((PFLESHWORKITEM)item)->pci->pszFileName, (PCSZ)data, c) == 0;
    787788}
    788789
     
    793794 */
    794795
    795 #if 0 // 2015-08-03 SHL FIXME debug
     796#ifndef WaitFleshWorkListEmpty // 2015-08-03 SHL FIXME debug
    796797VOID WaitFleshWorkListEmpty(PCSZ pszDirName)
    797798#else
     
    862863  } // while
    863864
    864   if (!pathSaved) {
     865  if (pathSaved) {
    865866    xDosRequestMutexSem(hmtxFleshWork, SEM_INDEFINITE_WAIT);
    866867    pszFleshFocusPath = pszSavedFleshFocusPath;
     
    982983          case eStubby:
    983984            // DbgMsg(pszSrcFile, __LINE__, "FleshWorkThread pci %p pszFileName %s", stubbyArgs->pci, stubbyArgs->pci->pszFileName); // 2015-08-03 SHL FIXME debug
    984             Stubby(item->hwndCnr, item->pci);
    985             break;
     985            Stubby(item->hwndCnr, item->pci);
     986            break;
    986987          case eFlesh:
    987988            if (Flesh(item->hwndCnr, item->pci)) {
  • trunk/dll/treecnr.c

    r1862 r1865  
    285285
    286286VOID ShowTreeRec(HWND hwndCnr,
    287                  CHAR *pszDir_,
     287                 PCSZ pszDir_,
    288288                 BOOL collapsefirst,
    289289                 BOOL maketop)
     
    299299  CHAR szDir[CCHMAXPATH];
    300300
    301   DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec pszDir_ %s", pszDir_); // 2015-08-04 SHL FIXME debug
     301  DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec pszDir_ \"%s\"", pszDir_); // 2015-08-04 SHL FIXME debug
    302302
    303303  // already positioned to requested record?
     
    315315  if (fSwitchTreeOnDirChg)
    316316    DosSleep(200);
    317   //WaitFleshWorkListEmpty(0);
    318317
    319318  // 2015-08-13 SHL add retry logic 2015-08-22 GKY increase retries from 10 to 100 to
     
    353352                           TRUE);               // noenv
    354353      if (!pciP || (INT)pciP == -1) {
    355         DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec FindCnrRecord(%s) returned %p", szDir, pciP); // 2015-08-04 SHL FIXME debug
     354        DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec FindCnrRecord(\"%s\") returned %p", szDir, pciP); // 2015-08-04 SHL FIXME debug
    356355        WaitFleshWorkListEmpty(szDir);          // 2015-08-19 SHL
    357356        break;                                  // No match
    358357      }
    359358
    360       DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec FindCnrRecord returned %p %s", pciP, pciP->pszFileName); // 2015-08-04 SHL FIXME debug
     359      DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec FindCnrRecord returned %p \"%s\"", pciP, pciP->pszFileName); // 2015-08-04 SHL FIXME debug
    361360
    362361      if (!stricmp(pszDir_, pciP->pszFileName)) {
     
    367366
    368367      if (~pciP->rc.flRecordAttr & CRA_EXPANDED) {
    369         DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec expanding %s", pciP->pszFileName); // 2015-08-04 SHL FIXME debug
     368        DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec expanding \"%s\"", pciP->pszFileName); // 2015-08-04 SHL FIXME debug
    370369        WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
    371370        DosSleep(100);                          // 2015-08-13 SHL Let PM catch up
     
    388387  } // for
    389388
    390   DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec retries %u pci %p pci->pszFileName %s",retries, pci, pci && (INT)pci != -1 ? pci->pszFileName : "(null)"); // 2015-08-04 SHL FIXME debug
     389  DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec retries %u pci %p pci->pszFileName \"%s\"",retries, pci, pci && (INT)pci != -1 ? pci->pszFileName : "(null)"); // 2015-08-04 SHL FIXME debug
    391390
    392391  if (found) {
     
    431430    pciToSelect = pci;
    432431    if (pciToSelect && (INT) pciToSelect != -1) {
    433       DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec %p fTopDir %i maketop %i", pciToSelect, fTopDir, maketop); // 2015-08-04 SHL FIXME debug
    434       if (fSwitchTreeExpand && ~pciToSelect->rc.flRecordAttr & CRA_EXPANDED)
     432      if (fSwitchTreeExpand && ~pciToSelect->rc.flRecordAttr & CRA_EXPANDED) {
     433        // 2015-08-23 SHL FIXME debug
     434        DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec WinSendMsg(CM_EXPANDTREE, %p)", pciToSelect); // 2015-08-04 SHL FIXME debug
    435435        WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciToSelect), MPVOID);
    436       if (fTopDir || maketop)
     436      }
     437      if (fTopDir || maketop) {
     438        // 2015-08-23 SHL FIXME debug
     439        DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec ShowCnrRecord(%p) fTopDir %i maketop %i", pciToSelect, fTopDir, maketop); // 2015-08-04 SHL FIXME debug
    437440        ShowCnrRecord(hwndCnr, (PMINIRECORDCORE)pciToSelect);
     441      }
    438442
    439443      if (!quickbail) {
    440444        WaitFleshWorkListEmpty(pszDir_);        // 2015-08-19 SHL try to ensure contents stable
    441         DbgMsg(pszSrcFile, __LINE__, "WinSendMsg(CM_SETRECORDEMPHASIS, CRA_SELECTED | CRA_CURSORED) \"%s\"", pszDir_); // 2015-08-04 SHL FIXME debug
     445        DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec WinSendMsg(CM_SETRECORDEMPHASIS, CRA_SELECTED | CRA_CURSORED) pszDir_ \"%s\"", pszDir_); // 2015-08-04 SHL FIXME debug
    442446        WinSendMsg(hwndCnr,
    443447                   CM_SETRECORDEMPHASIS,
     
    724728        */
    725729        DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME cDirectoriesRestored %u", cDirectoriesRestored); // 2015-08-04 SHL FIXME debug
    726         DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME %s)", mp1); // 2015-08-04 SHL FIXME debug
     730        DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME \"%s\")", mp1); // 2015-08-04 SHL FIXME debug
    727731
    728732        if (cDirectoriesRestored > 0)
  • trunk/dll/treecnr.h

    r1360 r1865  
    1313  28 Dec 08 GKY Rework partition submenu to gray out unavailable items (check for existence of files)
    1414                and have no default choice.
     15  23 Aug 15 SHL Protect ShowTreeRec dirname arg
    1516
    1617***********************************************************************/
     
    2021
    2122MRESULT EXPENTRY OpenButtonProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
    22 VOID ShowTreeRec(HWND hwndCnr, CHAR * dirname, BOOL collapsefirst,
    23                  BOOL maketop);
     23VOID ShowTreeRec(HWND hwndCnr, PCSZ dirname, BOOL collapsefirst, BOOL maketop);
    2424HWND StartTreeCnr(HWND hwndParent, ULONG flags);
    2525MRESULT EXPENTRY TreeClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
Note: See TracChangeset for help on using the changeset viewer.