| [145] | 1 |  | 
|---|
|  | 2 | /*********************************************************************** | 
|---|
|  | 3 |  | 
|---|
|  | 4 | $Id: flesh.c 574 2007-03-23 22:37:07Z gyoung $ | 
|---|
|  | 5 |  | 
|---|
|  | 6 | Flesh | 
|---|
|  | 7 |  | 
|---|
|  | 8 | Copyright (c) 1993-98 M. Kimes | 
|---|
| [574] | 9 | Copyright (c) 2005-07 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 | 
|---|
| [145] | 18 |  | 
|---|
|  | 19 | ***********************************************************************/ | 
|---|
|  | 20 |  | 
|---|
| [2] | 21 | #define INCL_DOS | 
|---|
|  | 22 | #define INCL_DOSERRORS | 
|---|
|  | 23 | #define INCL_WIN | 
|---|
| [340] | 24 | #include <os2.h> | 
|---|
| [2] | 25 |  | 
|---|
|  | 26 | #include <stdarg.h> | 
|---|
|  | 27 | #include <stdio.h> | 
|---|
|  | 28 | #include <stdlib.h> | 
|---|
|  | 29 | #include <string.h> | 
|---|
|  | 30 | #include <ctype.h> | 
|---|
| [145] | 31 |  | 
|---|
| [2] | 32 | #include "fm3dll.h" | 
|---|
|  | 33 | #include "fm3str.h" | 
|---|
|  | 34 |  | 
|---|
|  | 35 | #pragma data_seg(DATA1) | 
|---|
| [340] | 36 |  | 
|---|
|  | 37 | static PSZ pszSrcFile = __FILE__; | 
|---|
|  | 38 |  | 
|---|
| [2] | 39 | #pragma alloc_text(FLESH,Flesh,FleshEnv,Unflesh,Stubby) | 
|---|
|  | 40 |  | 
|---|
| [551] | 41 | BOOL FleshEnv(HWND hwndCnr, PCNRITEM pciParent) | 
|---|
| [175] | 42 | { | 
|---|
| [551] | 43 | PCNRITEM pciL; | 
|---|
| [2] | 44 | DIRCNRDATA *dcd; | 
|---|
| [551] | 45 | CHAR path[CCHMAXPATH + 12], | 
|---|
|  | 46 | fullpath[CCHMAXPATH + 12], *env, *p, *pp, *var = NULL; | 
|---|
| [2] | 47 |  | 
|---|
| [551] | 48 | if (!pciParent || (INT) pciParent == -1 || !hwndCnr) | 
|---|
| [2] | 49 | return FALSE; | 
|---|
| [574] | 50 | dcd = (DIRCNRDATA *) WinQueryWindowPtr(hwndCnr, QWL_USER); | 
|---|
| [551] | 51 | if (!dcd) | 
|---|
| [2] | 52 | return FALSE; | 
|---|
|  | 53 |  | 
|---|
| [551] | 54 | strcpy(path, pciParent->szFileName + 1); | 
|---|
|  | 55 | if (stricmp(path, GetPString(IDS_ENVVARSTEXT) + 1)) | 
|---|
|  | 56 | UnFlesh(hwndCnr, pciParent); | 
|---|
|  | 57 | if (*path) { | 
|---|
| [2] | 58 | path[strlen(path) - 1] = 0; | 
|---|
| [551] | 59 | if (!stricmp(path, "LIBPATH")) { | 
|---|
|  | 60 | var = xmalloc(65536, pszSrcFile, __LINE__); | 
|---|
|  | 61 | if (var) | 
|---|
|  | 62 | LoadLibPath(var, 65536); | 
|---|
| [2] | 63 | env = var; | 
|---|
|  | 64 | } | 
|---|
|  | 65 | else | 
|---|
|  | 66 | env = getenv(path); | 
|---|
| [551] | 67 | if (env && *env) { | 
|---|
| [2] | 68 | p = env; | 
|---|
| [551] | 69 | while (*p) { | 
|---|
|  | 70 | pp = path; | 
|---|
|  | 71 | while (*p == ';') | 
|---|
|  | 72 | p++; | 
|---|
|  | 73 | while (*p && *p != ';') { | 
|---|
|  | 74 | *pp = *p; | 
|---|
|  | 75 | p++; | 
|---|
|  | 76 | pp++; | 
|---|
|  | 77 | } | 
|---|
|  | 78 | *pp = 0; | 
|---|
|  | 79 | if (*path && | 
|---|
|  | 80 | strcmp(path, ".") && | 
|---|
|  | 81 | strcmp(path, ".\\") && | 
|---|
|  | 82 | strcmp(path, "..") && | 
|---|
|  | 83 | strcmp(path, "..\\") && | 
|---|
|  | 84 | strncmp(path, ".\\", 2) && strncmp(path, "..\\", 3)) { | 
|---|
|  | 85 | if (!DosQueryPathInfo(path, | 
|---|
|  | 86 | FIL_QUERYFULLNAME, | 
|---|
|  | 87 | fullpath, | 
|---|
|  | 88 | sizeof(fullpath)) && IsValidDir(fullpath)) { | 
|---|
|  | 89 | pciL = FindCnrRecord(hwndCnr, | 
|---|
|  | 90 | fullpath, pciParent, FALSE, FALSE, FALSE); | 
|---|
|  | 91 | if (pciL) { | 
|---|
|  | 92 | while (pciL && pciL != (PCNRITEM) - 1 && pciL != pciParent) | 
|---|
|  | 93 | pciL = WinSendMsg(hwndCnr, | 
|---|
|  | 94 | CM_QUERYRECORD, | 
|---|
|  | 95 | MPFROMP(pciL), | 
|---|
|  | 96 | MPFROM2SHORT(CMA_PARENT, CMA_ITEMORDER)); | 
|---|
|  | 97 | } | 
|---|
|  | 98 | if (!pciL) { | 
|---|
| [2] | 99 |  | 
|---|
| [551] | 100 | RECORDINSERT ri; | 
|---|
| [2] | 101 |  | 
|---|
| [551] | 102 | pciL = WinSendMsg(hwndCnr, | 
|---|
|  | 103 | CM_ALLOCRECORD, | 
|---|
|  | 104 | MPFROMLONG(EXTRA_RECORD_BYTES2), | 
|---|
|  | 105 | MPFROMLONG(1)); | 
|---|
|  | 106 | if (pciL) { | 
|---|
|  | 107 | strcpy(pciL->szFileName, fullpath); | 
|---|
|  | 108 | pciL->pszFileName = pciL->szFileName; | 
|---|
|  | 109 | pciL->rc.pszIcon = pciL->pszFileName; | 
|---|
|  | 110 | if (!fNoIconsDirs && | 
|---|
|  | 111 | (!isalpha(*fullpath) || | 
|---|
|  | 112 | !(driveflags[toupper(*fullpath) - 'A'] & | 
|---|
|  | 113 | DRIVE_NOLOADICONS))) | 
|---|
|  | 114 | pciL->rc.hptrIcon = WinLoadFileIcon(fullpath, FALSE); | 
|---|
|  | 115 | if (!pciL->rc.hptrIcon) | 
|---|
|  | 116 | pciL->rc.hptrIcon = hptrDir; | 
|---|
|  | 117 | pciL->attrFile = FILE_DIRECTORY; | 
|---|
|  | 118 | strcpy(pciL->szDispAttr, "----D-"); | 
|---|
|  | 119 | pciL->pszDispAttr = pciL->szDispAttr; | 
|---|
|  | 120 | memset(&ri, 0, sizeof(ri)); | 
|---|
|  | 121 | ri.cb = sizeof(ri); | 
|---|
|  | 122 | ri.pRecordOrder = (PRECORDCORE) CMA_END; | 
|---|
|  | 123 | ri.pRecordParent = (PRECORDCORE) pciParent; | 
|---|
|  | 124 | ri.zOrder = (ULONG) CMA_TOP; | 
|---|
|  | 125 | ri.cRecordsInsert = 1; | 
|---|
|  | 126 | ri.fInvalidateRecord = FALSE; | 
|---|
|  | 127 | if (!WinSendMsg(hwndCnr, | 
|---|
|  | 128 | CM_INSERTRECORD, MPFROMP(pciL), MPFROMP(&ri))) | 
|---|
|  | 129 | WinSendMsg(hwndCnr, | 
|---|
|  | 130 | CM_FREERECORD, MPFROMP(&pciL), MPFROMSHORT(1)); | 
|---|
|  | 131 | } | 
|---|
|  | 132 | } | 
|---|
|  | 133 | } | 
|---|
|  | 134 | } | 
|---|
| [2] | 135 | } | 
|---|
|  | 136 | } | 
|---|
| [551] | 137 | if (var) | 
|---|
| [2] | 138 | free(var); | 
|---|
| [551] | 139 | pciL = (PCNRITEM) WinSendMsg(hwndCnr, | 
|---|
|  | 140 | CM_QUERYRECORD, | 
|---|
|  | 141 | MPFROMP(pciParent), | 
|---|
|  | 142 | MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER)); | 
|---|
|  | 143 | while (pciL && (INT) pciL != -1) { | 
|---|
| [2] | 144 | pciL->flags |= (RECFLAGS_NODRAG | RECFLAGS_UNDERENV); | 
|---|
|  | 145 | WinSendMsg(hwndCnr, | 
|---|
| [551] | 146 | CM_INVALIDATERECORD, MPFROMP(&pciL), MPFROM2SHORT(1, 0)); | 
|---|
| [2] | 147 | pciL = WinSendMsg(hwndCnr, | 
|---|
| [551] | 148 | CM_QUERYRECORD, | 
|---|
|  | 149 | MPFROMP(pciL), MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | 
|---|
| [2] | 150 | } | 
|---|
|  | 151 | } | 
|---|
|  | 152 | return TRUE; | 
|---|
|  | 153 | } | 
|---|
|  | 154 |  | 
|---|
| [551] | 155 | BOOL Flesh(HWND hwndCnr, PCNRITEM pciParent) | 
|---|
| [166] | 156 | { | 
|---|
| [551] | 157 | PCNRITEM pciL; | 
|---|
| [2] | 158 | DIRCNRDATA *dcd; | 
|---|
| [551] | 159 | BOOL includefiles = fFilesInTree; | 
|---|
| [2] | 160 |  | 
|---|
| [551] | 161 | if (!pciParent || (INT) pciParent == -1 || !hwndCnr) | 
|---|
| [2] | 162 | return FALSE; | 
|---|
| [551] | 163 | pciL = (PCNRITEM) WinSendMsg(hwndCnr, | 
|---|
|  | 164 | CM_QUERYRECORD, | 
|---|
|  | 165 | MPFROMP(pciParent), | 
|---|
|  | 166 | MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER)); | 
|---|
|  | 167 | if (!pciL || !*pciL->szFileName) { | 
|---|
|  | 168 | if (pciL && (INT) pciL != -1) { | 
|---|
| [2] | 169 | WinSendMsg(hwndCnr, | 
|---|
| [551] | 170 | CM_REMOVERECORD, MPFROMP(&pciL), MPFROM2SHORT(1, CMA_FREE)); | 
|---|
| [166] | 171 | } | 
|---|
| [2] | 172 | dcd = INSTDATA(hwndCnr); | 
|---|
| [166] | 173 | if (dcd && dcd->size != sizeof(DIRCNRDATA)) | 
|---|
| [2] | 174 | dcd = NULL; | 
|---|
| [551] | 175 | if (driveflags[toupper(*pciParent->szFileName) - 'A'] & | 
|---|
|  | 176 | DRIVE_INCLUDEFILES) | 
|---|
| [2] | 177 | includefiles = TRUE; | 
|---|
|  | 178 | ProcessDirectory(hwndCnr, | 
|---|
| [551] | 179 | pciParent, | 
|---|
|  | 180 | pciParent->szFileName, | 
|---|
|  | 181 | includefiles, TRUE, TRUE, NULL, dcd, NULL, NULL); | 
|---|
| [2] | 182 | } | 
|---|
|  | 183 | return TRUE; | 
|---|
|  | 184 | } | 
|---|
|  | 185 |  | 
|---|
| [551] | 186 | BOOL UnFlesh(HWND hwndCnr, PCNRITEM pciParent) | 
|---|
| [175] | 187 | { | 
|---|
| [551] | 188 | BOOL ret = FALSE; | 
|---|
| [2] | 189 | PCNRITEM pciL; | 
|---|
|  | 190 |  | 
|---|
| [175] | 191 | if (!pciParent || !hwndCnr) | 
|---|
| [2] | 192 | return FALSE; | 
|---|
| [551] | 193 | for (;;) { | 
|---|
|  | 194 | pciL = (PCNRITEM) WinSendMsg(hwndCnr, | 
|---|
|  | 195 | CM_QUERYRECORD, | 
|---|
|  | 196 | MPFROMP(pciParent), | 
|---|
|  | 197 | MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER)); | 
|---|
|  | 198 | if (pciL && (INT) pciL != -1) { | 
|---|
| [2] | 199 | ret = TRUE; | 
|---|
|  | 200 | WinSendMsg(hwndCnr, | 
|---|
| [551] | 201 | CM_REMOVERECORD, MPFROMP(&pciL), MPFROM2SHORT(1, CMA_FREE)); | 
|---|
| [2] | 202 | } | 
|---|
|  | 203 | else | 
|---|
|  | 204 | break; | 
|---|
|  | 205 | } | 
|---|
| [551] | 206 | if (ret) { | 
|---|
| [2] | 207 | WinSendMsg(hwndCnr, | 
|---|
| [551] | 208 | CM_INVALIDATERECORD, | 
|---|
|  | 209 | MPFROMP(&pciParent), | 
|---|
|  | 210 | MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION)); | 
|---|
| [175] | 211 | } | 
|---|
| [2] | 212 | return ret; | 
|---|
|  | 213 | } | 
|---|
|  | 214 |  | 
|---|
|  | 215 | #define DDEPTH 16 | 
|---|
|  | 216 |  | 
|---|
| [551] | 217 | BOOL Stubby(HWND hwndCnr, PCNRITEM pciParent) | 
|---|
| [175] | 218 | { | 
|---|
| [2] | 219 | /* | 
|---|
|  | 220 | * this code is full of workarounds for screwed up LANs. | 
|---|
|  | 221 | * let's hope all the current LAN programmers fall into | 
|---|
|  | 222 | * a black hole and make way for people who can get it right... | 
|---|
|  | 223 | */ | 
|---|
|  | 224 |  | 
|---|
| [551] | 225 | BOOL ret = FALSE; | 
|---|
|  | 226 | FILEFINDBUF3 ffb[DDEPTH]; | 
|---|
| [2] | 227 | PFILEFINDBUF3 pffb; | 
|---|
| [551] | 228 | HDIR hDir = HDIR_CREATE; | 
|---|
|  | 229 | ULONG nm, ulM = 1L, total = 0L, fl = MUST_HAVE_DIRECTORY; | 
|---|
|  | 230 | CHAR str[CCHMAXPATH]; | 
|---|
|  | 231 | register INT len; | 
|---|
|  | 232 | APIRET rc, prc; | 
|---|
|  | 233 | BOOL isadir = FALSE, isremote = FALSE, includefiles = fFilesInTree; | 
|---|
|  | 234 | ULONG ddepth = 3L; | 
|---|
|  | 235 | static BOOL brokenlan = FALSE, isbroken = FALSE; | 
|---|
| [2] | 236 |  | 
|---|
| [551] | 237 | if (!pciParent || !*pciParent->szFileName || !hwndCnr) | 
|---|
| [2] | 238 | return FALSE; | 
|---|
|  | 239 |  | 
|---|
|  | 240 | len = strlen(pciParent->szFileName); | 
|---|
| [551] | 241 | memcpy(str, pciParent->szFileName, len + 1); | 
|---|
|  | 242 | if (str[len - 1] != '\\') | 
|---|
| [2] | 243 | str[len++] = '\\'; | 
|---|
|  | 244 | str[len++] = '*'; | 
|---|
|  | 245 | str[len] = 0; | 
|---|
|  | 246 |  | 
|---|
| [551] | 247 | if (!isalpha(*str) || str[1] != ':' || str[2] != '\\') | 
|---|
| [2] | 248 | MakeFullName(str); | 
|---|
|  | 249 |  | 
|---|
| [551] | 250 | if (!isalpha(*str) || | 
|---|
|  | 251 | str[1] != ':' || | 
|---|
|  | 252 | str[2] != '\\' || ((driveflags[toupper(*str) - 'A'] & DRIVE_IGNORE))) | 
|---|
| [2] | 253 | return FALSE; | 
|---|
|  | 254 |  | 
|---|
| [551] | 255 | if (isalpha(*str) && driveflags[toupper(*str) - 'A'] & DRIVE_INCLUDEFILES) | 
|---|
| [2] | 256 | includefiles = TRUE; | 
|---|
|  | 257 |  | 
|---|
| [551] | 258 | if (!isalpha(*str) || | 
|---|
|  | 259 | str[1] != ':' || | 
|---|
|  | 260 | str[2] != '\\' || ((driveflags[toupper(*str) - 'A'] & DRIVE_REMOTE))) | 
|---|
| [2] | 261 | isremote = TRUE; | 
|---|
|  | 262 |  | 
|---|
| [551] | 263 | if (isremote) { | 
|---|
| [2] | 264 | ddepth = 14; | 
|---|
| [551] | 265 | if (fRemoteBug) { | 
|---|
|  | 266 | if (brokenlan) { | 
|---|
|  | 267 | ddepth = (ULONG) - 1; | 
|---|
|  | 268 | ddepth--; | 
|---|
| [2] | 269 | } | 
|---|
|  | 270 | ulM = 1L; | 
|---|
|  | 271 | } | 
|---|
|  | 272 | } | 
|---|
| [551] | 273 | else if (isbroken) | 
|---|
| [2] | 274 | ddepth = 14; | 
|---|
|  | 275 |  | 
|---|
| [551] | 276 | if (!isremote || !fRemoteBug) | 
|---|
| [2] | 277 | ulM = (ddepth < 16L) ? ddepth : 1L; | 
|---|
|  | 278 |  | 
|---|
|  | 279 | nm = ulM; | 
|---|
|  | 280 |  | 
|---|
|  | 281 | DosError(FERR_DISABLEHARDERR); | 
|---|
| [551] | 282 | if (includefiles) | 
|---|
| [2] | 283 | fl = FILE_DIRECTORY; | 
|---|
|  | 284 | rc = DosFindFirst(str, | 
|---|
| [551] | 285 | &hDir, | 
|---|
|  | 286 | FILE_NORMAL | fl | | 
|---|
|  | 287 | FILE_READONLY | FILE_ARCHIVED | | 
|---|
|  | 288 | FILE_SYSTEM | FILE_HIDDEN, | 
|---|
|  | 289 | &ffb, ulM * sizeof(FILEFINDBUF3), &nm, FIL_STANDARD); | 
|---|
|  | 290 | if (ulM == 1L && !rc) { | 
|---|
| [2] | 291 | do { | 
|---|
|  | 292 | pffb = &ffb[0]; | 
|---|
| [551] | 293 | if (!includefiles && !(pffb->attrFile & FILE_DIRECTORY) && !brokenlan) { | 
|---|
|  | 294 | brokenlan = TRUE; | 
|---|
|  | 295 | ddepth = (ULONG) - 1L; | 
|---|
|  | 296 | ddepth--; | 
|---|
|  | 297 | if (!NoBrokenNotify) { | 
|---|
|  | 298 | prc = saymsg(MB_YESNO | MB_ICONEXCLAMATION, | 
|---|
|  | 299 | HWND_DESKTOP, | 
|---|
|  | 300 | GetPString(IDS_LANERRORTITLETEXT), | 
|---|
|  | 301 | GetPString(IDS_LANERRORTEXT)); | 
|---|
|  | 302 | if (prc == MBID_NO) { | 
|---|
|  | 303 | saymsg(MB_ENTER, | 
|---|
|  | 304 | HWND_DESKTOP, | 
|---|
|  | 305 | GetPString(IDS_LANERROR2TITLETEXT), | 
|---|
|  | 306 | GetPString(IDS_LANERROR2TEXT)); | 
|---|
|  | 307 | NoBrokenNotify = 255L; | 
|---|
|  | 308 | PrfWriteProfileData(fmprof, | 
|---|
|  | 309 | FM3Str, | 
|---|
|  | 310 | "NoBrokenNotify", | 
|---|
|  | 311 | &NoBrokenNotify, sizeof(ULONG)); | 
|---|
|  | 312 | } | 
|---|
|  | 313 | } | 
|---|
|  | 314 | else { | 
|---|
|  | 315 | NoBrokenNotify--; | 
|---|
|  | 316 | PrfWriteProfileData(fmprof, | 
|---|
|  | 317 | FM3Str, | 
|---|
|  | 318 | "NoBrokenNotify", | 
|---|
|  | 319 | &NoBrokenNotify, sizeof(ULONG)); | 
|---|
|  | 320 | } | 
|---|
| [2] | 321 | } | 
|---|
| [515] | 322 | if (*pffb->achName && | 
|---|
| [551] | 323 | (includefiles || (pffb->attrFile & FILE_DIRECTORY)) && | 
|---|
| [515] | 324 | // Skip . and .. | 
|---|
| [551] | 325 | (pffb->achName[0] != '.' || | 
|---|
| [515] | 326 | (pffb->achName[1] && | 
|---|
| [551] | 327 | (pffb->achName[1] != '.' || pffb->achName[2])))) { | 
|---|
|  | 328 | DosFindClose(hDir); | 
|---|
|  | 329 | isadir = TRUE; | 
|---|
|  | 330 | goto Interruptus; | 
|---|
| [2] | 331 | } | 
|---|
|  | 332 | nm = 1L; | 
|---|
|  | 333 | DosError(FERR_DISABLEHARDERR); | 
|---|
| [551] | 334 | } while (++total < ddepth && !(rc = (DosFindNext(hDir, | 
|---|
|  | 335 | &ffb, | 
|---|
|  | 336 | sizeof(FILEFINDBUF3), | 
|---|
|  | 337 | &nm)))); | 
|---|
| [2] | 338 | DosFindClose(hDir); | 
|---|
| [551] | 339 | if (toupper(*pciParent->szFileName) > 'B' && | 
|---|
|  | 340 | pciParent->szFileName[1] == ':' && | 
|---|
|  | 341 | pciParent->szFileName[2] == '\\' && !pciParent->szFileName[3]) { | 
|---|
| [2] | 342 |  | 
|---|
|  | 343 | CHAR s[132]; | 
|---|
|  | 344 |  | 
|---|
|  | 345 | sprintf(s, | 
|---|
| [551] | 346 | GetPString(IDS_NOSUBDIRSTEXT), | 
|---|
|  | 347 | total, toupper(*pciParent->szFileName)); | 
|---|
|  | 348 | if (rc && rc != ERROR_NO_MORE_FILES) | 
|---|
|  | 349 | sprintf(&s[strlen(s)], GetPString(IDS_SEARCHERRORTEXT), rc, str); | 
|---|
|  | 350 | else if (ddepth < 16L) | 
|---|
|  | 351 | brokenlan = TRUE; | 
|---|
| [2] | 352 | Notify(s); | 
|---|
|  | 353 | } | 
|---|
|  | 354 | goto None; | 
|---|
|  | 355 | } | 
|---|
|  | 356 |  | 
|---|
| [551] | 357 | if (!rc) { | 
|---|
| [2] | 358 | DosFindClose(hDir); | 
|---|
| [551] | 359 | if (nm) { | 
|---|
| [2] | 360 |  | 
|---|
| [551] | 361 | register PBYTE fb = (PBYTE) & ffb[0]; | 
|---|
| [2] | 362 |  | 
|---|
| [551] | 363 | for (len = 0; len < nm; len++) { | 
|---|
|  | 364 | pffb = (PFILEFINDBUF3) fb; | 
|---|
|  | 365 | if (!includefiles && !(pffb->attrFile & FILE_DIRECTORY)) { | 
|---|
|  | 366 | if (!isbroken) { | 
|---|
|  | 367 | isbroken = TRUE; | 
|---|
|  | 368 | if (!NoBrokenNotify) { | 
|---|
|  | 369 | prc = saymsg(MB_YESNO | MB_ICONEXCLAMATION, | 
|---|
|  | 370 | HWND_DESKTOP, | 
|---|
|  | 371 | GetPString(IDS_FSDERRORTITLETEXT), | 
|---|
|  | 372 | GetPString(IDS_FSDERRORTEXT), | 
|---|
|  | 373 | (isremote) ? | 
|---|
|  | 374 | GetPString(IDS_REMOTETEXT) : | 
|---|
|  | 375 | GetPString(IDS_LOCALTEXT), *str); | 
|---|
|  | 376 | if (prc == MBID_NO) { | 
|---|
|  | 377 | saymsg(MB_ENTER, | 
|---|
|  | 378 | HWND_DESKTOP, | 
|---|
|  | 379 | GetPString(IDS_FSDERROR2TITLETEXT), | 
|---|
|  | 380 | GetPString(IDS_FSDERROR2TEXT)); | 
|---|
|  | 381 | NoBrokenNotify = 255L; | 
|---|
|  | 382 | PrfWriteProfileData(fmprof, | 
|---|
|  | 383 | FM3Str, | 
|---|
|  | 384 | "NoBrokenNotify", | 
|---|
|  | 385 | &NoBrokenNotify, sizeof(ULONG)); | 
|---|
|  | 386 | } | 
|---|
|  | 387 | } | 
|---|
|  | 388 | else { | 
|---|
|  | 389 | NoBrokenNotify--; | 
|---|
|  | 390 | PrfWriteProfileData(fmprof, | 
|---|
|  | 391 | FM3Str, | 
|---|
|  | 392 | "NoBrokenNotify", | 
|---|
|  | 393 | &NoBrokenNotify, sizeof(ULONG)); | 
|---|
|  | 394 | } | 
|---|
|  | 395 | } | 
|---|
|  | 396 | } | 
|---|
|  | 397 | if (*pffb->achName && | 
|---|
|  | 398 | (includefiles || (pffb->attrFile & FILE_DIRECTORY)) && | 
|---|
| [515] | 399 | // Skip . and .. | 
|---|
| [551] | 400 | (pffb->achName[0] != '.' || (pffb->achName[1] | 
|---|
|  | 401 | && (pffb->achName[1] != '.' | 
|---|
|  | 402 | || pffb->achName[2])))) { | 
|---|
|  | 403 | isadir = TRUE; | 
|---|
|  | 404 | break; | 
|---|
|  | 405 | } | 
|---|
|  | 406 | fb += pffb->oNextEntryOffset; | 
|---|
| [2] | 407 | } | 
|---|
|  | 408 |  | 
|---|
| [551] | 409 | Interruptus: | 
|---|
| [2] | 410 |  | 
|---|
| [551] | 411 | if (isadir) { | 
|---|
| [2] | 412 |  | 
|---|
| [551] | 413 | PCNRITEM pci; | 
|---|
| [2] | 414 |  | 
|---|
| [551] | 415 | pci = WinSendMsg(hwndCnr, | 
|---|
|  | 416 | CM_ALLOCRECORD, | 
|---|
|  | 417 | MPFROMLONG(EXTRA_RECORD_BYTES2), MPFROMLONG(1L)); | 
|---|
|  | 418 | if (!pci) { | 
|---|
|  | 419 | Win_Error(hwndCnr, HWND_DESKTOP, __FILE__, __LINE__, | 
|---|
|  | 420 | GetPString(IDS_RECORDALLOCFAILEDTEXT)); | 
|---|
| [340] | 421 | } | 
|---|
|  | 422 | else { | 
|---|
| [551] | 423 | RECORDINSERT ri; | 
|---|
| [2] | 424 |  | 
|---|
| [551] | 425 | *pci->szFileName = 0; | 
|---|
|  | 426 | pci->pszFileName = pci->szFileName; | 
|---|
|  | 427 | pci->rc.pszIcon = pci->pszFileName; | 
|---|
|  | 428 | memset(&ri, 0, sizeof(RECORDINSERT)); | 
|---|
|  | 429 | ri.cb = sizeof(RECORDINSERT); | 
|---|
|  | 430 | ri.pRecordOrder = (PRECORDCORE) CMA_END; | 
|---|
|  | 431 | ri.pRecordParent = (PRECORDCORE) pciParent; | 
|---|
|  | 432 | ri.zOrder = (ULONG) CMA_TOP; | 
|---|
|  | 433 | ri.cRecordsInsert = 1L; | 
|---|
|  | 434 | ri.fInvalidateRecord = TRUE; | 
|---|
|  | 435 | if (!WinSendMsg(hwndCnr, | 
|---|
|  | 436 | CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) { | 
|---|
|  | 437 | DosSleep(100L); | 
|---|
|  | 438 | WinSetFocus(HWND_DESKTOP, hwndCnr); | 
|---|
|  | 439 | if (WinIsWindow((HAB) 0, hwndCnr)) { | 
|---|
|  | 440 | if (!WinSendMsg(hwndCnr, | 
|---|
|  | 441 | CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) { | 
|---|
|  | 442 | Win_Error(hwndCnr, HWND_DESKTOP, __FILE__, __LINE__, | 
|---|
|  | 443 | GetPString(IDS_RECORDINSERTFAILEDTEXT)); | 
|---|
|  | 444 | WinSendMsg(hwndCnr, | 
|---|
|  | 445 | CM_FREERECORD, MPFROMP(&pci), MPFROMSHORT(1)); | 
|---|
| [340] | 446 | } | 
|---|
|  | 447 | else | 
|---|
| [551] | 448 | ret = TRUE; | 
|---|
|  | 449 | } | 
|---|
|  | 450 | } | 
|---|
|  | 451 | else | 
|---|
|  | 452 | ret = TRUE; | 
|---|
|  | 453 | } | 
|---|
| [2] | 454 | } | 
|---|
| [551] | 455 | else if (toupper(*str) > 'B' && str[1] == ':' && str[2] == '\\' && | 
|---|
|  | 456 | !str[3]) { | 
|---|
| [2] | 457 |  | 
|---|
| [551] | 458 | CHAR s[162]; | 
|---|
| [2] | 459 |  | 
|---|
| [551] | 460 | sprintf(s, | 
|---|
|  | 461 | GetPString(IDS_NOSUBDIRS2TEXT), | 
|---|
|  | 462 | nm, | 
|---|
|  | 463 | toupper(*pciParent->szFileName), | 
|---|
|  | 464 | (isremote) ? GetPString(IDS_NOSUBDIRS3TEXT) : NullStr); | 
|---|
|  | 465 | Notify(s); | 
|---|
| [2] | 466 | } | 
|---|
|  | 467 | } | 
|---|
|  | 468 | } | 
|---|
| [551] | 469 | else if (toupper(*str) > 'B' && rc != ERROR_NO_MORE_FILES) { | 
|---|
| [2] | 470 |  | 
|---|
|  | 471 | CHAR s[CCHMAXPATH + 80]; | 
|---|
|  | 472 |  | 
|---|
| [551] | 473 | sprintf(s, GetPString(IDS_SEARCHERRORTEXT), rc, str); | 
|---|
| [2] | 474 | Notify(s); | 
|---|
|  | 475 | } | 
|---|
|  | 476 |  | 
|---|
|  | 477 | None: | 
|---|
|  | 478 |  | 
|---|
|  | 479 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 480 | return ret; | 
|---|
|  | 481 | } | 
|---|