Changeset 1875 for trunk/dll/treecnr.c


Ignore:
Timestamp:
Oct 5, 2015, 1:06:42 AM (10 years ago)
Author:
Gregg Young
Message:

Move the eUnflesh call from UM_ENTER to the object window so WaitFleshWorkListEmpty can be used (UM_ENTER is on TID 1); Prevent eUnflesh from running if no child directories are present; treat floppies like invalid drives on rescan (IDM_UPDATE to avoid them seen as directories and having random subdirectories attached to them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/treecnr.c

    r1874 r1875  
    115115                while avoiding thread 1
    116116  27 Sep 15 GKY DosSleep times in WaitFleshWorkListEmpty set by caller
     117  04 Oct 15 GKY Move the eUnflesh call from UM_ENTER to the object window so WaitFleshWorkListEmpty
     118                can be used (UM_ENTER is on TID 1); Prevent eUnflesh from running if no child
     119                directories are present; treat floppies like invalid drives on rescan (IDM_UPDATE
     120                to avoid them seen as directories and having random subdirectories attached to
     121                them.
    117122
    118123***********************************************************************/
     
    860865    return 0;
    861866
     867  case UM_SETUP2:
     868    {
     869      PCNRITEM pci = (PCNRITEM) mp1;
     870      PCNRITEM pciL;
     871
     872      if (pci) {
     873        pciL = (PCNRITEM)WinSendMsg(dcd->hwndCnr,
     874                                    CM_QUERYRECORD,
     875                                    MPFROMP(pci),
     876                                    MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
     877        if (pciL && (INT) pciL != -1) {
     878          WaitFleshWorkListEmpty(NULL, 10);     // 2015-08-13 SHL in case pci still in work list
     879          AddFleshWorkRequest(hwnd, pci, eUnFlesh);
     880        }
     881        if ((INT) mp2 == 21 && pci->rc.hptrIcon == hptrCDROM)
     882          PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
     883        NotifyError(pci->pszFileName, (ULONG) mp2);
     884      }
     885    }
     886    return 0;
     887
    862888  case UM_SETUP:
    863889#   ifdef FORTIFY
     
    9771003            }
    9781004          }
    979           else {
    980             // find root record and strip it
    981             pci = FindParentRecord(dcd->hwndCnr, pci);
    982             driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
    983             WaitFleshWorkListEmpty(pci->pszFileName, 240);      // 2015-08-19 SHL in case pci still in work list
    984             AddFleshWorkRequest(dcd->hwndCnr, pci, eUnFlesh);
     1005          else {
     1006            PCNRITEM pciL;
     1007            // find root record and strip it if needed
     1008            pci = FindParentRecord(dcd->hwndCnr, pci);
     1009            driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
     1010            pciL = (PCNRITEM)WinSendMsg(dcd->hwndCnr,
     1011                                        CM_QUERYRECORD,
     1012                                        MPFROMP(pci),
     1013                                        MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
     1014            if (pciL && (INT) pciL != -1) {
     1015              WaitFleshWorkListEmpty(pci->pszFileName, 240);    // 2015-08-19 SHL in case pci still in work list
     1016              AddFleshWorkRequest(dcd->hwndCnr, pci, eUnFlesh);
     1017            }
    9851018          }
    9861019        }
     
    13771410    }
    13781411    return 0;
    1379 
     1412#if 0
    13801413  case UM_SETUP2:
    13811414    {
    13821415      PCNRITEM pci = (PCNRITEM) mp1;
    13831416
    1384       if (pci)
    1385         NotifyError(pci->pszFileName, (ULONG) mp2);
    1386     }
    1387     return 0;
    1388 
     1417      if (pci) {
     1418        WaitFleshWorkListEmpty(NULL, 10);       // 2015-08-13 SHL in case pci still in work list
     1419        AddFleshWorkRequest(hwnd, pci, eUnFlesh);
     1420        if ((INT) mp2 == 21)
     1421          PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
     1422        NotifyError(pci->pszFileName, (ULONG) mp2);
     1423      }
     1424    }
     1425    return 0;
     1426#endif
    13891427  case UM_SETUP:
    13901428#   ifdef FORTIFY
     
    20902128          else {
    20912129            driveserial[x] = -1;
    2092             //WaitFleshWorkListEmpty(NULL, 10); // 2015-08-13 SHL in case pci still in work list
    2093             AddFleshWorkRequest(hwnd, pci, eUnFlesh);
    2094             PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
    2095             PostMsg(hwnd, UM_SETUP2, MPFROMP(pci), MPFROMLONG(rc));
     2130            PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
     2131            if (dcd)
     2132              PostMsg(dcd->hwndObject, UM_SETUP2, MPFROMP(pci), MPFROMLONG(rc));
    20962133            return 0;
    20972134          }
     
    21812218        }
    21822219        else {
    2183           if (!IsRoot(pci->pszFileName)) {
    2184             NotifyError(pci->pszFileName, rc);
     2220          if (!IsRoot(pci->pszFileName)) {
     2221            NotifyError(pci->pszFileName, rc);
    21852222            RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE);
    21862223          }
     
    28822919            if (pci->attrFile & FILE_DIRECTORY) {
    28832920              if (pci->flags & RECFLAGS_UNDERENV)
    2884                 break;
    2885 
    2886               AddFleshWorkRequest(hwnd, pci, eUnFlesh);
     2921                break;
     2922
     2923              AddFleshWorkRequest(hwnd, pci, eUnFlesh);
    28872924
    28882925              // Check if drive type might need update
    28892926              if ((driveflag & (DRIVE_INVALID | DRIVE_NOPRESCAN)) ||
    2890                   (~driveflag & DRIVE_NOPRESCAN && pci->rc.hptrIcon == hptrDunno)) {
     2927                  (~driveflag & DRIVE_NOPRESCAN && pci->rc.hptrIcon == hptrDunno) || x < 2) {
    28912928                DriveFlagsOne(x, FileSystem, &volser);
    28922929                driveflag = driveflags[x];
     
    29112948                  PostMsg(hwndMain, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
    29122949              }
    2913               //DbgMsg(pszSrcFile, __LINE__, " TreeCnrWndProc IDM_UPDATE %s", pci->pszFileName); // 2015-08-03 SHL FIXME debug
    2914               if (~driveflag & DRIVE_INVALID)
     2950              DbgMsg(pszSrcFile, __LINE__, " TreeCnrWndProc IDM_UPDATE %s", pci->pszFileName); // 2015-08-03 SHL FIXME debug
     2951              if (~driveflag & DRIVE_INVALID || x < 2)
    29152952                AddFleshWorkRequest(hwnd, pci, eFlesh);
    29162953            }
Note: See TracChangeset for help on using the changeset viewer.