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