Changeset 167 for trunk


Ignore:
Timestamp:
May 26, 2005, 4:43:34 AM (20 years ago)
Author:
root
Message:

Rework for ULONGLONG
Rework FillInRecordFromFFB
Rework FillTreeCnr

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/filldir.c

    r145 r167  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2005 Steven H.Levine
     9  Copyright (c) 2001, 2005 Steven H. Levine
    1010
    1111  12 Sep 02 SHL Rework symbols to understand code
     
    1414  10 Jan 04 SHL ProcessDirectory: avoid most large drive failures
    1515  24 May 05 SHL Rework Win_Error usage
     16  24 May 05 SHL Rework for CNRITEM.szSubject
     17  25 May 05 SHL Rework for ULONGLONG
     18  25 May 05 SHL Rework FillInRecordFromFFB
     19  25 May 05 SHL Rework FillTreeCnr
    1620
    1721***********************************************************************/
     
    1923#define INCL_DOS
    2024#define INCL_WIN
    21 
     25#define INCL_LONGLONG
    2226#include <os2.h>
     27
    2328#include <stdarg.h>
    2429#include <stdio.h>
     
    2732#include <ctype.h>
    2833#include <time.h>
     34
    2935#include "fm3dll.h"
    3036#include "fm3str.h"
     
    3440
    3541
    36 HPOINTER IDFile (ULONG cmp)
     42static HPOINTER IDFile(ULONG cmp)
    3743{
    3844  HPOINTER hptr;
    3945
    4046  hptr = (HPOINTER)0;
    41   if(cmp == *(ULONG *)".EXE" || cmp == *(ULONG *)".CMD" ||
    42      cmp == *(ULONG *)".BAT" || cmp == *(ULONG *)".COM")
     47  if (cmp == *(ULONG *)".EXE" || cmp == *(ULONG *)".CMD" ||
     48      cmp == *(ULONG *)".BAT" || cmp == *(ULONG *)".COM")
    4349    hptr = hptrApp;
    44   else if(cmp == *(ULONG *)".ZIP" || cmp == *(ULONG *)".LZH" ||
    45           cmp == *(ULONG *)".ARJ" || cmp == *(ULONG *)".ARC" ||
    46           cmp == *(ULONG *)".ZOO" || cmp == *(ULONG *)".RAR")
     50  else if (cmp == *(ULONG *)".ZIP" || cmp == *(ULONG *)".LZH" ||
     51           cmp == *(ULONG *)".ARJ" || cmp == *(ULONG *)".ARC" ||
     52           cmp == *(ULONG *)".ZOO" || cmp == *(ULONG *)".RAR")
    4753    hptr = hptrArc;
    48   else if(cmp == *(ULONG *)".BMP" || cmp == *(ULONG *)".ICO" ||
    49           cmp == *(ULONG *)".PTR" || cmp == *(ULONG *)".GIF" ||
    50           cmp == *(ULONG *)".TIF" || cmp == *(ULONG *)".PCX" ||
    51           cmp == *(ULONG *)".TGA" || cmp == *(ULONG *)".XBM")
     54  else if (cmp == *(ULONG *)".BMP" || cmp == *(ULONG *)".ICO" ||
     55           cmp == *(ULONG *)".PTR" || cmp == *(ULONG *)".GIF" ||
     56           cmp == *(ULONG *)".TIF" || cmp == *(ULONG *)".PCX" ||
     57           cmp == *(ULONG *)".TGA" || cmp == *(ULONG *)".XBM")
    5258    hptr = hptrArt;
    5359  return hptr;
     
    5561
    5662
    57 ULONG FillInRecordFromFFB (HWND hwndCnr,PCNRITEM pci, const PSZ pszDirectory,
    58                            const PFILEFINDBUF4 pffb,const BOOL partial,
    59                            DIRCNRDATA *dcd)
     63ULONGLONG FillInRecordFromFFB(HWND hwndCnr,PCNRITEM pci, const PSZ pszDirectory,
     64                              const PFILEFINDBUF4 pffb,const BOOL partial,
     65                              DIRCNRDATA *dcd)
    6066{
    61 
    6267  /* fill in a container record from a FILEFINDBUF4 structure */
    6368
    64   CHAR           attrstring[] = "RHS\0DA",cmps[] = ".xxx";
    65   register CHAR *p;
    66   HPOINTER       hptr;
    67   register INT   x,y;
    68   INT            t;
    69   ULONG          cmp;
     69  CHAR          attrstring[] = "RHS\0DA";
     70  CHAR          cmps[] = ".xxx";
     71  CHAR         *p;
     72  HPOINTER      hptr;
     73  UINT          x;
     74  UINT          y;
     75  UINT          t;
     76  ULONG         cmp;
     77  BOOL          rc;
    7078
    7179  pci->hwndCnr = hwndCnr;
     
    7482  /* note!  we cheat below, and accept the full pathname in pszDirectory
    7583     if !*pffb->achName.  speeds up and simplifies processing elsewhere
    76      (like in update.c) */
    77   if(*pffb->achName) {
     84     (like in update.c)
     85  */
     86  if (*pffb->achName)
     87  {
    7888    p = pci->szFileName + (t - 1);
    79     if(*p != '\\') {
     89    if (*p != '\\') {
    8090      p++;
    8191      *p = '\\';
     
    8595  }
    8696  /* load the object's Subject, if required */
    87   if(pffb->cbList > 4L &&
    88      dcd && fLoadSubject &&
    89      (isalpha(*pci->szFileName) &&
    90       !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADSUBJS))) {
    91 
     97  if (pffb->cbList > 4L &&
     98      dcd && fLoadSubject &&
     99      (isalpha(*pci->szFileName) &&
     100       !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADSUBJS)))
     101  {
    92102    APIRET    rc;
    93103    EAOP2     eaop;
     
    99109
    100110    pgealist = malloc(sizeof(GEA2LIST) + 32);
    101     if(pgealist) {
     111    if (pgealist)
     112    {
    102113      memset(pgealist,0,sizeof(GEA2LIST) + 32);
    103114      pgea = &pgealist->list[0];
     
    107118      pgealist->cbList = (sizeof(GEA2LIST) + pgea->cbName);
    108119      pfealist = malloc(1532);
    109       if(pfealist) {
     120      if (pfealist)
     121      {
    110122        memset(pfealist,0,1532);
    111123        pfealist->cbList = 1024;
     
    115127        rc = DosQueryPathInfo(pci->szFileName,FIL_QUERYEASFROMLIST,
    116128                              (PVOID)&eaop,(ULONG)sizeof(EAOP2));
    117         if(!rc) {
     129        if (!rc) {
    118130          pfea = &eaop.fpFEA2List->list[0];
    119131          value = pfea->szName + pfea->cbName + 1;
    120132          value[pfea->cbValue] = 0;
    121           if(*(USHORT *)value == EAT_ASCII)
    122             strncpy(pci->subject,value + (sizeof(USHORT) * 2),39);
    123           pci->subject[39] = 0;
     133          if (*(USHORT *)value == EAT_ASCII)
     134            strncpy(pci->szSubject,value + (sizeof(USHORT) * 2),39);
     135          pci->szSubject[39] = 0;
    124136        }
    125137        free(pfealist);
     
    128140    }
    129141  }
    130   pci->pszSubject = pci->subject;
     142  pci->pszSubject = pci->szSubject;
    131143  /* load the object's longname */
    132   *pci->Longname = 0;
    133   if(pffb->cbList > 4L &&
    134      dcd && fLoadLongnames &&
    135      (isalpha(*pci->szFileName) &&
    136       (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLONGNAMES) &&
    137       !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADLONGS))) {
    138 
     144  *pci->szLongname = 0;
     145  if (pffb->cbList > 4L &&
     146      dcd && fLoadLongnames &&
     147      (isalpha(*pci->szFileName) &&
     148       (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLONGNAMES) &&
     149       !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADLONGS)))
     150  {
    139151    APIRET    rc;
    140152    EAOP2     eaop;
     
    146158
    147159    pgealist = malloc(sizeof(GEA2LIST) + 32);
    148     if(pgealist) {
     160    if (pgealist)
     161    {
    149162      memset(pgealist,0,sizeof(GEA2LIST) + 32);
    150163      pgea = &pgealist->list[0];
     
    154167      pgealist->cbList = (sizeof(GEA2LIST) + pgea->cbName);
    155168      pfealist = malloc(1532);
    156       if(pfealist) {
     169      if (pfealist) {
    157170        memset(pfealist,0,1532);
    158171        pfealist->cbList = 1024;
     
    162175        rc = DosQueryPathInfo(pci->szFileName,FIL_QUERYEASFROMLIST,
    163176                              (PVOID)&eaop,(ULONG)sizeof(EAOP2));
    164         if(!rc) {
     177        if (!rc)
     178        {
    165179          pfea = &eaop.fpFEA2List->list[0];
    166180          value = pfea->szName + pfea->cbName + 1;
    167181          value[pfea->cbValue] = 0;
    168           if(*(USHORT *)value == EAT_ASCII)
    169             strncpy(pci->Longname,value + (sizeof(USHORT) * 2),CCHMAXPATHCOMP);
    170           pci->Longname[CCHMAXPATHCOMP - 1] = 0;
     182          if (*(USHORT *)value == EAT_ASCII)
     183            strncpy(pci->szLongname,value + (sizeof(USHORT) * 2),CCHMAXPATHCOMP);
     184          pci->szLongname[CCHMAXPATHCOMP - 1] = 0;
    171185        }
    172186        free(pfealist);
     
    175189    }
    176190  }
    177   pci->pszLongname = pci->Longname;
     191  pci->pszLongname = pci->szLongname;
    178192
    179193  /* do anything required to case of filename */
    180   if(fForceUpper)
     194  if (fForceUpper)
    181195    strupr(pci->szFileName);
    182   else if(fForceLower)
     196  else if (fForceLower)
    183197    strlwr(pci->szFileName);
    184198
    185199  /* get an icon to use with it */
    186   if(pffb->attrFile & FILE_DIRECTORY) {
    187     if(!fNoIconsDirs && (!isalpha(*pci->szFileName) ||
    188        !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS)))
     200  if (pffb->attrFile & FILE_DIRECTORY)
     201  {
     202    if (!fNoIconsDirs && (!isalpha(*pci->szFileName) ||
     203        !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS)))
    189204      hptr = WinLoadFileIcon(pci->szFileName, FALSE);
    190205    else
    191206      hptr = (HPOINTER)0;
    192207  }
    193   else {
     208  else
     209  {
    194210    if (!fNoIconsFiles && (!isalpha(*pci->szFileName) ||
    195211       !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS)))
     212    {
    196213      hptr = WinLoadFileIcon(pci->szFileName, FALSE);
     214    }
    197215    else
    198216      hptr = (HPOINTER)0;
    199     if (!hptr || hptr == WinQuerySysPointer(HWND_DESKTOP,SPTR_FILE,FALSE)) {
     217
     218    if (!hptr || hptr == WinQuerySysPointer(HWND_DESKTOP,SPTR_FILE,FALSE))
     219    {
    200220      p = strrchr(pci->szFileName,'.');
    201       if(p && !p[4]) {
     221      if (p && !p[4])
     222      {
    202223        cmps[1] = toupper(p[1]);
    203224        cmps[2] = toupper(p[2]);
     
    210231    }
    211232  }
    212   if(!hptr)
     233  if (!hptr)
     234  {
    213235    hptr = ((pffb->attrFile & FILE_DIRECTORY) != 0) ? hptrDir :
    214236            ((pffb->attrFile & FILE_SYSTEM) != 0)   ? hptrSystem :
     
    216238            ((pffb->attrFile & FILE_READONLY) != 0) ? hptrReadonly :
    217239            hptrFile;
     240  }
    218241
    219242  /* decide where to point for the container's title text */
    220   if(partial) {
     243  if (partial)
     244  {
    221245    p = strrchr(pci->szFileName,'\\');
    222     if(!p) {
     246    if (!p)
     247    {
    223248      p = strrchr(pci->szFileName,':');
    224       if(!p)
     249      if (!p)
    225250        p = pci->szFileName;
    226251      else
    227252        p++;
    228253    }
    229     else if((dcd && dcd->type == TREE_FRAME) ||
    230             (!(pffb->attrFile & FILE_DIRECTORY) || !*(p + 1)))
     254    else if ((dcd && dcd->type == TREE_FRAME) ||
     255             (!(pffb->attrFile & FILE_DIRECTORY) || !*(p + 1)))
     256    {
    231257      p++;
    232     if(!*p)
     258    }
     259    if (!*p)
    233260      p = pci->szFileName;
    234261  }
     
    260287  /* build attribute string for display */
    261288  y = 0;
    262   for(x = 0;x < 6;x++)
    263     if(attrstring[x])
    264       pci->szDispAttr[y++] = (CHAR)((pci->attrFile & (1 << x)) ?
    265                              attrstring[x] : '-');
     289  for (x = 0; x < 6; x++)
     290  {
     291    if (attrstring[x])
     292    {
     293      pci->szDispAttr[y++] =
     294        (CHAR)((pci->attrFile & (1 << x)) ? attrstring[x] : '-');
     295    }
     296  }
    266297  pci->szDispAttr[5]  = 0;
    267298  pci->pszDispAttr    = pci->szDispAttr;
     
    270301
    271302  /* check to see if record should be visible */
    272   if(dcd && (*dcd->mask.szMask || dcd->mask.antiattr ||
    273      ((dcd->mask.attrFile &
    274       (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)) !=
    275       (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)))) {
    276     if(*dcd->mask.szMask || dcd->mask.antiattr) {
     303  if (dcd && (*dcd->mask.szMask || dcd->mask.antiattr ||
     304      ((dcd->mask.attrFile &
     305       (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)) !=
     306       (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED))))
     307  {
     308    if (*dcd->mask.szMask || dcd->mask.antiattr)
     309    {
    277310      if(!Filter((PMINIRECORDCORE)pci,(PVOID)&dcd->mask))
    278311        pci->rc.flRecordAttr |= CRA_FILTERED;
     
    286319            (!(dcd->mask.attrFile & FILE_ARCHIVED) &&
    287320             (pci->attrFile & FILE_ARCHIVED)))
     321    {
    288322      pci->rc.flRecordAttr |= CRA_FILTERED;
     323    }
    289324  }
    290325
    291326  return pffb->cbFile + pci->easize;
    292 }
    293 
    294 
    295 ULONG FillInRecordFromFSA (HWND hwndCnr,PCNRITEM pci,const PSZ pszFileName,
    296                            const PFILESTATUS4 pfsa4,
    297                            const BOOL partial,
    298                            DIRCNRDATA *dcd)
     327
     328} // FillInRecordFromFFB
     329
     330
     331ULONGLONG FillInRecordFromFSA(HWND hwndCnr,
     332                              PCNRITEM pci,
     333                              const PSZ pszFileName,
     334                              const PFILESTATUS4 pfsa4,
     335                              const BOOL partial,
     336                              DIRCNRDATA *dcd)          // Optional
    299337{
    300 
    301338  HPOINTER       hptr;
    302   CHAR           attrstring[] = "RHS\0DA",cmps[] = ".xxx";
     339  CHAR           attrstring[] = "RHS\0DA";
     340  CHAR           cmps[] = ".xxx";
    303341  register CHAR *p;
    304   register INT   x,y;
     342  register INT   x;
     343  register INT   y;
    305344  ULONG          cmp;
    306345
     
    310349  strcpy(pci->szFileName,pszFileName);
    311350  /* load the object's Subject, if required */
    312   if(pfsa4->cbList > 4L &&
    313      dcd && fLoadSubject &&
    314      (!isalpha(*pci->szFileName) ||
    315       !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADSUBJS))) {
    316 
     351  if (pfsa4->cbList > 4L &&
     352      dcd &&
     353      fLoadSubject &&
     354      (!isalpha(*pci->szFileName) ||
     355       !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADSUBJS)))
     356  {
    317357    APIRET    rc;
    318358    EAOP2     eaop;
     
    324364
    325365    pgealist = malloc(sizeof(GEA2LIST) + 32);
    326     if(pgealist) {
     366    if (pgealist) {
    327367      memset(pgealist,0,sizeof(GEA2LIST) + 32);
    328368      pgea = &pgealist->list[0];
     
    332372      pgealist->cbList = (sizeof(GEA2LIST) + pgea->cbName);
    333373      pfealist = malloc(1532);
    334       if(pfealist) {
     374      if (pfealist) {
    335375        memset(pfealist,0,1532);
    336376        pfealist->cbList = 1024;
     
    341381                              (PVOID)&eaop,
    342382                              (ULONG)sizeof(EAOP2));
    343         if(!rc) {
     383        if (!rc) {
    344384          pfea = &eaop.fpFEA2List->list[0];
    345385          value = pfea->szName + pfea->cbName + 1;
    346386          value[pfea->cbValue] = 0;
    347           if(*(USHORT *)value == EAT_ASCII)
    348             strncpy(pci->subject,value + (sizeof(USHORT) * 2),39);
    349           pci->subject[39] = 0;
     387          if (*(USHORT *)value == EAT_ASCII)
     388            strncpy(pci->szSubject,value + (sizeof(USHORT) * 2),39);
     389          pci->szSubject[39] = 0;
    350390        }
    351391        free(pfealist);
     
    354394    }
    355395  }
    356   pci->pszSubject = pci->subject;
    357   *pci->Longname = 0;
    358   if(pfsa4->cbList > 4L &&
    359      dcd && fLoadLongnames &&
    360      (!isalpha(*pci->szFileName) ||
    361       ((driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLONGNAMES) &&
    362       !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADLONGS))))
     396  pci->pszSubject = pci->szSubject;
     397  *pci->szLongname = 0;
     398  if (pfsa4->cbList > 4L &&
     399      dcd &&
     400      fLoadLongnames &&
     401      (!isalpha(*pci->szFileName) ||
     402       ((driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLONGNAMES) &&
     403       !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADLONGS))))
    363404  {
    364405    APIRET    rc;
     
    371412
    372413    pgealist = malloc(sizeof(GEA2LIST) + 32);
    373     if(pgealist) {
     414    if (pgealist) {
    374415      memset(pgealist,0,sizeof(GEA2LIST) + 32);
    375416      pgea = &pgealist->list[0];
     
    379420      pgealist->cbList = (sizeof(GEA2LIST) + pgea->cbName);
    380421      pfealist = malloc(1532);
    381       if(pfealist) {
     422      if (pfealist) {
    382423        memset(pfealist,0,1532);
    383424        pfealist->cbList = 1024;
     
    387428        rc = DosQueryPathInfo(pci->szFileName,FIL_QUERYEASFROMLIST,
    388429                              (PVOID)&eaop,(ULONG)sizeof(EAOP2));
    389         if(!rc) {
     430        if (!rc) {
    390431          pfea = &eaop.fpFEA2List->list[0];
    391432          value = pfea->szName + pfea->cbName + 1;
    392433          value[pfea->cbValue] = 0;
    393           if(*(USHORT *)value == EAT_ASCII)
    394             strncpy(pci->Longname,value + (sizeof(USHORT) * 2),CCHMAXPATHCOMP);
    395           pci->Longname[CCHMAXPATHCOMP - 1] = 0;
     434          if (*(USHORT *)value == EAT_ASCII)
     435            strncpy(pci->szLongname,value + (sizeof(USHORT) * 2),CCHMAXPATHCOMP);
     436          pci->szLongname[CCHMAXPATHCOMP - 1] = 0;
    396437        }
    397438        free(pfealist);
     
    400441    }
    401442  }
    402   pci->pszLongname = pci->Longname;
    403   if(fForceUpper)
     443  pci->pszLongname = pci->szLongname;
     444  if (fForceUpper)
    404445    strupr(pci->szFileName);
    405   else if(fForceLower)
     446  else if (fForceLower)
    406447    strlwr(pci->szFileName);
    407448
    408   if(pfsa4->attrFile & FILE_DIRECTORY) {
    409     if(!fNoIconsDirs && (!isalpha(*pci->szFileName) ||
    410        !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS)))
     449  if (pfsa4->attrFile & FILE_DIRECTORY) {
     450    if (!fNoIconsDirs && (!isalpha(*pci->szFileName) ||
     451        !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS)))
    411452      hptr = WinLoadFileIcon(pci->szFileName, FALSE);
    412453    else
    413454      hptr = (HPOINTER)0;
    414455  }
    415   else {
    416     if(!fNoIconsFiles && (!isalpha(*pci->szFileName) ||
    417        !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS)))
     456  else
     457  {
     458    if (!fNoIconsFiles && (!isalpha(*pci->szFileName) ||
     459        !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS)))
    418460      hptr = WinLoadFileIcon(pci->szFileName, FALSE);
    419     else {
     461    else
     462    {
    420463      p = strrchr(pci->szFileName,'.');
    421       if(p && !p[4]) {
     464      if (p && !p[4]) {
    422465        cmps[1] = toupper(p[1]);
    423466        cmps[2] = toupper(p[2]);
     
    430473    }
    431474  }
    432   if(!hptr)
     475  if (!hptr)
    433476    hptr = ((pfsa4->attrFile & FILE_DIRECTORY) != 0) ? hptrDir :
    434477            ((pfsa4->attrFile & FILE_SYSTEM) != 0)   ? hptrSystem :
     
    437480            hptrFile;
    438481
    439   if(partial) {
     482  if (partial) {
    440483    p = strrchr(pci->szFileName,'\\');
    441     if(!p) {
     484    if (!p) {
    442485        p = strrchr(pci->szFileName,':');
    443       if(!p)
     486      if (!p)
    444487        p = pci->szFileName;
    445488      else
    446489        p++;
    447490    }
    448     else if((dcd && dcd->type == TREE_FRAME) ||
    449             (!(pfsa4->attrFile & FILE_DIRECTORY) || !*(p + 1)))
     491    else if ((dcd && dcd->type == TREE_FRAME) ||
     492             !(pfsa4->attrFile & FILE_DIRECTORY) ||
     493             !*(p + 1))
    450494      p++;
    451     if(!*p)
     495    if (!*p)
    452496      p = pci->szFileName;
    453497  }
     
    478522  y = 0;
    479523  for(x = 0;x < 6;x++)
    480     if(attrstring[x])
     524    if (attrstring[x])
    481525      pci->szDispAttr[y++] = (CHAR)((pci->attrFile & (1 << x)) ?
    482526                             attrstring[x] : '-');
     
    486530  pci->rc.hptrIcon    = hptr;
    487531
    488   if(dcd && (*dcd->mask.szMask || dcd->mask.antiattr ||
    489      ((dcd->mask.attrFile &
    490       (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)) !=
    491       (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)))) {
    492     if(*dcd->mask.szMask || dcd->mask.antiattr) {
    493       if(!Filter((PMINIRECORDCORE)pci,(PVOID)&dcd->mask))
     532  if (dcd &&
     533      (*dcd->mask.szMask || dcd->mask.antiattr ||
     534       ((dcd->mask.attrFile &
     535        (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)) !=
     536        (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED))))
     537  {
     538    if (*dcd->mask.szMask || dcd->mask.antiattr)
     539    {
     540      if (!Filter((PMINIRECORDCORE)pci,(PVOID)&dcd->mask))
    494541        pci->rc.flRecordAttr |= CRA_FILTERED;
    495542    }
    496     else if((!(dcd->mask.attrFile & FILE_HIDDEN) &&
    497              (pci->attrFile & FILE_HIDDEN)) ||
    498             (!(dcd->mask.attrFile & FILE_SYSTEM) &&
    499              (pci->attrFile & FILE_SYSTEM)) ||
    500             (!(dcd->mask.attrFile & FILE_READONLY) &&
    501              (pci->attrFile & FILE_READONLY)) ||
    502             (!(dcd->mask.attrFile & FILE_ARCHIVED) &&
    503              (pci->attrFile & FILE_ARCHIVED)))
     543    else if ((!(dcd->mask.attrFile & FILE_HIDDEN) &&
     544              (pci->attrFile & FILE_HIDDEN)) ||
     545             (!(dcd->mask.attrFile & FILE_SYSTEM) &&
     546              (pci->attrFile & FILE_SYSTEM)) ||
     547             (!(dcd->mask.attrFile & FILE_READONLY) &&
     548              (pci->attrFile & FILE_READONLY)) ||
     549             (!(dcd->mask.attrFile & FILE_ARCHIVED) &&
     550              (pci->attrFile & FILE_ARCHIVED)))
    504551      pci->rc.flRecordAttr |= CRA_FILTERED;
    505552  }
    506553
    507554  return pfsa4->cbFile + pci->easize;
    508 }
    509 
    510 
    511 ULONG ProcessDirectory (const HWND hwndCnr, const PCNRITEM pciParent,
    512                         const CHAR *szDirBase, const BOOL filestoo,
    513                         const BOOL recurse,const BOOL partial,
    514                         CHAR *stopflag,DIRCNRDATA *dcd,ULONG *foundany)
     555
     556} // FillInRecordFromFSA
     557
     558
     559VOID ProcessDirectory(const HWND hwndCnr, const PCNRITEM pciParent,
     560                      const CHAR *szDirBase, const BOOL filestoo,
     561                      const BOOL recurse,const BOOL partial,
     562                      CHAR *stopflag,
     563                      DIRCNRDATA *dcd,                  // Optional
     564                      ULONG *pulTotalFiles,             // Optional
     565                      PULONGLONG pullTotalBytes)        // Optional
    515566{
    516 
    517567  /* put all the directories (and files if filestoo is TRUE) from a
    518568   * directory into the container.  recurse through subdirectories if
     
    522572  PSZ            pszFileSpec;
    523573  INT            t;
    524   PFILEFINDBUF4  paffbFound,*papffbSelected,pffbFile,paffbTotal = NULL,paffbTemp;
     574  PFILEFINDBUF4  paffbFound;
     575  PFILEFINDBUF4  *papffbSelected;
     576  PFILEFINDBUF4  pffbFile;
     577  PFILEFINDBUF4  paffbTotal = NULL;
     578  PFILEFINDBUF4  paffbTemp;
    525579  HDIR           hdir = HDIR_CREATE;
    526   ULONG          ulMaxFiles,ulExtraBytes,ulM = 1,ulTotal = 0L;
    527   ULONG          numbytes,totalbytes,returnbytes = 0L;
     580  ULONG          ulFileCnt;
     581  ULONG          ulExtraBytes;
     582  ULONG          ulM = 1;
     583  ULONG          ulTotal = 0L;
     584  ULONGLONG      ullBytes;
     585  ULONGLONG      ullTotalBytes;
     586  ULONG          ulReturnFiles = 0;
     587  ULONGLONG      ullReturnBytes = 0;
    528588  PCH            pchEndPath;
    529589  APIRET         rc;
    530   PCNRITEM       pci,pciFirst,pcit;
     590  PCNRITEM       pci;
     591  PCNRITEM       pciFirst;
     592  PCNRITEM       pcit;
    531593  RECORDINSERT   ri;
    532   register PBYTE pByte,pByte2;
    533 
    534   if(foundany)
    535     (*foundany) = 0L;
    536   if(isalpha(*szDirBase) && szDirBase[1] == ':' && szDirBase[2] == '\\') {
    537 //    if(!(driveflags[toupper(*szDirBase) - 'A'] & DRIVE_NOLONGNAMES))
     594  PBYTE          pByte;
     595  PBYTE          pByte2;
     596  BOOL           ok = TRUE;
     597
     598  if (isalpha(*szDirBase) && szDirBase[1] == ':' && szDirBase[2] == '\\')
     599  {
     600    // if (!(driveflags[toupper(*szDirBase) - 'A'] & DRIVE_NOLONGNAMES))
    538601      ulExtraBytes = EXTRA_RECORD_BYTES;
    539 //    else
    540 //      ulExtraBytes = EXTRA_RECORD_BYTES2;
    541     if((driveflags[toupper(*szDirBase) - 'A'] & DRIVE_REMOTE) && fRemoteBug)
    542       ulM = 1;                         /* file system gets confused */
    543     else if(driveflags[toupper(*szDirBase) - 'A'] & DRIVE_ZIPSTREAM)
     602    // else
     603    // ulExtraBytes = EXTRA_RECORD_BYTES2;
     604    if ((driveflags[toupper(*szDirBase) - 'A'] & DRIVE_REMOTE) && fRemoteBug)
     605      ulM = 1;                          /* file system gets confused */
     606    else if (driveflags[toupper(*szDirBase) - 'A'] & DRIVE_ZIPSTREAM)
    544607      ulM = min(FilesToGet,225);        /* anything more is wasted */
    545608    else
    546609      ulM = FilesToGet;                 /* full-out */
    547610  }
    548   else {
     611  else
     612  {
    549613    ulExtraBytes = EXTRA_RECORD_BYTES;
    550614    ulM = FilesToGet;
    551615  }
    552   if(OS2ver[0] == 20 && OS2ver[1] < 30)
     616  if (OS2ver[0] == 20 && OS2ver[1] < 30)
    553617    ulM = min(ulM,(65535 / sizeof(FILEFINDBUF4)));
    554618
    555   ulMaxFiles = ulM;
     619  ulFileCnt = ulM;
    556620  pszFileSpec = malloc(CCHMAXPATH + 2);
    557621  paffbFound = malloc((ulM + 1) * sizeof(FILEFINDBUF4));
    558622  papffbSelected = malloc((ulM + 1) * sizeof(PFILEFINDBUF4));
    559   if(paffbFound && papffbSelected && pszFileSpec) {
     623  if (paffbFound && papffbSelected && pszFileSpec) {
    560624    t = strlen(szDirBase);
    561625    memcpy(pszFileSpec,szDirBase,t + 1);
    562626    pchEndPath = pszFileSpec + t;
    563     if(*(pchEndPath - 1) != '\\') {
     627    if (*(pchEndPath - 1) != '\\') {
    564628      memcpy(pchEndPath,"\\",2);
    565629      pchEndPath++;
     
    572636                      FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
    573637                      paffbFound, ulM * sizeof(FILEFINDBUF4),
    574                       &ulMaxFiles, FIL_QUERYEASIZE);
     638                      &ulFileCnt, FIL_QUERYEASIZE);
    575639    priority_normal();
    576640    *pchEndPath = 0;
    577     if(!rc) {
    578       while(!rc) {
     641    if (!rc)
     642    {
     643      while (!rc)
     644      {
    579645        /*
    580646         * remove . and .. from list if present
     
    587653          register ULONG x;
    588654
    589           if(stopflag && *stopflag)
     655          if (stopflag && *stopflag)
    590656            goto Abort;
    591657          pByte = (PBYTE)paffbFound;
    592658          x = 0L;
    593           while(x < ulMaxFiles) {
     659          while (x < ulFileCnt)
     660          {
    594661            pffbFile = (PFILEFINDBUF4)pByte;
    595             if(!*pffbFile->achName ||
    596                (!filestoo && !(pffbFile->attrFile & FILE_DIRECTORY)) ||
    597                (((pffbFile->attrFile & FILE_DIRECTORY) &&
    598                  pffbFile->achName[0] == '.') &&
    599                 (!pffbFile->achName[1] || (pffbFile->achName[1] == '.' &&
    600                  !pffbFile->achName[2]))))
    601               ulMaxFiles--;
     662            if (!*pffbFile->achName ||
     663                (!filestoo && !(pffbFile->attrFile & FILE_DIRECTORY)) ||
     664                (((pffbFile->attrFile & FILE_DIRECTORY) &&
     665                  pffbFile->achName[0] == '.') &&
     666                 (!pffbFile->achName[1] || (pffbFile->achName[1] == '.' &&
     667                  !pffbFile->achName[2]))))
     668            {
     669              ulFileCnt--;
     670            }
    602671            else
    603672              papffbSelected[x++] = pffbFile;
    604             if(!pffbFile->oNextEntryOffset) {
    605               ulMaxFiles = x;
     673            if (!pffbFile->oNextEntryOffset)
     674            {
     675              ulFileCnt = x;
    606676              break;
    607677            }
    608678            pByte += pffbFile->oNextEntryOffset;
    609679          }
    610           if(ulMaxFiles) {
    611             if(stopflag && *stopflag)
     680          if (ulFileCnt)
     681          {
     682            if (stopflag && *stopflag)
    612683              goto Abort;
    613             if(fSyncUpdates) {
     684            if (fSyncUpdates)
     685            {
    614686              pciFirst = WinSendMsg(hwndCnr, CM_ALLOCRECORD,
    615687                                    MPFROMLONG(ulExtraBytes),
    616                                     MPFROMLONG(ulMaxFiles));
    617               if(pciFirst) {
    618 
     688                                    MPFROMLONG(ulFileCnt));
     689              if (pciFirst)
     690              {
    619691                register INT   i;
    620692
    621693                pci = pciFirst;
    622                 totalbytes = 0L;
    623                 for(i = 0; i < ulMaxFiles; i++) {
     694                ullTotalBytes = 0;
     695                for(i = 0; i < ulFileCnt; i++) {
    624696                  pffbFile = papffbSelected[i];
    625                   numbytes = FillInRecordFromFFB(hwndCnr,pci,pszFileSpec,
    626                                                  pffbFile,partial,dcd);
    627                   if(numbytes != -1) {
     697                  ullBytes = FillInRecordFromFFB(hwndCnr,pci,pszFileSpec,
     698                                           pffbFile,partial,dcd);
     699                  if (rc)
     700                  {
    628701                    pci = (PCNRITEM)pci->rc.preccNextRecord;
    629                     totalbytes += numbytes;
    630                     if (totalbytes == -1)
    631                       totalbytes--;             // fixme for real someday
    632 
     702                    ullTotalBytes += ullBytes;
    633703                  }
    634                   else {
     704                  else
     705                  {
    635706                    Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__,
    636707                              GetPString(IDS_FILLDIRERR1TEXT),
    637708                              hwndCnr);
    638                     ulMaxFiles--;
     709                    ulFileCnt--;
    639710                  }
    640711                }
    641                 if(ulMaxFiles) {
     712                if (ulFileCnt)
     713                {
    642714                  memset(&ri,0,sizeof(RECORDINSERT));
    643715                  ri.cb                 = sizeof(RECORDINSERT);
     
    645717                  ri.pRecordParent      = (PRECORDCORE) pciParent;
    646718                  ri.zOrder             = (ULONG) CMA_TOP;
    647                   ri.cRecordsInsert     = ulMaxFiles;
     719                  ri.cRecordsInsert     = ulFileCnt;
    648720                  ri.fInvalidateRecord  = (!fSyncUpdates && dcd &&
    649721                                           dcd->type == DIR_FRAME) ?
    650722                                            FALSE : TRUE;
    651                   if(!WinSendMsg(hwndCnr,
    652                                  CM_INSERTRECORD,
    653                                  MPFROMP(pciFirst),
    654                                  MPFROMP(&ri)))
     723                  if (!WinSendMsg(hwndCnr,
     724                                  CM_INSERTRECORD,
     725                                  MPFROMP(pciFirst),
     726                                  MPFROMP(&ri)))
    655727                  {
    656728                    DosSleep(100L);
    657729                    WinSetFocus(HWND_DESKTOP,hwndCnr);
    658                     if(!WinSendMsg(hwndCnr,
    659                                    CM_INSERTRECORD,
    660                                    MPFROMP(pciFirst),
    661                                    MPFROMP(&ri))) {
     730                    if (!WinSendMsg(hwndCnr,
     731                                    CM_INSERTRECORD,
     732                                    MPFROMP(pciFirst),
     733                                    MPFROMP(&ri))) {
    662734
    663735                      { // SHL
     
    674746                      Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__,
    675747                                GetPString(IDS_FILLDIRERR2TEXT));
    676                       totalbytes = -1;
    677                       if(WinIsWindow((HAB)0,hwndCnr)) {
     748                      ok = FALSE;
     749                      ullTotalBytes = 0;
     750                      if (WinIsWindow((HAB)0,hwndCnr))
     751                      {
    678752                        pci = pciFirst;
    679                         while(pci) {
     753                        while (pci)
     754                        {
    680755                          pcit = (PCNRITEM)pci->rc.preccNextRecord;
    681756                          WinSendMsg(hwndCnr,
     
    690765                }
    691766              }
    692               else {
     767              else
     768              {
    693769                Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__,
    694770                          GetPString(IDS_FILLDIRERR3TEXT));
    695                 totalbytes = -1;
     771                ok = FALSE;
     772                ullTotalBytes = 0;
    696773              }
    697               if(totalbytes != -1) {
    698                 returnbytes += totalbytes;
    699                 if (returnbytes == -1)
    700                   returnbytes--;        // fixme for real someday
    701                 if(foundany)
    702                   (*foundany) += ulMaxFiles;
     774              if (ok)
     775              {
     776                ullReturnBytes += ullTotalBytes;
     777                ulReturnFiles += ulFileCnt;
    703778              }
    704779            }
    705             else {
     780            else
     781            {
    706782              paffbTemp = realloc(paffbTotal,sizeof(FILEFINDBUF4) *
    707                                        (ulMaxFiles + ulTotal));
    708               if(paffbTemp) {
     783                                       (ulFileCnt + ulTotal));
     784              if (paffbTemp)
     785              {
    709786                paffbTotal = paffbTemp;
    710                 for(x = 0;x < ulMaxFiles;x++)
     787                for(x = 0;x < ulFileCnt;x++)
    711788                  paffbTotal[x + ulTotal] = *papffbSelected[x];
    712                 ulTotal += ulMaxFiles;
     789                ulTotal += ulFileCnt;
    713790              }
    714               else {
     791              else
     792              {
    715793                saymsg(MB_ENTER,
    716794                       HWND_DESKTOP,
     
    722800          }
    723801        }
    724         if(stopflag && *stopflag)
     802        if (stopflag && *stopflag)
    725803            goto Abort;
    726         ulMaxFiles = ulM;
     804        ulFileCnt = ulM;
    727805        DosError(FERR_DISABLEHARDERR);
    728806        rc = DosFindNext(hdir, paffbFound, ulM * sizeof(FILEFINDBUF4),
    729                          &ulMaxFiles);
     807                         &ulFileCnt);
    730808        priority_normal();
    731         if(rc)
     809        if (rc)
    732810          DosError(FERR_DISABLEHARDERR);
    733811      }
    734812      DosFindClose(hdir);
    735813
    736       if(paffbFound || papffbSelected) {
    737         if(paffbFound)
     814      if (paffbFound || papffbSelected) {
     815        if (paffbFound)
    738816          free(paffbFound);
    739         if(papffbSelected)
     817        if (papffbSelected)
    740818          free(papffbSelected);
    741819        papffbSelected = NULL;
     
    743821      }
    744822
    745       if(ulTotal && paffbTotal) {
    746         if(stopflag && *stopflag)
     823      if (ulTotal && paffbTotal)
     824      {
     825
     826        if (stopflag && *stopflag)
    747827          goto Abort;
     828
    748829        pciFirst = WinSendMsg(hwndCnr, CM_ALLOCRECORD,
    749830                              MPFROMLONG(ulExtraBytes),
    750831                              MPFROMLONG(ulTotal));
    751         if(pciFirst) {
    752 
     832        if (pciFirst)
     833        {
    753834          register INT   i;
    754835
    755836          pci = pciFirst;
    756           totalbytes = 0L;
     837          ullTotalBytes = 0;
    757838          pByte2 = (PBYTE)paffbTotal;
    758           for(i = 0; i < ulTotal; i++) {
     839          for(i = 0; i < ulTotal; i++)
     840          {
    759841            pffbFile = (PFILEFINDBUF4)pByte2;
    760             numbytes = FillInRecordFromFFB(hwndCnr,pci,pszFileSpec,
     842            ullBytes = FillInRecordFromFFB(hwndCnr,pci,pszFileSpec,
    761843                                           pffbFile,partial,dcd);
    762             if (numbytes != -1) {
    763               pci = (PCNRITEM)pci->rc.preccNextRecord;
    764               totalbytes += numbytes;
    765               if (totalbytes == -1)
    766                 totalbytes--;           // fixme for real someday
    767             }
    768             else {
    769               Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__,
    770                         GetPString(IDS_FILLDIRERR4TEXT),
    771                         hwndCnr);
    772               ulTotal--;
    773             }
     844            pci = (PCNRITEM)pci->rc.preccNextRecord;
     845            ullTotalBytes += ullBytes;
     846
    774847            pByte2 += sizeof(FILEFINDBUF4);
    775848          }
    776           if(ulTotal) {
     849          if (ulTotal)
     850          {
    777851            memset(&ri,0,sizeof(RECORDINSERT));
    778852            ri.cb                 = sizeof(RECORDINSERT);
     
    784858                                     dcd->type == DIR_FRAME) ?
    785859                                      FALSE : TRUE;
    786             if(!WinSendMsg(hwndCnr,CM_INSERTRECORD,
    787                            MPFROMP(pciFirst),MPFROMP(&ri))) {
     860            if (!WinSendMsg(hwndCnr,CM_INSERTRECORD,
     861                            MPFROMP(pciFirst),MPFROMP(&ri)))
     862            {
    788863              DosSleep(100L);
    789864              WinSetFocus(HWND_DESKTOP,hwndCnr);
    790               if(!WinSendMsg(hwndCnr,CM_INSERTRECORD,
     865              if (!WinSendMsg(hwndCnr,CM_INSERTRECORD,
    791866                             MPFROMP(pciFirst),MPFROMP(&ri)))
    792867              {
     
    804879                Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__,
    805880                          GetPString(IDS_FILLDIRERR5TEXT));
    806                 totalbytes = -1;
    807                 if(WinIsWindow((HAB)0,hwndCnr)) {
     881                ok = FALSE;
     882                ullTotalBytes = 0;
     883                if (WinIsWindow((HAB)0,hwndCnr))
     884                {
    808885                  pci = pciFirst;
    809                   while(pci) {
     886                  while (pci)
     887                  {
    810888                    pcit = (PCNRITEM)pci->rc.preccNextRecord;
    811889                    WinSendMsg(hwndCnr,CM_FREERECORD,
     
    818896          }
    819897        }
    820         else {
     898        else
     899        {
    821900          Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__,
    822901                    GetPString(IDS_FILLDIRERR3TEXT));
    823           totalbytes = -1;
    824         }
    825         if(totalbytes != -1) {
    826           returnbytes += totalbytes;
    827           if (returnbytes == -1)
    828             returnbytes--;              // fixme for real someday
    829           if(foundany)
    830             (*foundany) += ulMaxFiles;
    831         }
    832       }
    833     }
    834 
    835     if(!fSyncUpdates && dcd && dcd->type == DIR_FRAME)
     902          ok = FALSE;
     903          ullTotalBytes = 0;
     904        }
     905        if (ok)
     906        {
     907          ullReturnBytes += ullTotalBytes;
     908          ulReturnFiles += ulFileCnt;
     909        }
     910      }
     911    }
     912
     913    if (!fSyncUpdates && dcd && dcd->type == DIR_FRAME)
    836914      WinSendMsg(hwndCnr,CM_INVALIDATERECORD,MPVOID,
    837915                 MPFROM2SHORT(0,CMA_ERASE));
    838916  }
    839917Abort:
    840   if(paffbTotal || papffbSelected || paffbFound || pszFileSpec) {
    841     if(paffbTotal)
     918  if (paffbTotal || papffbSelected || paffbFound || pszFileSpec)
     919  {
     920    if (paffbTotal)
    842921      free(paffbTotal);
    843     if(pszFileSpec)
     922    if (pszFileSpec)
    844923      free(pszFileSpec);
    845     if(paffbFound)
     924    if (paffbFound)
    846925      free(paffbFound);
    847     if(papffbSelected)
     926    if (papffbSelected)
    848927      free(papffbSelected);
    849928  }
    850   if(recurse) {
     929  if (recurse)
     930  {
    851931    pci = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pciParent),
    852932                     MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
    853     while(pci && (INT)pci != -1) {
    854       if(pci->attrFile & FILE_DIRECTORY)
     933    while (pci && (INT)pci != -1)
     934    {
     935      if (pci->attrFile & FILE_DIRECTORY)
    855936        Stubby(hwndCnr,pci);
    856937      pci = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
     
    859940  }
    860941
    861   return returnbytes;
    862 }
    863 
    864 
    865 ULONG FillDirCnr (HWND hwndCnr,CHAR *directory,DIRCNRDATA *dcd)
     942  if (pulTotalFiles)
     943    *pulTotalFiles = ulReturnFiles;
     944
     945  if (pullTotalBytes)
     946    *pullTotalBytes = ullReturnBytes;
     947
     948} // ProcessDirectory
     949
     950
     951VOID FillDirCnr(HWND hwndCnr,
     952                CHAR *pszDirectory,
     953                DIRCNRDATA *dcd,
     954                PULONGLONG pullTotalBytes)
    866955{
    867   ULONG ret;
    868 
    869   ret = ProcessDirectory(hwndCnr,(PCNRITEM)NULL,directory,TRUE,FALSE,TRUE,
    870                          (dcd) ? &dcd->stopflag : NULL,dcd,NULL);
     956  ProcessDirectory(hwndCnr,
     957                   (PCNRITEM)NULL,
     958                   pszDirectory,
     959                   TRUE,
     960                   FALSE,
     961                   TRUE,
     962                   dcd ? &dcd->stopflag : NULL,
     963                   dcd,
     964                   NULL,
     965                   pullTotalBytes);
    871966  DosPostEventSem(CompactSem);
    872   return ret;
    873 }
    874 
    875 
    876 ULONG FillTreeCnr (HWND hwndCnr,HWND hwndParent)
     967
     968} // FillDirCnr
     969
     970
     971VOID FillTreeCnr(HWND hwndCnr,HWND hwndParent)
    877972{
    878973  ULONG       ulDriveNum,ulDriveMap,numtoinsert = 0L,drvtype;
     
    887982  fDummy = TRUE;
    888983  *suggest = 0;
    889   for(x = 0;x < 26;x++)
     984  for (x = 0;x < 26;x++)
    890985    driveflags[x] &= (DRIVE_IGNORE | DRIVE_NOPRESCAN | DRIVE_NOLOADICONS |
    891986                      DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS |
     
    896991
    897992    DosError(FERR_DISABLEHARDERR);
    898     if(!DosQuerySysInfo(QSV_BOOT_DRIVE,
    899                         QSV_BOOT_DRIVE,
    900                         (PVOID)&startdrive,
    901                         (ULONG)sizeof(ULONG)) &&
     993    if (!DosQuerySysInfo(QSV_BOOT_DRIVE,
     994                         QSV_BOOT_DRIVE,
     995                         (PVOID)&startdrive,
     996                         (ULONG)sizeof(ULONG)) &&
    902997       startdrive)
    903998      driveflags[startdrive - 1] |= DRIVE_BOOT;
     
    9061001  rc = DosQCurDisk(&ulDriveNum,
    9071002                   &ulDriveMap);
    908   if(rc) {
     1003  if (rc)
     1004  {
    9091005    Dos_Error(MB_CANCEL,
    9101006              rc,
     
    9161012  }
    9171013  for(x = 0;x < 26;x++)
    918     if((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE))
     1014    if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE))
    9191015      numtoinsert++;
    920   if(numtoinsert)
     1016  if (numtoinsert)
    9211017    pciFirst = WinSendMsg(hwndCnr,
    9221018                          CM_ALLOCRECORD,
    9231019                          MPFROMLONG(EXTRA_RECORD_BYTES2),
    9241020                          MPFROMLONG((ULONG)numtoinsert));
    925   if(pciFirst) {
     1021  if (pciFirst)
     1022  {
    9261023    pci = pciFirst;
    9271024    for(x = 0;x < 26;x++) {
    928       if((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) {
     1025      if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE))
     1026      {
    9291027        *szDrive = (CHAR)x + 'A';
    9301028
    9311029        {
    9321030          CHAR  s[80];
    933           ULONG flags = 0,size = sizeof(ULONG);
     1031          ULONG flags = 0;
     1032          ULONG size = sizeof(ULONG);
    9341033
    9351034          sprintf(s,"%c.DriveFlags",toupper(*szDrive));
    936           if(PrfQueryProfileData(fmprof,appname,s,&flags,&size) &&
    937              size == sizeof(ULONG))
     1035          if (PrfQueryProfileData(fmprof,appname,s,&flags,&size) &&
     1036              size == sizeof(ULONG))
     1037          {
    9381038            driveflags[toupper(*szDrive) - 'A'] |= flags;
    939         }
    940 
    941         if(x > 1) {
    942           if(!(driveflags[x] & DRIVE_NOPRESCAN)) {
     1039          }
     1040        }
     1041
     1042        if (x > 1)
     1043        {
     1044          if (!(driveflags[x] & DRIVE_NOPRESCAN))
     1045          {
    9431046            *FileSystem = 0;
    9441047            drvtype = 0;
    9451048            removable = CheckDrive(*szDrive,FileSystem,&drvtype);
    9461049            driveserial[x] = -1;
    947             if(removable != -1) {
    948 
     1050            if (removable != -1)
     1051            {
    9491052              struct {
    9501053                ULONG serial;
     
    9541057
    9551058              DosError(FERR_DISABLEHARDERR);
    956               if(!DosQueryFSInfo((ULONG)x,
    957                                  FSIL_VOLSER,
    958                                  &volser,
    959                                  sizeof(volser)))
     1059              if (!DosQueryFSInfo((ULONG)x,
     1060                                  FSIL_VOLSER,
     1061                                  &volser,
     1062                                  sizeof(volser)))
     1063              {
    9601064                driveserial[x] = volser.serial;
     1065              }
    9611066            }
    9621067            else
     
    9651070            driveflags[x] |= ((removable == -1 || removable == 1) ?
    9661071                                               DRIVE_REMOVABLE : 0);
    967             if(drvtype & DRIVE_REMOTE)
     1072            if (drvtype & DRIVE_REMOTE)
    9681073              driveflags[x] |= DRIVE_REMOTE;
    9691074            if (strcmp(FileSystem,HPFS) &&
     
    9751080              driveflags[x] |= DRIVE_NOLONGNAMES;
    9761081            }
    977             if(!strcmp(FileSystem,CDFS)) {
     1082            if (!strcmp(FileSystem,CDFS))
     1083            {
    9781084              removable = 1;
    9791085              driveflags[x] |= DRIVE_REMOVABLE | DRIVE_NOTWRITEABLE |
    9801086                                DRIVE_CDROM;
    9811087            }
    982             else if(!stricmp(FileSystem,CBSIFS))
     1088            else if (!stricmp(FileSystem,CBSIFS))
    9831089            {
    9841090              driveflags[x] |= DRIVE_ZIPSTREAM;
    9851091              driveflags[x] &= ~DRIVE_REMOTE;
    986               if(drvtype & DRIVE_REMOVABLE)
     1092              if (drvtype & DRIVE_REMOVABLE)
    9871093                driveflags[x] |= DRIVE_REMOVABLE;
    988               if(!(drvtype & DRIVE_NOLONGNAMES))
     1094              if (!(drvtype & DRIVE_NOLONGNAMES))
    9891095                driveflags[x] &= ~DRIVE_NOLONGNAMES;
    9901096            }
    9911097
    9921098            pci->rc.flRecordAttr |= CRA_RECORDREADONLY;
    993             if((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum)
     1099            if ((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum)
    9941100              pci->rc.flRecordAttr |= (CRA_CURSORED | CRA_SELECTED);
    9951101
    996             if(removable == 0) {
     1102            if (removable == 0)
     1103            {
    9971104              pci->attrFile |= FILE_DIRECTORY;
    9981105              DosError(FERR_DISABLEHARDERR);
     
    10011108                                    &fsa4,
    10021109                                    (ULONG)sizeof(FILESTATUS4));
    1003               if(rc == 58) {
     1110              if (rc == 58)
     1111              {
    10041112                DosError(FERR_DISABLEHARDERR);
    10051113                rc = DosQueryPathInfo(szDrive,
     
    10091117                fsa4.cbList = 0;
    10101118              }
    1011               if(rc && !didonce) {
    1012                 if(!*suggest) {
     1119              if (rc && !didonce)
     1120              {
     1121                if (!*suggest)
     1122                {
    10131123                  *suggest = '/';
    10141124                  suggest[1] = 0;
     
    10331143                                    NULL);
    10341144            }
    1035             else {
     1145            else
     1146            {
    10361147              strcpy(pci->szFileName,szDrive);
    10371148              pci->pszFileName = pci->szFileName;
     
    10421153            }
    10431154            *pci->szFileName = toupper(*pci->szFileName);
    1044             if(driveflags[x] & DRIVE_CDROM)
     1155            if (driveflags[x] & DRIVE_CDROM)
    10451156              pci->rc.hptrIcon = hptrCDROM;
    10461157            else
     
    10521163                                  hptrZipstrm : hptrDrive;
    10531164          }
    1054           else {
     1165          else
     1166          {
    10551167            pci->rc.hptrIcon = hptrDunno;
    10561168            strcpy(pci->szFileName,szDrive);
     
    10631175          }
    10641176        }
    1065         else {
     1177        else
     1178        {
    10661179          pci->rc.hptrIcon = hptrFloppy;
    10671180          strcpy(pci->szFileName,szDrive);
     
    10771190        pci = (PCNRITEM)pci->rc.preccNextRecord;  /* next rec */
    10781191      }
    1079       else if(!(ulDriveMap & (1L << x)))
     1192      else if (!(ulDriveMap & (1L << x)))
    10801193        driveflags[x] |= DRIVE_INVALID;
    10811194    }
     
    10861199    drivesbuilt = TRUE;
    10871200    /* insert the drives */
    1088     if(numtoinsert && pciFirst) {
    1089 
     1201    if (numtoinsert && pciFirst)
     1202    {
    10901203      RECORDINSERT ri;
    10911204
     
    10971210      ri.cRecordsInsert     = numtoinsert;
    10981211      ri.fInvalidateRecord  = FALSE;
    1099       if(!WinSendMsg(hwndCnr,
    1100                      CM_INSERTRECORD,
    1101                      MPFROMP(pciFirst),
    1102                      MPFROMP(&ri)))
     1212      if (!WinSendMsg(hwndCnr,
     1213                      CM_INSERTRECORD,
     1214                      MPFROMP(pciFirst),
     1215                      MPFROMP(&ri)))
    11031216        Win_Error(hwndCnr,hwndCnr,__FILE__,__LINE__,
    11041217                  GetPString(IDS_FILLDIRERR5TEXT));
    11051218    }
    11061219    /* move cursor onto the default drive rather than the first drive */
    1107     if(!fSwitchTree) {
     1220    if (!fSwitchTree)
     1221    {
    11081222      pci = (PCNRITEM)WinSendMsg(hwndCnr,
    11091223                                 CM_QUERYRECORD,
    11101224                                 MPVOID,
    11111225                                 MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER));
    1112       while(pci && (INT)pci != -1) {
    1113         if((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum) {
     1226      while(pci && (INT)pci != -1)
     1227      {
     1228        if ((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum)
     1229        {
    11141230          WinSendMsg(hwndCnr,
    11151231                     CM_SETRECORDEMPHASIS,
     
    11251241    }
    11261242
    1127     if(hwndParent)
     1243    if (hwndParent)
    11281244      WinSendMsg(WinWindowFromID(WinQueryWindow(hwndParent,QW_PARENT),
    11291245                 MAIN_DRIVELIST),
     
    11321248                 MPVOID);
    11331249
    1134     if(fShowEnv) {
    1135 
     1250    if (fShowEnv)
     1251    {
    11361252      RECORDINSERT ri;
    11371253
     
    11401256                             MPFROMLONG(EXTRA_RECORD_BYTES2),
    11411257                             MPFROMLONG(1));
    1142       if(pciParent) {
     1258      if (pciParent)
     1259      {
    11431260        pciParent->flags |= RECFLAGS_ENV;
    11441261        strcpy(pciParent->szFileName,GetPString(IDS_ENVVARSTEXT));
     
    11551272        ri.cRecordsInsert     = 1;
    11561273        ri.fInvalidateRecord  = FALSE;
    1157         if(WinSendMsg(hwndCnr,
    1158                       CM_INSERTRECORD,
    1159                       MPFROMP(pciParent),
    1160                       MPFROMP(&ri))) {
     1274        if (WinSendMsg(hwndCnr,
     1275                       CM_INSERTRECORD,
     1276                       MPFROMP(pciParent),
     1277                       MPFROMP(&ri))) {
    11611278
    11621279          char *p,*pp;
     
    11651282          while(*p == ' ')
    11661283            p++;
    1167           while(*p) {
     1284          while (*p)
     1285          {
    11681286            *FileSystem = 0;
    11691287            pp = FileSystem;
     
    11731291            while(*p == ' ')
    11741292              p++;
    1175             if(*FileSystem &&
    1176                (!stricmp(FileSystem,"LIBPATH") ||
    1177                 getenv(FileSystem))) {
     1293            if (*FileSystem &&
     1294                (!stricmp(FileSystem,"LIBPATH") ||
     1295                 getenv(FileSystem)))
     1296            {
    11781297              pci = WinSendMsg(hwndCnr,
    11791298                               CM_ALLOCRECORD,
    11801299                               MPFROMLONG(EXTRA_RECORD_BYTES2),
    11811300                               MPFROMLONG(1));
    1182               if(pci) {
     1301              if (pci)
     1302              {
    11831303                pci->flags |= RECFLAGS_ENV;
    11841304                sprintf(pci->szFileName,
     
    11971317                ri.cRecordsInsert     = 1;
    11981318                ri.fInvalidateRecord  = FALSE;
    1199                 if(!WinSendMsg(hwndCnr,
    1200                                CM_INSERTRECORD,
    1201                                MPFROMP(pci),
    1202                                MPFROMP(&ri))) {
     1319                if (!WinSendMsg(hwndCnr,
     1320                                CM_INSERTRECORD,
     1321                                MPFROMP(pci),
     1322                                MPFROMP(&ri))) {
    12031323                  Win_Error(hwndCnr,hwndCnr,__FILE__,__LINE__,
    12041324                            GetPString(IDS_FILLDIRERR5TEXT));
     
    12281348                               CM_QUERYRECORD,
    12291349                               MPVOID,
    1230                                MPFROM2SHORT(CMA_FIRST,
    1231                                             CMA_ITEMORDER));
    1232     while(pci && (INT)pci != -1) {
     1350                               MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
     1351    while (pci && (INT)pci != -1)
     1352    {
    12331353      pciNext = (PCNRITEM)WinSendMsg(hwndCnr,
    12341354                                     CM_QUERYRECORD,
    12351355                                     MPFROMP(pci),
    1236                                      MPFROM2SHORT(CMA_NEXT,
    1237                                                   CMA_ITEMORDER));
    1238       if(!(pci->flags & RECFLAGS_ENV)) {
    1239         if((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum ||
    1240            toupper(*pci->szFileName) > 'B') {
    1241           if(!(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_INVALID) &&
     1356                                     MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
     1357      if (!(pci->flags & RECFLAGS_ENV))
     1358      {
     1359        if ((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum ||
     1360            toupper(*pci->szFileName) > 'B')
     1361        {
     1362          if (!(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_INVALID) &&
    12421363             !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOPRESCAN) &&
    12431364             (!fNoRemovableScan ||
    1244               !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE))) {
    1245             if(!Stubby(hwndCnr,pci)) {
     1365              !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE)))
     1366          {
     1367            if (!Stubby(hwndCnr,pci))
     1368            {
    12461369              WinSendMsg(hwndCnr,
    12471370                         CM_INVALIDATERECORD,
     
    12571380                     MPFROMP(&pci),
    12581381                     MPFROM2SHORT(1,CMA_ERASE | CMA_REPOSITION));
     1382
    12591383        WinSendMsg(WinWindowFromID(WinQueryWindow(hwndParent,QW_PARENT),
    12601384                   MAIN_DRIVELIST),
     
    12671391      pci = pciNext;
    12681392    }
    1269     if(hwndParent)
     1393    if (hwndParent)
    12701394      WinSendMsg(WinWindowFromID(WinQueryWindow(hwndParent,QW_PARENT),
    12711395                 MAIN_DRIVELIST),LM_SELECTITEM,MPFROM2SHORT(0,0),
     
    12771401                               MPFROM2SHORT(CMA_FIRST,
    12781402                                            CMA_ITEMORDER));
    1279     while(pci && (INT)pci != -1) {
     1403    while (pci && (INT)pci != -1)
     1404    {
    12801405      pciNext = (PCNRITEM)WinSendMsg(hwndCnr,
    12811406                                     CM_QUERYRECORD,
     
    12831408                                     MPFROM2SHORT(CMA_NEXT,
    12841409                                                  CMA_ITEMORDER));
    1285       if(pci->flags & RECFLAGS_ENV) {
     1410      if (pci->flags & RECFLAGS_ENV)
     1411      {
    12861412        pci = (PCNRITEM)WinSendMsg(hwndCnr,
    12871413                                   CM_QUERYRECORD,
     
    12891415                                   MPFROM2SHORT(CMA_FIRSTCHILD,
    12901416                                                CMA_ITEMORDER));
    1291         while(pci && (INT)pci != -1) {
    1292           if(pci->flags & RECFLAGS_ENV)
     1417        while (pci && (INT)pci != -1)
     1418        {
     1419          if (pci->flags & RECFLAGS_ENV)
    12931420            FleshEnv(hwndCnr,pci);
    12941421          pci = (PCNRITEM)WinSendMsg(hwndCnr,
     
    13081435
    13091436  }
    1310   else {
     1437  else
     1438  {
    13111439    Win_Error(hwndCnr,hwndCnr,__FILE__,__LINE__,
    13121440              GetPString(IDS_FILLDIRERR7TEXT));
    13131441    exit(0);
    13141442  }
    1315   if(!drivesbuilt && hwndMain)
     1443  if (!drivesbuilt && hwndMain)
    13161444    PostMsg(hwndMain,
    13171445            UM_BUILDDRIVES,
     
    13251453    BOOL includesyours = FALSE;
    13261454
    1327     if(*suggest ||
    1328        (!(driveflags[1] & DRIVE_IGNORE) &&
    1329         fFirstTime)) {
    1330       if(!DosDevConfig(&info,
     1455    if (*suggest ||
     1456        (!(driveflags[1] & DRIVE_IGNORE) &&
     1457         fFirstTime))
     1458    {
     1459      if (!DosDevConfig(&info,
    13311460                       DEVINFO_FLOPPY) &&
    1332          info == 1) {
    1333         if(!*suggest) {
     1461           info == 1)
     1462      {
     1463        if (!*suggest)
     1464        {
    13341465          *suggest = '/';
    13351466          suggest[1] = 0;
     
    13401471      }
    13411472    }
    1342     if(*suggest) {
    1343       for(x = 2;x < 26;x++) {
    1344         if(driveflags[x] & DRIVE_IGNORE) {
     1473    if (*suggest)
     1474    {
     1475      for(x = 2;x < 26;x++)
     1476      {
     1477        if (driveflags[x] & DRIVE_IGNORE)
     1478        {
    13451479          includesyours = TRUE;
    13461480          sprintf(suggest + strlen(suggest),
     
    13501484      }
    13511485      strcat(suggest," %*");
    1352       if(saymsg(MB_YESNO | MB_ICONEXCLAMATION,
    1353                 (hwndParent) ? hwndParent : hwndCnr,
    1354                 GetPString(IDS_SUGGESTTITLETEXT),
    1355                 GetPString(IDS_SUGGEST1TEXT),
    1356                 (includesyours) ?
    1357                  GetPString(IDS_SUGGEST2TEXT) :
    1358                  NullStr,
    1359                 suggest) == MBID_YES) {
    1360 
     1486      if (saymsg(MB_YESNO | MB_ICONEXCLAMATION,
     1487                 (hwndParent) ? hwndParent : hwndCnr,
     1488                 GetPString(IDS_SUGGESTTITLETEXT),
     1489                 GetPString(IDS_SUGGEST1TEXT),
     1490                 (includesyours) ? GetPString(IDS_SUGGEST2TEXT) : NullStr,
     1491                 suggest) == MBID_YES)
     1492      {
    13611493        char s[64];
    13621494
    1363         sprintf(s,
    1364                 "PARAMETERS=%s",
    1365                 suggest);
     1495        sprintf(s, "PARAMETERS=%s", suggest);
    13661496        WinCreateObject(WPProgram,
    13671497                        "FM/2",
     
    14081538  }
    14091539  didonce = TRUE;
    1410   return 0;
    1411 }
    1412 
     1540
     1541} // FillTreeCnr
     1542
Note: See TracChangeset for help on using the changeset viewer.