Changeset 1550 for trunk/dll/filldir.c


Ignore:
Timestamp:
Nov 3, 2010, 3:50:42 AM (15 years ago)
Author:
Gregg Young
Message:

This actually fixes the double names in the tree container. It also streamlines the initial scan code by eliminating multiple redundant scans.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/filldir.c

    r1549 r1550  
    135135static PSZ pszSrcFile = __FILE__;
    136136static BOOL fFirstTime;
     137INT FixedVolume = 0;
    137138
    138139#pragma data_seg(GLOBAL1)
     
    215216  HAB thab;
    216217  HMQ hmq = (HMQ) 0;
    217   BOOL ok;
     218  //BOOL ok;
     219  static INT ProcessDirCount = 0;
    218220
    219221  DosError(FERR_DISABLEHARDERR);
     
    231233        IncrThreadUsage();
    232234        priority_normal();
    233         ok = Stubby(StubbyScan->hwndCnr, StubbyScan->pci);
    234         if (ok) {
    235           if (WinIsWindow((HAB)0, StubbyScan->hwndCnr)) {
    236             ULONG flags = driveflags[toupper(*StubbyScan->pci->pszFileName) - 'A'];
    237 
    238             if ((fRScanLocal && ~flags & DRIVE_REMOTE && ~flags & DRIVE_VIRTUAL) ||
    239                  (fRScanRemote && flags & DRIVE_REMOTE) ||
    240                  (fRScanVirtual && flags & DRIVE_VIRTUAL)) {
    241               if (!(flags & ((fRScanNoWrite ? 0 : DRIVE_NOTWRITEABLE) ||
    242                              (fRScanSlow ? 0 : DRIVE_SLOW)))) {
    243                 UnFlesh(StubbyScan->hwndCnr, StubbyScan->pci);
    244                 Flesh(StubbyScan->hwndCnr, StubbyScan->pci);
    245               }
    246             }
    247           }
    248         }
     235        if (WinIsWindow((HAB)0, StubbyScan->hwndCnr)) {
     236          ULONG flags = driveflags[toupper(*StubbyScan->pci->pszFileName) - 'A'];
     237
     238          if ((fRScanLocal && ~flags & DRIVE_REMOTE && ~flags & DRIVE_VIRTUAL) ||
     239               (fRScanRemote && flags & DRIVE_REMOTE) ||
     240               (fRScanVirtual && flags & DRIVE_VIRTUAL)) {
     241            if (!(flags & ((fRScanNoWrite ? 0 : DRIVE_NOTWRITEABLE) ||
     242                           (fRScanSlow ? 0 : DRIVE_SLOW)))) {
     243              UnFlesh(StubbyScan->hwndCnr, StubbyScan->pci);
     244              Flesh(StubbyScan->hwndCnr, StubbyScan->pci);
     245            }
     246          }
     247          else {
     248            Stubby(StubbyScan->hwndCnr, StubbyScan->pci);
     249            //if (!ok)
     250             // FixedVolume--;
     251          }       
     252        }
    249253        WinDestroyMsgQueue(hmq);
    250254      }
     
    254258    free(StubbyScan);
    255259  } // if StubbyScan
     260  ProcessDirCount++;
     261  DbgMsg(pszSrcFile, __LINE__, "ProcessDirCount %i FixedVolume %i",
     262         ProcessDirCount, FixedVolume);
     263  if (fInitialDriveScan && ProcessDirCount >= FixedVolume) {
     264    fInitialDriveScan = FALSE;
     265    DosPostEventSem(hevInitialCnrScanComplete);
     266    DosCloseEventSem(hevInitialCnrScanComplete);
     267    if (fSwitchTree && hwndTree && fSaveState && pszFocusDir) {
     268       // Keep drive tree in sync with directory container
     269      if (hwndMain) {
     270        //if (TopWindow(hwndMain, (HWND) 0) == dcd->hwndFrame)
     271          if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszFocusDir), MPVOID))
     272            free(pszFocusDir);
     273      }
     274      else {
     275        if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszFocusDir), MPVOID))
     276          free(pszFocusDir);
     277      }
     278    }
     279  }
    256280# ifdef FORTIFY
    257281  Fortify_LeaveScope();
     
    260284}
    261285
     286#if 0
    262287VOID ProcessDirectoryThread(VOID * arg)
    263288{
     
    265290  HAB thab;
    266291  HMQ hmq = (HMQ) 0;
     292 
    267293
    268294  DosError(FERR_DISABLEHARDERR);
     
    273299
    274300  ProcessDir = (PROCESSDIR *)arg;
    275   if (ProcessDir && ProcessDir->pciParent && ProcessDir->pciParent->pszFileName && ProcessDir->hwndCnr) {
     301  if (ProcessDir && ProcessDir->pciParent && ProcessDir->pciParent->pszFileName &&
     302      ProcessDir->hwndCnr) {
    276303    thab = WinInitialize(0);
    277304    if (thab) {
     
    297324    free(ProcessDir);
    298325  } // if ProcessDir
    299   if (fInitialDriveScan) {
    300     fInitialDriveScan = FALSE;
    301     DosPostEventSem(hevInitialCnrScanComplete);
    302     DosCloseEventSem(hevInitialCnrScanComplete);
    303   }
    304326# ifdef FORTIFY
    305327  Fortify_LeaveScope();
     
    307329
    308330}
     331# endif
    309332
    310333static HPOINTER IDFile(PSZ p)
     
    13691392
    13701393          if (~driveflags[iDrvNum] & DRIVE_REMOVABLE) {
    1371             // Fixed volume
     1394            // Fixed volume
     1395            if (~flags & DRIVE_INVALID && ~flags & DRIVE_NOPRESCAN)
     1396              FixedVolume++;
    13721397            pci->attrFile |= FILE_DIRECTORY;
    13731398            DosError(FERR_DISABLEHARDERR);
Note: See TracChangeset for help on using the changeset viewer.