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