Changeset 1444 for trunk/dll/filldir.c
- Timestamp:
- Jul 23, 2009, 1:24:23 AM (16 years ago)
- File:
-
- 1 edited
-
trunk/dll/filldir.c (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/filldir.c
r1440 r1444 75 75 for tree container 76 76 13 Jul 09 SHL Avoid trap in FillInRecordFromFSA if pszFSType NULL 77 22 Jul 09 GKY Code changes to use semaphores to serialize drive scanning 78 22 Jul 09 GKY Consolidated driveflag setting code in DriveFlagsOne 79 22 Jul 09 GKY Streamline scanning code for faster Tree rescans 77 80 78 81 ***********************************************************************/ … … 132 135 PCSZ FM3Tools = "<FM3_Tools>"; 133 136 PCSZ WPProgram = "WPProgram"; 134 volatile INT StubbyScanCount;135 volatile INT ProcessDirCount;136 137 137 138 typedef struct { … … 220 221 hmq = WinCreateMsgQueue(thab, 0); 221 222 if (hmq) { 222 StubbyScanCount++;223 223 IncrThreadUsage(); 224 224 priority_normal(); 225 225 ret = Stubby(StubbyScan->hwndCnr, StubbyScan->pci); 226 //DbgMsg(pszSrcFile, __LINE__, "Stubby %i ", ret);227 226 if (ret == 1) { 228 227 if (WinIsWindow((HAB)0, StubbyScan->hwndCnr)) { 229 WinSendMsg(StubbyScan->hwndCnr, 230 CM_INVALIDATERECORD, 231 MPFROMP(&StubbyScan->pci), 232 MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION)); 233 if ((fRScanLocal && 234 (!(driveflags[toupper(*StubbyScan->pci->pszFileName) - 'A'] & 235 ((DRIVE_REMOTE | DRIVE_VIRTUAL)))) || 236 (fRScanRemote && 237 (driveflags[toupper(*StubbyScan->pci->pszFileName) - 'A'] & 238 DRIVE_REMOTE)) || 239 (fRScanVirtual && 240 (driveflags[toupper(*StubbyScan->pci->pszFileName) - 'A'] & 241 DRIVE_VIRTUAL))) && fInitialDriveScan) { 242 if (!(driveflags[toupper(*StubbyScan->pci->pszFileName) - 'A'] & 243 ((fRScanNoWrite ? 0 : DRIVE_NOTWRITEABLE) | 244 (fRScanSlow ? 0 : DRIVE_SLOW)))) { 245 WinSendMsg(StubbyScan->hwndCnr, CM_EXPANDTREE, MPFROMP(StubbyScan->pci), MPVOID); 246 //DbgMsg(pszSrcFile, __LINE__, "expanded %x %p", StubbyScan->hwndCnr, StubbyScan->pci); 247 WinSendMsg(StubbyScan->hwndCnr, CM_COLLAPSETREE, MPFROMP(StubbyScan->pci), MPVOID); 228 ULONG flags = driveflags[toupper(*StubbyScan->pci->pszFileName) - 'A']; 229 230 if (((fRScanLocal && ~flags & DRIVE_REMOTE && ~flags & DRIVE_VIRTUAL) || 231 (fRScanRemote && flags & DRIVE_REMOTE) || 232 (fRScanVirtual && flags & DRIVE_VIRTUAL)) && fInitialDriveScan) { 233 if (!(flags & ((fRScanNoWrite ? 0 : DRIVE_NOTWRITEABLE) | 234 (fRScanSlow ? 0 : DRIVE_SLOW)))) { 235 UnFlesh(StubbyScan->hwndCnr, StubbyScan->pci); 236 Flesh(StubbyScan->hwndCnr, StubbyScan->pci); 248 237 } 249 238 } 250 239 } 251 240 } 252 if (WinIsWindow((HAB)0, StubbyScan->hwndDrivesList)) {253 WinSendMsg(StubbyScan->hwndDrivesList,254 LM_INSERTITEM,255 MPFROM2SHORT(LIT_SORTASCENDING, 0),256 MPFROMP(StubbyScan->pci->pszFileName));257 }258 StubbyScanCount--;259 241 WinDestroyMsgQueue(hmq); 260 242 } … … 268 250 # endif 269 251 270 // _endthread(); // 10 Dec 08 SHL271 252 } 272 253 … … 276 257 HAB thab; 277 258 HMQ hmq = (HMQ) 0; 278 //BOOL ret;279 259 280 260 DosError(FERR_DISABLEHARDERR); … … 290 270 hmq = WinCreateMsgQueue(thab, 0); 291 271 if (hmq) { 292 ProcessDirCount ++;293 272 IncrThreadUsage(); 294 273 priority_normal(); … … 303 282 ProcessDir->pulTotalFiles, // Optional 304 283 ProcessDir->pullTotalBytes); // Optional 305 ProcessDirCount --;306 284 WinDestroyMsgQueue(hmq); 307 285 } … … 315 293 # endif 316 294 317 // _endthread(); // 10 Dec 08 SHL318 295 } 319 296 … … 433 410 ULONG flags = driveflags[toupper(*pci->pszFileName) - 'A']; 434 411 BOOL fLoadSubjectForDrive = fLoadSubject && ~flags & DRIVE_NOLOADSUBJS; 435 BOOL fLoadLongNameForDrive = fLoadLongnames && ~flags & DRIVE_NOLONGNAMES &&412 BOOL fLoadLongNameForDrive = fLoadLongnames && //~flags & DRIVE_NOLONGNAMES && 436 413 ~flags & DRIVE_NOLOADLONGS; 437 414 if (fLoadSubjectForDrive || fLoadLongNameForDrive) { … … 580 557 581 558 // load Subject and/or Longname EAs, if required and have EAs 582 if (pffb->cbList > 4L && dcd) 559 if (pffb->cbList > 4L && dcd && 560 !(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_NOEASUPPORT)) 583 561 FetchCommonEAs(pci); 584 562 … … 741 719 // 13 Jul 09 SHL fixme to know if fetch can be bypassed if pszFSType already filled 742 720 // If FSType not supplied, assume don't need EAs either 743 if (pfsa4->cbList > 4L && dcd && pszFSType) 721 if (pfsa4->cbList > 4L && dcd && 722 !(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_NOEASUPPORT)) 744 723 FetchCommonEAs(pci); 745 724 … … 827 806 # endif 828 807 } 829 else 808 else { 830 809 pci->pszFmtFileSize = NullStr; 810 //DbgMsg(pszSrcFile, __LINE__, "Bypassed Format size %s", pci->pszDisplayName); 811 } 831 812 pci->date.day = pfsa4->fdateLastWrite.day; 832 813 pci->date.month = pfsa4->fdateLastWrite.month; … … 1182 1163 while (pci && (INT)pci != -1) { 1183 1164 if ((pci->attrFile & FILE_DIRECTORY)) 1184 if (!fInitialDriveScan) 1185 Stubby(hwndCnr, pci); 1186 else { 1187 while (StubbyScanCount != 0) 1188 DosSleep(50); 1189 Stubby(hwndCnr, pci); 1190 } 1165 Stubby(hwndCnr, pci); 1191 1166 pci = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci), 1192 1167 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); … … 1236 1211 ULONG ulDriveType; 1237 1212 PCNRITEM pci, pciFirst = NULL, pciNext, pciParent = NULL; 1238 INT x ,removable;1213 INT x;// removable; 1239 1214 CHAR suggest[32]; 1240 1215 CHAR szDrive[] = " :\\"; … … 1303 1278 ULONG flags = 0; 1304 1279 ULONG size = sizeof(ULONG); 1305 BOOL FSInfo = FALSE;1306 1280 struct { 1307 1281 ULONG serial; … … 1321 1295 if (!(driveflags[x] & DRIVE_NOPRESCAN)) { 1322 1296 *szFSType = 0; 1323 ulDriveType = 0; 1324 removable = CheckDrive(*szDrive, szFSType, &ulDriveType); 1325 driveserial[x] = -1; 1326 if (removable != -1) { 1327 DosError(FERR_DISABLEHARDERR); 1328 if (!DosQueryFSInfo((ULONG) x + 1, 1329 FSIL_VOLSER, &volser, sizeof(volser))) { 1330 driveserial[x] = volser.serial; 1331 FSInfo = TRUE; 1332 } 1333 1334 } 1335 else 1336 driveflags[x] |= DRIVE_INVALID; 1337 1297 ulDriveType = 0; 1298 memset(&volser, 0, sizeof(volser)); 1299 DriveFlagsOne(x, szFSType, &volser); 1300 driveserial[x] = volser.serial; 1338 1301 memset(&fsa4, 0, sizeof(FILESTATUS4L)); 1339 driveflags[x] |= removable == -1 || removable == 1 ? DRIVE_REMOVABLE : 0;1340 if (ulDriveType & DRIVE_REMOTE)1341 driveflags[x] |= DRIVE_REMOTE;1342 if (!stricmp(szFSType,RAMFS)) {1343 driveflags[x] |= DRIVE_RAMDISK;1344 driveflags[x] &= ~DRIVE_REMOTE;1345 }1346 if (!stricmp(szFSType,NDFS32)) {1347 driveflags[x] |= DRIVE_VIRTUAL;1348 driveflags[x] &= ~DRIVE_REMOTE;1349 }1350 if (!stricmp(szFSType,NTFS))1351 driveflags[x] |= DRIVE_NOTWRITEABLE;1352 if (strcmp(szFSType, HPFS) &&1353 strcmp(szFSType, JFS) &&1354 strcmp(szFSType, ISOFS) &&1355 strcmp(szFSType, CDFS) &&1356 strcmp(szFSType, FAT32) &&1357 strcmp(szFSType, NDFS32) &&1358 strcmp(szFSType, RAMFS) &&1359 strcmp(szFSType, NTFS) &&1360 strcmp(szFSType, HPFS386)) {1361 driveflags[x] |= DRIVE_NOLONGNAMES;1362 }1363 1364 if (!strcmp(szFSType, CDFS) || !strcmp(szFSType,ISOFS)) {1365 removable = 1;1366 driveflags[x] |= DRIVE_REMOVABLE | DRIVE_NOTWRITEABLE | DRIVE_CDROM;1367 }1368 if (!stricmp(szFSType, CBSIFS)) {1369 driveflags[x] |= DRIVE_ZIPSTREAM;1370 driveflags[x] &= ~DRIVE_REMOTE;1371 if (ulDriveType & DRIVE_REMOVABLE)1372 driveflags[x] |= DRIVE_REMOVABLE;1373 if (!(ulDriveType & DRIVE_NOLONGNAMES))1374 driveflags[x] &= ~DRIVE_NOLONGNAMES;1375 }1376 1302 if (!fVerifyOffChecked[x]) { 1377 1303 if (driveflags[x] & DRIVE_REMOVABLE) … … 1385 1311 } 1386 1312 } 1387 if (str cmp(volser.volumelabel, NullStr) != 0 && FSInfo&& fShowDriveLabelInTree)1313 if (stricmp(volser.volumelabel, NullStr) != 0 && fShowDriveLabelInTree) 1388 1314 strcpy(szFSType, volser.volumelabel); 1389 1315 pci->rc.flRecordAttr |= CRA_RECORDREADONLY; … … 1391 1317 pci->rc.flRecordAttr |= (CRA_CURSORED | CRA_SELECTED); 1392 1318 1393 if ( removable == 0) {1319 if (!(driveflags[x] & DRIVE_REMOVABLE)) { 1394 1320 // Fixed volume 1395 1321 pci->attrFile |= FILE_DIRECTORY; … … 1622 1548 MPVOID, 1623 1549 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 1624 StubbyScanCount ++;1625 1550 while (pci && (INT)pci != -1) { 1626 1551 stubbyScan = xmallocz(sizeof(STUBBYSCAN), pszSrcFile, __LINE__); … … 1630 1555 stubbyScan->hwndCnr = hwndCnr; 1631 1556 stubbyScan->hwndDrivesList = hwndDrivesList; 1632 //stubbyScan->RamDrive = FALSE;1633 1557 pciNext = (PCNRITEM) WinSendMsg(hwndCnr, 1634 1558 CM_QUERYRECORD, … … 1650 1574 { 1651 1575 xfree(stubbyScan, pszSrcFile, __LINE__); 1652 }1576 } 1653 1577 } // if drive for scanning 1654 1578 else … … 1671 1595 pci = pciNext; 1672 1596 } // while 1673 StubbyScanCount--;1674 1597 } 1675 1598 if (hwndParent) … … 1766 1689 } 1767 1690 didonce = TRUE; 1768 if (fInitialDriveScan) {1769 HWND hwndDrivesList = WinWindowFromID(WinQueryWindow(hwndParent, QW_PARENT),1770 MAIN_DRIVELIST);1771 while (StubbyScanCount != 0 || ProcessDirCount != 0)1772 DosSleep(50);1773 WinShowWindow(hwndCnr, TRUE);1774 WinShowWindow(hwndDrivesList, TRUE);1775 fInitialDriveScan = FALSE;1776 }1777 1691 } // FillTreeCnr 1778 1692
Note:
See TracChangeset
for help on using the changeset viewer.
