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