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