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