Changeset 1865 for trunk/dll/treecnr.c


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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)
Note: See TracChangeset for help on using the changeset viewer.