Changeset 1424 for trunk/dll/filldir.c


Ignore:
Timestamp:
Jun 6, 2009, 9:16:12 PM (16 years ago)
Author:
Gregg Young
Message:

Show either file system type or drive label beside dirve letter in tree. (tickets 47 & 339)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/filldir.c

    r1402 r1424  
    108108#include "common.h"                     // IncrThreadUsage
    109109#include "excputil.h"                   // xbeginthread
     110#include "fm3dlg.h"                     // INFO_LABEL
    110111
    111112VOID StubbyScanThread(VOID * arg);
     
    719720                              const PSZ pszFileName,
    720721                              const PFILESTATUS4L pfsa4,
    721                               const BOOL partial,
     722                              const BOOL partial,
     723                              CHAR *szFSType,
    722724                              DIRCNRDATA *dcd)  // Optional
    723725{
     
    725727  CHAR *p;
    726728  ULONG flags;
     729  CHAR szBuf[80];
    727730
    728731  // fill in a container record from a FILESTATUS4L structure
     
    730733  pci->hwndCnr = hwndCnr;
    731734  pci->pszFileName = xstrdup(pszFileName, pszSrcFile, __LINE__);
    732   //strcpy(pci->pszFileName, pszFileName);
    733735  flags = driveflags[toupper(*pci->pszFileName) - 'A'];
    734   // load the object's Subject, if required
    735   //pci->pszSubject = NullStr;
    736   if (pfsa4->cbList > 4 &&
     736  if ((pfsa4->cbList > 4) &&
    737737      dcd &&
    738738      fLoadSubject &&
     
    876876  else
    877877    p = pci->pszFileName;
    878   pci->pszDisplayName = p;
     878  if (szFSType && (fShowSysType || fShowLabel)) {
     879    strcpy(szBuf, p);
     880    strcat(szBuf, " [");
     881    strcat(szBuf, szFSType);
     882    strcat(szBuf, "]");
     883    pci->pszDisplayName = xstrdup(szBuf, pszSrcFile, __LINE__);
     884  }
     885  else
     886    pci->pszDisplayName = p;
    879887
    880888  //comma format the file size for large file support
     
    12441252    while (pci && (INT)pci != -1) {
    12451253      if ((pci->attrFile & FILE_DIRECTORY))
    1246         //if (fInitialDriveScan)
     1254        if (!fInitialDriveScan)
    12471255          Stubby(hwndCnr, pci);
    1248         /*else {
     1256        else {
    12491257          while (StubbyScanCount != 0)
    12501258            DosSleep(50);
    12511259          Stubby(hwndCnr, pci);
    1252         } */
     1260        }
    12531261        //Stubby(hwndCnr, pci);
    12541262      pci = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
     
    13021310  CHAR suggest[32];
    13031311  CHAR szDrive[] = " :\\";
    1304   CHAR szFSType[CCHMAXPATH];
     1312  CHAR szFSType[CCHMAXPATH]; 
    13051313  FILESTATUS4L fsa4;
    13061314  APIRET rc;
     
    13661374      ULONG flags = 0;
    13671375      ULONG size = sizeof(ULONG);
     1376      BOOL FSInfo = FALSE;
     1377      struct {
     1378              ULONG serial;
     1379              CHAR volumelength;
     1380              CHAR volumelabel[CCHMAXPATH];
     1381             } volser;
    13681382
    13691383      *szDrive = (CHAR)x + 'A';         // Build path spec
     
    13811395          removable = CheckDrive(*szDrive, szFSType, &ulDriveType);
    13821396          driveserial[x] = -1;
    1383           if (removable != -1) {
    1384             struct {
    1385               ULONG serial;
    1386               CHAR volumelength;
    1387               CHAR volumelabel[CCHMAXPATH];
    1388             } volser;
    1389 
    1390             DosError(FERR_DISABLEHARDERR);
    1391             if (!DosQueryFSInfo((ULONG) x,
    1392                                 FSIL_VOLSER, &volser, sizeof(volser))) {
    1393               driveserial[x] = volser.serial;
    1394             }
     1397          if (removable != -1) {
     1398            DosError(FERR_DISABLEHARDERR);
     1399            if (!DosQueryFSInfo((ULONG) x + 1,
     1400                                FSIL_VOLSER, &volser, sizeof(volser))) {
     1401              driveserial[x] = volser.serial;
     1402              FSInfo = TRUE;
     1403            }
     1404
    13951405          }
    13961406          else
     
    13981408
    13991409          memset(&fsa4, 0, sizeof(FILESTATUS4L));
    1400           driveflags[x] |= removable == -1 || removable == 1 ?
    1401                             DRIVE_REMOVABLE : 0;
     1410          driveflags[x] |= removable == -1 || removable == 1 ? DRIVE_REMOVABLE : 0;
    14021411          if (ulDriveType & DRIVE_REMOTE)
    14031412            driveflags[x] |= DRIVE_REMOTE;
     
    14471456            }
    14481457          }
     1458          if (strcmp(volser.volumelabel, "") != 0 && FSInfo && fShowLabel)
     1459            strcpy(szFSType, volser.volumelabel);
    14491460          pci->rc.flRecordAttr |= CRA_RECORDREADONLY;
    14501461          if ((ULONG)(toupper(*szDrive) - '@') == ulCurDriveNum)
     
    14711482                *suggest = '/';
    14721483                suggest[1] = 0;
    1473               }
    1474               sprintf(suggest + strlen(suggest), "%c" , toupper(*szDrive));
    1475               pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__);
    1476               pci->pszDisplayName = pci->pszFileName;
     1484              }
     1485
     1486              sprintf(suggest + strlen(suggest), "%c" , toupper(*szDrive));
     1487              pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__);
     1488              if (fShowSysType || fShowLabel) {
     1489                strcat(szDrive, " [");
     1490                strcat(szDrive, szFSType);
     1491                strcat(szDrive, "]");
     1492              }
     1493              pci->pszDisplayName = xstrdup(szDrive, pszSrcFile, __LINE__);
     1494              szDrive[3] = 0;
    14771495              pci->rc.pszIcon = pci->pszDisplayName;
    14781496              pci->attrFile = FILE_DIRECTORY;
     
    14801498              driveserial[x] = -1;
    14811499            }
    1482             else
    1483               FillInRecordFromFSA(hwndCnr, pci, szDrive, &fsa4, TRUE, NULL);
     1500            else
     1501              FillInRecordFromFSA(hwndCnr, pci, szDrive, &fsa4, TRUE, szFSType, NULL);
    14841502          }
    14851503          else {
    1486             // Removable volume
    1487             pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__);
    1488             pci->pszDisplayName = pci->pszFileName;
     1504            // Removable volume
     1505            pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__);
     1506            if (fShowSysType || fShowLabel) {
     1507              strcat(szDrive, " [");
     1508              strcat(szDrive, szFSType);
     1509              strcat(szDrive, "]");
     1510            }
     1511            pci->pszDisplayName = xstrdup(szDrive, pszSrcFile, __LINE__);
     1512            szDrive[3] = 0;
    14891513            pci->rc.pszIcon = pci->pszDisplayName;
    14901514            pci->attrFile = FILE_DIRECTORY;
     
    14981522        }
    14991523        else {
    1500           pci->rc.hptrIcon = hptrDunno;
    1501           pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__);
     1524          pci->rc.hptrIcon = hptrDunno;
     1525          pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__);
     1526          if (fShowSysType || fShowLabel) {
     1527            strcat(szDrive, " [");
     1528            strcat(szDrive, szFSType);
     1529            strcat(szDrive, "]");
     1530          }
     1531          pci->pszDisplayName = xstrdup(szDrive, pszSrcFile, __LINE__);
     1532          szDrive[3] = 0;
    15021533#         ifdef FORTIFY
    15031534          // Will be freed by TreeCnrWndProc WM_DESTROY
    15041535          Fortify_SetScope(pci->pszFileName, 2);
    15051536#         endif
    1506           pci->pszDisplayName = pci->pszFileName;
    1507           pci->rc.pszIcon = pci->pszFileName;
     1537          pci->rc.pszIcon = pci->pszDisplayName;
    15081538          pci->attrFile = FILE_DIRECTORY;
    15091539          pci->pszDispAttr = FileAttrToString(pci->attrFile);
     
    15131543      else {
    15141544        // diskette drive (A or B)
    1515         pci->rc.hptrIcon = hptrFloppy;
    1516         pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__);
    1517         pci->pszDisplayName = pci->pszFileName;
     1545        pci->rc.hptrIcon = hptrFloppy;
     1546        pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__);
     1547        if (fShowSysType || fShowLabel)
     1548          strcat(szDrive, "  [Floppy]");
     1549        pci->pszDisplayName = xstrdup(szDrive, pszSrcFile, __LINE__);
     1550        szDrive[3] = 0;
    15181551        pci->rc.pszIcon = pci->pszDisplayName;
    15191552        pci->attrFile = FILE_DIRECTORY;
Note: See TracChangeset for help on using the changeset viewer.