1 |
|
---|
2 | /***********************************************************************
|
---|
3 |
|
---|
4 | $Id: flesh.c 1650 2011-11-19 21:21:47Z gyoung $
|
---|
5 |
|
---|
6 | Flesh
|
---|
7 |
|
---|
8 | Copyright (c) 1993-98 M. Kimes
|
---|
9 | Copyright (c) 2005, 2010 Steven H. Levine
|
---|
10 |
|
---|
11 | 24 May 05 SHL Rework Win_Error usage
|
---|
12 | 25 May 05 SHL Rework for ProcessDirectory
|
---|
13 | 28 May 05 SHL Clean while reading code
|
---|
14 | 24 Oct 05 SHL Delete obsolete code
|
---|
15 | 22 Jul 06 SHL Check more run time errors
|
---|
16 | 19 Oct 06 SHL Stubby - correct . and .. detect
|
---|
17 | 22 Mar 07 GKY Use QWL_USER
|
---|
18 | 01 Aug 07 SHL Sync with CNRITEM mods
|
---|
19 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
|
---|
20 | 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
|
---|
21 | 29 Feb 08 GKY Use xfree where appropriate
|
---|
22 | 24 Nov 08 GKY remove redundant code and minor speed up of Stubby
|
---|
23 | 25 Dec 08 GKY Add ProcessDirectoryThread to allow optional recursive drive scan at startup.
|
---|
24 | 25 Dec 08 GKY Add DRIVE_RSCANNED flag to monitor for the first recursive drive scan per session
|
---|
25 | to prevent duplicate directory names in tree following a copy before initial scan.
|
---|
26 | 08 Mar 09 GKY Additional strings move to PCSZs in init.c
|
---|
27 | 13 Dec 09 GKY Fixed separate paramenters. Please note that appname should be used in
|
---|
28 | profile calls for user settings that work and are setable in more than one
|
---|
29 | miniapp; FM3Str should be used for setting only relavent to FM/2 or that
|
---|
30 | aren't user settable; realappname should be used for setting applicable to
|
---|
31 | one or more miniapp but not to FM/2
|
---|
32 | 17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
|
---|
33 |
|
---|
34 | ***********************************************************************/
|
---|
35 |
|
---|
36 | #include <stdlib.h>
|
---|
37 | #include <string.h>
|
---|
38 | #include <ctype.h>
|
---|
39 |
|
---|
40 | #define INCL_DOS
|
---|
41 | #define INCL_DOSERRORS
|
---|
42 | #define INCL_WIN
|
---|
43 | #define INCL_LONGLONG // dircnrs.h
|
---|
44 |
|
---|
45 | #include "fm3dll.h"
|
---|
46 | #include "draglist.h" // Data declaration(s)
|
---|
47 | #include "notebook.h" // Data declaration(s)
|
---|
48 | #include "info.h" // Data declaration(s)
|
---|
49 | #include "init.h" // Data declaration(s)
|
---|
50 | #include "mainwnd.h" // Data declaration(s)
|
---|
51 | #include "fm3str.h"
|
---|
52 | #include "filldir.h" // FileAttrToString...
|
---|
53 | #include "errutil.h" // Dos_Error...
|
---|
54 | #include "strutil.h" // GetPString
|
---|
55 | #include "flesh.h"
|
---|
56 | #include "valid.h" // IsValidDir
|
---|
57 | #include "misc.h" // LoadLibPath
|
---|
58 | #include "findrec.h" // FindCnrRecord
|
---|
59 | #include "notify.h" // Notify
|
---|
60 | #include "wrappers.h" // xfree
|
---|
61 | #include "excputil.h" // xbeginthread
|
---|
62 |
|
---|
63 | // Data definitions
|
---|
64 | #pragma data_seg(DATA1)
|
---|
65 |
|
---|
66 | static PSZ pszSrcFile = __FILE__;
|
---|
67 |
|
---|
68 | #pragma data_seg(GLOBAL1)
|
---|
69 | ULONG NoBrokenNotify;
|
---|
70 | BOOL fFilesInTree;
|
---|
71 |
|
---|
72 | BOOL FleshEnv(HWND hwndCnr, PCNRITEM pciParent)
|
---|
73 | {
|
---|
74 | PCNRITEM pciL;
|
---|
75 | DIRCNRDATA *dcd;
|
---|
76 | CHAR path[CCHMAXPATH + 12],
|
---|
77 | fullpath[CCHMAXPATH + 12], *env, *p, *pp, *var = NULL;
|
---|
78 |
|
---|
79 | if (!pciParent || (INT) pciParent == -1 || !hwndCnr)
|
---|
80 | return FALSE;
|
---|
81 | dcd = (DIRCNRDATA *) WinQueryWindowPtr(hwndCnr, QWL_USER);
|
---|
82 | if (!dcd)
|
---|
83 | return FALSE;
|
---|
84 |
|
---|
85 | strcpy(path, pciParent->pszFileName + 1);
|
---|
86 | if (stricmp(path, GetPString(IDS_ENVVARSTEXT) + 1))
|
---|
87 | UnFlesh(hwndCnr, pciParent);
|
---|
88 | if (*path) {
|
---|
89 | path[strlen(path) - 1] = 0;
|
---|
90 | if (!stricmp(path, PCSZ_LIBPATH)) {
|
---|
91 | var = xmalloc(65536, pszSrcFile, __LINE__);
|
---|
92 | if (var)
|
---|
93 | LoadLibPath(var, 65536);
|
---|
94 | env = var;
|
---|
95 | }
|
---|
96 | else
|
---|
97 | env = getenv(path);
|
---|
98 | if (env && *env) {
|
---|
99 | p = env;
|
---|
100 | while (*p) {
|
---|
101 | pp = path;
|
---|
102 | while (*p == ';')
|
---|
103 | p++;
|
---|
104 | while (*p && *p != ';') {
|
---|
105 | *pp = *p;
|
---|
106 | p++;
|
---|
107 | pp++;
|
---|
108 | }
|
---|
109 | *pp = 0;
|
---|
110 | if (*path &&
|
---|
111 | strcmp(path, ".") &&
|
---|
112 | strcmp(path, ".\\") &&
|
---|
113 | strcmp(path, "..") &&
|
---|
114 | strcmp(path, "..\\") &&
|
---|
115 | strncmp(path, ".\\", 2) && strncmp(path, "..\\", 3)) {
|
---|
116 | if (!DosQueryPathInfo(path,
|
---|
117 | FIL_QUERYFULLNAME,
|
---|
118 | fullpath,
|
---|
119 | sizeof(fullpath)) && IsValidDir(fullpath)) {
|
---|
120 | pciL = FindCnrRecord(hwndCnr,
|
---|
121 | fullpath, pciParent, FALSE, FALSE, FALSE);
|
---|
122 | if (pciL) {
|
---|
123 | while (pciL && pciL != (PCNRITEM) - 1 && pciL != pciParent)
|
---|
124 | pciL = WinSendMsg(hwndCnr,
|
---|
125 | CM_QUERYRECORD,
|
---|
126 | MPFROMP(pciL),
|
---|
127 | MPFROM2SHORT(CMA_PARENT, CMA_ITEMORDER));
|
---|
128 | }
|
---|
129 | if (!pciL) {
|
---|
130 |
|
---|
131 | RECORDINSERT ri;
|
---|
132 |
|
---|
133 | pciL = WinSendMsg(hwndCnr,
|
---|
134 | CM_ALLOCRECORD,
|
---|
135 | MPFROMLONG(EXTRA_RECORD_BYTES),
|
---|
136 | MPFROMLONG(1));
|
---|
137 | if (pciL) {
|
---|
138 | pciL->pszFileName = xstrdup(fullpath, pszSrcFile, __LINE__);
|
---|
139 | pciL->rc.pszIcon = pciL->pszFileName;
|
---|
140 | if (!fNoIconsDirs &&
|
---|
141 | (!isalpha(*fullpath) ||
|
---|
142 | !(driveflags[toupper(*fullpath) - 'A'] &
|
---|
143 | DRIVE_NOLOADICONS)))
|
---|
144 | pciL->rc.hptrIcon = WinLoadFileIcon(fullpath, FALSE);
|
---|
145 | if (!pciL->rc.hptrIcon)
|
---|
146 | pciL->rc.hptrIcon = hptrDir;
|
---|
147 | pciL->attrFile = FILE_DIRECTORY;
|
---|
148 | pciL->pszDispAttr = FileAttrToString(pciL->attrFile);
|
---|
149 | memset(&ri, 0, sizeof(ri));
|
---|
150 | ri.cb = sizeof(ri);
|
---|
151 | ri.pRecordOrder = (PRECORDCORE) CMA_END;
|
---|
152 | ri.pRecordParent = (PRECORDCORE) pciParent;
|
---|
153 | ri.zOrder = (ULONG) CMA_TOP;
|
---|
154 | ri.cRecordsInsert = 1;
|
---|
155 | ri.fInvalidateRecord = FALSE;
|
---|
156 | if (!WinSendMsg(hwndCnr,
|
---|
157 | CM_INSERTRECORD, MPFROMP(pciL), MPFROMP(&ri)))
|
---|
158 | FreeCnrItem(hwndCnr, pciL);
|
---|
159 | }
|
---|
160 | }
|
---|
161 | }
|
---|
162 | }
|
---|
163 | }
|
---|
164 | }
|
---|
165 | xfree(var, pszSrcFile, __LINE__);
|
---|
166 | pciL = (PCNRITEM) WinSendMsg(hwndCnr,
|
---|
167 | CM_QUERYRECORD,
|
---|
168 | MPFROMP(pciParent),
|
---|
169 | MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
|
---|
170 | while (pciL && (INT) pciL != -1) {
|
---|
171 | pciL->flags |= (RECFLAGS_NODRAG | RECFLAGS_UNDERENV);
|
---|
172 | WinSendMsg(hwndCnr,
|
---|
173 | CM_INVALIDATERECORD, MPFROMP(&pciL), MPFROM2SHORT(1, 0));
|
---|
174 | pciL = WinSendMsg(hwndCnr,
|
---|
175 | CM_QUERYRECORD,
|
---|
176 | MPFROMP(pciL), MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
177 | }
|
---|
178 | }
|
---|
179 | return TRUE;
|
---|
180 | }
|
---|
181 |
|
---|
182 | BOOL Flesh(HWND hwndCnr, PCNRITEM pciParent)
|
---|
183 | {
|
---|
184 | PCNRITEM pciL;
|
---|
185 | DIRCNRDATA *dcd;
|
---|
186 | BOOL includefiles = fFilesInTree;
|
---|
187 |
|
---|
188 | if (!pciParent || (INT) pciParent == -1 || !hwndCnr)
|
---|
189 | return FALSE;
|
---|
190 | pciL = (PCNRITEM) WinSendMsg(hwndCnr,
|
---|
191 | CM_QUERYRECORD,
|
---|
192 | MPFROMP(pciParent),
|
---|
193 | MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
|
---|
194 | if (pciL && (INT) pciL != -1 && *pciL->pszFileName)
|
---|
195 | return FALSE;
|
---|
196 | dcd = INSTDATA(hwndCnr);
|
---|
197 | if (dcd && dcd->size != sizeof(DIRCNRDATA))
|
---|
198 | dcd = NULL;
|
---|
199 | if (driveflags[toupper(*pciParent->pszFileName) - 'A'] &
|
---|
200 | DRIVE_INCLUDEFILES)
|
---|
201 | includefiles = TRUE;
|
---|
202 | ProcessDirectory(hwndCnr,
|
---|
203 | pciParent,
|
---|
204 | pciParent->pszFileName,
|
---|
205 | includefiles, // filestoo
|
---|
206 | TRUE, // recurse
|
---|
207 | TRUE, // partial
|
---|
208 | NULL, // stop flag
|
---|
209 | dcd,
|
---|
210 | NULL, // total files
|
---|
211 | NULL); // total bytes
|
---|
212 | driveflags[*pciParent->pszFileName - 'A'] |= DRIVE_RSCANNED;
|
---|
213 | return TRUE;
|
---|
214 | }
|
---|
215 |
|
---|
216 | BOOL UnFlesh(HWND hwndCnr, PCNRITEM pciParent)
|
---|
217 | {
|
---|
218 | BOOL ret = FALSE;
|
---|
219 | PCNRITEM pciL;
|
---|
220 |
|
---|
221 | if (!pciParent || !hwndCnr)
|
---|
222 | return FALSE;
|
---|
223 | for (;;) {
|
---|
224 | pciL = (PCNRITEM) WinSendMsg(hwndCnr,
|
---|
225 | CM_QUERYRECORD,
|
---|
226 | MPFROMP(pciParent),
|
---|
227 | MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
|
---|
228 | if (pciL && (INT) pciL != -1) {
|
---|
229 | ret = TRUE;
|
---|
230 | RemoveCnrItems(hwndCnr, pciL, 1, CMA_FREE);
|
---|
231 | }
|
---|
232 | else
|
---|
233 | break;
|
---|
234 | }
|
---|
235 | if (ret) {
|
---|
236 | WinSendMsg(hwndCnr,
|
---|
237 | CM_INVALIDATERECORD,
|
---|
238 | MPFROMP(&pciParent),
|
---|
239 | MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
|
---|
240 | }
|
---|
241 | return ret;
|
---|
242 | }
|
---|
243 |
|
---|
244 | #define DDEPTH 64
|
---|
245 |
|
---|
246 | /**
|
---|
247 | * Fill in drive tree subtree
|
---|
248 | * @return TRUE if OK, else FALSE
|
---|
249 | * This only scans the root directory and adds the first level directories
|
---|
250 | * Flesh does a recursive scan and should be used on fast hardware.
|
---|
251 | */
|
---|
252 |
|
---|
253 | BOOL Stubby(HWND hwndCnr, PCNRITEM pciParent)
|
---|
254 | {
|
---|
255 | /**
|
---|
256 | * this code is full of workarounds for screwed up LANs.
|
---|
257 | * let's hope all the current LAN programmers fall into
|
---|
258 | * a black hole and make way for people who can get it right...
|
---|
259 | */
|
---|
260 |
|
---|
261 | BOOL ok = FALSE;
|
---|
262 | FILEFINDBUF3 ffb[DDEPTH];
|
---|
263 | PFILEFINDBUF3 pffb;
|
---|
264 | HDIR hDir = HDIR_CREATE;
|
---|
265 | ULONG nm, ulM = 1, total = 0, fl = MUST_HAVE_DIRECTORY;
|
---|
266 | CHAR str[CCHMAXPATH];
|
---|
267 | register INT len;
|
---|
268 | APIRET rc, prc;
|
---|
269 | BOOL isadir = FALSE, isremote = FALSE, includefiles = fFilesInTree;
|
---|
270 | ULONG ddepth = DDEPTH;
|
---|
271 | ULONG drvNum;
|
---|
272 | ULONG flags;
|
---|
273 | static BOOL brokenlan = FALSE, isbroken = FALSE;
|
---|
274 |
|
---|
275 | if (!pciParent || !*pciParent->pszFileName || !hwndCnr)
|
---|
276 | return FALSE;
|
---|
277 |
|
---|
278 | len = strlen(pciParent->pszFileName);
|
---|
279 | memcpy(str, pciParent->pszFileName, len + 1);
|
---|
280 | if (str[len - 1] != '\\')
|
---|
281 | str[len++] = '\\';
|
---|
282 | str[len++] = '*';
|
---|
283 | str[len] = 0;
|
---|
284 |
|
---|
285 | if (!isalpha(*str) || str[1] != ':' || str[2] != '\\')
|
---|
286 | MakeFullName(str);
|
---|
287 |
|
---|
288 | drvNum = toupper(*pciParent->pszFileName) - 'A';
|
---|
289 | flags = driveflags[drvNum];
|
---|
290 | if (!isalpha(*str) ||
|
---|
291 | str[1] != ':' ||
|
---|
292 | str[2] != '\\' || ((flags & DRIVE_IGNORE)))
|
---|
293 | return FALSE; // Not a directory
|
---|
294 |
|
---|
295 | if (flags & DRIVE_INCLUDEFILES)
|
---|
296 | includefiles = TRUE;
|
---|
297 |
|
---|
298 | if (flags & DRIVE_REMOTE)
|
---|
299 | isremote = TRUE;
|
---|
300 |
|
---|
301 | if (isremote) {
|
---|
302 | if (fRemoteBug) {
|
---|
303 | if (brokenlan) {
|
---|
304 | ddepth = (ULONG) - 1;
|
---|
305 | ddepth--;
|
---|
306 | }
|
---|
307 | ulM = 1;
|
---|
308 | }
|
---|
309 | }
|
---|
310 | else if (isbroken)
|
---|
311 | ddepth = 14;
|
---|
312 |
|
---|
313 | if (!fRemoteBug)
|
---|
314 | ulM = (ddepth <= DDEPTH) ? ddepth : 1;
|
---|
315 |
|
---|
316 | nm = ulM;
|
---|
317 |
|
---|
318 | DosError(FERR_DISABLEHARDERR);
|
---|
319 | if (includefiles)
|
---|
320 | fl = FILE_DIRECTORY;
|
---|
321 | rc = DosFindFirst(str,
|
---|
322 | &hDir,
|
---|
323 | FILE_NORMAL | fl |
|
---|
324 | FILE_READONLY | FILE_ARCHIVED |
|
---|
325 | FILE_SYSTEM | FILE_HIDDEN,
|
---|
326 | &ffb, ulM * sizeof(FILEFINDBUF3), &nm, FIL_STANDARD);
|
---|
327 | if (ulM == 1 && !rc) {
|
---|
328 | do {
|
---|
329 | pffb = &ffb[0];
|
---|
330 | if (!includefiles && !(pffb->attrFile & FILE_DIRECTORY) && !brokenlan) {
|
---|
331 | brokenlan = TRUE;
|
---|
332 | ddepth = (ULONG) - 1;
|
---|
333 | ddepth--;
|
---|
334 | if (!NoBrokenNotify) {
|
---|
335 | prc = saymsg(MB_YESNO | MB_ICONEXCLAMATION,
|
---|
336 | HWND_DESKTOP,
|
---|
337 | GetPString(IDS_LANERRORTITLETEXT),
|
---|
338 | GetPString(IDS_LANERRORTEXT));
|
---|
339 | if (prc == MBID_NO) {
|
---|
340 | saymsg(MB_ENTER,
|
---|
341 | HWND_DESKTOP,
|
---|
342 | GetPString(IDS_LANERROR2TITLETEXT),
|
---|
343 | GetPString(IDS_LANERROR2TEXT));
|
---|
344 | NoBrokenNotify = 255;
|
---|
345 | PrfWriteProfileData(fmprof, FM3Str, "NoBrokenNotify",
|
---|
346 | &NoBrokenNotify, sizeof(ULONG));
|
---|
347 | }
|
---|
348 | }
|
---|
349 | else {
|
---|
350 | NoBrokenNotify--;
|
---|
351 | PrfWriteProfileData(fmprof, FM3Str, "NoBrokenNotify",
|
---|
352 | &NoBrokenNotify, sizeof(ULONG));
|
---|
353 | }
|
---|
354 | }
|
---|
355 | if (*pffb->achName &&
|
---|
356 | (includefiles || (pffb->attrFile & FILE_DIRECTORY)) &&
|
---|
357 | // Skip . and ..
|
---|
358 | (pffb->achName[0] != '.' ||
|
---|
359 | (pffb->achName[1] &&
|
---|
360 | (pffb->achName[1] != '.' || pffb->achName[2])))) {
|
---|
361 | DosFindClose(hDir);
|
---|
362 | isadir = TRUE;
|
---|
363 | goto Interruptus;
|
---|
364 | }
|
---|
365 | nm = 1;
|
---|
366 | DosError(FERR_DISABLEHARDERR);
|
---|
367 | }
|
---|
368 | while (++total < ddepth && !(rc = (DosFindNext(hDir,
|
---|
369 | &ffb,
|
---|
370 | sizeof(FILEFINDBUF3),
|
---|
371 | &nm))));
|
---|
372 | DosFindClose(hDir);
|
---|
373 | // If drive B:
|
---|
374 | if (toupper(*pciParent->pszFileName) > 'B' &&
|
---|
375 | (*(pciParent->pszFileName + 1)) == ':' &&
|
---|
376 | (*(pciParent->pszFileName + 2)) == '\\' && !(*(pciParent->pszFileName + 3))) {
|
---|
377 |
|
---|
378 | CHAR s[132];
|
---|
379 | sprintf(s,
|
---|
380 | GetPString(IDS_NOSUBDIRSTEXT),
|
---|
381 | total, toupper(*pciParent->pszFileName));
|
---|
382 | if (rc && rc != ERROR_NO_MORE_FILES)
|
---|
383 | sprintf(&s[strlen(s)], GetPString(IDS_SEARCHERRORTEXT), rc, str);
|
---|
384 | else if (ddepth < 16)
|
---|
385 | brokenlan = TRUE;
|
---|
386 | Notify(s);
|
---|
387 | }
|
---|
388 | goto None;
|
---|
389 | }
|
---|
390 |
|
---|
391 | if (!rc) {
|
---|
392 | DosFindClose(hDir);
|
---|
393 | if (nm) {
|
---|
394 | PBYTE fb = (PBYTE)&ffb[0];
|
---|
395 | for (len = 0; len < nm; len++) {
|
---|
396 | pffb = (PFILEFINDBUF3) fb;
|
---|
397 | if (!includefiles && !(pffb->attrFile & FILE_DIRECTORY)) {
|
---|
398 | if (!isbroken) {
|
---|
399 | isbroken = TRUE;
|
---|
400 | if (!NoBrokenNotify) {
|
---|
401 | prc = saymsg(MB_YESNO | MB_ICONEXCLAMATION,
|
---|
402 | HWND_DESKTOP,
|
---|
403 | GetPString(IDS_FSDERRORTITLETEXT),
|
---|
404 | GetPString(IDS_FSDERRORTEXT),
|
---|
405 | isremote ? GetPString(IDS_REMOTETEXT) :
|
---|
406 | GetPString(IDS_LOCALTEXT),
|
---|
407 | *str);
|
---|
408 | if (prc == MBID_NO) {
|
---|
409 | saymsg(MB_ENTER,
|
---|
410 | HWND_DESKTOP,
|
---|
411 | GetPString(IDS_FSDERROR2TITLETEXT),
|
---|
412 | GetPString(IDS_FSDERROR2TEXT));
|
---|
413 | NoBrokenNotify = 255;
|
---|
414 | PrfWriteProfileData(fmprof, FM3Str, "NoBrokenNotify",
|
---|
415 | &NoBrokenNotify, sizeof(ULONG));
|
---|
416 | }
|
---|
417 | }
|
---|
418 | else {
|
---|
419 | NoBrokenNotify--;
|
---|
420 | PrfWriteProfileData(fmprof, FM3Str, "NoBrokenNotify",
|
---|
421 | &NoBrokenNotify, sizeof(ULONG));
|
---|
422 | }
|
---|
423 | }
|
---|
424 | }
|
---|
425 | if (*pffb->achName &&
|
---|
426 | (includefiles || (pffb->attrFile & FILE_DIRECTORY)) &&
|
---|
427 | // Skip . and ..
|
---|
428 | (pffb->achName[0] != '.' || (pffb->achName[1]
|
---|
429 | && (pffb->achName[1] != '.'
|
---|
430 | || pffb->achName[2])))) {
|
---|
431 | isadir = TRUE;
|
---|
432 | break;
|
---|
433 | }
|
---|
434 | fb += pffb->oNextEntryOffset;
|
---|
435 | } // for
|
---|
436 |
|
---|
437 | Interruptus:
|
---|
438 |
|
---|
439 | if (isadir) {
|
---|
440 |
|
---|
441 | PCNRITEM pci;
|
---|
442 |
|
---|
443 | if (WinIsWindow((HAB)0, hwndCnr)) {
|
---|
444 | pci = WinSendMsg(hwndCnr,
|
---|
445 | CM_ALLOCRECORD,
|
---|
446 | MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1));
|
---|
447 | if (!pci) {
|
---|
448 | Win_Error(hwndCnr, HWND_DESKTOP, __FILE__, __LINE__,
|
---|
449 | GetPString(IDS_RECORDALLOCFAILEDTEXT));
|
---|
450 | }
|
---|
451 | else {
|
---|
452 | RECORDINSERT ri;
|
---|
453 | pci->pszFileName = NullStr;
|
---|
454 | pci->pszDisplayName = pci->pszFileName;
|
---|
455 | pci->rc.pszIcon = pci->pszDisplayName;
|
---|
456 | memset(&ri, 0, sizeof(RECORDINSERT));
|
---|
457 | ri.cb = sizeof(RECORDINSERT);
|
---|
458 | ri.pRecordOrder = (PRECORDCORE) CMA_END;
|
---|
459 | ri.pRecordParent = (PRECORDCORE) pciParent;
|
---|
460 | ri.zOrder = (ULONG) CMA_TOP;
|
---|
461 | ri.cRecordsInsert = 1;
|
---|
462 | ri.fInvalidateRecord = TRUE;
|
---|
463 | //DbgMsg(pszSrcFile, __LINE__, "Stubby %p CM_INSERTRECORD \"%s\" %.255s", hwndCnr, pci->pszFileName, pffb->achName); // 18 Dec 08 SHL fixme debug
|
---|
464 | if (!WinSendMsg(hwndCnr,
|
---|
465 | CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
|
---|
466 | DosSleep(50); //05 Aug 07 GKY 100
|
---|
467 | WinSetFocus(HWND_DESKTOP, hwndCnr);
|
---|
468 | if (WinIsWindow((HAB)0, hwndCnr)) {
|
---|
469 | //DbgMsg(pszSrcFile, __LINE__, "Stubby %p CM_INSERTRECORD %s", hwndCnr, pci->pszFileName); // 18 Dec 08 SHL fixme debug
|
---|
470 | if (!WinSendMsg(hwndCnr,
|
---|
471 | CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
|
---|
472 | Win_Error(hwndCnr, HWND_DESKTOP, __FILE__, __LINE__,
|
---|
473 | GetPString(IDS_RECORDINSERTFAILEDTEXT));
|
---|
474 | FreeCnrItem(hwndCnr, pci);
|
---|
475 | }
|
---|
476 | else
|
---|
477 | ok = TRUE;
|
---|
478 | }
|
---|
479 | }
|
---|
480 | else
|
---|
481 | ok = TRUE;
|
---|
482 | }
|
---|
483 | }
|
---|
484 | }
|
---|
485 | else if (toupper(*str) > 'B' && str[1] == ':' && str[2] == '\\' &&
|
---|
486 | !str[3]) {
|
---|
487 |
|
---|
488 | CHAR s[162];
|
---|
489 |
|
---|
490 | sprintf(s,
|
---|
491 | GetPString(IDS_NOSUBDIRS2TEXT),
|
---|
492 | nm,
|
---|
493 | toupper(*pciParent->pszFileName),
|
---|
494 | (isremote) ? GetPString(IDS_NOSUBDIRS3TEXT) : NullStr);
|
---|
495 | Notify(s);
|
---|
496 | }
|
---|
497 | }
|
---|
498 | }
|
---|
499 | else if (toupper(*str) > 'B' && rc != ERROR_NO_MORE_FILES) {
|
---|
500 | CHAR s[CCHMAXPATH + 80];
|
---|
501 | sprintf(s, GetPString(IDS_SEARCHERRORTEXT), rc, str);
|
---|
502 | Notify(s);
|
---|
503 | }
|
---|
504 |
|
---|
505 | None:
|
---|
506 |
|
---|
507 | DosError(FERR_DISABLEHARDERR);
|
---|
508 | return ok;
|
---|
509 | }
|
---|
510 |
|
---|
511 | #pragma alloc_text(FLESH,Flesh,FleshEnv,UnFlesh,Stubby)
|
---|