| [31] | 1 |  | 
|---|
|  | 2 | /*********************************************************************** | 
|---|
|  | 3 |  | 
|---|
|  | 4 | $Id: filldir.c 188 2005-06-05 19:10:26Z root $ | 
|---|
|  | 5 |  | 
|---|
|  | 6 | Fill Directory Tree Containers | 
|---|
|  | 7 |  | 
|---|
|  | 8 | Copyright (c) 1993-98 M. Kimes | 
|---|
| [167] | 9 | Copyright (c) 2001, 2005 Steven H. Levine | 
|---|
| [31] | 10 |  | 
|---|
| [145] | 11 | 12 Sep 02 SHL Rework symbols to understand code | 
|---|
|  | 12 | 08 Feb 03 SHL DropHelp: calc EA size consistently | 
|---|
|  | 13 | 11 Jun 03 SHL Add JFS and FAT32 support | 
|---|
|  | 14 | 10 Jan 04 SHL ProcessDirectory: avoid most large drive failures | 
|---|
|  | 15 | 24 May 05 SHL Rework Win_Error usage | 
|---|
| [167] | 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 | 
|---|
| [174] | 20 | 28 May 05 SHL Drop stale debug code | 
|---|
| [188] | 21 | 05 Jun 05 SHL Comments | 
|---|
| [31] | 22 |  | 
|---|
|  | 23 | ***********************************************************************/ | 
|---|
|  | 24 |  | 
|---|
| [2] | 25 | #define INCL_DOS | 
|---|
|  | 26 | #define INCL_WIN | 
|---|
| [167] | 27 | #define INCL_LONGLONG | 
|---|
|  | 28 | #include <os2.h> | 
|---|
| [2] | 29 |  | 
|---|
|  | 30 | #include <stdarg.h> | 
|---|
|  | 31 | #include <stdio.h> | 
|---|
|  | 32 | #include <stdlib.h> | 
|---|
|  | 33 | #include <string.h> | 
|---|
|  | 34 | #include <ctype.h> | 
|---|
|  | 35 | #include <time.h> | 
|---|
| [167] | 36 |  | 
|---|
| [2] | 37 | #include "fm3dll.h" | 
|---|
|  | 38 | #include "fm3str.h" | 
|---|
|  | 39 |  | 
|---|
|  | 40 | #pragma alloc_text(FILLDIR,FillInRecordFromFFB,FillInRecordFromFSA,IDFile) | 
|---|
|  | 41 | #pragma alloc_text(FILLDIR1,ProcessDirectory,FillDirCnr,FillTreeCnr) | 
|---|
|  | 42 |  | 
|---|
|  | 43 |  | 
|---|
| [167] | 44 | static HPOINTER IDFile(ULONG cmp) | 
|---|
| [90] | 45 | { | 
|---|
| [2] | 46 | HPOINTER hptr; | 
|---|
|  | 47 |  | 
|---|
|  | 48 | hptr = (HPOINTER)0; | 
|---|
| [167] | 49 | if (cmp == *(ULONG *)".EXE" || cmp == *(ULONG *)".CMD" || | 
|---|
|  | 50 | cmp == *(ULONG *)".BAT" || cmp == *(ULONG *)".COM") | 
|---|
| [2] | 51 | hptr = hptrApp; | 
|---|
| [167] | 52 | else if (cmp == *(ULONG *)".ZIP" || cmp == *(ULONG *)".LZH" || | 
|---|
|  | 53 | cmp == *(ULONG *)".ARJ" || cmp == *(ULONG *)".ARC" || | 
|---|
|  | 54 | cmp == *(ULONG *)".ZOO" || cmp == *(ULONG *)".RAR") | 
|---|
| [2] | 55 | hptr = hptrArc; | 
|---|
| [167] | 56 | else if (cmp == *(ULONG *)".BMP" || cmp == *(ULONG *)".ICO" || | 
|---|
|  | 57 | cmp == *(ULONG *)".PTR" || cmp == *(ULONG *)".GIF" || | 
|---|
|  | 58 | cmp == *(ULONG *)".TIF" || cmp == *(ULONG *)".PCX" || | 
|---|
|  | 59 | cmp == *(ULONG *)".TGA" || cmp == *(ULONG *)".XBM") | 
|---|
| [2] | 60 | hptr = hptrArt; | 
|---|
|  | 61 | return hptr; | 
|---|
|  | 62 | } | 
|---|
|  | 63 |  | 
|---|
|  | 64 |  | 
|---|
| [167] | 65 | ULONGLONG FillInRecordFromFFB(HWND hwndCnr,PCNRITEM pci, const PSZ pszDirectory, | 
|---|
|  | 66 | const PFILEFINDBUF4 pffb,const BOOL partial, | 
|---|
|  | 67 | DIRCNRDATA *dcd) | 
|---|
| [31] | 68 | { | 
|---|
| [2] | 69 | /* fill in a container record from a FILEFINDBUF4 structure */ | 
|---|
|  | 70 |  | 
|---|
| [167] | 71 | CHAR          attrstring[] = "RHS\0DA"; | 
|---|
|  | 72 | CHAR          cmps[] = ".xxx"; | 
|---|
|  | 73 | CHAR         *p; | 
|---|
|  | 74 | HPOINTER      hptr; | 
|---|
|  | 75 | UINT          x; | 
|---|
|  | 76 | UINT          y; | 
|---|
|  | 77 | UINT          t; | 
|---|
|  | 78 | ULONG         cmp; | 
|---|
|  | 79 | BOOL          rc; | 
|---|
| [2] | 80 |  | 
|---|
|  | 81 | pci->hwndCnr = hwndCnr; | 
|---|
|  | 82 | t = strlen(pszDirectory); | 
|---|
|  | 83 | memcpy(pci->szFileName,pszDirectory,t + 1); | 
|---|
|  | 84 | /* note!  we cheat below, and accept the full pathname in pszDirectory | 
|---|
|  | 85 | if !*pffb->achName.  speeds up and simplifies processing elsewhere | 
|---|
| [167] | 86 | (like in update.c) | 
|---|
|  | 87 | */ | 
|---|
|  | 88 | if (*pffb->achName) | 
|---|
|  | 89 | { | 
|---|
| [2] | 90 | p = pci->szFileName + (t - 1); | 
|---|
| [167] | 91 | if (*p != '\\') { | 
|---|
| [2] | 92 | p++; | 
|---|
|  | 93 | *p = '\\'; | 
|---|
|  | 94 | } | 
|---|
|  | 95 | p++; | 
|---|
|  | 96 | memcpy(p,pffb->achName,pffb->cchName + 1); | 
|---|
|  | 97 | } | 
|---|
|  | 98 | /* load the object's Subject, if required */ | 
|---|
| [167] | 99 | if (pffb->cbList > 4L && | 
|---|
|  | 100 | dcd && fLoadSubject && | 
|---|
|  | 101 | (isalpha(*pci->szFileName) && | 
|---|
|  | 102 | !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADSUBJS))) | 
|---|
|  | 103 | { | 
|---|
| [2] | 104 | APIRET    rc; | 
|---|
|  | 105 | EAOP2     eaop; | 
|---|
|  | 106 | PGEA2LIST pgealist; | 
|---|
|  | 107 | PFEA2LIST pfealist; | 
|---|
|  | 108 | PGEA2     pgea; | 
|---|
|  | 109 | PFEA2     pfea; | 
|---|
|  | 110 | CHAR      *value; | 
|---|
|  | 111 |  | 
|---|
|  | 112 | pgealist = malloc(sizeof(GEA2LIST) + 32); | 
|---|
| [167] | 113 | if (pgealist) | 
|---|
|  | 114 | { | 
|---|
| [2] | 115 | memset(pgealist,0,sizeof(GEA2LIST) + 32); | 
|---|
|  | 116 | pgea = &pgealist->list[0]; | 
|---|
|  | 117 | strcpy(pgea->szName,SUBJECT); | 
|---|
|  | 118 | pgea->cbName = strlen(pgea->szName); | 
|---|
| [188] | 119 | pgea->oNextEntryOffset = 0; | 
|---|
| [2] | 120 | pgealist->cbList = (sizeof(GEA2LIST) + pgea->cbName); | 
|---|
|  | 121 | pfealist = malloc(1532); | 
|---|
| [167] | 122 | if (pfealist) | 
|---|
|  | 123 | { | 
|---|
| [2] | 124 | memset(pfealist,0,1532); | 
|---|
|  | 125 | pfealist->cbList = 1024; | 
|---|
|  | 126 | eaop.fpGEA2List = pgealist; | 
|---|
|  | 127 | eaop.fpFEA2List = pfealist; | 
|---|
| [188] | 128 | eaop.oError = 0; | 
|---|
| [2] | 129 | rc = DosQueryPathInfo(pci->szFileName,FIL_QUERYEASFROMLIST, | 
|---|
|  | 130 | (PVOID)&eaop,(ULONG)sizeof(EAOP2)); | 
|---|
| [167] | 131 | if (!rc) { | 
|---|
| [2] | 132 | pfea = &eaop.fpFEA2List->list[0]; | 
|---|
|  | 133 | value = pfea->szName + pfea->cbName + 1; | 
|---|
|  | 134 | value[pfea->cbValue] = 0; | 
|---|
| [167] | 135 | if (*(USHORT *)value == EAT_ASCII) | 
|---|
|  | 136 | strncpy(pci->szSubject,value + (sizeof(USHORT) * 2),39); | 
|---|
|  | 137 | pci->szSubject[39] = 0; | 
|---|
| [2] | 138 | } | 
|---|
|  | 139 | free(pfealist); | 
|---|
|  | 140 | } | 
|---|
|  | 141 | free(pgealist); | 
|---|
|  | 142 | } | 
|---|
|  | 143 | } | 
|---|
| [167] | 144 | pci->pszSubject = pci->szSubject; | 
|---|
| [2] | 145 | /* load the object's longname */ | 
|---|
| [167] | 146 | *pci->szLongname = 0; | 
|---|
|  | 147 | if (pffb->cbList > 4L && | 
|---|
|  | 148 | dcd && fLoadLongnames && | 
|---|
|  | 149 | (isalpha(*pci->szFileName) && | 
|---|
|  | 150 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLONGNAMES) && | 
|---|
|  | 151 | !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADLONGS))) | 
|---|
|  | 152 | { | 
|---|
| [2] | 153 | APIRET    rc; | 
|---|
|  | 154 | EAOP2     eaop; | 
|---|
|  | 155 | PGEA2LIST pgealist; | 
|---|
|  | 156 | PFEA2LIST pfealist; | 
|---|
|  | 157 | PGEA2     pgea; | 
|---|
|  | 158 | PFEA2     pfea; | 
|---|
|  | 159 | CHAR      *value; | 
|---|
|  | 160 |  | 
|---|
|  | 161 | pgealist = malloc(sizeof(GEA2LIST) + 32); | 
|---|
| [167] | 162 | if (pgealist) | 
|---|
|  | 163 | { | 
|---|
| [2] | 164 | memset(pgealist,0,sizeof(GEA2LIST) + 32); | 
|---|
|  | 165 | pgea = &pgealist->list[0]; | 
|---|
|  | 166 | strcpy(pgea->szName,LONGNAME); | 
|---|
|  | 167 | pgea->cbName = strlen(pgea->szName); | 
|---|
| [188] | 168 | pgea->oNextEntryOffset = 0; | 
|---|
| [2] | 169 | pgealist->cbList = (sizeof(GEA2LIST) + pgea->cbName); | 
|---|
|  | 170 | pfealist = malloc(1532); | 
|---|
| [167] | 171 | if (pfealist) { | 
|---|
| [2] | 172 | memset(pfealist,0,1532); | 
|---|
|  | 173 | pfealist->cbList = 1024; | 
|---|
|  | 174 | eaop.fpGEA2List = pgealist; | 
|---|
|  | 175 | eaop.fpFEA2List = pfealist; | 
|---|
| [188] | 176 | eaop.oError = 0; | 
|---|
| [2] | 177 | rc = DosQueryPathInfo(pci->szFileName,FIL_QUERYEASFROMLIST, | 
|---|
|  | 178 | (PVOID)&eaop,(ULONG)sizeof(EAOP2)); | 
|---|
| [167] | 179 | if (!rc) | 
|---|
|  | 180 | { | 
|---|
| [2] | 181 | pfea = &eaop.fpFEA2List->list[0]; | 
|---|
|  | 182 | value = pfea->szName + pfea->cbName + 1; | 
|---|
|  | 183 | value[pfea->cbValue] = 0; | 
|---|
| [167] | 184 | if (*(USHORT *)value == EAT_ASCII) | 
|---|
|  | 185 | strncpy(pci->szLongname,value + (sizeof(USHORT) * 2),CCHMAXPATHCOMP); | 
|---|
|  | 186 | pci->szLongname[CCHMAXPATHCOMP - 1] = 0; | 
|---|
| [2] | 187 | } | 
|---|
|  | 188 | free(pfealist); | 
|---|
|  | 189 | } | 
|---|
|  | 190 | free(pgealist); | 
|---|
|  | 191 | } | 
|---|
|  | 192 | } | 
|---|
| [167] | 193 | pci->pszLongname = pci->szLongname; | 
|---|
| [2] | 194 |  | 
|---|
|  | 195 | /* do anything required to case of filename */ | 
|---|
| [167] | 196 | if (fForceUpper) | 
|---|
| [2] | 197 | strupr(pci->szFileName); | 
|---|
| [167] | 198 | else if (fForceLower) | 
|---|
| [2] | 199 | strlwr(pci->szFileName); | 
|---|
|  | 200 |  | 
|---|
|  | 201 | /* get an icon to use with it */ | 
|---|
| [167] | 202 | if (pffb->attrFile & FILE_DIRECTORY) | 
|---|
|  | 203 | { | 
|---|
|  | 204 | if (!fNoIconsDirs && (!isalpha(*pci->szFileName) || | 
|---|
|  | 205 | !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS))) | 
|---|
| [2] | 206 | hptr = WinLoadFileIcon(pci->szFileName, FALSE); | 
|---|
|  | 207 | else | 
|---|
|  | 208 | hptr = (HPOINTER)0; | 
|---|
|  | 209 | } | 
|---|
| [167] | 210 | else | 
|---|
|  | 211 | { | 
|---|
| [42] | 212 | if (!fNoIconsFiles && (!isalpha(*pci->szFileName) || | 
|---|
| [2] | 213 | !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS))) | 
|---|
| [167] | 214 | { | 
|---|
| [2] | 215 | hptr = WinLoadFileIcon(pci->szFileName, FALSE); | 
|---|
| [167] | 216 | } | 
|---|
| [42] | 217 | else | 
|---|
|  | 218 | hptr = (HPOINTER)0; | 
|---|
| [167] | 219 |  | 
|---|
|  | 220 | if (!hptr || hptr == WinQuerySysPointer(HWND_DESKTOP,SPTR_FILE,FALSE)) | 
|---|
|  | 221 | { | 
|---|
| [2] | 222 | p = strrchr(pci->szFileName,'.'); | 
|---|
| [167] | 223 | if (p && !p[4]) | 
|---|
|  | 224 | { | 
|---|
| [2] | 225 | cmps[1] = toupper(p[1]); | 
|---|
|  | 226 | cmps[2] = toupper(p[2]); | 
|---|
|  | 227 | cmps[3] = toupper(p[3]); | 
|---|
|  | 228 | cmp = *(ULONG *)cmps; | 
|---|
|  | 229 | hptr = IDFile(cmp); | 
|---|
|  | 230 | } | 
|---|
|  | 231 | else | 
|---|
|  | 232 | hptr = (HPOINTER)0; | 
|---|
|  | 233 | } | 
|---|
|  | 234 | } | 
|---|
| [167] | 235 | if (!hptr) | 
|---|
|  | 236 | { | 
|---|
| [2] | 237 | hptr = ((pffb->attrFile & FILE_DIRECTORY) != 0) ? hptrDir : | 
|---|
|  | 238 | ((pffb->attrFile & FILE_SYSTEM) != 0)   ? hptrSystem : | 
|---|
|  | 239 | ((pffb->attrFile & FILE_HIDDEN) != 0)   ? hptrHidden : | 
|---|
|  | 240 | ((pffb->attrFile & FILE_READONLY) != 0) ? hptrReadonly : | 
|---|
|  | 241 | hptrFile; | 
|---|
| [167] | 242 | } | 
|---|
| [2] | 243 |  | 
|---|
|  | 244 | /* decide where to point for the container's title text */ | 
|---|
| [167] | 245 | if (partial) | 
|---|
|  | 246 | { | 
|---|
| [2] | 247 | p = strrchr(pci->szFileName,'\\'); | 
|---|
| [167] | 248 | if (!p) | 
|---|
|  | 249 | { | 
|---|
| [2] | 250 | p = strrchr(pci->szFileName,':'); | 
|---|
| [167] | 251 | if (!p) | 
|---|
| [2] | 252 | p = pci->szFileName; | 
|---|
|  | 253 | else | 
|---|
|  | 254 | p++; | 
|---|
|  | 255 | } | 
|---|
| [167] | 256 | else if ((dcd && dcd->type == TREE_FRAME) || | 
|---|
|  | 257 | (!(pffb->attrFile & FILE_DIRECTORY) || !*(p + 1))) | 
|---|
|  | 258 | { | 
|---|
| [2] | 259 | p++; | 
|---|
| [167] | 260 | } | 
|---|
|  | 261 | if (!*p) | 
|---|
| [2] | 262 | p = pci->szFileName; | 
|---|
|  | 263 | } | 
|---|
|  | 264 | else | 
|---|
|  | 265 | p = pci->szFileName; | 
|---|
|  | 266 | /* now fill the darned thing in... */ | 
|---|
|  | 267 | pci->pszFileName    = p; | 
|---|
|  | 268 | pci->date.day       = pffb->fdateLastWrite.day; | 
|---|
|  | 269 | pci->date.month     = pffb->fdateLastWrite.month; | 
|---|
|  | 270 | pci->date.year      = pffb->fdateLastWrite.year + 1980; | 
|---|
|  | 271 | pci->time.seconds   = pffb->ftimeLastWrite.twosecs * 2; | 
|---|
|  | 272 | pci->time.minutes   = pffb->ftimeLastWrite.minutes; | 
|---|
|  | 273 | pci->time.hours     = pffb->ftimeLastWrite.hours; | 
|---|
|  | 274 | pci->ladate.day     = pffb->fdateLastAccess.day; | 
|---|
|  | 275 | pci->ladate.month   = pffb->fdateLastAccess.month; | 
|---|
|  | 276 | pci->ladate.year    = pffb->fdateLastAccess.year + 1980; | 
|---|
|  | 277 | pci->latime.seconds = pffb->ftimeLastAccess.twosecs * 2; | 
|---|
|  | 278 | pci->latime.minutes = pffb->ftimeLastAccess.minutes; | 
|---|
|  | 279 | pci->latime.hours   = pffb->ftimeLastAccess.hours; | 
|---|
|  | 280 | pci->crdate.day     = pffb->fdateCreation.day; | 
|---|
|  | 281 | pci->crdate.month   = pffb->fdateCreation.month; | 
|---|
|  | 282 | pci->crdate.year    = pffb->fdateCreation.year + 1980; | 
|---|
|  | 283 | pci->crtime.seconds = pffb->ftimeCreation.twosecs * 2; | 
|---|
|  | 284 | pci->crtime.minutes = pffb->ftimeCreation.minutes; | 
|---|
|  | 285 | pci->crtime.hours   = pffb->ftimeCreation.hours; | 
|---|
| [51] | 286 | pci->easize         = CBLIST_TO_EASIZE(pffb->cbList); | 
|---|
| [2] | 287 | pci->cbFile         = pffb->cbFile; | 
|---|
|  | 288 | pci->attrFile       = pffb->attrFile; | 
|---|
|  | 289 | /* build attribute string for display */ | 
|---|
|  | 290 | y = 0; | 
|---|
| [167] | 291 | for (x = 0; x < 6; x++) | 
|---|
|  | 292 | { | 
|---|
|  | 293 | if (attrstring[x]) | 
|---|
|  | 294 | { | 
|---|
|  | 295 | pci->szDispAttr[y++] = | 
|---|
|  | 296 | (CHAR)((pci->attrFile & (1 << x)) ? attrstring[x] : '-'); | 
|---|
|  | 297 | } | 
|---|
|  | 298 | } | 
|---|
| [2] | 299 | pci->szDispAttr[5]  = 0; | 
|---|
|  | 300 | pci->pszDispAttr    = pci->szDispAttr; | 
|---|
|  | 301 | pci->rc.pszIcon     = pci->pszFileName; | 
|---|
|  | 302 | pci->rc.hptrIcon    = hptr; | 
|---|
|  | 303 |  | 
|---|
|  | 304 | /* check to see if record should be visible */ | 
|---|
| [167] | 305 | if (dcd && (*dcd->mask.szMask || dcd->mask.antiattr || | 
|---|
|  | 306 | ((dcd->mask.attrFile & | 
|---|
|  | 307 | (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)) != | 
|---|
|  | 308 | (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)))) | 
|---|
|  | 309 | { | 
|---|
|  | 310 | if (*dcd->mask.szMask || dcd->mask.antiattr) | 
|---|
|  | 311 | { | 
|---|
| [2] | 312 | if(!Filter((PMINIRECORDCORE)pci,(PVOID)&dcd->mask)) | 
|---|
|  | 313 | pci->rc.flRecordAttr |= CRA_FILTERED; | 
|---|
|  | 314 | } | 
|---|
|  | 315 | else if((!(dcd->mask.attrFile & FILE_HIDDEN) && | 
|---|
|  | 316 | (pci->attrFile & FILE_HIDDEN)) || | 
|---|
|  | 317 | (!(dcd->mask.attrFile & FILE_SYSTEM) && | 
|---|
|  | 318 | (pci->attrFile & FILE_SYSTEM)) || | 
|---|
|  | 319 | (!(dcd->mask.attrFile & FILE_READONLY) && | 
|---|
|  | 320 | (pci->attrFile & FILE_READONLY)) || | 
|---|
|  | 321 | (!(dcd->mask.attrFile & FILE_ARCHIVED) && | 
|---|
|  | 322 | (pci->attrFile & FILE_ARCHIVED))) | 
|---|
| [167] | 323 | { | 
|---|
| [2] | 324 | pci->rc.flRecordAttr |= CRA_FILTERED; | 
|---|
| [167] | 325 | } | 
|---|
| [2] | 326 | } | 
|---|
|  | 327 |  | 
|---|
|  | 328 | return pffb->cbFile + pci->easize; | 
|---|
|  | 329 |  | 
|---|
| [167] | 330 | } // FillInRecordFromFFB | 
|---|
| [2] | 331 |  | 
|---|
| [167] | 332 |  | 
|---|
|  | 333 | ULONGLONG FillInRecordFromFSA(HWND hwndCnr, | 
|---|
|  | 334 | PCNRITEM pci, | 
|---|
|  | 335 | const PSZ pszFileName, | 
|---|
|  | 336 | const PFILESTATUS4 pfsa4, | 
|---|
|  | 337 | const BOOL partial, | 
|---|
|  | 338 | DIRCNRDATA *dcd)          // Optional | 
|---|
| [31] | 339 | { | 
|---|
| [2] | 340 | HPOINTER       hptr; | 
|---|
| [167] | 341 | CHAR           attrstring[] = "RHS\0DA"; | 
|---|
|  | 342 | CHAR           cmps[] = ".xxx"; | 
|---|
| [2] | 343 | register CHAR *p; | 
|---|
| [167] | 344 | register INT   x; | 
|---|
|  | 345 | register INT   y; | 
|---|
| [2] | 346 | ULONG          cmp; | 
|---|
|  | 347 |  | 
|---|
|  | 348 | /* fill in a container record from a FILESTATUS4 structure */ | 
|---|
|  | 349 |  | 
|---|
|  | 350 | pci->hwndCnr = hwndCnr; | 
|---|
|  | 351 | strcpy(pci->szFileName,pszFileName); | 
|---|
|  | 352 | /* load the object's Subject, if required */ | 
|---|
| [167] | 353 | if (pfsa4->cbList > 4L && | 
|---|
|  | 354 | dcd && | 
|---|
|  | 355 | fLoadSubject && | 
|---|
|  | 356 | (!isalpha(*pci->szFileName) || | 
|---|
|  | 357 | !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADSUBJS))) | 
|---|
|  | 358 | { | 
|---|
| [2] | 359 | APIRET    rc; | 
|---|
|  | 360 | EAOP2     eaop; | 
|---|
|  | 361 | PGEA2LIST pgealist; | 
|---|
|  | 362 | PFEA2LIST pfealist; | 
|---|
|  | 363 | PGEA2     pgea; | 
|---|
|  | 364 | PFEA2     pfea; | 
|---|
|  | 365 | CHAR      *value; | 
|---|
|  | 366 |  | 
|---|
|  | 367 | pgealist = malloc(sizeof(GEA2LIST) + 32); | 
|---|
| [167] | 368 | if (pgealist) { | 
|---|
| [2] | 369 | memset(pgealist,0,sizeof(GEA2LIST) + 32); | 
|---|
|  | 370 | pgea = &pgealist->list[0]; | 
|---|
|  | 371 | strcpy(pgea->szName,SUBJECT); | 
|---|
|  | 372 | pgea->cbName = strlen(pgea->szName); | 
|---|
| [188] | 373 | pgea->oNextEntryOffset = 0; | 
|---|
| [2] | 374 | pgealist->cbList = (sizeof(GEA2LIST) + pgea->cbName); | 
|---|
|  | 375 | pfealist = malloc(1532); | 
|---|
| [167] | 376 | if (pfealist) { | 
|---|
| [2] | 377 | memset(pfealist,0,1532); | 
|---|
|  | 378 | pfealist->cbList = 1024; | 
|---|
|  | 379 | eaop.fpGEA2List = pgealist; | 
|---|
|  | 380 | eaop.fpFEA2List = pfealist; | 
|---|
| [188] | 381 | eaop.oError = 0; | 
|---|
| [2] | 382 | rc = DosQueryPathInfo(pci->szFileName,FIL_QUERYEASFROMLIST, | 
|---|
|  | 383 | (PVOID)&eaop, | 
|---|
|  | 384 | (ULONG)sizeof(EAOP2)); | 
|---|
| [167] | 385 | if (!rc) { | 
|---|
| [2] | 386 | pfea = &eaop.fpFEA2List->list[0]; | 
|---|
|  | 387 | value = pfea->szName + pfea->cbName + 1; | 
|---|
|  | 388 | value[pfea->cbValue] = 0; | 
|---|
| [167] | 389 | if (*(USHORT *)value == EAT_ASCII) | 
|---|
|  | 390 | strncpy(pci->szSubject,value + (sizeof(USHORT) * 2),39); | 
|---|
|  | 391 | pci->szSubject[39] = 0; | 
|---|
| [2] | 392 | } | 
|---|
|  | 393 | free(pfealist); | 
|---|
|  | 394 | } | 
|---|
|  | 395 | free(pgealist); | 
|---|
|  | 396 | } | 
|---|
|  | 397 | } | 
|---|
| [167] | 398 | pci->pszSubject = pci->szSubject; | 
|---|
|  | 399 | *pci->szLongname = 0; | 
|---|
|  | 400 | if (pfsa4->cbList > 4L && | 
|---|
|  | 401 | dcd && | 
|---|
|  | 402 | fLoadLongnames && | 
|---|
|  | 403 | (!isalpha(*pci->szFileName) || | 
|---|
|  | 404 | ((driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLONGNAMES) && | 
|---|
|  | 405 | !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADLONGS)))) | 
|---|
| [51] | 406 | { | 
|---|
| [2] | 407 | APIRET    rc; | 
|---|
|  | 408 | EAOP2     eaop; | 
|---|
|  | 409 | PGEA2LIST pgealist; | 
|---|
|  | 410 | PFEA2LIST pfealist; | 
|---|
|  | 411 | PGEA2     pgea; | 
|---|
|  | 412 | PFEA2     pfea; | 
|---|
|  | 413 | CHAR      *value; | 
|---|
|  | 414 |  | 
|---|
|  | 415 | pgealist = malloc(sizeof(GEA2LIST) + 32); | 
|---|
| [167] | 416 | if (pgealist) { | 
|---|
| [2] | 417 | memset(pgealist,0,sizeof(GEA2LIST) + 32); | 
|---|
|  | 418 | pgea = &pgealist->list[0]; | 
|---|
|  | 419 | strcpy(pgea->szName,LONGNAME); | 
|---|
|  | 420 | pgea->cbName = strlen(pgea->szName); | 
|---|
| [188] | 421 | pgea->oNextEntryOffset = 0; | 
|---|
| [2] | 422 | pgealist->cbList = (sizeof(GEA2LIST) + pgea->cbName); | 
|---|
|  | 423 | pfealist = malloc(1532); | 
|---|
| [167] | 424 | if (pfealist) { | 
|---|
| [2] | 425 | memset(pfealist,0,1532); | 
|---|
|  | 426 | pfealist->cbList = 1024; | 
|---|
|  | 427 | eaop.fpGEA2List = pgealist; | 
|---|
|  | 428 | eaop.fpFEA2List = pfealist; | 
|---|
| [188] | 429 | eaop.oError = 0; | 
|---|
| [2] | 430 | rc = DosQueryPathInfo(pci->szFileName,FIL_QUERYEASFROMLIST, | 
|---|
|  | 431 | (PVOID)&eaop,(ULONG)sizeof(EAOP2)); | 
|---|
| [167] | 432 | if (!rc) { | 
|---|
| [2] | 433 | pfea = &eaop.fpFEA2List->list[0]; | 
|---|
|  | 434 | value = pfea->szName + pfea->cbName + 1; | 
|---|
|  | 435 | value[pfea->cbValue] = 0; | 
|---|
| [167] | 436 | if (*(USHORT *)value == EAT_ASCII) | 
|---|
|  | 437 | strncpy(pci->szLongname,value + (sizeof(USHORT) * 2),CCHMAXPATHCOMP); | 
|---|
|  | 438 | pci->szLongname[CCHMAXPATHCOMP - 1] = 0; | 
|---|
| [2] | 439 | } | 
|---|
|  | 440 | free(pfealist); | 
|---|
|  | 441 | } | 
|---|
|  | 442 | free(pgealist); | 
|---|
|  | 443 | } | 
|---|
|  | 444 | } | 
|---|
| [167] | 445 | pci->pszLongname = pci->szLongname; | 
|---|
|  | 446 | if (fForceUpper) | 
|---|
| [2] | 447 | strupr(pci->szFileName); | 
|---|
| [167] | 448 | else if (fForceLower) | 
|---|
| [2] | 449 | strlwr(pci->szFileName); | 
|---|
|  | 450 |  | 
|---|
| [167] | 451 | if (pfsa4->attrFile & FILE_DIRECTORY) { | 
|---|
|  | 452 | if (!fNoIconsDirs && (!isalpha(*pci->szFileName) || | 
|---|
|  | 453 | !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS))) | 
|---|
| [2] | 454 | hptr = WinLoadFileIcon(pci->szFileName, FALSE); | 
|---|
|  | 455 | else | 
|---|
|  | 456 | hptr = (HPOINTER)0; | 
|---|
|  | 457 | } | 
|---|
| [167] | 458 | else | 
|---|
|  | 459 | { | 
|---|
|  | 460 | if (!fNoIconsFiles && (!isalpha(*pci->szFileName) || | 
|---|
|  | 461 | !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS))) | 
|---|
| [2] | 462 | hptr = WinLoadFileIcon(pci->szFileName, FALSE); | 
|---|
| [167] | 463 | else | 
|---|
|  | 464 | { | 
|---|
| [2] | 465 | p = strrchr(pci->szFileName,'.'); | 
|---|
| [167] | 466 | if (p && !p[4]) { | 
|---|
| [2] | 467 | cmps[1] = toupper(p[1]); | 
|---|
|  | 468 | cmps[2] = toupper(p[2]); | 
|---|
|  | 469 | cmps[3] = toupper(p[3]); | 
|---|
|  | 470 | cmp = *(ULONG *)cmps; | 
|---|
|  | 471 | hptr = IDFile(cmp); | 
|---|
|  | 472 | } | 
|---|
|  | 473 | else | 
|---|
|  | 474 | hptr = (HPOINTER)0; | 
|---|
|  | 475 | } | 
|---|
|  | 476 | } | 
|---|
| [167] | 477 | if (!hptr) | 
|---|
| [2] | 478 | hptr = ((pfsa4->attrFile & FILE_DIRECTORY) != 0) ? hptrDir : | 
|---|
|  | 479 | ((pfsa4->attrFile & FILE_SYSTEM) != 0)   ? hptrSystem : | 
|---|
|  | 480 | ((pfsa4->attrFile & FILE_HIDDEN) != 0)   ? hptrHidden : | 
|---|
|  | 481 | ((pfsa4->attrFile & FILE_READONLY) != 0) ? hptrReadonly : | 
|---|
|  | 482 | hptrFile; | 
|---|
|  | 483 |  | 
|---|
| [167] | 484 | if (partial) { | 
|---|
| [2] | 485 | p = strrchr(pci->szFileName,'\\'); | 
|---|
| [167] | 486 | if (!p) { | 
|---|
| [2] | 487 | p = strrchr(pci->szFileName,':'); | 
|---|
| [167] | 488 | if (!p) | 
|---|
| [2] | 489 | p = pci->szFileName; | 
|---|
|  | 490 | else | 
|---|
|  | 491 | p++; | 
|---|
|  | 492 | } | 
|---|
| [167] | 493 | else if ((dcd && dcd->type == TREE_FRAME) || | 
|---|
|  | 494 | !(pfsa4->attrFile & FILE_DIRECTORY) || | 
|---|
|  | 495 | !*(p + 1)) | 
|---|
| [2] | 496 | p++; | 
|---|
| [167] | 497 | if (!*p) | 
|---|
| [2] | 498 | p = pci->szFileName; | 
|---|
|  | 499 | } | 
|---|
|  | 500 | else | 
|---|
|  | 501 | p = pci->szFileName; | 
|---|
|  | 502 | pci->pszFileName    = p; | 
|---|
|  | 503 | pci->date.day       = pfsa4->fdateLastWrite.day; | 
|---|
|  | 504 | pci->date.month     = pfsa4->fdateLastWrite.month; | 
|---|
|  | 505 | pci->date.year      = pfsa4->fdateLastWrite.year + 1980; | 
|---|
|  | 506 | pci->time.seconds   = pfsa4->ftimeLastWrite.twosecs * 2; | 
|---|
|  | 507 | pci->time.minutes   = pfsa4->ftimeLastWrite.minutes; | 
|---|
|  | 508 | pci->time.hours     = pfsa4->ftimeLastWrite.hours; | 
|---|
|  | 509 | pci->ladate.day     = pfsa4->fdateLastAccess.day; | 
|---|
|  | 510 | pci->ladate.month   = pfsa4->fdateLastAccess.month; | 
|---|
|  | 511 | pci->ladate.year    = pfsa4->fdateLastAccess.year + 1980; | 
|---|
|  | 512 | pci->latime.seconds = pfsa4->ftimeLastAccess.twosecs * 2; | 
|---|
|  | 513 | pci->latime.minutes = pfsa4->ftimeLastAccess.minutes; | 
|---|
|  | 514 | pci->latime.hours   = pfsa4->ftimeLastAccess.hours; | 
|---|
|  | 515 | pci->crdate.day     = pfsa4->fdateCreation.day; | 
|---|
|  | 516 | pci->crdate.month   = pfsa4->fdateCreation.month; | 
|---|
|  | 517 | pci->crdate.year    = pfsa4->fdateCreation.year + 1980; | 
|---|
|  | 518 | pci->crtime.seconds = pfsa4->ftimeCreation.twosecs * 2; | 
|---|
|  | 519 | pci->crtime.minutes = pfsa4->ftimeCreation.minutes; | 
|---|
|  | 520 | pci->crtime.hours   = pfsa4->ftimeCreation.hours; | 
|---|
| [51] | 521 | pci->easize         = CBLIST_TO_EASIZE(pfsa4->cbList); | 
|---|
| [2] | 522 | pci->cbFile         = pfsa4->cbFile; | 
|---|
|  | 523 | pci->attrFile       = pfsa4->attrFile; | 
|---|
|  | 524 | y = 0; | 
|---|
|  | 525 | for(x = 0;x < 6;x++) | 
|---|
| [167] | 526 | if (attrstring[x]) | 
|---|
| [2] | 527 | pci->szDispAttr[y++] = (CHAR)((pci->attrFile & (1 << x)) ? | 
|---|
|  | 528 | attrstring[x] : '-'); | 
|---|
|  | 529 | pci->szDispAttr[5]  = 0; | 
|---|
|  | 530 | pci->pszDispAttr    = pci->szDispAttr; | 
|---|
|  | 531 | pci->rc.pszIcon     = pci->pszFileName; | 
|---|
|  | 532 | pci->rc.hptrIcon    = hptr; | 
|---|
|  | 533 |  | 
|---|
| [167] | 534 | if (dcd && | 
|---|
|  | 535 | (*dcd->mask.szMask || dcd->mask.antiattr || | 
|---|
|  | 536 | ((dcd->mask.attrFile & | 
|---|
|  | 537 | (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)) != | 
|---|
|  | 538 | (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)))) | 
|---|
|  | 539 | { | 
|---|
|  | 540 | if (*dcd->mask.szMask || dcd->mask.antiattr) | 
|---|
|  | 541 | { | 
|---|
|  | 542 | if (!Filter((PMINIRECORDCORE)pci,(PVOID)&dcd->mask)) | 
|---|
| [2] | 543 | pci->rc.flRecordAttr |= CRA_FILTERED; | 
|---|
|  | 544 | } | 
|---|
| [167] | 545 | else if ((!(dcd->mask.attrFile & FILE_HIDDEN) && | 
|---|
|  | 546 | (pci->attrFile & FILE_HIDDEN)) || | 
|---|
|  | 547 | (!(dcd->mask.attrFile & FILE_SYSTEM) && | 
|---|
|  | 548 | (pci->attrFile & FILE_SYSTEM)) || | 
|---|
|  | 549 | (!(dcd->mask.attrFile & FILE_READONLY) && | 
|---|
|  | 550 | (pci->attrFile & FILE_READONLY)) || | 
|---|
|  | 551 | (!(dcd->mask.attrFile & FILE_ARCHIVED) && | 
|---|
|  | 552 | (pci->attrFile & FILE_ARCHIVED))) | 
|---|
| [2] | 553 | pci->rc.flRecordAttr |= CRA_FILTERED; | 
|---|
|  | 554 | } | 
|---|
|  | 555 |  | 
|---|
|  | 556 | return pfsa4->cbFile + pci->easize; | 
|---|
|  | 557 |  | 
|---|
| [167] | 558 | } // FillInRecordFromFSA | 
|---|
| [2] | 559 |  | 
|---|
| [167] | 560 |  | 
|---|
|  | 561 | VOID ProcessDirectory(const HWND hwndCnr, const PCNRITEM pciParent, | 
|---|
|  | 562 | const CHAR *szDirBase, const BOOL filestoo, | 
|---|
|  | 563 | const BOOL recurse,const BOOL partial, | 
|---|
|  | 564 | CHAR *stopflag, | 
|---|
|  | 565 | DIRCNRDATA *dcd,                  // Optional | 
|---|
|  | 566 | ULONG *pulTotalFiles,             // Optional | 
|---|
|  | 567 | PULONGLONG pullTotalBytes)        // Optional | 
|---|
| [31] | 568 | { | 
|---|
| [2] | 569 | /* put all the directories (and files if filestoo is TRUE) from a | 
|---|
|  | 570 | * directory into the container.  recurse through subdirectories if | 
|---|
|  | 571 | * recurse is TRUE. | 
|---|
|  | 572 | */ | 
|---|
|  | 573 |  | 
|---|
| [42] | 574 | PSZ            pszFileSpec; | 
|---|
| [2] | 575 | INT            t; | 
|---|
| [167] | 576 | PFILEFINDBUF4  paffbFound; | 
|---|
|  | 577 | PFILEFINDBUF4  *papffbSelected; | 
|---|
|  | 578 | PFILEFINDBUF4  pffbFile; | 
|---|
|  | 579 | PFILEFINDBUF4  paffbTotal = NULL; | 
|---|
|  | 580 | PFILEFINDBUF4  paffbTemp; | 
|---|
| [2] | 581 | HDIR           hdir = HDIR_CREATE; | 
|---|
| [167] | 582 | ULONG          ulFileCnt; | 
|---|
|  | 583 | ULONG          ulExtraBytes; | 
|---|
|  | 584 | ULONG          ulM = 1; | 
|---|
| [188] | 585 | ULONG          ulTotal = 0; | 
|---|
| [167] | 586 | ULONGLONG      ullBytes; | 
|---|
|  | 587 | ULONGLONG      ullTotalBytes; | 
|---|
|  | 588 | ULONG          ulReturnFiles = 0; | 
|---|
|  | 589 | ULONGLONG      ullReturnBytes = 0; | 
|---|
| [2] | 590 | PCH            pchEndPath; | 
|---|
|  | 591 | APIRET         rc; | 
|---|
| [167] | 592 | PCNRITEM       pci; | 
|---|
|  | 593 | PCNRITEM       pciFirst; | 
|---|
|  | 594 | PCNRITEM       pcit; | 
|---|
| [2] | 595 | RECORDINSERT   ri; | 
|---|
| [167] | 596 | PBYTE          pByte; | 
|---|
|  | 597 | PBYTE          pByte2; | 
|---|
|  | 598 | BOOL           ok = TRUE; | 
|---|
| [2] | 599 |  | 
|---|
| [167] | 600 | if (isalpha(*szDirBase) && szDirBase[1] == ':' && szDirBase[2] == '\\') | 
|---|
|  | 601 | { | 
|---|
|  | 602 | // if (!(driveflags[toupper(*szDirBase) - 'A'] & DRIVE_NOLONGNAMES)) | 
|---|
| [2] | 603 | ulExtraBytes = EXTRA_RECORD_BYTES; | 
|---|
| [167] | 604 | // else | 
|---|
|  | 605 | // ulExtraBytes = EXTRA_RECORD_BYTES2; | 
|---|
|  | 606 | if ((driveflags[toupper(*szDirBase) - 'A'] & DRIVE_REMOTE) && fRemoteBug) | 
|---|
|  | 607 | ulM = 1;                          /* file system gets confused */ | 
|---|
|  | 608 | else if (driveflags[toupper(*szDirBase) - 'A'] & DRIVE_ZIPSTREAM) | 
|---|
| [2] | 609 | ulM = min(FilesToGet,225);        /* anything more is wasted */ | 
|---|
|  | 610 | else | 
|---|
|  | 611 | ulM = FilesToGet;                 /* full-out */ | 
|---|
|  | 612 | } | 
|---|
| [167] | 613 | else | 
|---|
|  | 614 | { | 
|---|
| [2] | 615 | ulExtraBytes = EXTRA_RECORD_BYTES; | 
|---|
|  | 616 | ulM = FilesToGet; | 
|---|
|  | 617 | } | 
|---|
| [167] | 618 | if (OS2ver[0] == 20 && OS2ver[1] < 30) | 
|---|
| [2] | 619 | ulM = min(ulM,(65535 / sizeof(FILEFINDBUF4))); | 
|---|
|  | 620 |  | 
|---|
| [167] | 621 | ulFileCnt = ulM; | 
|---|
| [42] | 622 | pszFileSpec = malloc(CCHMAXPATH + 2); | 
|---|
| [90] | 623 | paffbFound = malloc((ulM + 1) * sizeof(FILEFINDBUF4)); | 
|---|
|  | 624 | papffbSelected = malloc((ulM + 1) * sizeof(PFILEFINDBUF4)); | 
|---|
| [167] | 625 | if (paffbFound && papffbSelected && pszFileSpec) { | 
|---|
| [2] | 626 | t = strlen(szDirBase); | 
|---|
| [42] | 627 | memcpy(pszFileSpec,szDirBase,t + 1); | 
|---|
|  | 628 | pchEndPath = pszFileSpec + t; | 
|---|
| [167] | 629 | if (*(pchEndPath - 1) != '\\') { | 
|---|
| [2] | 630 | memcpy(pchEndPath,"\\",2); | 
|---|
|  | 631 | pchEndPath++; | 
|---|
|  | 632 | } | 
|---|
|  | 633 | memcpy(pchEndPath,"*",2); | 
|---|
|  | 634 | DosError(FERR_DISABLEHARDERR); | 
|---|
| [42] | 635 | rc = DosFindFirst(pszFileSpec, &hdir, | 
|---|
| [2] | 636 | FILE_NORMAL | ((filestoo) ? FILE_DIRECTORY : | 
|---|
|  | 637 | MUST_HAVE_DIRECTORY) | FILE_READONLY | | 
|---|
|  | 638 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN, | 
|---|
| [42] | 639 | paffbFound, ulM * sizeof(FILEFINDBUF4), | 
|---|
| [167] | 640 | &ulFileCnt, FIL_QUERYEASIZE); | 
|---|
| [2] | 641 | priority_normal(); | 
|---|
|  | 642 | *pchEndPath = 0; | 
|---|
| [167] | 643 | if (!rc) | 
|---|
|  | 644 | { | 
|---|
|  | 645 | while (!rc) | 
|---|
|  | 646 | { | 
|---|
| [2] | 647 | /* | 
|---|
|  | 648 | * remove . and .. from list if present | 
|---|
|  | 649 | * also counter file system bugs that sometimes | 
|---|
|  | 650 | * allows normal files to slip through when | 
|---|
|  | 651 | * only directories should appear (only a few | 
|---|
|  | 652 | * network file systems exhibit such a problem). | 
|---|
|  | 653 | */ | 
|---|
| [174] | 654 | register ULONG x; | 
|---|
| [2] | 655 |  | 
|---|
| [174] | 656 | if (stopflag && *stopflag) | 
|---|
|  | 657 | goto Abort; | 
|---|
|  | 658 | pByte = (PBYTE)paffbFound; | 
|---|
|  | 659 | for (x = 0;;x < ulFileCnt) | 
|---|
|  | 660 | { | 
|---|
|  | 661 | pffbFile = (PFILEFINDBUF4)pByte; | 
|---|
|  | 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 | } | 
|---|
|  | 671 | else | 
|---|
|  | 672 | papffbSelected[x++] = pffbFile; | 
|---|
|  | 673 | if (!pffbFile->oNextEntryOffset) | 
|---|
|  | 674 | { | 
|---|
|  | 675 | ulFileCnt = x; | 
|---|
|  | 676 | break; | 
|---|
|  | 677 | } | 
|---|
|  | 678 | pByte += pffbFile->oNextEntryOffset; | 
|---|
|  | 679 | } | 
|---|
|  | 680 | if (ulFileCnt) | 
|---|
|  | 681 | { | 
|---|
| [167] | 682 | if (stopflag && *stopflag) | 
|---|
| [2] | 683 | goto Abort; | 
|---|
| [174] | 684 | if (fSyncUpdates) | 
|---|
| [167] | 685 | { | 
|---|
| [174] | 686 | pciFirst = WinSendMsg(hwndCnr, CM_ALLOCRECORD, | 
|---|
|  | 687 | MPFROMLONG(ulExtraBytes), | 
|---|
|  | 688 | MPFROMLONG(ulFileCnt)); | 
|---|
|  | 689 | if (pciFirst) | 
|---|
| [167] | 690 | { | 
|---|
| [174] | 691 | register INT   i; | 
|---|
|  | 692 |  | 
|---|
|  | 693 | pci = pciFirst; | 
|---|
|  | 694 | ullTotalBytes = 0; | 
|---|
|  | 695 | for(i = 0; i < ulFileCnt; i++) { | 
|---|
|  | 696 | pffbFile = papffbSelected[i]; | 
|---|
|  | 697 | ullBytes = FillInRecordFromFFB(hwndCnr,pci,pszFileSpec, | 
|---|
|  | 698 | pffbFile,partial,dcd); | 
|---|
|  | 699 | pci = (PCNRITEM)pci->rc.preccNextRecord; | 
|---|
|  | 700 | ullTotalBytes += ullBytes; | 
|---|
|  | 701 | } | 
|---|
|  | 702 | if (ulFileCnt) | 
|---|
| [167] | 703 | { | 
|---|
| [174] | 704 | memset(&ri,0,sizeof(RECORDINSERT)); | 
|---|
|  | 705 | ri.cb                 = sizeof(RECORDINSERT); | 
|---|
|  | 706 | ri.pRecordOrder       = (PRECORDCORE) CMA_END; | 
|---|
|  | 707 | ri.pRecordParent      = (PRECORDCORE) pciParent; | 
|---|
|  | 708 | ri.zOrder             = (ULONG) CMA_TOP; | 
|---|
|  | 709 | ri.cRecordsInsert     = ulFileCnt; | 
|---|
|  | 710 | ri.fInvalidateRecord  = (!fSyncUpdates && dcd && | 
|---|
|  | 711 | dcd->type == DIR_FRAME) ? | 
|---|
|  | 712 | FALSE : TRUE; | 
|---|
|  | 713 | if (!WinSendMsg(hwndCnr, | 
|---|
|  | 714 | CM_INSERTRECORD, | 
|---|
|  | 715 | MPFROMP(pciFirst), | 
|---|
|  | 716 | MPFROMP(&ri))) | 
|---|
| [167] | 717 | { | 
|---|
| [188] | 718 | DosSleep(100); | 
|---|
| [174] | 719 | WinSetFocus(HWND_DESKTOP,hwndCnr); | 
|---|
| [167] | 720 | if (!WinSendMsg(hwndCnr, | 
|---|
|  | 721 | CM_INSERTRECORD, | 
|---|
|  | 722 | MPFROMP(pciFirst), | 
|---|
|  | 723 | MPFROMP(&ri))) | 
|---|
| [90] | 724 | { | 
|---|
| [174] | 725 | Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__, | 
|---|
|  | 726 | GetPString(IDS_FILLDIRERR2TEXT)); | 
|---|
|  | 727 | ok = FALSE; | 
|---|
|  | 728 | ullTotalBytes = 0; | 
|---|
|  | 729 | if (WinIsWindow((HAB)0,hwndCnr)) | 
|---|
|  | 730 | { | 
|---|
|  | 731 | pci = pciFirst; | 
|---|
|  | 732 | while (pci) | 
|---|
| [167] | 733 | { | 
|---|
| [174] | 734 | pcit = (PCNRITEM)pci->rc.preccNextRecord; | 
|---|
|  | 735 | WinSendMsg(hwndCnr, | 
|---|
|  | 736 | CM_FREERECORD, | 
|---|
|  | 737 | MPFROMP(&pci), | 
|---|
|  | 738 | MPFROMSHORT(1)); | 
|---|
|  | 739 | pci = pcit; | 
|---|
| [2] | 740 | } | 
|---|
|  | 741 | } | 
|---|
|  | 742 | } | 
|---|
|  | 743 | } | 
|---|
|  | 744 | } | 
|---|
|  | 745 | } | 
|---|
| [167] | 746 | else | 
|---|
|  | 747 | { | 
|---|
| [174] | 748 | Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__, | 
|---|
|  | 749 | GetPString(IDS_FILLDIRERR3TEXT)); | 
|---|
|  | 750 | ok = FALSE; | 
|---|
|  | 751 | ullTotalBytes = 0; | 
|---|
| [2] | 752 | } | 
|---|
| [174] | 753 | if (ok) | 
|---|
|  | 754 | { | 
|---|
|  | 755 | ullReturnBytes += ullTotalBytes; | 
|---|
|  | 756 | ulReturnFiles += ulFileCnt; | 
|---|
|  | 757 | } | 
|---|
| [2] | 758 | } | 
|---|
| [174] | 759 | else | 
|---|
|  | 760 | { | 
|---|
|  | 761 | paffbTemp = realloc(paffbTotal,sizeof(FILEFINDBUF4) * | 
|---|
|  | 762 | (ulFileCnt + ulTotal)); | 
|---|
|  | 763 | if (paffbTemp) | 
|---|
|  | 764 | { | 
|---|
|  | 765 | paffbTotal = paffbTemp; | 
|---|
|  | 766 | for(x = 0;x < ulFileCnt;x++) | 
|---|
|  | 767 | paffbTotal[x + ulTotal] = *papffbSelected[x]; | 
|---|
|  | 768 | ulTotal += ulFileCnt; | 
|---|
|  | 769 | } | 
|---|
|  | 770 | else | 
|---|
|  | 771 | { | 
|---|
|  | 772 | saymsg(MB_ENTER, | 
|---|
|  | 773 | HWND_DESKTOP, | 
|---|
|  | 774 | GetPString(IDS_ERRORTEXT), | 
|---|
|  | 775 | GetPString(IDS_OUTOFMEMORY)); | 
|---|
|  | 776 | break; | 
|---|
|  | 777 | } | 
|---|
|  | 778 | } | 
|---|
| [2] | 779 | } | 
|---|
| [167] | 780 | if (stopflag && *stopflag) | 
|---|
| [2] | 781 | goto Abort; | 
|---|
| [167] | 782 | ulFileCnt = ulM; | 
|---|
| [2] | 783 | DosError(FERR_DISABLEHARDERR); | 
|---|
| [42] | 784 | rc = DosFindNext(hdir, paffbFound, ulM * sizeof(FILEFINDBUF4), | 
|---|
| [167] | 785 | &ulFileCnt); | 
|---|
| [2] | 786 | priority_normal(); | 
|---|
| [167] | 787 | if (rc) | 
|---|
| [2] | 788 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 789 | } | 
|---|
|  | 790 | DosFindClose(hdir); | 
|---|
|  | 791 |  | 
|---|
| [167] | 792 | if (paffbFound || papffbSelected) { | 
|---|
|  | 793 | if (paffbFound) | 
|---|
| [42] | 794 | free(paffbFound); | 
|---|
| [167] | 795 | if (papffbSelected) | 
|---|
| [42] | 796 | free(papffbSelected); | 
|---|
|  | 797 | papffbSelected = NULL; | 
|---|
|  | 798 | paffbFound = NULL; | 
|---|
| [2] | 799 | } | 
|---|
|  | 800 |  | 
|---|
| [167] | 801 | if (ulTotal && paffbTotal) | 
|---|
|  | 802 | { | 
|---|
|  | 803 |  | 
|---|
|  | 804 | if (stopflag && *stopflag) | 
|---|
| [2] | 805 | goto Abort; | 
|---|
| [167] | 806 |  | 
|---|
| [2] | 807 | pciFirst = WinSendMsg(hwndCnr, CM_ALLOCRECORD, | 
|---|
|  | 808 | MPFROMLONG(ulExtraBytes), | 
|---|
|  | 809 | MPFROMLONG(ulTotal)); | 
|---|
| [167] | 810 | if (pciFirst) | 
|---|
|  | 811 | { | 
|---|
| [2] | 812 | register INT   i; | 
|---|
|  | 813 |  | 
|---|
|  | 814 | pci = pciFirst; | 
|---|
| [167] | 815 | ullTotalBytes = 0; | 
|---|
| [42] | 816 | pByte2 = (PBYTE)paffbTotal; | 
|---|
| [167] | 817 | for(i = 0; i < ulTotal; i++) | 
|---|
|  | 818 | { | 
|---|
| [42] | 819 | pffbFile = (PFILEFINDBUF4)pByte2; | 
|---|
| [167] | 820 | ullBytes = FillInRecordFromFFB(hwndCnr,pci,pszFileSpec, | 
|---|
| [2] | 821 | pffbFile,partial,dcd); | 
|---|
| [167] | 822 | pci = (PCNRITEM)pci->rc.preccNextRecord; | 
|---|
|  | 823 | ullTotalBytes += ullBytes; | 
|---|
|  | 824 |  | 
|---|
| [42] | 825 | pByte2 += sizeof(FILEFINDBUF4); | 
|---|
| [2] | 826 | } | 
|---|
| [167] | 827 | if (ulTotal) | 
|---|
|  | 828 | { | 
|---|
| [2] | 829 | memset(&ri,0,sizeof(RECORDINSERT)); | 
|---|
|  | 830 | ri.cb                 = sizeof(RECORDINSERT); | 
|---|
|  | 831 | ri.pRecordOrder       = (PRECORDCORE) CMA_END; | 
|---|
|  | 832 | ri.pRecordParent      = (PRECORDCORE) pciParent; | 
|---|
|  | 833 | ri.zOrder             = (ULONG) CMA_TOP; | 
|---|
|  | 834 | ri.cRecordsInsert     = ulTotal; | 
|---|
|  | 835 | ri.fInvalidateRecord  = (!fSyncUpdates && dcd && | 
|---|
|  | 836 | dcd->type == DIR_FRAME) ? | 
|---|
|  | 837 | FALSE : TRUE; | 
|---|
| [167] | 838 | if (!WinSendMsg(hwndCnr,CM_INSERTRECORD, | 
|---|
|  | 839 | MPFROMP(pciFirst),MPFROMP(&ri))) | 
|---|
|  | 840 | { | 
|---|
| [188] | 841 | DosSleep(100); | 
|---|
| [2] | 842 | WinSetFocus(HWND_DESKTOP,hwndCnr); | 
|---|
| [167] | 843 | if (!WinSendMsg(hwndCnr,CM_INSERTRECORD, | 
|---|
| [90] | 844 | MPFROMP(pciFirst),MPFROMP(&ri))) | 
|---|
|  | 845 | { | 
|---|
| [145] | 846 | Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__, | 
|---|
|  | 847 | GetPString(IDS_FILLDIRERR5TEXT)); | 
|---|
| [167] | 848 | ok = FALSE; | 
|---|
|  | 849 | ullTotalBytes = 0; | 
|---|
|  | 850 | if (WinIsWindow((HAB)0,hwndCnr)) | 
|---|
|  | 851 | { | 
|---|
| [2] | 852 | pci = pciFirst; | 
|---|
| [167] | 853 | while (pci) | 
|---|
|  | 854 | { | 
|---|
| [2] | 855 | pcit = (PCNRITEM)pci->rc.preccNextRecord; | 
|---|
|  | 856 | WinSendMsg(hwndCnr,CM_FREERECORD, | 
|---|
|  | 857 | MPFROMP(&pci),MPFROMSHORT(1)); | 
|---|
|  | 858 | pci = pcit; | 
|---|
|  | 859 | } | 
|---|
|  | 860 | } | 
|---|
|  | 861 | } | 
|---|
|  | 862 | } | 
|---|
|  | 863 | } | 
|---|
|  | 864 | } | 
|---|
| [167] | 865 | else | 
|---|
|  | 866 | { | 
|---|
| [145] | 867 | Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__, | 
|---|
|  | 868 | GetPString(IDS_FILLDIRERR3TEXT)); | 
|---|
| [167] | 869 | ok = FALSE; | 
|---|
|  | 870 | ullTotalBytes = 0; | 
|---|
| [2] | 871 | } | 
|---|
| [167] | 872 | if (ok) | 
|---|
|  | 873 | { | 
|---|
|  | 874 | ullReturnBytes += ullTotalBytes; | 
|---|
|  | 875 | ulReturnFiles += ulFileCnt; | 
|---|
| [2] | 876 | } | 
|---|
|  | 877 | } | 
|---|
|  | 878 | } | 
|---|
|  | 879 |  | 
|---|
| [167] | 880 | if (!fSyncUpdates && dcd && dcd->type == DIR_FRAME) | 
|---|
| [2] | 881 | WinSendMsg(hwndCnr,CM_INVALIDATERECORD,MPVOID, | 
|---|
|  | 882 | MPFROM2SHORT(0,CMA_ERASE)); | 
|---|
|  | 883 | } | 
|---|
|  | 884 | Abort: | 
|---|
| [167] | 885 | if (paffbTotal || papffbSelected || paffbFound || pszFileSpec) | 
|---|
|  | 886 | { | 
|---|
|  | 887 | if (paffbTotal) | 
|---|
| [42] | 888 | free(paffbTotal); | 
|---|
| [167] | 889 | if (pszFileSpec) | 
|---|
| [42] | 890 | free(pszFileSpec); | 
|---|
| [167] | 891 | if (paffbFound) | 
|---|
| [42] | 892 | free(paffbFound); | 
|---|
| [167] | 893 | if (papffbSelected) | 
|---|
| [42] | 894 | free(papffbSelected); | 
|---|
| [2] | 895 | } | 
|---|
| [167] | 896 | if (recurse) | 
|---|
|  | 897 | { | 
|---|
| [2] | 898 | pci = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pciParent), | 
|---|
|  | 899 | MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER)); | 
|---|
| [167] | 900 | while (pci && (INT)pci != -1) | 
|---|
|  | 901 | { | 
|---|
|  | 902 | if (pci->attrFile & FILE_DIRECTORY) | 
|---|
| [2] | 903 | Stubby(hwndCnr,pci); | 
|---|
|  | 904 | pci = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci), | 
|---|
|  | 905 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | 
|---|
|  | 906 | } | 
|---|
|  | 907 | } | 
|---|
|  | 908 |  | 
|---|
| [167] | 909 | if (pulTotalFiles) | 
|---|
|  | 910 | *pulTotalFiles = ulReturnFiles; | 
|---|
| [2] | 911 |  | 
|---|
| [167] | 912 | if (pullTotalBytes) | 
|---|
|  | 913 | *pullTotalBytes = ullReturnBytes; | 
|---|
| [2] | 914 |  | 
|---|
| [167] | 915 | } // ProcessDirectory | 
|---|
|  | 916 |  | 
|---|
|  | 917 |  | 
|---|
|  | 918 | VOID FillDirCnr(HWND hwndCnr, | 
|---|
|  | 919 | CHAR *pszDirectory, | 
|---|
|  | 920 | DIRCNRDATA *dcd, | 
|---|
|  | 921 | PULONGLONG pullTotalBytes) | 
|---|
| [90] | 922 | { | 
|---|
| [167] | 923 | ProcessDirectory(hwndCnr, | 
|---|
|  | 924 | (PCNRITEM)NULL, | 
|---|
|  | 925 | pszDirectory, | 
|---|
|  | 926 | TRUE, | 
|---|
|  | 927 | FALSE, | 
|---|
|  | 928 | TRUE, | 
|---|
|  | 929 | dcd ? &dcd->stopflag : NULL, | 
|---|
|  | 930 | dcd, | 
|---|
|  | 931 | NULL, | 
|---|
|  | 932 | pullTotalBytes); | 
|---|
| [2] | 933 | DosPostEventSem(CompactSem); | 
|---|
|  | 934 |  | 
|---|
| [167] | 935 | } // FillDirCnr | 
|---|
| [2] | 936 |  | 
|---|
| [167] | 937 |  | 
|---|
|  | 938 | VOID FillTreeCnr(HWND hwndCnr,HWND hwndParent) | 
|---|
| [90] | 939 | { | 
|---|
| [188] | 940 | ULONG       ulDriveNum,ulDriveMap,numtoinsert = 0,drvtype; | 
|---|
| [2] | 941 | PCNRITEM    pci,pciFirst = NULL,pciNext,pciParent = NULL; | 
|---|
|  | 942 | INT         x,removable; | 
|---|
|  | 943 | CHAR        szDrive[] = " :\\",FileSystem[CCHMAXPATH],suggest[32]; | 
|---|
|  | 944 | FILESTATUS4 fsa4; | 
|---|
|  | 945 | APIRET      rc; | 
|---|
|  | 946 | BOOL        drivesbuilt = FALSE; | 
|---|
|  | 947 | static BOOL didonce = FALSE; | 
|---|
|  | 948 |  | 
|---|
|  | 949 | fDummy = TRUE; | 
|---|
|  | 950 | *suggest = 0; | 
|---|
| [167] | 951 | for (x = 0;x < 26;x++) | 
|---|
| [2] | 952 | driveflags[x] &= (DRIVE_IGNORE | DRIVE_NOPRESCAN | DRIVE_NOLOADICONS | | 
|---|
|  | 953 | DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS | | 
|---|
|  | 954 | DRIVE_INCLUDEFILES | DRIVE_SLOW); | 
|---|
|  | 955 | memset(driveserial,-1,sizeof(driveserial)); | 
|---|
|  | 956 | { | 
|---|
|  | 957 | ULONG  startdrive = 3L; | 
|---|
|  | 958 |  | 
|---|
|  | 959 | DosError(FERR_DISABLEHARDERR); | 
|---|
| [167] | 960 | if (!DosQuerySysInfo(QSV_BOOT_DRIVE, | 
|---|
|  | 961 | QSV_BOOT_DRIVE, | 
|---|
|  | 962 | (PVOID)&startdrive, | 
|---|
|  | 963 | (ULONG)sizeof(ULONG)) && | 
|---|
| [2] | 964 | startdrive) | 
|---|
|  | 965 | driveflags[startdrive - 1] |= DRIVE_BOOT; | 
|---|
|  | 966 | } | 
|---|
|  | 967 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 968 | rc = DosQCurDisk(&ulDriveNum, | 
|---|
|  | 969 | &ulDriveMap); | 
|---|
| [167] | 970 | if (rc) | 
|---|
|  | 971 | { | 
|---|
| [2] | 972 | Dos_Error(MB_CANCEL, | 
|---|
|  | 973 | rc, | 
|---|
|  | 974 | HWND_DESKTOP, | 
|---|
|  | 975 | __FILE__, | 
|---|
|  | 976 | __LINE__, | 
|---|
|  | 977 | GetPString(IDS_FILLDIRERR6TEXT)); | 
|---|
|  | 978 | exit(0); | 
|---|
|  | 979 | } | 
|---|
|  | 980 | for(x = 0;x < 26;x++) | 
|---|
| [167] | 981 | if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) | 
|---|
| [2] | 982 | numtoinsert++; | 
|---|
| [167] | 983 | if (numtoinsert) | 
|---|
| [2] | 984 | pciFirst = WinSendMsg(hwndCnr, | 
|---|
|  | 985 | CM_ALLOCRECORD, | 
|---|
|  | 986 | MPFROMLONG(EXTRA_RECORD_BYTES2), | 
|---|
|  | 987 | MPFROMLONG((ULONG)numtoinsert)); | 
|---|
| [167] | 988 | if (pciFirst) | 
|---|
|  | 989 | { | 
|---|
| [2] | 990 | pci = pciFirst; | 
|---|
|  | 991 | for(x = 0;x < 26;x++) { | 
|---|
| [167] | 992 | if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) | 
|---|
|  | 993 | { | 
|---|
| [2] | 994 | *szDrive = (CHAR)x + 'A'; | 
|---|
|  | 995 |  | 
|---|
|  | 996 | { | 
|---|
|  | 997 | CHAR  s[80]; | 
|---|
| [167] | 998 | ULONG flags = 0; | 
|---|
|  | 999 | ULONG size = sizeof(ULONG); | 
|---|
| [2] | 1000 |  | 
|---|
|  | 1001 | sprintf(s,"%c.DriveFlags",toupper(*szDrive)); | 
|---|
| [167] | 1002 | if (PrfQueryProfileData(fmprof,appname,s,&flags,&size) && | 
|---|
|  | 1003 | size == sizeof(ULONG)) | 
|---|
|  | 1004 | { | 
|---|
| [2] | 1005 | driveflags[toupper(*szDrive) - 'A'] |= flags; | 
|---|
| [167] | 1006 | } | 
|---|
| [2] | 1007 | } | 
|---|
|  | 1008 |  | 
|---|
| [167] | 1009 | if (x > 1) | 
|---|
|  | 1010 | { | 
|---|
|  | 1011 | if (!(driveflags[x] & DRIVE_NOPRESCAN)) | 
|---|
|  | 1012 | { | 
|---|
| [2] | 1013 | *FileSystem = 0; | 
|---|
|  | 1014 | drvtype = 0; | 
|---|
|  | 1015 | removable = CheckDrive(*szDrive,FileSystem,&drvtype); | 
|---|
|  | 1016 | driveserial[x] = -1; | 
|---|
| [167] | 1017 | if (removable != -1) | 
|---|
|  | 1018 | { | 
|---|
| [2] | 1019 | struct { | 
|---|
|  | 1020 | ULONG serial; | 
|---|
|  | 1021 | CHAR  volumelength; | 
|---|
|  | 1022 | CHAR  volumelabel[CCHMAXPATH]; | 
|---|
|  | 1023 | } volser; | 
|---|
|  | 1024 |  | 
|---|
|  | 1025 | DosError(FERR_DISABLEHARDERR); | 
|---|
| [167] | 1026 | if (!DosQueryFSInfo((ULONG)x, | 
|---|
|  | 1027 | FSIL_VOLSER, | 
|---|
|  | 1028 | &volser, | 
|---|
|  | 1029 | sizeof(volser))) | 
|---|
|  | 1030 | { | 
|---|
| [2] | 1031 | driveserial[x] = volser.serial; | 
|---|
| [167] | 1032 | } | 
|---|
| [2] | 1033 | } | 
|---|
|  | 1034 | else | 
|---|
|  | 1035 | driveflags[x] |= DRIVE_INVALID; | 
|---|
|  | 1036 | memset(&fsa4,0,sizeof(FILESTATUS4)); | 
|---|
|  | 1037 | driveflags[x] |= ((removable == -1 || removable == 1) ? | 
|---|
|  | 1038 | DRIVE_REMOVABLE : 0); | 
|---|
| [167] | 1039 | if (drvtype & DRIVE_REMOTE) | 
|---|
| [2] | 1040 | driveflags[x] |= DRIVE_REMOTE; | 
|---|
| [70] | 1041 | if (strcmp(FileSystem,HPFS) && | 
|---|
|  | 1042 | strcmp(FileSystem,JFS) && | 
|---|
|  | 1043 | strcmp(FileSystem,CDFS) && | 
|---|
|  | 1044 | strcmp(FileSystem,FAT32) && | 
|---|
|  | 1045 | strcmp(FileSystem,HPFS386)) | 
|---|
|  | 1046 | { | 
|---|
| [2] | 1047 | driveflags[x] |= DRIVE_NOLONGNAMES; | 
|---|
| [70] | 1048 | } | 
|---|
| [167] | 1049 | if (!strcmp(FileSystem,CDFS)) | 
|---|
|  | 1050 | { | 
|---|
| [2] | 1051 | removable = 1; | 
|---|
| [70] | 1052 | driveflags[x] |= DRIVE_REMOVABLE | DRIVE_NOTWRITEABLE | | 
|---|
|  | 1053 | DRIVE_CDROM; | 
|---|
| [2] | 1054 | } | 
|---|
| [167] | 1055 | else if (!stricmp(FileSystem,CBSIFS)) | 
|---|
| [70] | 1056 | { | 
|---|
| [2] | 1057 | driveflags[x] |= DRIVE_ZIPSTREAM; | 
|---|
| [70] | 1058 | driveflags[x] &= ~DRIVE_REMOTE; | 
|---|
| [167] | 1059 | if (drvtype & DRIVE_REMOVABLE) | 
|---|
| [2] | 1060 | driveflags[x] |= DRIVE_REMOVABLE; | 
|---|
| [167] | 1061 | if (!(drvtype & DRIVE_NOLONGNAMES)) | 
|---|
| [70] | 1062 | driveflags[x] &= ~DRIVE_NOLONGNAMES; | 
|---|
| [2] | 1063 | } | 
|---|
|  | 1064 |  | 
|---|
|  | 1065 | pci->rc.flRecordAttr |= CRA_RECORDREADONLY; | 
|---|
| [167] | 1066 | if ((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum) | 
|---|
| [2] | 1067 | pci->rc.flRecordAttr |= (CRA_CURSORED | CRA_SELECTED); | 
|---|
|  | 1068 |  | 
|---|
| [167] | 1069 | if (removable == 0) | 
|---|
|  | 1070 | { | 
|---|
| [2] | 1071 | pci->attrFile |= FILE_DIRECTORY; | 
|---|
|  | 1072 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 1073 | rc = DosQueryPathInfo(szDrive, | 
|---|
|  | 1074 | FIL_QUERYEASIZE, | 
|---|
|  | 1075 | &fsa4, | 
|---|
|  | 1076 | (ULONG)sizeof(FILESTATUS4)); | 
|---|
| [167] | 1077 | if (rc == 58) | 
|---|
|  | 1078 | { | 
|---|
| [2] | 1079 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 1080 | rc = DosQueryPathInfo(szDrive, | 
|---|
|  | 1081 | FIL_STANDARD, | 
|---|
|  | 1082 | &fsa4, | 
|---|
|  | 1083 | (ULONG)sizeof(FILESTATUS3)); | 
|---|
|  | 1084 | fsa4.cbList = 0; | 
|---|
|  | 1085 | } | 
|---|
| [167] | 1086 | if (rc && !didonce) | 
|---|
|  | 1087 | { | 
|---|
|  | 1088 | if (!*suggest) | 
|---|
|  | 1089 | { | 
|---|
| [2] | 1090 | *suggest = '/'; | 
|---|
|  | 1091 | suggest[1] = 0; | 
|---|
|  | 1092 | } | 
|---|
|  | 1093 | sprintf(suggest + strlen(suggest), | 
|---|
|  | 1094 | "%c", | 
|---|
|  | 1095 | toupper(*szDrive)); | 
|---|
|  | 1096 | strcpy(pci->szFileName,szDrive); | 
|---|
|  | 1097 | pci->pszFileName = pci->szFileName; | 
|---|
|  | 1098 | pci->rc.pszIcon = pci->pszFileName; | 
|---|
|  | 1099 | pci->attrFile = FILE_DIRECTORY; | 
|---|
|  | 1100 | strcpy(pci->szDispAttr,"----D-"); | 
|---|
|  | 1101 | pci->pszDispAttr = pci->szDispAttr; | 
|---|
|  | 1102 | driveserial[x] = -1; | 
|---|
|  | 1103 | } | 
|---|
|  | 1104 | else | 
|---|
|  | 1105 | FillInRecordFromFSA(hwndCnr, | 
|---|
|  | 1106 | pci, | 
|---|
|  | 1107 | szDrive, | 
|---|
|  | 1108 | &fsa4, | 
|---|
|  | 1109 | TRUE, | 
|---|
|  | 1110 | NULL); | 
|---|
|  | 1111 | } | 
|---|
| [167] | 1112 | else | 
|---|
|  | 1113 | { | 
|---|
| [2] | 1114 | strcpy(pci->szFileName,szDrive); | 
|---|
|  | 1115 | pci->pszFileName = pci->szFileName; | 
|---|
|  | 1116 | pci->rc.pszIcon = pci->pszFileName; | 
|---|
|  | 1117 | pci->attrFile = FILE_DIRECTORY; | 
|---|
|  | 1118 | strcpy(pci->szDispAttr,"----D-"); | 
|---|
|  | 1119 | pci->pszDispAttr = pci->szDispAttr; | 
|---|
|  | 1120 | } | 
|---|
|  | 1121 | *pci->szFileName = toupper(*pci->szFileName); | 
|---|
| [167] | 1122 | if (driveflags[x] & DRIVE_CDROM) | 
|---|
| [2] | 1123 | pci->rc.hptrIcon = hptrCDROM; | 
|---|
|  | 1124 | else | 
|---|
|  | 1125 | pci->rc.hptrIcon = (driveflags[x] & DRIVE_REMOVABLE) ? | 
|---|
|  | 1126 | hptrRemovable : | 
|---|
|  | 1127 | (driveflags[x] & DRIVE_REMOTE) ? | 
|---|
|  | 1128 | hptrRemote : | 
|---|
|  | 1129 | (driveflags[x] & DRIVE_ZIPSTREAM) ? | 
|---|
|  | 1130 | hptrZipstrm : hptrDrive; | 
|---|
|  | 1131 | } | 
|---|
| [167] | 1132 | else | 
|---|
|  | 1133 | { | 
|---|
| [2] | 1134 | pci->rc.hptrIcon = hptrDunno; | 
|---|
|  | 1135 | strcpy(pci->szFileName,szDrive); | 
|---|
|  | 1136 | pci->pszFileName = pci->szFileName; | 
|---|
|  | 1137 | pci->rc.pszIcon = pci->pszFileName; | 
|---|
|  | 1138 | pci->attrFile = FILE_DIRECTORY; | 
|---|
|  | 1139 | strcpy(pci->szDispAttr,"----D-"); | 
|---|
|  | 1140 | pci->pszDispAttr = pci->szDispAttr; | 
|---|
|  | 1141 | driveserial[x] = -1; | 
|---|
|  | 1142 | } | 
|---|
|  | 1143 | } | 
|---|
| [167] | 1144 | else | 
|---|
|  | 1145 | { | 
|---|
| [2] | 1146 | pci->rc.hptrIcon = hptrFloppy; | 
|---|
|  | 1147 | strcpy(pci->szFileName,szDrive); | 
|---|
|  | 1148 | pci->pszFileName = pci->szFileName; | 
|---|
|  | 1149 | pci->rc.pszIcon = pci->pszFileName; | 
|---|
|  | 1150 | pci->attrFile = FILE_DIRECTORY; | 
|---|
|  | 1151 | strcpy(pci->szDispAttr,"----D-"); | 
|---|
|  | 1152 | pci->pszDispAttr = pci->szDispAttr; | 
|---|
|  | 1153 | driveflags[x] |= (DRIVE_REMOVABLE | DRIVE_NOLONGNAMES); | 
|---|
|  | 1154 | driveserial[x] = -1; | 
|---|
|  | 1155 | } | 
|---|
|  | 1156 | pci->rc.flRecordAttr |= CRA_RECORDREADONLY; | 
|---|
|  | 1157 | pci = (PCNRITEM)pci->rc.preccNextRecord;  /* next rec */ | 
|---|
|  | 1158 | } | 
|---|
| [167] | 1159 | else if (!(ulDriveMap & (1L << x))) | 
|---|
| [2] | 1160 | driveflags[x] |= DRIVE_INVALID; | 
|---|
|  | 1161 | } | 
|---|
|  | 1162 | PostMsg(hwndMain, | 
|---|
|  | 1163 | UM_BUILDDRIVES, | 
|---|
|  | 1164 | MPVOID, | 
|---|
|  | 1165 | MPVOID); | 
|---|
|  | 1166 | drivesbuilt = TRUE; | 
|---|
|  | 1167 | /* insert the drives */ | 
|---|
| [167] | 1168 | if (numtoinsert && pciFirst) | 
|---|
|  | 1169 | { | 
|---|
| [2] | 1170 | RECORDINSERT ri; | 
|---|
|  | 1171 |  | 
|---|
|  | 1172 | memset(&ri,0,sizeof(RECORDINSERT)); | 
|---|
|  | 1173 | ri.cb                 = sizeof(RECORDINSERT); | 
|---|
|  | 1174 | ri.pRecordOrder       = (PRECORDCORE)CMA_END; | 
|---|
|  | 1175 | ri.pRecordParent      = (PRECORDCORE)NULL; | 
|---|
|  | 1176 | ri.zOrder             = (ULONG)CMA_TOP; | 
|---|
|  | 1177 | ri.cRecordsInsert     = numtoinsert; | 
|---|
|  | 1178 | ri.fInvalidateRecord  = FALSE; | 
|---|
| [167] | 1179 | if (!WinSendMsg(hwndCnr, | 
|---|
|  | 1180 | CM_INSERTRECORD, | 
|---|
|  | 1181 | MPFROMP(pciFirst), | 
|---|
|  | 1182 | MPFROMP(&ri))) | 
|---|
| [145] | 1183 | Win_Error(hwndCnr,hwndCnr,__FILE__,__LINE__, | 
|---|
|  | 1184 | GetPString(IDS_FILLDIRERR5TEXT)); | 
|---|
| [2] | 1185 | } | 
|---|
|  | 1186 | /* move cursor onto the default drive rather than the first drive */ | 
|---|
| [167] | 1187 | if (!fSwitchTree) | 
|---|
|  | 1188 | { | 
|---|
| [2] | 1189 | pci = (PCNRITEM)WinSendMsg(hwndCnr, | 
|---|
|  | 1190 | CM_QUERYRECORD, | 
|---|
|  | 1191 | MPVOID, | 
|---|
|  | 1192 | MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER)); | 
|---|
| [167] | 1193 | while(pci && (INT)pci != -1) | 
|---|
|  | 1194 | { | 
|---|
|  | 1195 | if ((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum) | 
|---|
|  | 1196 | { | 
|---|
| [2] | 1197 | WinSendMsg(hwndCnr, | 
|---|
|  | 1198 | CM_SETRECORDEMPHASIS, | 
|---|
|  | 1199 | MPFROMP(pci), | 
|---|
|  | 1200 | MPFROM2SHORT(TRUE,CRA_CURSORED)); | 
|---|
|  | 1201 | break; | 
|---|
|  | 1202 | } | 
|---|
|  | 1203 | pci = (PCNRITEM)WinSendMsg(hwndCnr, | 
|---|
|  | 1204 | CM_QUERYRECORD, | 
|---|
|  | 1205 | MPFROMP(pci), | 
|---|
|  | 1206 | MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER)); | 
|---|
|  | 1207 | } | 
|---|
|  | 1208 | } | 
|---|
|  | 1209 |  | 
|---|
| [167] | 1210 | if (hwndParent) | 
|---|
| [2] | 1211 | WinSendMsg(WinWindowFromID(WinQueryWindow(hwndParent,QW_PARENT), | 
|---|
|  | 1212 | MAIN_DRIVELIST), | 
|---|
|  | 1213 | LM_DELETEALL, | 
|---|
|  | 1214 | MPVOID, | 
|---|
|  | 1215 | MPVOID); | 
|---|
|  | 1216 |  | 
|---|
| [167] | 1217 | if (fShowEnv) | 
|---|
|  | 1218 | { | 
|---|
| [2] | 1219 | RECORDINSERT ri; | 
|---|
|  | 1220 |  | 
|---|
|  | 1221 | pciParent = WinSendMsg(hwndCnr, | 
|---|
|  | 1222 | CM_ALLOCRECORD, | 
|---|
|  | 1223 | MPFROMLONG(EXTRA_RECORD_BYTES2), | 
|---|
|  | 1224 | MPFROMLONG(1)); | 
|---|
| [167] | 1225 | if (pciParent) | 
|---|
|  | 1226 | { | 
|---|
| [2] | 1227 | pciParent->flags |= RECFLAGS_ENV; | 
|---|
|  | 1228 | strcpy(pciParent->szFileName,GetPString(IDS_ENVVARSTEXT)); | 
|---|
|  | 1229 | pciParent->pszFileName = pciParent->szFileName; | 
|---|
|  | 1230 | pciParent->rc.hptrIcon = hptrEnv; | 
|---|
|  | 1231 | pciParent->rc.pszIcon = pciParent->pszFileName; | 
|---|
|  | 1232 | strcpy(pciParent->szDispAttr,"------"); | 
|---|
|  | 1233 | pciParent->pszDispAttr = pciParent->szDispAttr; | 
|---|
|  | 1234 | memset(&ri,0,sizeof(RECORDINSERT)); | 
|---|
|  | 1235 | ri.cb                 = sizeof(RECORDINSERT); | 
|---|
|  | 1236 | ri.pRecordOrder       = (PRECORDCORE)CMA_END; | 
|---|
|  | 1237 | ri.pRecordParent      = (PRECORDCORE)NULL; | 
|---|
|  | 1238 | ri.zOrder             = (ULONG)CMA_TOP; | 
|---|
|  | 1239 | ri.cRecordsInsert     = 1; | 
|---|
|  | 1240 | ri.fInvalidateRecord  = FALSE; | 
|---|
| [167] | 1241 | if (WinSendMsg(hwndCnr, | 
|---|
|  | 1242 | CM_INSERTRECORD, | 
|---|
|  | 1243 | MPFROMP(pciParent), | 
|---|
|  | 1244 | MPFROMP(&ri))) { | 
|---|
| [2] | 1245 |  | 
|---|
|  | 1246 | char *p,*pp; | 
|---|
|  | 1247 |  | 
|---|
|  | 1248 | p = GetPString(IDS_ENVVARNAMES); | 
|---|
|  | 1249 | while(*p == ' ') | 
|---|
|  | 1250 | p++; | 
|---|
| [167] | 1251 | while (*p) | 
|---|
|  | 1252 | { | 
|---|
| [2] | 1253 | *FileSystem = 0; | 
|---|
|  | 1254 | pp = FileSystem; | 
|---|
|  | 1255 | while(*p && *p != ' ') | 
|---|
|  | 1256 | *pp++ = *p++; | 
|---|
|  | 1257 | *pp = 0; | 
|---|
|  | 1258 | while(*p == ' ') | 
|---|
|  | 1259 | p++; | 
|---|
| [167] | 1260 | if (*FileSystem && | 
|---|
|  | 1261 | (!stricmp(FileSystem,"LIBPATH") || | 
|---|
|  | 1262 | getenv(FileSystem))) | 
|---|
|  | 1263 | { | 
|---|
| [2] | 1264 | pci = WinSendMsg(hwndCnr, | 
|---|
|  | 1265 | CM_ALLOCRECORD, | 
|---|
|  | 1266 | MPFROMLONG(EXTRA_RECORD_BYTES2), | 
|---|
|  | 1267 | MPFROMLONG(1)); | 
|---|
| [167] | 1268 | if (pci) | 
|---|
|  | 1269 | { | 
|---|
| [2] | 1270 | pci->flags |= RECFLAGS_ENV; | 
|---|
|  | 1271 | sprintf(pci->szFileName, | 
|---|
|  | 1272 | "%%%s%%", | 
|---|
|  | 1273 | FileSystem); | 
|---|
|  | 1274 | pci->pszFileName = pci->szFileName; | 
|---|
|  | 1275 | pci->rc.hptrIcon = hptrEnv; | 
|---|
|  | 1276 | pci->rc.pszIcon = pci->pszFileName; | 
|---|
|  | 1277 | strcpy(pci->szDispAttr,"------"); | 
|---|
|  | 1278 | pci->pszDispAttr = pci->szDispAttr; | 
|---|
|  | 1279 | memset(&ri,0,sizeof(RECORDINSERT)); | 
|---|
|  | 1280 | ri.cb                 = sizeof(RECORDINSERT); | 
|---|
|  | 1281 | ri.pRecordOrder       = (PRECORDCORE)CMA_END; | 
|---|
|  | 1282 | ri.pRecordParent      = (PRECORDCORE)pciParent; | 
|---|
|  | 1283 | ri.zOrder             = (ULONG)CMA_TOP; | 
|---|
|  | 1284 | ri.cRecordsInsert     = 1; | 
|---|
|  | 1285 | ri.fInvalidateRecord  = FALSE; | 
|---|
| [167] | 1286 | if (!WinSendMsg(hwndCnr, | 
|---|
|  | 1287 | CM_INSERTRECORD, | 
|---|
|  | 1288 | MPFROMP(pci), | 
|---|
|  | 1289 | MPFROMP(&ri))) { | 
|---|
| [145] | 1290 | Win_Error(hwndCnr,hwndCnr,__FILE__,__LINE__, | 
|---|
|  | 1291 | GetPString(IDS_FILLDIRERR5TEXT)); | 
|---|
| [2] | 1292 | WinSendMsg(hwndCnr, | 
|---|
|  | 1293 | CM_FREERECORD, | 
|---|
|  | 1294 | MPFROMP(&pci), | 
|---|
|  | 1295 | MPFROMSHORT(1)); | 
|---|
|  | 1296 | } | 
|---|
|  | 1297 | } | 
|---|
|  | 1298 | } | 
|---|
|  | 1299 | } | 
|---|
|  | 1300 | WinSendMsg(hwndCnr, | 
|---|
|  | 1301 | CM_INVALIDATERECORD, | 
|---|
|  | 1302 | MPFROMP(&pciParent), | 
|---|
|  | 1303 | MPFROM2SHORT(1,CMA_ERASE | CMA_REPOSITION)); | 
|---|
|  | 1304 | } | 
|---|
|  | 1305 | else | 
|---|
|  | 1306 | WinSendMsg(hwndCnr, | 
|---|
|  | 1307 | CM_FREERECORD, | 
|---|
|  | 1308 | MPFROMP(&pciParent), | 
|---|
|  | 1309 | MPFROMSHORT(1)); | 
|---|
|  | 1310 | } | 
|---|
|  | 1311 | } | 
|---|
|  | 1312 |  | 
|---|
|  | 1313 | x = 0; | 
|---|
|  | 1314 | pci = (PCNRITEM)WinSendMsg(hwndCnr, | 
|---|
|  | 1315 | CM_QUERYRECORD, | 
|---|
|  | 1316 | MPVOID, | 
|---|
| [167] | 1317 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); | 
|---|
|  | 1318 | while (pci && (INT)pci != -1) | 
|---|
|  | 1319 | { | 
|---|
| [2] | 1320 | pciNext = (PCNRITEM)WinSendMsg(hwndCnr, | 
|---|
|  | 1321 | CM_QUERYRECORD, | 
|---|
|  | 1322 | MPFROMP(pci), | 
|---|
| [167] | 1323 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | 
|---|
|  | 1324 | if (!(pci->flags & RECFLAGS_ENV)) | 
|---|
|  | 1325 | { | 
|---|
|  | 1326 | if ((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum || | 
|---|
|  | 1327 | toupper(*pci->szFileName) > 'B') | 
|---|
|  | 1328 | { | 
|---|
|  | 1329 | if (!(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_INVALID) && | 
|---|
| [2] | 1330 | !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOPRESCAN) && | 
|---|
|  | 1331 | (!fNoRemovableScan || | 
|---|
| [167] | 1332 | !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE))) | 
|---|
|  | 1333 | { | 
|---|
|  | 1334 | if (!Stubby(hwndCnr,pci)) | 
|---|
|  | 1335 | { | 
|---|
| [2] | 1336 | WinSendMsg(hwndCnr, | 
|---|
|  | 1337 | CM_INVALIDATERECORD, | 
|---|
|  | 1338 | MPFROMP(&pci), | 
|---|
|  | 1339 | MPFROM2SHORT(1,CMA_ERASE | CMA_REPOSITION)); | 
|---|
|  | 1340 | goto SkipBadRec; | 
|---|
|  | 1341 | } | 
|---|
|  | 1342 | } | 
|---|
|  | 1343 | } | 
|---|
|  | 1344 | else | 
|---|
|  | 1345 | WinSendMsg(hwndCnr, | 
|---|
|  | 1346 | CM_INVALIDATERECORD, | 
|---|
|  | 1347 | MPFROMP(&pci), | 
|---|
|  | 1348 | MPFROM2SHORT(1,CMA_ERASE | CMA_REPOSITION)); | 
|---|
| [167] | 1349 |  | 
|---|
| [2] | 1350 | WinSendMsg(WinWindowFromID(WinQueryWindow(hwndParent,QW_PARENT), | 
|---|
|  | 1351 | MAIN_DRIVELIST), | 
|---|
|  | 1352 | LM_INSERTITEM, | 
|---|
|  | 1353 | MPFROM2SHORT(LIT_SORTASCENDING,0), | 
|---|
|  | 1354 | MPFROMP(pci->szFileName)); | 
|---|
|  | 1355 | } | 
|---|
|  | 1356 | SkipBadRec: | 
|---|
|  | 1357 | x++; | 
|---|
|  | 1358 | pci = pciNext; | 
|---|
|  | 1359 | } | 
|---|
| [167] | 1360 | if (hwndParent) | 
|---|
| [2] | 1361 | WinSendMsg(WinWindowFromID(WinQueryWindow(hwndParent,QW_PARENT), | 
|---|
|  | 1362 | MAIN_DRIVELIST),LM_SELECTITEM,MPFROM2SHORT(0,0), | 
|---|
|  | 1363 | MPFROMLONG(TRUE)); | 
|---|
|  | 1364 |  | 
|---|
|  | 1365 | pci = (PCNRITEM)WinSendMsg(hwndCnr, | 
|---|
|  | 1366 | CM_QUERYRECORD, | 
|---|
|  | 1367 | MPVOID, | 
|---|
|  | 1368 | MPFROM2SHORT(CMA_FIRST, | 
|---|
|  | 1369 | CMA_ITEMORDER)); | 
|---|
| [167] | 1370 | while (pci && (INT)pci != -1) | 
|---|
|  | 1371 | { | 
|---|
| [2] | 1372 | pciNext = (PCNRITEM)WinSendMsg(hwndCnr, | 
|---|
|  | 1373 | CM_QUERYRECORD, | 
|---|
|  | 1374 | MPFROMP(pci), | 
|---|
|  | 1375 | MPFROM2SHORT(CMA_NEXT, | 
|---|
|  | 1376 | CMA_ITEMORDER)); | 
|---|
| [167] | 1377 | if (pci->flags & RECFLAGS_ENV) | 
|---|
|  | 1378 | { | 
|---|
| [2] | 1379 | pci = (PCNRITEM)WinSendMsg(hwndCnr, | 
|---|
|  | 1380 | CM_QUERYRECORD, | 
|---|
|  | 1381 | MPFROMP(pci), | 
|---|
|  | 1382 | MPFROM2SHORT(CMA_FIRSTCHILD, | 
|---|
|  | 1383 | CMA_ITEMORDER)); | 
|---|
| [167] | 1384 | while (pci && (INT)pci != -1) | 
|---|
|  | 1385 | { | 
|---|
|  | 1386 | if (pci->flags & RECFLAGS_ENV) | 
|---|
| [2] | 1387 | FleshEnv(hwndCnr,pci); | 
|---|
|  | 1388 | pci = (PCNRITEM)WinSendMsg(hwndCnr, | 
|---|
|  | 1389 | CM_QUERYRECORD, | 
|---|
|  | 1390 | MPFROMP(pci), | 
|---|
|  | 1391 | MPFROM2SHORT(CMA_NEXT, | 
|---|
|  | 1392 | CMA_ITEMORDER)); | 
|---|
|  | 1393 | } | 
|---|
|  | 1394 | break; | 
|---|
|  | 1395 | } | 
|---|
|  | 1396 | pci = (PCNRITEM)WinSendMsg(hwndCnr, | 
|---|
|  | 1397 | CM_QUERYRECORD, | 
|---|
|  | 1398 | MPFROMP(pci), | 
|---|
|  | 1399 | MPFROM2SHORT(CMA_NEXT, | 
|---|
|  | 1400 | CMA_ITEMORDER)); | 
|---|
|  | 1401 | } | 
|---|
|  | 1402 |  | 
|---|
|  | 1403 | } | 
|---|
| [167] | 1404 | else | 
|---|
|  | 1405 | { | 
|---|
| [145] | 1406 | Win_Error(hwndCnr,hwndCnr,__FILE__,__LINE__, | 
|---|
|  | 1407 | GetPString(IDS_FILLDIRERR7TEXT)); | 
|---|
| [2] | 1408 | exit(0); | 
|---|
|  | 1409 | } | 
|---|
| [167] | 1410 | if (!drivesbuilt && hwndMain) | 
|---|
| [2] | 1411 | PostMsg(hwndMain, | 
|---|
|  | 1412 | UM_BUILDDRIVES, | 
|---|
|  | 1413 | MPVOID, | 
|---|
|  | 1414 | MPVOID); | 
|---|
|  | 1415 | DosSleep(33L); | 
|---|
|  | 1416 | fDummy = FALSE; | 
|---|
|  | 1417 | DosPostEventSem(CompactSem); | 
|---|
|  | 1418 | { | 
|---|
|  | 1419 | BYTE info; | 
|---|
|  | 1420 | BOOL includesyours = FALSE; | 
|---|
|  | 1421 |  | 
|---|
| [167] | 1422 | if (*suggest || | 
|---|
|  | 1423 | (!(driveflags[1] & DRIVE_IGNORE) && | 
|---|
|  | 1424 | fFirstTime)) | 
|---|
|  | 1425 | { | 
|---|
|  | 1426 | if (!DosDevConfig(&info, | 
|---|
| [2] | 1427 | DEVINFO_FLOPPY) && | 
|---|
| [167] | 1428 | info == 1) | 
|---|
|  | 1429 | { | 
|---|
|  | 1430 | if (!*suggest) | 
|---|
|  | 1431 | { | 
|---|
| [2] | 1432 | *suggest = '/'; | 
|---|
|  | 1433 | suggest[1] = 0; | 
|---|
|  | 1434 | } | 
|---|
|  | 1435 | else | 
|---|
|  | 1436 | memmove(suggest + 2,suggest + 1,strlen(suggest)); | 
|---|
|  | 1437 | suggest[1] = 'B'; | 
|---|
|  | 1438 | } | 
|---|
|  | 1439 | } | 
|---|
| [167] | 1440 | if (*suggest) | 
|---|
|  | 1441 | { | 
|---|
|  | 1442 | for(x = 2;x < 26;x++) | 
|---|
|  | 1443 | { | 
|---|
|  | 1444 | if (driveflags[x] & DRIVE_IGNORE) | 
|---|
|  | 1445 | { | 
|---|
| [2] | 1446 | includesyours = TRUE; | 
|---|
|  | 1447 | sprintf(suggest + strlen(suggest), | 
|---|
|  | 1448 | "%c", | 
|---|
|  | 1449 | (char)(x + 'A')); | 
|---|
|  | 1450 | } | 
|---|
|  | 1451 | } | 
|---|
|  | 1452 | strcat(suggest," %*"); | 
|---|
| [167] | 1453 | if (saymsg(MB_YESNO | MB_ICONEXCLAMATION, | 
|---|
|  | 1454 | (hwndParent) ? hwndParent : hwndCnr, | 
|---|
|  | 1455 | GetPString(IDS_SUGGESTTITLETEXT), | 
|---|
|  | 1456 | GetPString(IDS_SUGGEST1TEXT), | 
|---|
|  | 1457 | (includesyours) ? GetPString(IDS_SUGGEST2TEXT) : NullStr, | 
|---|
|  | 1458 | suggest) == MBID_YES) | 
|---|
|  | 1459 | { | 
|---|
| [2] | 1460 | char s[64]; | 
|---|
|  | 1461 |  | 
|---|
| [167] | 1462 | sprintf(s, "PARAMETERS=%s", suggest); | 
|---|
| [2] | 1463 | WinCreateObject(WPProgram, | 
|---|
|  | 1464 | "FM/2", | 
|---|
|  | 1465 | s, | 
|---|
|  | 1466 | FM3Folder, | 
|---|
|  | 1467 | CO_UPDATEIFEXISTS); | 
|---|
|  | 1468 | WinCreateObject(WPProgram, | 
|---|
|  | 1469 | "FM/2 Lite", | 
|---|
|  | 1470 | s, | 
|---|
|  | 1471 | FM3Folder, | 
|---|
|  | 1472 | CO_UPDATEIFEXISTS); | 
|---|
|  | 1473 | WinCreateObject(WPProgram, | 
|---|
|  | 1474 | "Archive Viewer/2", | 
|---|
|  | 1475 | s, | 
|---|
|  | 1476 | FM3Tools, | 
|---|
|  | 1477 | CO_UPDATEIFEXISTS); | 
|---|
|  | 1478 | WinCreateObject(WPProgram, | 
|---|
|  | 1479 | "Dir Sizes", | 
|---|
|  | 1480 | s, | 
|---|
|  | 1481 | FM3Tools, | 
|---|
|  | 1482 | CO_UPDATEIFEXISTS); | 
|---|
|  | 1483 | WinCreateObject(WPProgram, | 
|---|
|  | 1484 | "Visual Tree", | 
|---|
|  | 1485 | s, | 
|---|
|  | 1486 | FM3Tools, | 
|---|
|  | 1487 | CO_UPDATEIFEXISTS); | 
|---|
|  | 1488 | WinCreateObject(WPProgram, | 
|---|
|  | 1489 | "Visual Directory", | 
|---|
|  | 1490 | s, | 
|---|
|  | 1491 | FM3Tools, | 
|---|
|  | 1492 | CO_UPDATEIFEXISTS); | 
|---|
|  | 1493 | WinCreateObject(WPProgram, | 
|---|
|  | 1494 | "Global File Viewer", | 
|---|
|  | 1495 | s, | 
|---|
|  | 1496 | FM3Tools, | 
|---|
|  | 1497 | CO_UPDATEIFEXISTS); | 
|---|
|  | 1498 | WinCreateObject(WPProgram, | 
|---|
|  | 1499 | "Databar", | 
|---|
|  | 1500 | s, | 
|---|
|  | 1501 | FM3Tools, | 
|---|
|  | 1502 | CO_UPDATEIFEXISTS); | 
|---|
|  | 1503 | } | 
|---|
|  | 1504 | } | 
|---|
|  | 1505 | } | 
|---|
|  | 1506 | didonce = TRUE; | 
|---|
|  | 1507 |  | 
|---|
| [167] | 1508 | } // FillTreeCnr | 
|---|
|  | 1509 |  | 
|---|