Changeset 551 for trunk/dll/update.c


Ignore:
Timestamp:
Feb 28, 2007, 2:33:51 AM (19 years ago)
Author:
Gregg Young
Message:

Indentation cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/update.c

    r385 r551  
    3636#pragma alloc_text(UPDATECNR,UpdateCnrRecord,UpdateCnrList)
    3737
    38 PCNRITEM UpdateCnrRecord (HWND hwndCnr,CHAR *filename,BOOL partial,
    39                           DIRCNRDATA *dcd)
     38PCNRITEM UpdateCnrRecord(HWND hwndCnr, CHAR * filename, BOOL partial,
     39                         DIRCNRDATA * dcd)
    4040{
    41   PCNRITEM      pci;
    42   FILEFINDBUF4  ffb;
    43   HDIR          hDir = HDIR_CREATE;
    44   ULONG         nm = 1L;
    45   ULONG         oldemphasis = 0;
    46   APIRET        status;
     41  PCNRITEM pci;
     42  FILEFINDBUF4 ffb;
     43  HDIR hDir = HDIR_CREATE;
     44  ULONG nm = 1L;
     45  ULONG oldemphasis = 0;
     46  APIRET status;
     47
    4748#ifdef DEBUG
    48   BOOL existed=FALSE,updated=FALSE,added=FALSE,deleted=FALSE,found=FALSE;
     49  BOOL existed = FALSE, updated = FALSE, added = FALSE, deleted =
     50    FALSE, found = FALSE;
    4951#endif
    5052
    51   if(!filename || !*filename)
    52     return (PCNRITEM)NULL;
    53   if(IsFullName(filename)) {
    54     if(driveflags[toupper(*filename) - 'A'] & DRIVE_NOTWRITEABLE)
     53  if (!filename || !*filename)
     54    return (PCNRITEM) NULL;
     55  if (IsFullName(filename)) {
     56    if (driveflags[toupper(*filename) - 'A'] & DRIVE_NOTWRITEABLE)
    5557      /* ignore non-writeable drives */
    56       return (PCNRITEM)NULL;
     58      return (PCNRITEM) NULL;
    5759  }
    5860  status = DosFindFirst(filename,
    59                         &hDir,
    60                         FILE_NORMAL   | FILE_DIRECTORY |
    61                         FILE_ARCHIVED | FILE_READONLY |
    62                         FILE_HIDDEN   | FILE_SYSTEM,
    63                         &ffb,
    64                         sizeof(ffb),
    65                         &nm,
    66                         FIL_QUERYEASIZE);
    67   if(!status) {
     61                        &hDir,
     62                        FILE_NORMAL | FILE_DIRECTORY |
     63                        FILE_ARCHIVED | FILE_READONLY |
     64                        FILE_HIDDEN | FILE_SYSTEM,
     65                        &ffb, sizeof(ffb), &nm, FIL_QUERYEASIZE);
     66  if (!status) {
    6867#ifdef DEBUG
    6968    existed = TRUE;
     
    7170    /* file exists */
    7271    DosFindClose(hDir);
    73     if(!dcd)
     72    if (!dcd)
    7473      dcd = INSTDATA(hwndCnr);
    7574/*
     
    7877      return (PCNRITEM)NULL;
    7978*/
    80     if(dcd->type == ARC_FRAME)
    81       return (PCNRITEM)NULL;
    82     if(*dcd->directory) {
    83 
    84       CHAR *p,temp;
    85 
    86       p = strrchr(filename,'\\');
    87       if(p) {
    88         if(p < filename + 3)
    89           p++;
    90         temp = *p;
    91         *p = 0;
    92         if(stricmp(filename,dcd->directory)) {
    93           *p = temp;
    94           return (PCNRITEM)NULL;
    95         }
    96         *p = temp;
     79    if (dcd->type == ARC_FRAME)
     80      return (PCNRITEM) NULL;
     81    if (*dcd->directory) {
     82
     83      CHAR *p, temp;
     84
     85      p = strrchr(filename, '\\');
     86      if (p) {
     87        if (p < filename + 3)
     88          p++;
     89        temp = *p;
     90        *p = 0;
     91        if (stricmp(filename, dcd->directory)) {
     92          *p = temp;
     93          return (PCNRITEM) NULL;
     94        }
     95        *p = temp;
    9796      }
    9897      else
    99         return (PCNRITEM)NULL;
     98        return (PCNRITEM) NULL;
    10099    }
    101100    pci = FindCnrRecord(hwndCnr,
    102                         filename,
    103                         (PCNRITEM)NULL,
    104                         partial,
    105                         FALSE,
    106                         TRUE);
    107 Update:
    108     if(pci) {     /* update record? */
     101                        filename, (PCNRITEM) NULL, partial, FALSE, TRUE);
     102  Update:
     103    if (pci) {                          /* update record? */
    109104#ifdef DEBUG
    110       found=TRUE;
     105      found = TRUE;
    111106#endif
    112       if((!fForceUpper && !fForceLower &&
    113          strcmp(pci->szFileName,filename)) ||
    114          pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile ||
    115          pci->easize != CBLIST_TO_EASIZE(ffb.cbList) ||
    116          pci->date.day != ffb.fdateLastWrite.day ||
    117          pci->date.month != ffb.fdateLastWrite.month ||
    118          pci->date.year != ffb.fdateLastWrite.year + 1980 ||
    119          pci->time.seconds != ffb.ftimeLastWrite.twosecs * 2 ||
    120          pci->time.minutes != ffb.ftimeLastWrite.minutes ||
    121          pci->time.hours != ffb.ftimeLastWrite.hours ||
    122          pci->ladate.day != ffb.fdateLastAccess.day ||
    123          pci->ladate.month != ffb.fdateLastAccess.month ||
    124          pci->ladate.year != ffb.fdateLastAccess.year + 1980 ||
    125          pci->latime.seconds != ffb.ftimeLastAccess.twosecs * 2 ||
    126          pci->latime.minutes != ffb.ftimeLastAccess.minutes ||
    127          pci->latime.hours != ffb.ftimeLastAccess.hours) { /* changed; update */
     107      if ((!fForceUpper && !fForceLower && strcmp(pci->szFileName, filename)) || pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile || pci->easize != CBLIST_TO_EASIZE(ffb.cbList) || pci->date.day != ffb.fdateLastWrite.day || pci->date.month != ffb.fdateLastWrite.month || pci->date.year != ffb.fdateLastWrite.year + 1980 || pci->time.seconds != ffb.ftimeLastWrite.twosecs * 2 || pci->time.minutes != ffb.ftimeLastWrite.minutes || pci->time.hours != ffb.ftimeLastWrite.hours || pci->ladate.day != ffb.fdateLastAccess.day || pci->ladate.month != ffb.fdateLastAccess.month || pci->ladate.year != ffb.fdateLastAccess.year + 1980 || pci->latime.seconds != ffb.ftimeLastAccess.twosecs * 2 || pci->latime.minutes != ffb.ftimeLastAccess.minutes || pci->latime.hours != ffb.ftimeLastAccess.hours) {   /* changed; update */
    128108#ifdef DEBUG
    129         updated=TRUE;
     109        updated = TRUE;
    130110#endif
    131         *ffb.achName = 0;
    132         ffb.cchName = 0;
    133         FillInRecordFromFFB(hwndCnr,pci,filename,&ffb,partial,dcd);
    134         if(strlen(pci->szFileName) < 4) {
    135           *pci->szFileName = toupper(*pci->szFileName);
    136           if(isalpha(*pci->szFileName) && toupper(*pci->szFileName) > 'B') {
    137             if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM)
    138               pci->rc.hptrIcon = hptrCDROM;
    139             else
    140               pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ?
    141                                   hptrRemovable :
    142                                   (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ?
    143                                   hptrRemote :
    144                                   (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ?
    145                                   hptrZipstrm : hptrDrive;
    146           }
    147           else
    148             pci->rc.hptrIcon = hptrFloppy;
    149         }
    150         oldemphasis = pci->rc.flRecordAttr &
    151                       (CRA_SELECTED | CRA_CURSORED);
    152         if(oldemphasis)
    153           WinSendMsg(hwndCnr,
    154                      CM_SETRECORDEMPHASIS,
    155                      MPFROMP(pci),
    156                      MPFROM2SHORT(FALSE,
    157                                   oldemphasis));
    158         WinSendMsg(hwndCnr,
    159                    CM_INVALIDATERECORD,
    160                    MPFROMP(&pci),
    161                    MPFROM2SHORT(1,
    162                                 /* CMA_ERASE | */CMA_TEXTCHANGED));
    163         if(oldemphasis)
    164           WinSendMsg(hwndCnr,
    165                      CM_SETRECORDEMPHASIS,
    166                      MPFROMP(pci),
    167                      MPFROM2SHORT(TRUE,
    168                                   oldemphasis));
     111        *ffb.achName = 0;
     112        ffb.cchName = 0;
     113        FillInRecordFromFFB(hwndCnr, pci, filename, &ffb, partial, dcd);
     114        if (strlen(pci->szFileName) < 4) {
     115          *pci->szFileName = toupper(*pci->szFileName);
     116          if (isalpha(*pci->szFileName) && toupper(*pci->szFileName) > 'B') {
     117            if (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM)
     118              pci->rc.hptrIcon = hptrCDROM;
     119            else
     120              pci->rc.hptrIcon =
     121                (driveflags[toupper(*pci->szFileName) - 'A'] &
     122                 DRIVE_REMOVABLE) ? hptrRemovable
     123                : (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE)
     124                ? hptrRemote : (driveflags[toupper(*pci->szFileName) - 'A'] &
     125                                DRIVE_ZIPSTREAM) ? hptrZipstrm : hptrDrive;
     126          }
     127          else
     128            pci->rc.hptrIcon = hptrFloppy;
     129        }
     130        oldemphasis = pci->rc.flRecordAttr & (CRA_SELECTED | CRA_CURSORED);
     131        if (oldemphasis)
     132          WinSendMsg(hwndCnr,
     133                     CM_SETRECORDEMPHASIS,
     134                     MPFROMP(pci), MPFROM2SHORT(FALSE, oldemphasis));
     135        WinSendMsg(hwndCnr,
     136                   CM_INVALIDATERECORD, MPFROMP(&pci), MPFROM2SHORT(1,
     137                                                                    /* CMA_ERASE | */
     138                                                                    CMA_TEXTCHANGED));
     139        if (oldemphasis)
     140          WinSendMsg(hwndCnr,
     141                     CM_SETRECORDEMPHASIS,
     142                     MPFROMP(pci), MPFROM2SHORT(TRUE, oldemphasis));
    169143      }
    170       else  /* existed, unchanged, do nothing but return */
    171         return pci;
     144      else                              /* existed, unchanged, do nothing but return */
     145        return pci;
    172146    }
    173     else {        /* add record */
     147    else {                              /* add record */
    174148#ifdef DEBUG
    175       added=TRUE;
     149      added = TRUE;
    176150#endif
    177       if(dcd->type == DIR_FRAME) {
    178 
    179         RECORDINSERT ri;
    180         ULONGLONG ullTotalBytes;
    181 
    182         pci = WinSendMsg(hwndCnr,
    183                          CM_ALLOCRECORD,
    184                          MPFROMLONG(EXTRA_RECORD_BYTES),
    185                          MPFROMLONG(1L));
    186         if(pci) {
    187           *ffb.achName = 0;
    188           ullTotalBytes = FillInRecordFromFFB(hwndCnr,
    189                                               pci,
    190                                               filename,
    191                                               &ffb,
    192                                               partial,
    193                                               dcd);
    194           if(strlen(pci->szFileName) < 4) {
    195             *pci->szFileName = toupper(*pci->szFileName);
    196             if(isalpha(*pci->szFileName) &&
    197                toupper(*pci->szFileName) > 'B') {
    198               if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM)
    199                 pci->rc.hptrIcon = hptrCDROM;
    200               else
    201                 pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ?
    202                                     hptrRemovable :
    203                                     (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ?
    204                                     hptrRemote :
    205                                     (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ?
    206                                     hptrZipstrm : hptrDrive;
    207             }
    208             else
    209               pci->rc.hptrIcon = hptrFloppy;
    210           }
    211           memset(&ri,0,sizeof(RECORDINSERT));
    212           ri.cb                 = sizeof(RECORDINSERT);
    213           ri.pRecordOrder       = (PRECORDCORE)CMA_END;
    214           ri.pRecordParent      = (PRECORDCORE)NULL;
    215           ri.zOrder             = (USHORT)CMA_TOP;
    216           ri.cRecordsInsert     = 1L;
    217           ri.fInvalidateRecord  = TRUE;
    218           if (WinSendMsg(hwndCnr,
    219                         CM_INSERTRECORD,
    220                         MPFROMP(pci),
    221                         MPFROMP(&ri)) &&
    222               ullTotalBytes)
    223           {
    224             dcd->ullTotalBytes += ullTotalBytes;
    225             PostMsg(hwndCnr,
    226                     UM_RESCAN,
    227                     MPVOID,
    228                     MPVOID);
    229             if(pci->attrFile & FILE_DIRECTORY)
    230               Stubby(hwndCnr,pci);
    231           }
    232         }
     151      if (dcd->type == DIR_FRAME) {
     152
     153        RECORDINSERT ri;
     154        ULONGLONG ullTotalBytes;
     155
     156        pci = WinSendMsg(hwndCnr,
     157                         CM_ALLOCRECORD,
     158                         MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1L));
     159        if (pci) {
     160          *ffb.achName = 0;
     161          ullTotalBytes = FillInRecordFromFFB(hwndCnr,
     162                                              pci,
     163                                              filename, &ffb, partial, dcd);
     164          if (strlen(pci->szFileName) < 4) {
     165            *pci->szFileName = toupper(*pci->szFileName);
     166            if (isalpha(*pci->szFileName) && toupper(*pci->szFileName) > 'B') {
     167              if (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM)
     168                pci->rc.hptrIcon = hptrCDROM;
     169              else
     170                pci->rc.hptrIcon =
     171                  (driveflags[toupper(*pci->szFileName) - 'A'] &
     172                   DRIVE_REMOVABLE) ? hptrRemovable
     173                  : (driveflags[toupper(*pci->szFileName) - 'A'] &
     174                     DRIVE_REMOTE) ? hptrRemote
     175                  : (driveflags[toupper(*pci->szFileName) - 'A'] &
     176                     DRIVE_ZIPSTREAM) ? hptrZipstrm : hptrDrive;
     177            }
     178            else
     179              pci->rc.hptrIcon = hptrFloppy;
     180          }
     181          memset(&ri, 0, sizeof(RECORDINSERT));
     182          ri.cb = sizeof(RECORDINSERT);
     183          ri.pRecordOrder = (PRECORDCORE) CMA_END;
     184          ri.pRecordParent = (PRECORDCORE) NULL;
     185          ri.zOrder = (USHORT) CMA_TOP;
     186          ri.cRecordsInsert = 1L;
     187          ri.fInvalidateRecord = TRUE;
     188          if (WinSendMsg(hwndCnr,
     189                         CM_INSERTRECORD,
     190                         MPFROMP(pci), MPFROMP(&ri)) && ullTotalBytes) {
     191            dcd->ullTotalBytes += ullTotalBytes;
     192            PostMsg(hwndCnr, UM_RESCAN, MPVOID, MPVOID);
     193            if (pci->attrFile & FILE_DIRECTORY)
     194              Stubby(hwndCnr, pci);
     195          }
     196        }
    233197      }
    234       else if(ffb.attrFile & FILE_DIRECTORY) {
    235 
    236         /* check all parts and insert as required */
    237         CHAR    *p,temp;
    238         PCNRITEM pciParent = NULL,pciT;
    239 
    240         p = strchr(filename,'\\');
    241         if(p) {
    242           while(p && *p) {
    243             if(p < filename + 3)
    244               p++;
    245             temp = *p;
    246             *p = 0;
    247             pciT = FindCnrRecord(hwndCnr,
    248                                  filename,
    249                                  NULL,
    250                                  partial,
    251                                  FALSE,
    252                                  TRUE);
    253             if(!pciT || (INT)pciT == -1) {
    254               pci = WinSendMsg(hwndCnr,
    255                                CM_ALLOCRECORD,
    256                                MPFROMLONG(EXTRA_RECORD_BYTES),
    257                                MPFROMLONG(1L));
    258               if(pci) {
    259 
    260                 RECORDINSERT ri;
    261 
    262                 *ffb.achName = 0;
    263                 FillInRecordFromFFB(hwndCnr,
    264                                     pci,
    265                                     filename,
    266                                     &ffb,
    267                                     partial,
    268                                     dcd);
    269                 if(strlen(pci->szFileName) < 4) {
    270                   *pci->szFileName = toupper(*pci->szFileName);
    271                   if(isalpha(*pci->szFileName) && toupper(*pci->szFileName) > 'B') {
    272                     if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM)
    273                       pci->rc.hptrIcon = hptrCDROM;
    274                     else
    275                       pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ?
    276                                           hptrRemovable :
    277                                           (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ?
    278                                           hptrRemote :
    279                                           (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ?
    280                                           hptrZipstrm : hptrDrive;
    281                   }
    282                   else
    283                     pci->rc.hptrIcon = hptrFloppy;
    284                 }
    285                 memset(&ri,0,sizeof(RECORDINSERT));
    286                 ri.cb                 = sizeof(RECORDINSERT);
    287                 ri.pRecordOrder       = (PRECORDCORE)CMA_END;
    288                 ri.pRecordParent      = (PRECORDCORE)pciParent;
    289                 ri.zOrder             = (USHORT)CMA_TOP;
    290                 ri.cRecordsInsert     = 1L;
    291                 ri.fInvalidateRecord  = TRUE;
    292                 if(WinSendMsg(hwndCnr,
    293                               CM_INSERTRECORD,
    294                               MPFROMP(pci),
    295                               MPFROMP(&ri))) {
    296                   Flesh(hwndCnr,pci);
    297                   *p = temp;
    298                   pci = FindCnrRecord(hwndCnr,
    299                                       filename,
    300                                       pciT,
    301                                       partial,
    302                                       FALSE,
    303                                       TRUE);
    304                   if(pci)
    305                     goto Update;
    306                 }
    307               }
    308             }
    309             else {
    310               pciParent = pciT;
    311               if(!(pciT->rc.flRecordAttr & CRA_EXPANDED)) {
    312                 Flesh(hwndCnr,pciT);
    313                 *p = temp;
    314                 pci = FindCnrRecord(hwndCnr,
    315                                     filename,
    316                                     pciT,
    317                                     partial,
    318                                     FALSE,
    319                                     TRUE);
    320                 if(pci)
    321                   goto Update;
    322               }
    323             }
    324             *p = temp;
    325             p = strchr(p + ((temp == '\\') ? 1 : 0),'\\');
    326           }
    327         }
    328         pci = WinSendMsg(hwndCnr,
    329                          CM_ALLOCRECORD,
    330                          MPFROMLONG(EXTRA_RECORD_BYTES),
    331                          MPFROMLONG(1L));
    332         if(pci) {
    333 
    334           RECORDINSERT ri;
    335           ULONGLONG ullTotalBytes;
    336 
    337           *ffb.achName = 0;
    338           ullTotalBytes = FillInRecordFromFFB(hwndCnr,
     198      else if (ffb.attrFile & FILE_DIRECTORY) {
     199
     200        /* check all parts and insert as required */
     201        CHAR *p, temp;
     202        PCNRITEM pciParent = NULL, pciT;
     203
     204        p = strchr(filename, '\\');
     205        if (p) {
     206          while (p && *p) {
     207            if (p < filename + 3)
     208              p++;
     209            temp = *p;
     210            *p = 0;
     211            pciT = FindCnrRecord(hwndCnr,
     212                                 filename, NULL, partial, FALSE, TRUE);
     213            if (!pciT || (INT) pciT == -1) {
     214              pci = WinSendMsg(hwndCnr,
     215                               CM_ALLOCRECORD,
     216                               MPFROMLONG(EXTRA_RECORD_BYTES),
     217                               MPFROMLONG(1L));
     218              if (pci) {
     219
     220                RECORDINSERT ri;
     221
     222                *ffb.achName = 0;
     223                FillInRecordFromFFB(hwndCnr,
     224                                    pci, filename, &ffb, partial, dcd);
     225                if (strlen(pci->szFileName) < 4) {
     226                  *pci->szFileName = toupper(*pci->szFileName);
     227                  if (isalpha(*pci->szFileName)
     228                      && toupper(*pci->szFileName) > 'B') {
     229                    if (driveflags[toupper(*pci->szFileName) - 'A'] &
     230                        DRIVE_CDROM)
     231                      pci->rc.hptrIcon = hptrCDROM;
     232                    else
     233                      pci->rc.hptrIcon =
     234                        (driveflags[toupper(*pci->szFileName) - 'A'] &
     235                         DRIVE_REMOVABLE) ? hptrRemovable
     236                        : (driveflags[toupper(*pci->szFileName) - 'A'] &
     237                           DRIVE_REMOTE) ? hptrRemote
     238                        : (driveflags[toupper(*pci->szFileName) - 'A'] &
     239                           DRIVE_ZIPSTREAM) ? hptrZipstrm : hptrDrive;
     240                  }
     241                  else
     242                    pci->rc.hptrIcon = hptrFloppy;
     243                }
     244                memset(&ri, 0, sizeof(RECORDINSERT));
     245                ri.cb = sizeof(RECORDINSERT);
     246                ri.pRecordOrder = (PRECORDCORE) CMA_END;
     247                ri.pRecordParent = (PRECORDCORE) pciParent;
     248                ri.zOrder = (USHORT) CMA_TOP;
     249                ri.cRecordsInsert = 1L;
     250                ri.fInvalidateRecord = TRUE;
     251                if (WinSendMsg(hwndCnr,
     252                               CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
     253                  Flesh(hwndCnr, pci);
     254                  *p = temp;
     255                  pci = FindCnrRecord(hwndCnr,
     256                                      filename, pciT, partial, FALSE, TRUE);
     257                  if (pci)
     258                    goto Update;
     259                }
     260              }
     261            }
     262            else {
     263              pciParent = pciT;
     264              if (!(pciT->rc.flRecordAttr & CRA_EXPANDED)) {
     265                Flesh(hwndCnr, pciT);
     266                *p = temp;
     267                pci = FindCnrRecord(hwndCnr,
     268                                    filename, pciT, partial, FALSE, TRUE);
     269                if (pci)
     270                  goto Update;
     271              }
     272            }
     273            *p = temp;
     274            p = strchr(p + ((temp == '\\') ? 1 : 0), '\\');
     275          }
     276        }
     277        pci = WinSendMsg(hwndCnr,
     278                         CM_ALLOCRECORD,
     279                         MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1L));
     280        if (pci) {
     281
     282          RECORDINSERT ri;
     283          ULONGLONG ullTotalBytes;
     284
     285          *ffb.achName = 0;
     286          ullTotalBytes = FillInRecordFromFFB(hwndCnr,
    339287                                              pci,
    340                                               filename,
    341                                               &ffb,
    342                                               partial,
    343                                               dcd);
    344           if(strlen(pci->szFileName) < 4) {
    345             *pci->szFileName = toupper(*pci->szFileName);
    346             if(isalpha(*pci->szFileName) &&
    347                toupper(*pci->szFileName) > 'B') {
    348               if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM)
    349                 pci->rc.hptrIcon = hptrCDROM;
    350               else
    351                 pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ?
    352                                     hptrRemovable :
    353                                     (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ?
    354                                     hptrRemote :
    355                                     (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ?
    356                                     hptrZipstrm : hptrDrive;
    357             }
    358             else
    359               pci->rc.hptrIcon = hptrFloppy;
    360           }
    361           memset(&ri,0,sizeof(RECORDINSERT));
    362           ri.cb                 = sizeof(RECORDINSERT);
    363           ri.pRecordOrder       = (PRECORDCORE)CMA_END;
    364           ri.pRecordParent      = (PRECORDCORE)pciParent;
    365           ri.zOrder             = (USHORT)CMA_TOP;
    366           ri.cRecordsInsert     = 1L;
    367           ri.fInvalidateRecord  = TRUE;
    368           if(WinSendMsg(hwndCnr,
    369                         CM_INSERTRECORD,
    370                         MPFROMP(pci),
    371                         MPFROMP(&ri)) &&
    372              ullTotalBytes)
    373           {
    374             if (dcd->type == DIR_FRAME) {
    375               dcd->ullTotalBytes += ullTotalBytes;
    376             }
    377             Stubby(hwndCnr,pci);
    378           }
    379         }
     288                                              filename, &ffb, partial, dcd);
     289          if (strlen(pci->szFileName) < 4) {
     290            *pci->szFileName = toupper(*pci->szFileName);
     291            if (isalpha(*pci->szFileName) && toupper(*pci->szFileName) > 'B') {
     292              if (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM)
     293                pci->rc.hptrIcon = hptrCDROM;
     294              else
     295                pci->rc.hptrIcon =
     296                  (driveflags[toupper(*pci->szFileName) - 'A'] &
     297                   DRIVE_REMOVABLE) ? hptrRemovable
     298                  : (driveflags[toupper(*pci->szFileName) - 'A'] &
     299                     DRIVE_REMOTE) ? hptrRemote
     300                  : (driveflags[toupper(*pci->szFileName) - 'A'] &
     301                     DRIVE_ZIPSTREAM) ? hptrZipstrm : hptrDrive;
     302            }
     303            else
     304              pci->rc.hptrIcon = hptrFloppy;
     305          }
     306          memset(&ri, 0, sizeof(RECORDINSERT));
     307          ri.cb = sizeof(RECORDINSERT);
     308          ri.pRecordOrder = (PRECORDCORE) CMA_END;
     309          ri.pRecordParent = (PRECORDCORE) pciParent;
     310          ri.zOrder = (USHORT) CMA_TOP;
     311          ri.cRecordsInsert = 1L;
     312          ri.fInvalidateRecord = TRUE;
     313          if (WinSendMsg(hwndCnr,
     314                         CM_INSERTRECORD,
     315                         MPFROMP(pci), MPFROMP(&ri)) && ullTotalBytes) {
     316            if (dcd->type == DIR_FRAME) {
     317              dcd->ullTotalBytes += ullTotalBytes;
     318            }
     319            Stubby(hwndCnr, pci);
     320          }
     321        }
    380322      }
    381323    }
    382324  }
    383   else if((pci = FindCnrRecord(hwndCnr,
    384                                filename,
    385                                (PCNRITEM)NULL,
    386                                partial,
    387                                FALSE,
    388                                TRUE)) !=
    389            NULL && (INT)pci != -1 && strlen(pci->szFileName) > 3) {
     325  else if ((pci = FindCnrRecord(hwndCnr,
     326                                filename,
     327                                (PCNRITEM) NULL,
     328                                partial,
     329                                FALSE,
     330                                TRUE)) !=
     331           NULL && (INT) pci != -1 && strlen(pci->szFileName) > 3) {
    390332    /* file doesn't exist; delete record */
    391333#ifdef DEBUG
    392     found=TRUE;
    393     deleted=TRUE;
     334    found = TRUE;
     335    deleted = TRUE;
    394336#endif
    395     if(!dcd)
     337    if (!dcd)
    396338      dcd = INSTDATA(hwndCnr);
    397     if(pci->rc.flRecordAttr & CRA_SELECTED)
     339    if (pci->rc.flRecordAttr & CRA_SELECTED)
    398340      WinSendMsg(hwndCnr,
    399                  CM_SETRECORDEMPHASIS,
    400                  MPFROMP(pci),
    401                  MPFROM2SHORT(FALSE,
    402                               CRA_SELECTED));
    403     if(dcd->type == DIR_FRAME)
     341                 CM_SETRECORDEMPHASIS,
     342                 MPFROMP(pci), MPFROM2SHORT(FALSE, CRA_SELECTED));
     343    if (dcd->type == DIR_FRAME)
    404344      dcd->ullTotalBytes -= pci->cbFile + pci->easize;
    405345    WinSendMsg(hwndCnr,
    406                CM_REMOVERECORD,
    407                MPFROMP(&pci),
    408                MPFROM2SHORT(1,
    409                             CMA_FREE | CMA_INVALIDATE));
    410     pci = (PCNRITEM)NULL;
    411     PostMsg(hwndCnr,
    412             UM_RESCAN,
    413             MPVOID,
    414             MPVOID);
     346               CM_REMOVERECORD,
     347               MPFROMP(&pci), MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE));
     348    pci = (PCNRITEM) NULL;
     349    PostMsg(hwndCnr, UM_RESCAN, MPVOID, MPVOID);
    415350  }
    416351#ifdef DEBUG
    417352  {
    418353    char s[CCHMAXPATH + 80];
    419     sprintf(s,"%s:%s%s%s%s%s",filename,(existed) ? " Existed" : "",
    420             (updated) ? " Updated" : "",(added) ? " Added" : "",
    421             (deleted) ? " Deleted" : "",(found) ? " Found" : "");
    422     WinSetWindowText(WinQueryWindow(hwndMain,QW_PARENT),s);
     354
     355    sprintf(s, "%s:%s%s%s%s%s", filename, (existed) ? " Existed" : "",
     356            (updated) ? " Updated" : "", (added) ? " Added" : "",
     357            (deleted) ? " Deleted" : "", (found) ? " Found" : "");
     358    WinSetWindowText(WinQueryWindow(hwndMain, QW_PARENT), s);
    423359  }
    424360#endif
     
    426362}
    427363
    428 
    429 BOOL UpdateCnrList (HWND hwndCnr,CHAR **filename,INT howmany,BOOL partial,
    430                     DIRCNRDATA *dcd)
     364BOOL UpdateCnrList(HWND hwndCnr, CHAR ** filename, INT howmany, BOOL partial,
     365                   DIRCNRDATA * dcd)
    431366{
    432   PCNRITEM      pci,*pciList = NULL;
    433   FILEFINDBUF4  ffb;
    434   HDIR          hDir;
    435   ULONG         nm = 1L;
    436   INT           x;
    437   INT           numlist = 0;
    438   INT           numremain;
    439   BOOL          repos = FALSE;
    440   BOOL          ret = FALSE;
    441   APIRET        status;
    442 
    443   if(!dcd)
     367  PCNRITEM pci, *pciList = NULL;
     368  FILEFINDBUF4 ffb;
     369  HDIR hDir;
     370  ULONG nm = 1L;
     371  INT x;
     372  INT numlist = 0;
     373  INT numremain;
     374  BOOL repos = FALSE;
     375  BOOL ret = FALSE;
     376  APIRET status;
     377
     378  if (!dcd)
    444379    dcd = INSTDATA(hwndCnr);
    445380  if (!dcd) {
     
    452387    CNRINFO cnri;
    453388
    454     memset(&cnri,0,sizeof(CNRINFO));
     389    memset(&cnri, 0, sizeof(CNRINFO));
    455390    cnri.cb = sizeof(CNRINFO);
    456391    WinSendMsg(hwndCnr,
    457                CM_QUERYCNRINFO,
    458                MPFROMP(&cnri),
    459                MPFROMLONG(sizeof(CNRINFO)));
     392               CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
    460393    numremain = cnri.cRecords;
    461394  }
    462   pciList = xmalloc(sizeof(PCNRITEM) * howmany,pszSrcFile,__LINE__);
     395  pciList = xmalloc(sizeof(PCNRITEM) * howmany, pszSrcFile, __LINE__);
    463396  if (pciList) {
    464     for (x = 0;filename[x] && x < howmany;x++) {
     397    for (x = 0; filename[x] && x < howmany; x++) {
    465398      if (IsFullName(filename[x])) {
    466         if (driveflags[toupper(*filename[x]) - 'A'] & DRIVE_NOTWRITEABLE)
    467           /* ignore non-writeable drives */
    468           continue;
     399        if (driveflags[toupper(*filename[x]) - 'A'] & DRIVE_NOTWRITEABLE)
     400          /* ignore non-writeable drives */
     401          continue;
    469402      }
    470403      hDir = HDIR_CREATE;
    471404      status = DosFindFirst(filename[x],
    472                             &hDir,
    473                             FILE_NORMAL   | FILE_DIRECTORY |
    474                             FILE_ARCHIVED | FILE_READONLY |
    475                             FILE_HIDDEN   | FILE_SYSTEM,
    476                             &ffb,
    477                             sizeof(ffb),
    478                             &nm,
    479                             FIL_QUERYEASIZE);
    480       if(!status) {
    481         /* file exists */
    482         DosFindClose(hDir);
    483   //      if(dcd->type == TREE_FRAME && !(ffb.attrFile & FILE_DIRECTORY))
    484   //        continue;
    485         if(dcd->type == DIR_FRAME &&
    486            *dcd->directory) {
    487 
    488           CHAR *p,temp;
    489 
    490           p = strrchr(filename[x],'\\');
    491           if(p) {
    492             if(p < filename[x] + 3)
    493               p++;
    494             temp = *p;
    495             *p = 0;
    496             if(stricmp(filename[x],dcd->directory)) {
    497               *p = temp;
    498               continue;
    499             }
    500             *p = temp;
    501           }
    502           else
    503             continue;
    504         }
    505         ret = TRUE;
    506         pci = FindCnrRecord(hwndCnr,
    507                             filename[x],
    508                             (PCNRITEM)NULL,
    509                             partial,
    510                             FALSE,
    511                             TRUE);
    512         if (pci)
    513         {
    514           /* update record? */
    515           if ((!fForceUpper && !fForceLower &&
    516                strcmp(pci->szFileName,filename[x])) ||
    517               pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile ||
    518               pci->easize != CBLIST_TO_EASIZE(ffb.cbList) ||
    519               pci->date.day != ffb.fdateLastWrite.day ||
    520               pci->date.month != ffb.fdateLastWrite.month ||
    521               pci->date.year != ffb.fdateLastWrite.year + 1980 ||
    522               pci->time.seconds != ffb.ftimeLastWrite.twosecs * 2 ||
    523               pci->time.minutes != ffb.ftimeLastWrite.minutes ||
    524               pci->time.hours != ffb.ftimeLastWrite.hours ||
    525               pci->ladate.day != ffb.fdateLastAccess.day ||
    526               pci->ladate.month != ffb.fdateLastAccess.month ||
    527               pci->ladate.year != ffb.fdateLastAccess.year + 1980 ||
    528               pci->latime.seconds != ffb.ftimeLastAccess.twosecs * 2 ||
    529               pci->latime.minutes != ffb.ftimeLastAccess.minutes ||
    530               pci->latime.hours != ffb.ftimeLastAccess.hours)
    531           {
     405                            &hDir,
     406                            FILE_NORMAL | FILE_DIRECTORY |
     407                            FILE_ARCHIVED | FILE_READONLY |
     408                            FILE_HIDDEN | FILE_SYSTEM,
     409                            &ffb, sizeof(ffb), &nm, FIL_QUERYEASIZE);
     410      if (!status) {
     411        /* file exists */
     412        DosFindClose(hDir);
     413        //      if(dcd->type == TREE_FRAME && !(ffb.attrFile & FILE_DIRECTORY))
     414        //        continue;
     415        if (dcd->type == DIR_FRAME && *dcd->directory) {
     416
     417          CHAR *p, temp;
     418
     419          p = strrchr(filename[x], '\\');
     420          if (p) {
     421            if (p < filename[x] + 3)
     422              p++;
     423            temp = *p;
     424            *p = 0;
     425            if (stricmp(filename[x], dcd->directory)) {
     426              *p = temp;
     427              continue;
     428            }
     429            *p = temp;
     430          }
     431          else
     432            continue;
     433        }
     434        ret = TRUE;
     435        pci = FindCnrRecord(hwndCnr,
     436                            filename[x],
     437                            (PCNRITEM) NULL, partial, FALSE, TRUE);
     438        if (pci) {
     439          /* update record? */
     440          if ((!fForceUpper && !fForceLower &&
     441               strcmp(pci->szFileName, filename[x])) ||
     442              pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile ||
     443              pci->easize != CBLIST_TO_EASIZE(ffb.cbList) ||
     444              pci->date.day != ffb.fdateLastWrite.day ||
     445              pci->date.month != ffb.fdateLastWrite.month ||
     446              pci->date.year != ffb.fdateLastWrite.year + 1980 ||
     447              pci->time.seconds != ffb.ftimeLastWrite.twosecs * 2 ||
     448              pci->time.minutes != ffb.ftimeLastWrite.minutes ||
     449              pci->time.hours != ffb.ftimeLastWrite.hours ||
     450              pci->ladate.day != ffb.fdateLastAccess.day ||
     451              pci->ladate.month != ffb.fdateLastAccess.month ||
     452              pci->ladate.year != ffb.fdateLastAccess.year + 1980 ||
     453              pci->latime.seconds != ffb.ftimeLastAccess.twosecs * 2 ||
     454              pci->latime.minutes != ffb.ftimeLastAccess.minutes ||
     455              pci->latime.hours != ffb.ftimeLastAccess.hours) {
    532456            /* changed; update */
    533             pciList[numlist++] = pci;
    534             *ffb.achName = 0;
    535             ffb.cchName = 0;
    536             FillInRecordFromFFB(hwndCnr,
    537                                 pci,
    538                                 filename[x],
    539                                 &ffb,
    540                                 partial,
    541                                 dcd);
    542             if (IsRoot(pci->szFileName))
     457            pciList[numlist++] = pci;
     458            *ffb.achName = 0;
     459            ffb.cchName = 0;
     460            FillInRecordFromFFB(hwndCnr,
     461                                pci, filename[x], &ffb, partial, dcd);
     462            if (IsRoot(pci->szFileName)) {
     463              *pci->szFileName = toupper(*pci->szFileName);
     464              if (isalpha(*pci->szFileName) &&
     465                  toupper(*pci->szFileName) > 'B') {
     466                if (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM)
     467                  pci->rc.hptrIcon = hptrCDROM;
     468                else
     469                  pci->rc.hptrIcon =
     470                    (driveflags[toupper(*pci->szFileName) - 'A'] &
     471                     DRIVE_REMOVABLE) ? hptrRemovable
     472                    : (driveflags[toupper(*pci->szFileName) - 'A'] &
     473                       DRIVE_REMOTE) ? hptrRemote
     474                    : (driveflags[toupper(*pci->szFileName) - 'A'] &
     475                       DRIVE_ZIPSTREAM) ? hptrZipstrm : hptrDrive;
     476              }
     477              else
     478                pci->rc.hptrIcon = hptrFloppy;
     479            }
     480            WinSendMsg(hwndCnr,
     481                       CM_SETRECORDEMPHASIS,
     482                       MPFROMP(pci),
     483                       MPFROM2SHORT(FALSE, CRA_SELECTED | CRA_CURSORED));
     484          }
     485        }
     486        else {
     487          /* add record */
     488          if (dcd->type == DIR_FRAME) {
     489            RECORDINSERT ri;
     490            ULONGLONG ullTotalBytes;
     491
     492            pci = WinSendMsg(hwndCnr,
     493                             CM_ALLOCRECORD,
     494                             MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1L));
     495            if (pci) {
     496              ret = TRUE;
     497              *ffb.achName = 0;
     498              ullTotalBytes = FillInRecordFromFFB(hwndCnr,
     499                                                  pci,
     500                                                  filename[x],
     501                                                  &ffb, partial, dcd);
     502              if (strlen(pci->szFileName) < 4) {
     503                *pci->szFileName = toupper(*pci->szFileName);
     504                if (isalpha(*pci->szFileName) &&
     505                    toupper(*pci->szFileName) > 'B') {
     506                  if (driveflags[toupper(*pci->szFileName) - 'A'] &
     507                      DRIVE_CDROM)
     508                    pci->rc.hptrIcon = hptrCDROM;
     509                  else
     510                    pci->rc.hptrIcon =
     511                      (driveflags[toupper(*pci->szFileName) - 'A'] &
     512                       DRIVE_REMOVABLE) ? hptrRemovable
     513                      : (driveflags[toupper(*pci->szFileName) - 'A'] &
     514                         DRIVE_REMOTE) ? hptrRemote
     515                      : (driveflags[toupper(*pci->szFileName) - 'A'] &
     516                         DRIVE_ZIPSTREAM) ? hptrZipstrm : hptrDrive;
     517                }
     518                else
     519                  pci->rc.hptrIcon = hptrFloppy;
     520              }
     521              memset(&ri, 0, sizeof(RECORDINSERT));
     522              ri.cb = sizeof(RECORDINSERT);
     523              ri.pRecordOrder = (PRECORDCORE) CMA_END;
     524              ri.pRecordParent = (PRECORDCORE) NULL;
     525              ri.zOrder = (USHORT) CMA_TOP;
     526              ri.cRecordsInsert = 1L;
     527              ri.fInvalidateRecord = FALSE;
     528              if (WinSendMsg(hwndCnr,
     529                             CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
     530                if (ullTotalBytes) {
     531                  dcd->ullTotalBytes += ullTotalBytes;
     532                  numremain++;
     533                }
     534                repos = TRUE;
     535                if (pci->attrFile & FILE_DIRECTORY)
     536                  Stubby(hwndCnr, pci);
     537              }
     538              else
     539                WinSendMsg(hwndCnr,
     540                           CM_FREERECORD, MPFROMP(&pci), MPFROMSHORT(1));
     541            }
     542          }
     543          else if (ffb.attrFile & FILE_DIRECTORY) {
     544            /* check all parts and insert as required */
     545            CHAR *p, temp;
     546            PCNRITEM pciParent = NULL, pciT;
     547
     548            p = strchr(filename[x], '\\');
     549            if (p) {
     550              while (p && *p) {
     551                if (p < filename[x] + 3)
     552                  p++;
     553                temp = *p;
     554                *p = 0;
     555                pciT = FindCnrRecord(hwndCnr,
     556                                     filename[x], NULL, partial, FALSE, TRUE);
     557                if (!pciT || (INT) pciT == -1) {
     558                  pci = WinSendMsg(hwndCnr,
     559                                   CM_ALLOCRECORD,
     560                                   MPFROMLONG(EXTRA_RECORD_BYTES),
     561                                   MPFROMLONG(1L));
     562                  if (pci) {
     563
     564                    RECORDINSERT ri;
     565                    ULONGLONG ullTotalBytes;
     566
     567                    ret = TRUE;
     568                    *ffb.achName = 0;
     569                    ullTotalBytes = FillInRecordFromFFB(hwndCnr,
     570                                                        pci,
     571                                                        filename[x],
     572                                                        &ffb, partial, dcd);
     573                    if (strlen(pci->szFileName) < 4) {
     574                      *pci->szFileName = toupper(*pci->szFileName);
     575                      if (isalpha(*pci->szFileName) &&
     576                          toupper(*pci->szFileName) > 'B') {
     577                        if (driveflags[toupper(*pci->szFileName) - 'A'] &
     578                            DRIVE_CDROM)
     579                          pci->rc.hptrIcon = hptrCDROM;
     580                        else
     581                          pci->rc.hptrIcon =
     582                            (driveflags[toupper(*pci->szFileName) - 'A'] &
     583                             DRIVE_REMOVABLE) ? hptrRemovable
     584                            : (driveflags[toupper(*pci->szFileName) - 'A'] &
     585                               DRIVE_REMOTE) ? hptrRemote
     586                            : (driveflags[toupper(*pci->szFileName) - 'A'] &
     587                               DRIVE_ZIPSTREAM) ? hptrZipstrm : hptrDrive;
     588                      }
     589                      else
     590                        pci->rc.hptrIcon = hptrFloppy;
     591                    }
     592                    memset(&ri, 0, sizeof(RECORDINSERT));
     593                    ri.cb = sizeof(RECORDINSERT);
     594                    ri.pRecordOrder = (PRECORDCORE) CMA_END;
     595                    ri.pRecordParent = (PRECORDCORE) pciParent;
     596                    ri.zOrder = (USHORT) CMA_TOP;
     597                    ri.cRecordsInsert = 1L;
     598                    ri.fInvalidateRecord = FALSE;
     599                    if (WinSendMsg(hwndCnr,
     600                                   CM_INSERTRECORD,
     601                                   MPFROMP(pci), MPFROMP(&ri))) {
     602                      if (ullTotalBytes) {
     603                        numremain++;
     604                        if (dcd->type == DIR_FRAME)
     605                          dcd->ullTotalBytes += ullTotalBytes;
     606                      }
     607                      repos = TRUE;
     608                    }
     609                    else
     610                      WinSendMsg(hwndCnr,
     611                                 CM_FREERECORD,
     612                                 MPFROMP(&pci), MPFROMSHORT(1));
     613                  }
     614                }
     615                else
     616                  pciParent = pciT;
     617                *p = temp;
     618                p = strchr(p + ((temp == '\\') ? 1 : 0), '\\');
     619              }
     620            }
    543621            {
    544               *pci->szFileName = toupper(*pci->szFileName);
    545               if (isalpha(*pci->szFileName) &&
    546                   toupper(*pci->szFileName) > 'B')
    547               {
    548                 if (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM)
    549                   pci->rc.hptrIcon = hptrCDROM;
    550                 else
    551                   pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ?
    552                                       hptrRemovable :
    553                                       (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ?
    554                                       hptrRemote :
    555                                       (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ?
    556                                       hptrZipstrm : hptrDrive;
    557               }
    558               else
    559                 pci->rc.hptrIcon = hptrFloppy;
    560             }
    561             WinSendMsg(hwndCnr,
    562                        CM_SETRECORDEMPHASIS,
    563                        MPFROMP(pci),
    564                        MPFROM2SHORT(FALSE,
    565                                     CRA_SELECTED | CRA_CURSORED));
    566           }
    567         }
    568         else
    569         {
    570           /* add record */
    571           if (dcd->type == DIR_FRAME)
    572           {
    573             RECORDINSERT ri;
    574             ULONGLONG ullTotalBytes;
    575 
    576             pci = WinSendMsg(hwndCnr,
    577                              CM_ALLOCRECORD,
    578                              MPFROMLONG(EXTRA_RECORD_BYTES),
    579                              MPFROMLONG(1L));
    580             if (pci)
    581             {
    582               ret = TRUE;
    583               *ffb.achName = 0;
    584               ullTotalBytes = FillInRecordFromFFB(hwndCnr,
    585                                                   pci,
    586                                                   filename[x],
    587                                                   &ffb,
    588                                                   partial,
    589                                                   dcd);
    590               if(strlen(pci->szFileName) < 4) {
    591                 *pci->szFileName = toupper(*pci->szFileName);
    592                 if(isalpha(*pci->szFileName) &&
    593                    toupper(*pci->szFileName) > 'B') {
    594                   if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM)
    595                     pci->rc.hptrIcon = hptrCDROM;
    596                   else
    597                     pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ?
    598                                         hptrRemovable :
    599                                         (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ?
    600                                         hptrRemote :
    601                                         (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ?
    602                                         hptrZipstrm : hptrDrive;
    603                 }
    604                 else
    605                   pci->rc.hptrIcon = hptrFloppy;
    606               }
    607               memset(&ri,0,sizeof(RECORDINSERT));
    608               ri.cb                 = sizeof(RECORDINSERT);
    609               ri.pRecordOrder       = (PRECORDCORE)CMA_END;
    610               ri.pRecordParent      = (PRECORDCORE)NULL;
    611               ri.zOrder             = (USHORT)CMA_TOP;
    612               ri.cRecordsInsert     = 1L;
    613               ri.fInvalidateRecord  = FALSE;
    614               if (WinSendMsg(hwndCnr,
    615                              CM_INSERTRECORD,
    616                              MPFROMP(pci),
    617                              MPFROMP(&ri)))
    618               {
    619                 if (ullTotalBytes)
    620                 {
    621                   dcd->ullTotalBytes += ullTotalBytes;
    622                   numremain++;
    623                 }
    624                 repos = TRUE;
    625                 if(pci->attrFile & FILE_DIRECTORY)
    626                   Stubby(hwndCnr,pci);
    627               }
    628               else
    629                 WinSendMsg(hwndCnr,
    630                            CM_FREERECORD,
    631                            MPFROMP(&pci),
    632                            MPFROMSHORT(1));
    633             }
    634           }
    635           else if (ffb.attrFile & FILE_DIRECTORY)
    636           {
    637             /* check all parts and insert as required */
    638             CHAR    *p,temp;
    639             PCNRITEM pciParent = NULL,pciT;
    640 
    641             p = strchr(filename[x],'\\');
    642             if(p) {
    643               while(p && *p) {
    644                 if(p < filename[x] + 3)
    645                   p++;
    646                 temp = *p;
    647                 *p = 0;
    648                 pciT = FindCnrRecord(hwndCnr,
    649                                      filename[x],
    650                                      NULL,
    651                                      partial,
    652                                      FALSE,
    653                                      TRUE);
    654                 if(!pciT || (INT)pciT == -1) {
    655                   pci = WinSendMsg(hwndCnr,
    656                                    CM_ALLOCRECORD,
    657                                    MPFROMLONG(EXTRA_RECORD_BYTES),
    658                                    MPFROMLONG(1L));
    659                   if(pci) {
    660 
    661                     RECORDINSERT ri;
    662                     ULONGLONG ullTotalBytes;
    663 
    664                     ret = TRUE;
    665                     *ffb.achName = 0;
    666                     ullTotalBytes = FillInRecordFromFFB(hwndCnr,
    667                                                         pci,
    668                                                         filename[x],
    669                                                         &ffb,
    670                                                         partial,
    671                                                         dcd);
    672                     if(strlen(pci->szFileName) < 4) {
    673                       *pci->szFileName = toupper(*pci->szFileName);
    674                       if(isalpha(*pci->szFileName) &&
    675                          toupper(*pci->szFileName) > 'B') {
    676                         if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM)
    677                           pci->rc.hptrIcon = hptrCDROM;
    678                         else
    679                           pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ?
    680                                               hptrRemovable :
    681                                               (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ?
    682                                               hptrRemote :
    683                                               (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ?
    684                                               hptrZipstrm : hptrDrive;
    685                       }
    686                       else
    687                         pci->rc.hptrIcon = hptrFloppy;
    688                     }
    689                     memset(&ri,0,sizeof(RECORDINSERT));
    690                     ri.cb                 = sizeof(RECORDINSERT);
    691                     ri.pRecordOrder       = (PRECORDCORE)CMA_END;
    692                     ri.pRecordParent      = (PRECORDCORE)pciParent;
    693                     ri.zOrder             = (USHORT)CMA_TOP;
    694                     ri.cRecordsInsert     = 1L;
    695                     ri.fInvalidateRecord  = FALSE;
    696                     if(WinSendMsg(hwndCnr,
    697                                   CM_INSERTRECORD,
    698                                   MPFROMP(pci),
    699                                   MPFROMP(&ri))) {
    700                       if (ullTotalBytes)
    701                       {
    702                         numremain++;
    703                         if (dcd->type == DIR_FRAME)
    704                           dcd->ullTotalBytes += ullTotalBytes;
    705                       }
    706                       repos = TRUE;
    707                     }
    708                     else
    709                       WinSendMsg(hwndCnr,
    710                                  CM_FREERECORD,
    711                                  MPFROMP(&pci),
    712                                  MPFROMSHORT(1));
    713                   }
    714                 }
    715                 else
    716                   pciParent = pciT;
    717                 *p = temp;
    718                 p = strchr(p + ((temp == '\\') ? 1 : 0),'\\');
    719               }
    720             }
    721             {
    722               pci = WinSendMsg(hwndCnr,
    723                                CM_ALLOCRECORD,
    724                                MPFROMLONG(EXTRA_RECORD_BYTES),
    725                                MPFROMLONG(1L));
    726               if(pci) {
    727 
    728                 RECORDINSERT ri;
    729                 ULONGLONG ullTotalBytes;
    730 
    731                 ret = TRUE;
    732                 *ffb.achName = 0;
    733                 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
    734                                                     pci,
    735                                                     filename[x],
    736                                                     &ffb,
    737                                                     partial,
    738                                                     dcd);
    739                 if(strlen(pci->szFileName) < 4) {
    740                   *pci->szFileName = toupper(*pci->szFileName);
    741                   if(isalpha(*pci->szFileName) &&
    742                      toupper(*pci->szFileName) > 'B') {
    743                     if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM)
    744                       pci->rc.hptrIcon = hptrCDROM;
    745                     else
    746                       pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ?
    747                                           hptrRemovable :
    748                                           (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ?
    749                                           hptrRemote :
    750                                           (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ?
    751                                           hptrZipstrm : hptrDrive;
    752                   }
    753                   else
    754                     pci->rc.hptrIcon = hptrFloppy;
    755                 }
    756                 memset(&ri,0,sizeof(RECORDINSERT));
    757                 ri.cb                 = sizeof(RECORDINSERT);
    758                 ri.pRecordOrder       = (PRECORDCORE)CMA_END;
    759                 ri.pRecordParent      = (PRECORDCORE)pciParent;
    760                 ri.zOrder             = (USHORT)CMA_TOP;
    761                 ri.cRecordsInsert     = 1L;
    762                 ri.fInvalidateRecord  = FALSE;
    763                 if(WinSendMsg(hwndCnr,
    764                               CM_INSERTRECORD,
    765                               MPFROMP(pci),
    766                               MPFROMP(&ri))) {
    767                   if (ullTotalBytes)
    768                   {
    769                     numremain++;
    770                     if (dcd->type == DIR_FRAME)
    771                       dcd->ullTotalBytes += ullTotalBytes;
    772                   }
    773                   repos = TRUE;
    774                   Stubby(hwndCnr,pci);
    775                 }
    776                 else
    777                   WinSendMsg(hwndCnr,
    778                              CM_FREERECORD,
    779                              MPFROMP(&pci),
    780                              MPFROMSHORT(1));
    781               }
    782             }
    783           }
    784         }
     622              pci = WinSendMsg(hwndCnr,
     623                               CM_ALLOCRECORD,
     624                               MPFROMLONG(EXTRA_RECORD_BYTES),
     625                               MPFROMLONG(1L));
     626              if (pci) {
     627
     628                RECORDINSERT ri;
     629                ULONGLONG ullTotalBytes;
     630
     631                ret = TRUE;
     632                *ffb.achName = 0;
     633                ullTotalBytes = FillInRecordFromFFB(hwndCnr,
     634                                                    pci,
     635                                                    filename[x],
     636                                                    &ffb, partial, dcd);
     637                if (strlen(pci->szFileName) < 4) {
     638                  *pci->szFileName = toupper(*pci->szFileName);
     639                  if (isalpha(*pci->szFileName) &&
     640                      toupper(*pci->szFileName) > 'B') {
     641                    if (driveflags[toupper(*pci->szFileName) - 'A'] &
     642                        DRIVE_CDROM)
     643                      pci->rc.hptrIcon = hptrCDROM;
     644                    else
     645                      pci->rc.hptrIcon =
     646                        (driveflags[toupper(*pci->szFileName) - 'A'] &
     647                         DRIVE_REMOVABLE) ? hptrRemovable
     648                        : (driveflags[toupper(*pci->szFileName) - 'A'] &
     649                           DRIVE_REMOTE) ? hptrRemote
     650                        : (driveflags[toupper(*pci->szFileName) - 'A'] &
     651                           DRIVE_ZIPSTREAM) ? hptrZipstrm : hptrDrive;
     652                  }
     653                  else
     654                    pci->rc.hptrIcon = hptrFloppy;
     655                }
     656                memset(&ri, 0, sizeof(RECORDINSERT));
     657                ri.cb = sizeof(RECORDINSERT);
     658                ri.pRecordOrder = (PRECORDCORE) CMA_END;
     659                ri.pRecordParent = (PRECORDCORE) pciParent;
     660                ri.zOrder = (USHORT) CMA_TOP;
     661                ri.cRecordsInsert = 1L;
     662                ri.fInvalidateRecord = FALSE;
     663                if (WinSendMsg(hwndCnr,
     664                               CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
     665                  if (ullTotalBytes) {
     666                    numremain++;
     667                    if (dcd->type == DIR_FRAME)
     668                      dcd->ullTotalBytes += ullTotalBytes;
     669                  }
     670                  repos = TRUE;
     671                  Stubby(hwndCnr, pci);
     672                }
     673                else
     674                  WinSendMsg(hwndCnr,
     675                             CM_FREERECORD, MPFROMP(&pci), MPFROMSHORT(1));
     676              }
     677            }
     678          }
     679        }
    785680      }
    786681      else if ((pci = FindCnrRecord(hwndCnr,
    787                                     filename[x],
    788                                     (PCNRITEM)NULL,
    789                                     partial,
    790                                     FALSE,
    791                                     TRUE)) !=  NULL &&
    792                (INT)pci != -1 &&
    793                !IsRoot(pci->szFileName))
    794       {
    795         /* file doesn't exist; delete record */
    796         if(pci->rc.flRecordAttr & CRA_SELECTED)
    797           WinSendMsg(hwndCnr,
    798                      CM_SETRECORDEMPHASIS,
    799                      MPFROMP(pci),
    800                      MPFROM2SHORT(FALSE,
    801                                   CRA_SELECTED));
    802         if (dcd->type == DIR_FRAME)
    803           dcd->ullTotalBytes -= (pci->cbFile + pci->easize);
    804         if (WinSendMsg(hwndCnr,
    805                        CM_REMOVERECORD,
    806                        MPFROMP(&pci),
    807                        MPFROM2SHORT(1, CMA_FREE | (numremain == 1 ? CMA_INVALIDATE : 0))))
    808         {
    809           numremain--;
    810           repos = TRUE;
    811         }
     682                                    filename[x],
     683                                    (PCNRITEM) NULL,
     684                                    partial,
     685                                    FALSE,
     686                                    TRUE)) != NULL &&
     687               (INT) pci != -1 && !IsRoot(pci->szFileName)) {
     688        /* file doesn't exist; delete record */
     689        if (pci->rc.flRecordAttr & CRA_SELECTED)
     690          WinSendMsg(hwndCnr,
     691                     CM_SETRECORDEMPHASIS,
     692                     MPFROMP(pci), MPFROM2SHORT(FALSE, CRA_SELECTED));
     693        if (dcd->type == DIR_FRAME)
     694          dcd->ullTotalBytes -= (pci->cbFile + pci->easize);
     695        if (WinSendMsg(hwndCnr,
     696                       CM_REMOVERECORD,
     697                       MPFROMP(&pci),
     698                       MPFROM2SHORT(1,
     699                                    CMA_FREE | (numremain ==
     700                                                1 ? CMA_INVALIDATE : 0)))) {
     701          numremain--;
     702          repos = TRUE;
     703        }
    812704      }
    813     } // for
    814   }
    815   if (repos || (pciList && numlist))
    816   {
     705    }                                   // for
     706  }
     707  if (repos || (pciList && numlist)) {
    817708    QUERYRECORDRECT qrr;
    818     RECTL           rCnr,rCItem;
     709    RECTL rCnr, rCItem;
    819710
    820711    pci = WinSendMsg(hwndCnr,
    821                      CM_QUERYRECORDEMPHASIS,
    822                      MPFROMLONG(CMA_FIRST),
    823                      MPFROMLONG(CRA_CURSORED));
    824     if (pci && (INT)pci != -1)
    825     {
     712                     CM_QUERYRECORDEMPHASIS,
     713                     MPFROMLONG(CMA_FIRST), MPFROMLONG(CRA_CURSORED));
     714    if (pci && (INT) pci != -1) {
    826715      memset(&qrr, 0, sizeof(QUERYRECORDRECT));
    827716      qrr.cb = sizeof(QUERYRECORDRECT);
     
    829718      qrr.fRightSplitWindow = FALSE;
    830719      qrr.fsExtent = CMA_TEXT;
    831       if(!WinSendMsg(hwndCnr,
    832                      CM_QUERYRECORDRECT,
    833                      MPFROMP(&rCItem),
    834                      MPFROMP(&qrr)))
    835         qrr.cb = 0;
     720      if (!WinSendMsg(hwndCnr,
     721                      CM_QUERYRECORDRECT, MPFROMP(&rCItem), MPFROMP(&qrr)))
     722        qrr.cb = 0;
    836723    }
    837     if(pciList && numlist && !repos)
    838     {
     724    if (pciList && numlist && !repos) {
    839725      WinSendMsg(hwndCnr,
    840                 CM_INVALIDATERECORD,
    841                 MPFROMP(pciList),
    842                 MPFROM2SHORT(numlist,
    843                               (repos ? CMA_NOREPOSITION :
    844                                        CMA_REPOSITION | CMA_ERASE)));
     726                CM_INVALIDATERECORD,
     727                MPFROMP(pciList),
     728                MPFROM2SHORT(numlist,
     729                              (repos ? CMA_NOREPOSITION :
     730                               CMA_REPOSITION | CMA_ERASE)));
    845731    }
    846732    if (repos)
    847733      WinSendMsg(hwndCnr,
    848                  CM_INVALIDATERECORD,
    849                  MPVOID,
    850                  MPFROM2SHORT(0,
    851                               CMA_ERASE | CMA_REPOSITION));
    852     if(pci && (INT)pci != -1 && qrr.cb) {
     734                 CM_INVALIDATERECORD,
     735                 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
     736    if (pci && (INT) pci != -1 && qrr.cb) {
    853737      WinSendMsg(hwndCnr,
    854                  CM_QUERYVIEWPORTRECT,
    855                  MPFROMP(&rCnr),
    856                  MPFROM2SHORT(CMA_WINDOW,
    857                               (SHORT)FALSE));
     738                 CM_QUERYVIEWPORTRECT,
     739                 MPFROMP(&rCnr), MPFROM2SHORT(CMA_WINDOW, (SHORT) FALSE));
    858740      WinSendMsg(hwndCnr,
    859                 CM_SCROLLWINDOW,
    860                 MPFROMSHORT(CMA_VERTICAL),
    861                 MPFROMLONG(rCnr.yTop - rCItem.yTop));
     741                CM_SCROLLWINDOW,
     742                MPFROMSHORT(CMA_VERTICAL),
     743                MPFROMLONG(rCnr.yTop - rCItem.yTop));
    862744    }
    863745  }
    864   PostMsg(hwndCnr,
    865           UM_RESCAN,
    866           MPVOID,
    867           MPVOID);
     746  PostMsg(hwndCnr, UM_RESCAN, MPVOID, MPVOID);
    868747  if (pciList) {
    869748    free(pciList);
Note: See TracChangeset for help on using the changeset viewer.