Changeset 214
- Timestamp:
- Jun 18, 2005, 5:51:49 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/filldir.c
r188 r214 20 20 28 May 05 SHL Drop stale debug code 21 21 05 Jun 05 SHL Comments 22 09 Jun 05 SHL Rework WinLoadFileIcon enables 23 09 Jun 05 SHL Rework IDFile 22 24 23 25 ***********************************************************************/ … … 42 44 43 45 44 static HPOINTER IDFile( ULONG cmp)46 static HPOINTER IDFile(PSZ p) 45 47 { 46 48 HPOINTER hptr; 47 48 hptr = (HPOINTER)0; 49 if (cmp == *(ULONG *)".EXE" || cmp == *(ULONG *)".CMD" || 50 cmp == *(ULONG *)".BAT" || cmp == *(ULONG *)".COM") 51 hptr = hptrApp; 52 else if (cmp == *(ULONG *)".ZIP" || cmp == *(ULONG *)".LZH" || 53 cmp == *(ULONG *)".ARJ" || cmp == *(ULONG *)".ARC" || 54 cmp == *(ULONG *)".ZOO" || cmp == *(ULONG *)".RAR") 55 hptr = hptrArc; 56 else if (cmp == *(ULONG *)".BMP" || cmp == *(ULONG *)".ICO" || 57 cmp == *(ULONG *)".PTR" || cmp == *(ULONG *)".GIF" || 58 cmp == *(ULONG *)".TIF" || cmp == *(ULONG *)".PCX" || 59 cmp == *(ULONG *)".TGA" || cmp == *(ULONG *)".XBM") 60 hptr = hptrArt; 49 ULONG cmp; 50 CHAR cmps[4]; 51 52 p = strrchr(p,'.'); 53 if (p && !p[4]) 54 { 55 cmps[0] = '.'; 56 cmps[1] = toupper(p[1]); 57 cmps[2] = toupper(p[2]); 58 cmps[3] = toupper(p[3]); 59 60 cmp = *(ULONG *)cmps; 61 62 if (cmp == *(ULONG *)".EXE" || cmp == *(ULONG *)".CMD" || 63 cmp == *(ULONG *)".BAT" || cmp == *(ULONG *)".COM") 64 hptr = hptrApp; 65 else if (cmp == *(ULONG *)".ZIP" || cmp == *(ULONG *)".LZH" || 66 cmp == *(ULONG *)".ARJ" || cmp == *(ULONG *)".ARC" || 67 cmp == *(ULONG *)".ZOO" || cmp == *(ULONG *)".RAR") 68 hptr = hptrArc; 69 else if (cmp == *(ULONG *)".BMP" || cmp == *(ULONG *)".ICO" || 70 cmp == *(ULONG *)".PTR" || cmp == *(ULONG *)".GIF" || 71 cmp == *(ULONG *)".TIF" || cmp == *(ULONG *)".PCX" || 72 cmp == *(ULONG *)".TGA" || cmp == *(ULONG *)".XBM") 73 hptr = hptrArt; 74 else 75 hptr = (HPOINTER)0; 76 } 77 else 78 hptr = (HPOINTER)0; 79 61 80 return hptr; 62 81 } 63 82 64 83 84 static BOOL IsDefaultIcon(HPOINTER hptr) 85 { 86 HPOINTER hptr2; 87 HPOINTER hptr3; 88 LONG l; 89 UINT u; 90 91 static HPOINTER hptrPMFile; 92 static HPOINTER hptrWPSFile; 93 94 if (!hptrPMFile) 95 { 96 # if 0 // fixme to be gone 97 for (l = 1; l <= SPTR_CPTR; l++) 98 { 99 hptr3 = WinQuerySysPointer(HWND_DESKTOP,l,FALSE); 100 fprintf(stderr, "0x%08lx SPTR %ld\n", hptr3, l); 101 } 102 # endif // fixme to be gone 103 hptrPMFile = WinQuerySysPointer(HWND_DESKTOP,SPTR_FILE,FALSE); 104 } 105 # if 0 // fixme to be gone 106 else 107 { 108 hptr2 = WinQuerySysPointer(HWND_DESKTOP,SPTR_FILE,FALSE); 109 if (hptr2 != hptrPMFile) 110 { 111 saymsg(0, NULLHANDLE, "*Debug*", "ptr changed from %lx to %lx", hptrPMFile, hptr2); 112 hptrPMFile = hptr2; 113 fprintf(stderr, "0x%08lx SPTR_FILE changed\n", hptrPMFile); 114 } 115 } 116 # endif // fixme to be gone 117 118 // try to guess WPS default file icon 119 hptr2 = (HPOINTER)0; 120 for (u = 0; !hptrWPSFile && u < 10; u++) 121 { 122 char szFileName[CCHMAXPATH]; 123 char *psz; 124 125 psz = getenv("TMP"); 126 if (!psz && *psz) 127 psz = getenv("TEMP"); 128 if (psz && *psz) 129 { 130 strcpy(szFileName, psz); 131 psz = szFileName + strlen(szFileName) - 1; 132 if (*psz != '\\') 133 { 134 psz++; 135 *psz++ = '\\'; 136 } 137 } 138 else 139 psz = szFileName; 140 141 sprintf(psz,"%08x.%03x",rand() & 0xffffffff, rand() & 0xfff); 142 if (IsFile(szFileName) != 1) 143 { 144 FILE *fp = fopen(szFileName,"w"); 145 if (fp) 146 { 147 fclose(fp); 148 hptr3 = WinLoadFileIcon(szFileName, FALSE); 149 # if 0 // fixme to be gone 150 fprintf(stderr, "0x%08lx %s\n", hptr3, szFileName); 151 # endif // fixme to be gone 152 unlinkf("%s", szFileName); 153 if (!hptr2) 154 hptr2 = hptr3; 155 else if (hptr3 == hptr3) 156 { 157 hptrWPSFile = hptr3; // Got same icon twice 158 break; 159 } 160 } 161 } 162 DosSleep(rand() % 100); 163 164 } // for 165 166 return hptr == hptrPMFile || hptr == hptrWPSFile; 167 168 } // IsDefaultIcon 169 170 65 171 ULONGLONG FillInRecordFromFFB(HWND hwndCnr,PCNRITEM pci, const PSZ pszDirectory, 66 67 172 const PFILEFINDBUF4 pffb,const BOOL partial, 173 DIRCNRDATA *dcd) 68 174 { 69 175 /* fill in a container record from a FILEFINDBUF4 structure */ 70 176 71 177 CHAR attrstring[] = "RHS\0DA"; 72 CHAR cmps[] = ".xxx";73 178 CHAR *p; 74 179 HPOINTER hptr; … … 76 181 UINT y; 77 182 UINT t; 78 ULONG cmp;79 BOOL rc;80 183 81 184 pci->hwndCnr = hwndCnr; … … 122 225 if (pfealist) 123 226 { 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 227 memset(pfealist,0,1532); 228 pfealist->cbList = 1024; 229 eaop.fpGEA2List = pgealist; 230 eaop.fpFEA2List = pfealist; 231 eaop.oError = 0; 232 rc = DosQueryPathInfo(pci->szFileName,FIL_QUERYEASFROMLIST, 233 (PVOID)&eaop,(ULONG)sizeof(EAOP2)); 234 if (!rc) { 235 pfea = &eaop.fpFEA2List->list[0]; 236 value = pfea->szName + pfea->cbName + 1; 237 value[pfea->cbValue] = 0; 238 if (*(USHORT *)value == EAT_ASCII) 239 strncpy(pci->szSubject,value + (sizeof(USHORT) * 2),39); 240 pci->szSubject[39] = 0; 241 } 242 free(pfealist); 140 243 } 141 244 free(pgealist); … … 170 273 pfealist = malloc(1532); 171 274 if (pfealist) { 172 173 174 175 176 177 178 179 275 memset(pfealist,0,1532); 276 pfealist->cbList = 1024; 277 eaop.fpGEA2List = pgealist; 278 eaop.fpFEA2List = pfealist; 279 eaop.oError = 0; 280 rc = DosQueryPathInfo(pci->szFileName,FIL_QUERYEASFROMLIST, 281 (PVOID)&eaop,(ULONG)sizeof(EAOP2)); 282 if (!rc) 180 283 { 181 182 183 184 185 186 187 188 284 pfea = &eaop.fpFEA2List->list[0]; 285 value = pfea->szName + pfea->cbName + 1; 286 value[pfea->cbValue] = 0; 287 if (*(USHORT *)value == EAT_ASCII) 288 strncpy(pci->szLongname,value + (sizeof(USHORT) * 2),CCHMAXPATHCOMP); 289 pci->szLongname[CCHMAXPATHCOMP - 1] = 0; 290 } 291 free(pfealist); 189 292 } 190 293 free(pgealist); … … 202 305 if (pffb->attrFile & FILE_DIRECTORY) 203 306 { 204 if (!fNoIconsDirs && (!isalpha(*pci->szFileName) || 205 !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS))) 307 // is directory 308 if (fNoIconsDirs || 309 (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS) || 310 !isalpha(*pci->szFileName)) 311 { 312 hptr = (HPOINTER)0; 313 } 314 else 206 315 hptr = WinLoadFileIcon(pci->szFileName, FALSE); 316 } 317 else 318 { 319 // is file 320 if (fNoIconsFiles || 321 (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS) || 322 !isalpha(*pci->szFileName)) 323 { 324 hptr = (HPOINTER)0; 325 } 207 326 else 208 hptr = (HPOINTER)0;209 }210 else211 {212 if (!fNoIconsFiles && (!isalpha(*pci->szFileName) ||213 !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS)))214 {215 327 hptr = WinLoadFileIcon(pci->szFileName, FALSE); 216 } 217 else 218 hptr = (HPOINTER)0; 219 220 if (!hptr || hptr == WinQuerySysPointer(HWND_DESKTOP,SPTR_FILE,FALSE)) 221 { 222 p = strrchr(pci->szFileName,'.'); 223 if (p && !p[4]) 224 { 225 cmps[1] = toupper(p[1]); 226 cmps[2] = toupper(p[2]); 227 cmps[3] = toupper(p[3]); 228 cmp = *(ULONG *)cmps; 229 hptr = IDFile(cmp); 230 } 231 else 232 hptr = (HPOINTER)0; 233 } 234 } 328 329 if (!hptr || IsDefaultIcon(hptr)) 330 hptr = IDFile(pci->szFileName); 331 } 332 235 333 if (!hptr) 236 334 { 237 hptr = ((pffb->attrFile & FILE_DIRECTORY) != 0) ? hptrDir : 238 ((pffb->attrFile & FILE_SYSTEM) != 0) ? hptrSystem : 239 ((pffb->attrFile & FILE_HIDDEN) != 0) ? hptrHidden : 240 ((pffb->attrFile & FILE_READONLY) != 0) ? hptrReadonly : 241 hptrFile; 335 hptr = pffb->attrFile & FILE_DIRECTORY ? 336 hptrDir : 337 pffb->attrFile & FILE_SYSTEM ? 338 hptrSystem : 339 pffb->attrFile & FILE_HIDDEN ? 340 hptrHidden : 341 pffb->attrFile & FILE_READONLY ? 342 hptrReadonly : 343 hptrFile; 242 344 } 243 345 … … 250 352 p = strrchr(pci->szFileName,':'); 251 353 if (!p) 252 354 p = pci->szFileName; 253 355 else 254 356 p++; 255 357 } 256 358 else if ((dcd && dcd->type == TREE_FRAME) || 257 359 (!(pffb->attrFile & FILE_DIRECTORY) || !*(p + 1))) 258 360 { 259 361 p++; … … 294 396 { 295 397 pci->szDispAttr[y++] = 296 398 (CHAR)((pci->attrFile & (1 << x)) ? attrstring[x] : '-'); 297 399 } 298 400 } … … 311 413 { 312 414 if(!Filter((PMINIRECORDCORE)pci,(PVOID)&dcd->mask)) 313 415 pci->rc.flRecordAttr |= CRA_FILTERED; 314 416 } 315 417 else if((!(dcd->mask.attrFile & FILE_HIDDEN) && 316 317 318 319 320 321 322 418 (pci->attrFile & FILE_HIDDEN)) || 419 (!(dcd->mask.attrFile & FILE_SYSTEM) && 420 (pci->attrFile & FILE_SYSTEM)) || 421 (!(dcd->mask.attrFile & FILE_READONLY) && 422 (pci->attrFile & FILE_READONLY)) || 423 (!(dcd->mask.attrFile & FILE_ARCHIVED) && 424 (pci->attrFile & FILE_ARCHIVED))) 323 425 { 324 426 pci->rc.flRecordAttr |= CRA_FILTERED; … … 332 434 333 435 ULONGLONG FillInRecordFromFSA(HWND hwndCnr, 334 436 PCNRITEM pci, 335 437 const PSZ pszFileName, 336 337 338 438 const PFILESTATUS4 pfsa4, 439 const BOOL partial, 440 DIRCNRDATA *dcd) // Optional 339 441 { 340 442 HPOINTER hptr; 341 443 CHAR attrstring[] = "RHS\0DA"; 342 CHAR cmps[] = ".xxx";343 444 register CHAR *p; 344 445 register INT x; 345 446 register INT y; 346 ULONG cmp;347 447 348 448 /* fill in a container record from a FILESTATUS4 structure */ … … 375 475 pfealist = malloc(1532); 376 476 if (pfealist) { 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 477 memset(pfealist,0,1532); 478 pfealist->cbList = 1024; 479 eaop.fpGEA2List = pgealist; 480 eaop.fpFEA2List = pfealist; 481 eaop.oError = 0; 482 rc = DosQueryPathInfo(pci->szFileName,FIL_QUERYEASFROMLIST, 483 (PVOID)&eaop, 484 (ULONG)sizeof(EAOP2)); 485 if (!rc) { 486 pfea = &eaop.fpFEA2List->list[0]; 487 value = pfea->szName + pfea->cbName + 1; 488 value[pfea->cbValue] = 0; 489 if (*(USHORT *)value == EAT_ASCII) 490 strncpy(pci->szSubject,value + (sizeof(USHORT) * 2),39); 491 pci->szSubject[39] = 0; 492 } 493 free(pfealist); 394 494 } 395 495 free(pgealist); … … 423 523 pfealist = malloc(1532); 424 524 if (pfealist) { 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 525 memset(pfealist,0,1532); 526 pfealist->cbList = 1024; 527 eaop.fpGEA2List = pgealist; 528 eaop.fpFEA2List = pfealist; 529 eaop.oError = 0; 530 rc = DosQueryPathInfo(pci->szFileName,FIL_QUERYEASFROMLIST, 531 (PVOID)&eaop,(ULONG)sizeof(EAOP2)); 532 if (!rc) { 533 pfea = &eaop.fpFEA2List->list[0]; 534 value = pfea->szName + pfea->cbName + 1; 535 value[pfea->cbValue] = 0; 536 if (*(USHORT *)value == EAT_ASCII) 537 strncpy(pci->szLongname,value + (sizeof(USHORT) * 2),CCHMAXPATHCOMP); 538 pci->szLongname[CCHMAXPATHCOMP - 1] = 0; 539 } 540 free(pfealist); 441 541 } 442 542 free(pgealist); … … 449 549 strlwr(pci->szFileName); 450 550 451 if (pfsa4->attrFile & FILE_DIRECTORY) { 452 if (!fNoIconsDirs && (!isalpha(*pci->szFileName) || 453 !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS))) 551 if (pfsa4->attrFile & FILE_DIRECTORY) 552 { 553 if (fNoIconsDirs || 554 (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS) || 555 !isalpha(*pci->szFileName)) 556 { 557 hptr = (HPOINTER)0; 558 } 559 else 454 560 hptr = WinLoadFileIcon(pci->szFileName, FALSE); 561 } 562 else 563 { 564 if (fNoIconsFiles || 565 (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS) || 566 !isalpha(*pci->szFileName)) 567 { 568 hptr = IDFile(pci->szFileName); 569 } 455 570 else 456 hptr = (HPOINTER)0;457 }458 else459 {460 if (!fNoIconsFiles && (!isalpha(*pci->szFileName) ||461 !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOLOADICONS)))462 571 hptr = WinLoadFileIcon(pci->szFileName, FALSE); 463 else464 {465 p = strrchr(pci->szFileName,'.');466 if (p && !p[4]) {467 cmps[1] = toupper(p[1]);468 cmps[2] = toupper(p[2]);469 cmps[3] = toupper(p[3]);470 cmp = *(ULONG *)cmps;471 hptr = IDFile(cmp);472 }473 else474 hptr = (HPOINTER)0;475 }476 572 } 477 573 if (!hptr) 478 hptr = ((pfsa4->attrFile & FILE_DIRECTORY) != 0) ? hptrDir : 479 ((pfsa4->attrFile & FILE_SYSTEM) != 0) ? hptrSystem : 480 ((pfsa4->attrFile & FILE_HIDDEN) != 0) ? hptrHidden : 481 ((pfsa4->attrFile & FILE_READONLY) != 0) ? hptrReadonly : 482 hptrFile; 483 484 if (partial) { 574 { 575 hptr = pfsa4->attrFile & FILE_DIRECTORY ? 576 hptrDir : 577 pfsa4->attrFile & FILE_SYSTEM ? 578 hptrSystem : 579 pfsa4->attrFile & FILE_HIDDEN ? 580 hptrHidden : 581 pfsa4->attrFile & FILE_READONLY ? 582 hptrReadonly : 583 hptrFile; 584 } 585 586 if (partial) 587 { 485 588 p = strrchr(pci->szFileName,'\\'); 486 589 if (!p) { 487 590 p = strrchr(pci->szFileName,':'); 488 591 if (!p) 489 592 p = pci->szFileName; 490 593 else 491 594 p++; 492 595 } 493 596 else if ((dcd && dcd->type == TREE_FRAME) || 494 597 !(pfsa4->attrFile & FILE_DIRECTORY) || 495 598 !*(p + 1)) 496 599 p++; … … 526 629 if (attrstring[x]) 527 630 pci->szDispAttr[y++] = (CHAR)((pci->attrFile & (1 << x)) ? 528 631 attrstring[x] : '-'); 529 632 pci->szDispAttr[5] = 0; 530 633 pci->pszDispAttr = pci->szDispAttr; … … 535 638 (*dcd->mask.szMask || dcd->mask.antiattr || 536 639 ((dcd->mask.attrFile & 537 538 640 (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)) != 641 (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)))) 539 642 { 540 643 if (*dcd->mask.szMask || dcd->mask.antiattr) 541 644 { 542 645 if (!Filter((PMINIRECORDCORE)pci,(PVOID)&dcd->mask)) 543 646 pci->rc.flRecordAttr |= CRA_FILTERED; 544 647 } 545 648 else if ((!(dcd->mask.attrFile & FILE_HIDDEN) && 546 547 548 549 550 551 552 649 (pci->attrFile & FILE_HIDDEN)) || 650 (!(dcd->mask.attrFile & FILE_SYSTEM) && 651 (pci->attrFile & FILE_SYSTEM)) || 652 (!(dcd->mask.attrFile & FILE_READONLY) && 653 (pci->attrFile & FILE_READONLY)) || 654 (!(dcd->mask.attrFile & FILE_ARCHIVED) && 655 (pci->attrFile & FILE_ARCHIVED))) 553 656 pci->rc.flRecordAttr |= CRA_FILTERED; 554 657 } … … 560 663 561 664 VOID ProcessDirectory(const HWND hwndCnr, const PCNRITEM pciParent, 562 563 564 665 const CHAR *szDirBase, const BOOL filestoo, 666 const BOOL recurse,const BOOL partial, 667 CHAR *stopflag, 565 668 DIRCNRDATA *dcd, // Optional 566 669 ULONG *pulTotalFiles, // Optional … … 605 708 // ulExtraBytes = EXTRA_RECORD_BYTES2; 606 709 if ((driveflags[toupper(*szDirBase) - 'A'] & DRIVE_REMOTE) && fRemoteBug) 607 ulM = 1; 710 ulM = 1; /* file system gets confused */ 608 711 else if (driveflags[toupper(*szDirBase) - 'A'] & DRIVE_ZIPSTREAM) 609 712 ulM = min(FilesToGet,225); /* anything more is wasted */ … … 634 737 DosError(FERR_DISABLEHARDERR); 635 738 rc = DosFindFirst(pszFileSpec, &hdir, 636 637 638 639 640 739 FILE_NORMAL | ((filestoo) ? FILE_DIRECTORY : 740 MUST_HAVE_DIRECTORY) | FILE_READONLY | 741 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN, 742 paffbFound, ulM * sizeof(FILEFINDBUF4), 743 &ulFileCnt, FIL_QUERYEASIZE); 641 744 priority_normal(); 642 745 *pchEndPath = 0; … … 645 748 while (!rc) 646 749 { 647 648 649 650 651 652 653 654 655 656 657 658 659 for (x = 0;;x < ulFileCnt)750 /* 751 * remove . and .. from list if present 752 * also counter file system bugs that sometimes 753 * allows normal files to slip through when 754 * only directories should appear (only a few 755 * network file systems exhibit such a problem). 756 */ 757 register ULONG x; 758 759 if (stopflag && *stopflag) 760 goto Abort; 761 pByte = (PBYTE)paffbFound; 762 for (x = 0;x < ulFileCnt;) 660 763 { 661 662 663 664 665 666 667 764 pffbFile = (PFILEFINDBUF4)pByte; 765 if (!*pffbFile->achName || 766 (!filestoo && !(pffbFile->attrFile & FILE_DIRECTORY)) || 767 (((pffbFile->attrFile & FILE_DIRECTORY) && 768 pffbFile->achName[0] == '.') && 769 (!pffbFile->achName[1] || (pffbFile->achName[1] == '.' && 770 !pffbFile->achName[2])))) 668 771 { 669 ulFileCnt--; 772 ulFileCnt--; // Got . or .. 670 773 } 671 672 papffbSelected[x++] = pffbFile; 673 774 else 775 papffbSelected[x++] = pffbFile; // Count file 776 if (!pffbFile->oNextEntryOffset) 674 777 { 675 ulFileCnt = x; 676 677 678 679 680 778 ulFileCnt = x; // Adjust count 779 break; 780 } 781 pByte += pffbFile->oNextEntryOffset; 782 } 783 if (ulFileCnt) 681 784 { 682 683 684 785 if (stopflag && *stopflag) 786 goto Abort; 787 if (fSyncUpdates) 685 788 { 686 687 688 689 789 pciFirst = WinSendMsg(hwndCnr, CM_ALLOCRECORD, 790 MPFROMLONG(ulExtraBytes), 791 MPFROMLONG(ulFileCnt)); 792 if (pciFirst) 690 793 { 691 692 693 694 695 696 697 698 699 700 701 702 794 register INT i; 795 796 pci = pciFirst; 797 ullTotalBytes = 0; 798 for(i = 0; i < ulFileCnt; i++) { 799 pffbFile = papffbSelected[i]; 800 ullBytes = FillInRecordFromFFB(hwndCnr,pci,pszFileSpec, 801 pffbFile,partial,dcd); 802 pci = (PCNRITEM)pci->rc.preccNextRecord; 803 ullTotalBytes += ullBytes; 804 } 805 if (ulFileCnt) 703 806 { 704 705 706 707 708 709 710 711 712 713 714 715 716 807 memset(&ri,0,sizeof(RECORDINSERT)); 808 ri.cb = sizeof(RECORDINSERT); 809 ri.pRecordOrder = (PRECORDCORE) CMA_END; 810 ri.pRecordParent = (PRECORDCORE) pciParent; 811 ri.zOrder = (ULONG) CMA_TOP; 812 ri.cRecordsInsert = ulFileCnt; 813 ri.fInvalidateRecord = (!fSyncUpdates && dcd && 814 dcd->type == DIR_FRAME) ? 815 FALSE : TRUE; 816 if (!WinSendMsg(hwndCnr, 817 CM_INSERTRECORD, 818 MPFROMP(pciFirst), 819 MPFROMP(&ri))) 717 820 { 718 719 720 721 722 723 821 DosSleep(100); 822 WinSetFocus(HWND_DESKTOP,hwndCnr); 823 if (!WinSendMsg(hwndCnr, 824 CM_INSERTRECORD, 825 MPFROMP(pciFirst), 826 MPFROMP(&ri))) 724 827 { 725 726 727 728 729 828 Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__, 829 GetPString(IDS_FILLDIRERR2TEXT)); 830 ok = FALSE; 831 ullTotalBytes = 0; 832 if (WinIsWindow((HAB)0,hwndCnr)) 730 833 { 731 732 834 pci = pciFirst; 835 while (pci) 733 836 { 734 735 736 737 738 739 740 741 742 743 744 745 746 837 pcit = (PCNRITEM)pci->rc.preccNextRecord; 838 WinSendMsg(hwndCnr, 839 CM_FREERECORD, 840 MPFROMP(&pci), 841 MPFROMSHORT(1)); 842 pci = pcit; 843 } 844 } 845 } 846 } 847 } 848 } 849 else 747 850 { 748 749 750 751 752 753 851 Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__, 852 GetPString(IDS_FILLDIRERR3TEXT)); 853 ok = FALSE; 854 ullTotalBytes = 0; 855 } 856 if (ok) 754 857 { 755 756 757 758 759 858 ullReturnBytes += ullTotalBytes; 859 ulReturnFiles += ulFileCnt; 860 } 861 } 862 else 760 863 { 761 762 763 864 paffbTemp = realloc(paffbTotal,sizeof(FILEFINDBUF4) * 865 (ulFileCnt + ulTotal)); 866 if (paffbTemp) 764 867 { 765 766 767 768 769 770 868 paffbTotal = paffbTemp; 869 for(x = 0;x < ulFileCnt;x++) 870 paffbTotal[x + ulTotal] = *papffbSelected[x]; 871 ulTotal += ulFileCnt; 872 } 873 else 771 874 { 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 875 saymsg(MB_ENTER, 876 HWND_DESKTOP, 877 GetPString(IDS_ERRORTEXT), 878 GetPString(IDS_OUTOFMEMORY)); 879 break; 880 } 881 } 882 } 883 if (stopflag && *stopflag) 884 goto Abort; 885 ulFileCnt = ulM; 886 DosError(FERR_DISABLEHARDERR); 887 rc = DosFindNext(hdir, paffbFound, ulM * sizeof(FILEFINDBUF4), 888 &ulFileCnt); 889 priority_normal(); 890 if (rc) 891 DosError(FERR_DISABLEHARDERR); 789 892 } 790 893 DosFindClose(hdir); 791 894 792 895 if (paffbFound || papffbSelected) { 793 794 795 796 797 798 896 if (paffbFound) 897 free(paffbFound); 898 if (papffbSelected) 899 free(papffbSelected); 900 papffbSelected = NULL; 901 paffbFound = NULL; 799 902 } 800 903 … … 802 905 { 803 906 804 805 806 807 808 809 810 907 if (stopflag && *stopflag) 908 goto Abort; 909 910 pciFirst = WinSendMsg(hwndCnr, CM_ALLOCRECORD, 911 MPFROMLONG(ulExtraBytes), 912 MPFROMLONG(ulTotal)); 913 if (pciFirst) 811 914 { 812 813 814 815 816 817 915 register INT i; 916 917 pci = pciFirst; 918 ullTotalBytes = 0; 919 pByte2 = (PBYTE)paffbTotal; 920 for(i = 0; i < ulTotal; i++) 818 921 { 819 820 821 822 823 824 825 826 827 922 pffbFile = (PFILEFINDBUF4)pByte2; 923 ullBytes = FillInRecordFromFFB(hwndCnr,pci,pszFileSpec, 924 pffbFile,partial,dcd); 925 pci = (PCNRITEM)pci->rc.preccNextRecord; 926 ullTotalBytes += ullBytes; 927 928 pByte2 += sizeof(FILEFINDBUF4); 929 } 930 if (ulTotal) 828 931 { 829 830 831 832 833 834 835 836 837 838 839 932 memset(&ri,0,sizeof(RECORDINSERT)); 933 ri.cb = sizeof(RECORDINSERT); 934 ri.pRecordOrder = (PRECORDCORE) CMA_END; 935 ri.pRecordParent = (PRECORDCORE) pciParent; 936 ri.zOrder = (ULONG) CMA_TOP; 937 ri.cRecordsInsert = ulTotal; 938 ri.fInvalidateRecord = (!fSyncUpdates && dcd && 939 dcd->type == DIR_FRAME) ? 940 FALSE : TRUE; 941 if (!WinSendMsg(hwndCnr,CM_INSERTRECORD, 942 MPFROMP(pciFirst),MPFROMP(&ri))) 840 943 { 841 842 843 844 845 846 847 848 849 850 944 DosSleep(100); 945 WinSetFocus(HWND_DESKTOP,hwndCnr); 946 if (!WinSendMsg(hwndCnr,CM_INSERTRECORD, 947 MPFROMP(pciFirst),MPFROMP(&ri))) 948 { 949 Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__, 950 GetPString(IDS_FILLDIRERR5TEXT)); 951 ok = FALSE; 952 ullTotalBytes = 0; 953 if (WinIsWindow((HAB)0,hwndCnr)) 851 954 { 852 853 955 pci = pciFirst; 956 while (pci) 854 957 { 855 856 857 858 859 860 861 862 863 864 865 958 pcit = (PCNRITEM)pci->rc.preccNextRecord; 959 WinSendMsg(hwndCnr,CM_FREERECORD, 960 MPFROMP(&pci),MPFROMSHORT(1)); 961 pci = pcit; 962 } 963 } 964 } 965 } 966 } 967 } 968 else 866 969 { 867 868 869 870 871 872 970 Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__, 971 GetPString(IDS_FILLDIRERR3TEXT)); 972 ok = FALSE; 973 ullTotalBytes = 0; 974 } 975 if (ok) 873 976 { 874 875 876 977 ullReturnBytes += ullTotalBytes; 978 ulReturnFiles += ulFileCnt; 979 } 877 980 } 878 981 } … … 880 983 if (!fSyncUpdates && dcd && dcd->type == DIR_FRAME) 881 984 WinSendMsg(hwndCnr,CM_INVALIDATERECORD,MPVOID, 882 985 MPFROM2SHORT(0,CMA_ERASE)); 883 986 } 884 987 Abort: … … 897 1000 { 898 1001 pci = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pciParent), 899 1002 MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER)); 900 1003 while (pci && (INT)pci != -1) 901 1004 { 902 1005 if (pci->attrFile & FILE_DIRECTORY) 903 1006 Stubby(hwndCnr,pci); 904 1007 pci = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci), 905 1008 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 906 1009 } 907 1010 } … … 917 1020 918 1021 VOID FillDirCnr(HWND hwndCnr, 919 920 921 1022 CHAR *pszDirectory, 1023 DIRCNRDATA *dcd, 1024 PULONGLONG pullTotalBytes) 922 1025 { 923 1026 ProcessDirectory(hwndCnr, 924 1027 (PCNRITEM)NULL, 925 1028 pszDirectory, 926 1029 TRUE, 927 1030 FALSE, 928 1031 TRUE, 929 1032 dcd ? &dcd->stopflag : NULL, 930 1033 dcd, 931 1034 NULL, … … 951 1054 for (x = 0;x < 26;x++) 952 1055 driveflags[x] &= (DRIVE_IGNORE | DRIVE_NOPRESCAN | DRIVE_NOLOADICONS | 953 954 1056 DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS | 1057 DRIVE_INCLUDEFILES | DRIVE_SLOW); 955 1058 memset(driveserial,-1,sizeof(driveserial)); 956 1059 { … … 959 1062 DosError(FERR_DISABLEHARDERR); 960 1063 if (!DosQuerySysInfo(QSV_BOOT_DRIVE, 961 962 963 1064 QSV_BOOT_DRIVE, 1065 (PVOID)&startdrive, 1066 (ULONG)sizeof(ULONG)) && 964 1067 startdrive) 965 1068 driveflags[startdrive - 1] |= DRIVE_BOOT; … … 967 1070 DosError(FERR_DISABLEHARDERR); 968 1071 rc = DosQCurDisk(&ulDriveNum, 969 1072 &ulDriveMap); 970 1073 if (rc) 971 1074 { 972 1075 Dos_Error(MB_CANCEL, 973 974 975 976 977 1076 rc, 1077 HWND_DESKTOP, 1078 __FILE__, 1079 __LINE__, 1080 GetPString(IDS_FILLDIRERR6TEXT)); 978 1081 exit(0); 979 1082 } … … 983 1086 if (numtoinsert) 984 1087 pciFirst = WinSendMsg(hwndCnr, 985 986 987 1088 CM_ALLOCRECORD, 1089 MPFROMLONG(EXTRA_RECORD_BYTES2), 1090 MPFROMLONG((ULONG)numtoinsert)); 988 1091 if (pciFirst) 989 1092 { … … 992 1095 if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) 993 1096 { 994 995 996 997 998 1097 *szDrive = (CHAR)x + 'A'; 1098 1099 { 1100 CHAR s[80]; 1101 ULONG flags = 0; 999 1102 ULONG size = sizeof(ULONG); 1000 1103 1001 1002 1003 1104 sprintf(s,"%c.DriveFlags",toupper(*szDrive)); 1105 if (PrfQueryProfileData(fmprof,appname,s,&flags,&size) && 1106 size == sizeof(ULONG)) 1004 1107 { 1005 1108 driveflags[toupper(*szDrive) - 'A'] |= flags; 1006 1109 } 1007 1008 1009 1110 } 1111 1112 if (x > 1) 1010 1113 { 1011 1114 if (!(driveflags[x] & DRIVE_NOPRESCAN)) 1012 1115 { 1013 1014 1015 1016 1017 1116 *FileSystem = 0; 1117 drvtype = 0; 1118 removable = CheckDrive(*szDrive,FileSystem,&drvtype); 1119 driveserial[x] = -1; 1120 if (removable != -1) 1018 1121 { 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1122 struct { 1123 ULONG serial; 1124 CHAR volumelength; 1125 CHAR volumelabel[CCHMAXPATH]; 1126 } volser; 1127 1128 DosError(FERR_DISABLEHARDERR); 1129 if (!DosQueryFSInfo((ULONG)x, 1130 FSIL_VOLSER, 1131 &volser, 1132 sizeof(volser))) 1133 { 1134 driveserial[x] = volser.serial; 1032 1135 } 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1136 } 1137 else 1138 driveflags[x] |= DRIVE_INVALID; 1139 memset(&fsa4,0,sizeof(FILESTATUS4)); 1140 driveflags[x] |= ((removable == -1 || removable == 1) ? 1141 DRIVE_REMOVABLE : 0); 1142 if (drvtype & DRIVE_REMOTE) 1143 driveflags[x] |= DRIVE_REMOTE; 1144 if (strcmp(FileSystem,HPFS) && 1145 strcmp(FileSystem,JFS) && 1146 strcmp(FileSystem,CDFS) && 1147 strcmp(FileSystem,FAT32) && 1148 strcmp(FileSystem,HPFS386)) 1046 1149 { 1047 1150 driveflags[x] |= DRIVE_NOLONGNAMES; 1048 1151 } 1049 1152 if (!strcmp(FileSystem,CDFS)) 1050 1153 { 1051 1052 1053 1054 1055 1154 removable = 1; 1155 driveflags[x] |= DRIVE_REMOVABLE | DRIVE_NOTWRITEABLE | 1156 DRIVE_CDROM; 1157 } 1158 else if (!stricmp(FileSystem,CBSIFS)) 1056 1159 { 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1160 driveflags[x] |= DRIVE_ZIPSTREAM; 1161 driveflags[x] &= ~DRIVE_REMOTE; 1162 if (drvtype & DRIVE_REMOVABLE) 1163 driveflags[x] |= DRIVE_REMOVABLE; 1164 if (!(drvtype & DRIVE_NOLONGNAMES)) 1165 driveflags[x] &= ~DRIVE_NOLONGNAMES; 1166 } 1167 1168 pci->rc.flRecordAttr |= CRA_RECORDREADONLY; 1169 if ((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum) 1170 pci->rc.flRecordAttr |= (CRA_CURSORED | CRA_SELECTED); 1171 1172 if (removable == 0) 1070 1173 { 1071 1072 1073 1074 1075 1076 1077 1174 pci->attrFile |= FILE_DIRECTORY; 1175 DosError(FERR_DISABLEHARDERR); 1176 rc = DosQueryPathInfo(szDrive, 1177 FIL_QUERYEASIZE, 1178 &fsa4, 1179 (ULONG)sizeof(FILESTATUS4)); 1180 if (rc == 58) 1078 1181 { 1079 1080 1081 1082 1083 1084 1085 1086 1182 DosError(FERR_DISABLEHARDERR); 1183 rc = DosQueryPathInfo(szDrive, 1184 FIL_STANDARD, 1185 &fsa4, 1186 (ULONG)sizeof(FILESTATUS3)); 1187 fsa4.cbList = 0; 1188 } 1189 if (rc && !didonce) 1087 1190 { 1088 1191 if (!*suggest) 1089 1192 { 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1193 *suggest = '/'; 1194 suggest[1] = 0; 1195 } 1196 sprintf(suggest + strlen(suggest), 1197 "%c", 1198 toupper(*szDrive)); 1199 strcpy(pci->szFileName,szDrive); 1200 pci->pszFileName = pci->szFileName; 1201 pci->rc.pszIcon = pci->pszFileName; 1202 pci->attrFile = FILE_DIRECTORY; 1203 strcpy(pci->szDispAttr,"----D-"); 1204 pci->pszDispAttr = pci->szDispAttr; 1205 driveserial[x] = -1; 1206 } 1207 else 1208 FillInRecordFromFSA(hwndCnr, 1209 pci, 1210 szDrive, 1211 &fsa4, 1212 TRUE, 1213 NULL); 1214 } 1215 else 1113 1216 { 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1217 strcpy(pci->szFileName,szDrive); 1218 pci->pszFileName = pci->szFileName; 1219 pci->rc.pszIcon = pci->pszFileName; 1220 pci->attrFile = FILE_DIRECTORY; 1221 strcpy(pci->szDispAttr,"----D-"); 1222 pci->pszDispAttr = pci->szDispAttr; 1223 } 1224 *pci->szFileName = toupper(*pci->szFileName); 1225 if (driveflags[x] & DRIVE_CDROM) 1226 pci->rc.hptrIcon = hptrCDROM; 1227 else 1228 pci->rc.hptrIcon = (driveflags[x] & DRIVE_REMOVABLE) ? 1229 hptrRemovable : 1230 (driveflags[x] & DRIVE_REMOTE) ? 1231 hptrRemote : 1232 (driveflags[x] & DRIVE_ZIPSTREAM) ? 1233 hptrZipstrm : hptrDrive; 1234 } 1235 else 1133 1236 { 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1237 pci->rc.hptrIcon = hptrDunno; 1238 strcpy(pci->szFileName,szDrive); 1239 pci->pszFileName = pci->szFileName; 1240 pci->rc.pszIcon = pci->pszFileName; 1241 pci->attrFile = FILE_DIRECTORY; 1242 strcpy(pci->szDispAttr,"----D-"); 1243 pci->pszDispAttr = pci->szDispAttr; 1244 driveserial[x] = -1; 1245 } 1246 } 1247 else 1145 1248 { 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1249 pci->rc.hptrIcon = hptrFloppy; 1250 strcpy(pci->szFileName,szDrive); 1251 pci->pszFileName = pci->szFileName; 1252 pci->rc.pszIcon = pci->pszFileName; 1253 pci->attrFile = FILE_DIRECTORY; 1254 strcpy(pci->szDispAttr,"----D-"); 1255 pci->pszDispAttr = pci->szDispAttr; 1256 driveflags[x] |= (DRIVE_REMOVABLE | DRIVE_NOLONGNAMES); 1257 driveserial[x] = -1; 1258 } 1259 pci->rc.flRecordAttr |= CRA_RECORDREADONLY; 1260 pci = (PCNRITEM)pci->rc.preccNextRecord; /* next rec */ 1158 1261 } 1159 1262 else if (!(ulDriveMap & (1L << x))) 1160 1263 driveflags[x] |= DRIVE_INVALID; 1161 1264 } 1162 1265 PostMsg(hwndMain, 1163 1164 1165 1266 UM_BUILDDRIVES, 1267 MPVOID, 1268 MPVOID); 1166 1269 drivesbuilt = TRUE; 1167 1270 /* insert the drives */ … … 1178 1281 ri.fInvalidateRecord = FALSE; 1179 1282 if (!WinSendMsg(hwndCnr, 1180 1181 1182 1183 1184 1283 CM_INSERTRECORD, 1284 MPFROMP(pciFirst), 1285 MPFROMP(&ri))) 1286 Win_Error(hwndCnr,hwndCnr,__FILE__,__LINE__, 1287 GetPString(IDS_FILLDIRERR5TEXT)); 1185 1288 } 1186 1289 /* move cursor onto the default drive rather than the first drive */ … … 1188 1291 { 1189 1292 pci = (PCNRITEM)WinSendMsg(hwndCnr, 1190 1191 1192 1293 CM_QUERYRECORD, 1294 MPVOID, 1295 MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER)); 1193 1296 while(pci && (INT)pci != -1) 1194 1297 { 1195 1298 if ((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum) 1196 1299 { 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1300 WinSendMsg(hwndCnr, 1301 CM_SETRECORDEMPHASIS, 1302 MPFROMP(pci), 1303 MPFROM2SHORT(TRUE,CRA_CURSORED)); 1304 break; 1305 } 1306 pci = (PCNRITEM)WinSendMsg(hwndCnr, 1307 CM_QUERYRECORD, 1308 MPFROMP(pci), 1309 MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER)); 1207 1310 } 1208 1311 } … … 1210 1313 if (hwndParent) 1211 1314 WinSendMsg(WinWindowFromID(WinQueryWindow(hwndParent,QW_PARENT), 1212 1213 1214 1215 1315 MAIN_DRIVELIST), 1316 LM_DELETEALL, 1317 MPVOID, 1318 MPVOID); 1216 1319 1217 1320 if (fShowEnv) … … 1220 1323 1221 1324 pciParent = WinSendMsg(hwndCnr, 1222 1223 1224 1325 CM_ALLOCRECORD, 1326 MPFROMLONG(EXTRA_RECORD_BYTES2), 1327 MPFROMLONG(1)); 1225 1328 if (pciParent) 1226 1329 { 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1330 pciParent->flags |= RECFLAGS_ENV; 1331 strcpy(pciParent->szFileName,GetPString(IDS_ENVVARSTEXT)); 1332 pciParent->pszFileName = pciParent->szFileName; 1333 pciParent->rc.hptrIcon = hptrEnv; 1334 pciParent->rc.pszIcon = pciParent->pszFileName; 1335 strcpy(pciParent->szDispAttr,"------"); 1336 pciParent->pszDispAttr = pciParent->szDispAttr; 1337 memset(&ri,0,sizeof(RECORDINSERT)); 1338 ri.cb = sizeof(RECORDINSERT); 1339 ri.pRecordOrder = (PRECORDCORE)CMA_END; 1340 ri.pRecordParent = (PRECORDCORE)NULL; 1341 ri.zOrder = (ULONG)CMA_TOP; 1342 ri.cRecordsInsert = 1; 1343 ri.fInvalidateRecord = FALSE; 1344 if (WinSendMsg(hwndCnr, 1345 CM_INSERTRECORD, 1346 MPFROMP(pciParent), 1347 MPFROMP(&ri))) { 1348 1349 char *p,*pp; 1350 1351 p = GetPString(IDS_ENVVARNAMES); 1352 while(*p == ' ') 1353 p++; 1354 while (*p) 1252 1355 { 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1356 *FileSystem = 0; 1357 pp = FileSystem; 1358 while(*p && *p != ' ') 1359 *pp++ = *p++; 1360 *pp = 0; 1361 while(*p == ' ') 1362 p++; 1363 if (*FileSystem && 1364 (!stricmp(FileSystem,"LIBPATH") || 1365 getenv(FileSystem))) 1263 1366 { 1264 1265 1266 1267 1268 1367 pci = WinSendMsg(hwndCnr, 1368 CM_ALLOCRECORD, 1369 MPFROMLONG(EXTRA_RECORD_BYTES2), 1370 MPFROMLONG(1)); 1371 if (pci) 1269 1372 { 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1373 pci->flags |= RECFLAGS_ENV; 1374 sprintf(pci->szFileName, 1375 "%%%s%%", 1376 FileSystem); 1377 pci->pszFileName = pci->szFileName; 1378 pci->rc.hptrIcon = hptrEnv; 1379 pci->rc.pszIcon = pci->pszFileName; 1380 strcpy(pci->szDispAttr,"------"); 1381 pci->pszDispAttr = pci->szDispAttr; 1382 memset(&ri,0,sizeof(RECORDINSERT)); 1383 ri.cb = sizeof(RECORDINSERT); 1384 ri.pRecordOrder = (PRECORDCORE)CMA_END; 1385 ri.pRecordParent = (PRECORDCORE)pciParent; 1386 ri.zOrder = (ULONG)CMA_TOP; 1387 ri.cRecordsInsert = 1; 1388 ri.fInvalidateRecord = FALSE; 1389 if (!WinSendMsg(hwndCnr, 1390 CM_INSERTRECORD, 1391 MPFROMP(pci), 1392 MPFROMP(&ri))) { 1393 Win_Error(hwndCnr,hwndCnr,__FILE__,__LINE__, 1394 GetPString(IDS_FILLDIRERR5TEXT)); 1395 WinSendMsg(hwndCnr, 1396 CM_FREERECORD, 1397 MPFROMP(&pci), 1398 MPFROMSHORT(1)); 1399 } 1400 } 1401 } 1402 } 1403 WinSendMsg(hwndCnr, 1404 CM_INVALIDATERECORD, 1405 MPFROMP(&pciParent), 1406 MPFROM2SHORT(1,CMA_ERASE | CMA_REPOSITION)); 1407 } 1408 else 1409 WinSendMsg(hwndCnr, 1410 CM_FREERECORD, 1411 MPFROMP(&pciParent), 1412 MPFROMSHORT(1)); 1310 1413 } 1311 1414 } … … 1313 1416 x = 0; 1314 1417 pci = (PCNRITEM)WinSendMsg(hwndCnr, 1315 1316 1317 1418 CM_QUERYRECORD, 1419 MPVOID, 1420 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 1318 1421 while (pci && (INT)pci != -1) 1319 1422 { 1320 1423 pciNext = (PCNRITEM)WinSendMsg(hwndCnr, 1321 1322 1323 1424 CM_QUERYRECORD, 1425 MPFROMP(pci), 1426 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 1324 1427 if (!(pci->flags & RECFLAGS_ENV)) 1325 1428 { 1326 1327 1429 if ((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum || 1430 toupper(*pci->szFileName) > 'B') 1328 1431 { 1329 1330 1331 1332 1432 if (!(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_INVALID) && 1433 !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOPRESCAN) && 1434 (!fNoRemovableScan || 1435 !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE))) 1333 1436 { 1334 1437 if (!Stubby(hwndCnr,pci)) 1335 1438 { 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1439 WinSendMsg(hwndCnr, 1440 CM_INVALIDATERECORD, 1441 MPFROMP(&pci), 1442 MPFROM2SHORT(1,CMA_ERASE | CMA_REPOSITION)); 1443 goto SkipBadRec; 1444 } 1445 } 1446 } 1447 else 1448 WinSendMsg(hwndCnr, 1449 CM_INVALIDATERECORD, 1450 MPFROMP(&pci), 1451 MPFROM2SHORT(1,CMA_ERASE | CMA_REPOSITION)); 1452 1453 WinSendMsg(WinWindowFromID(WinQueryWindow(hwndParent,QW_PARENT), 1454 MAIN_DRIVELIST), 1455 LM_INSERTITEM, 1456 MPFROM2SHORT(LIT_SORTASCENDING,0), 1457 MPFROMP(pci->szFileName)); 1355 1458 } 1356 1459 SkipBadRec: … … 1360 1463 if (hwndParent) 1361 1464 WinSendMsg(WinWindowFromID(WinQueryWindow(hwndParent,QW_PARENT), 1362 1363 1465 MAIN_DRIVELIST),LM_SELECTITEM,MPFROM2SHORT(0,0), 1466 MPFROMLONG(TRUE)); 1364 1467 1365 1468 pci = (PCNRITEM)WinSendMsg(hwndCnr, 1366 1367 1368 1369 1469 CM_QUERYRECORD, 1470 MPVOID, 1471 MPFROM2SHORT(CMA_FIRST, 1472 CMA_ITEMORDER)); 1370 1473 while (pci && (INT)pci != -1) 1371 1474 { 1372 1475 pciNext = (PCNRITEM)WinSendMsg(hwndCnr, 1373 1374 1375 1376 1476 CM_QUERYRECORD, 1477 MPFROMP(pci), 1478 MPFROM2SHORT(CMA_NEXT, 1479 CMA_ITEMORDER)); 1377 1480 if (pci->flags & RECFLAGS_ENV) 1378 1481 { 1379 1380 1381 1382 1383 1384 1482 pci = (PCNRITEM)WinSendMsg(hwndCnr, 1483 CM_QUERYRECORD, 1484 MPFROMP(pci), 1485 MPFROM2SHORT(CMA_FIRSTCHILD, 1486 CMA_ITEMORDER)); 1487 while (pci && (INT)pci != -1) 1385 1488 { 1386 1387 1388 1389 1390 1391 1392 1393 1394 1489 if (pci->flags & RECFLAGS_ENV) 1490 FleshEnv(hwndCnr,pci); 1491 pci = (PCNRITEM)WinSendMsg(hwndCnr, 1492 CM_QUERYRECORD, 1493 MPFROMP(pci), 1494 MPFROM2SHORT(CMA_NEXT, 1495 CMA_ITEMORDER)); 1496 } 1497 break; 1395 1498 } 1396 1499 pci = (PCNRITEM)WinSendMsg(hwndCnr, 1397 1398 1399 1400 1500 CM_QUERYRECORD, 1501 MPFROMP(pci), 1502 MPFROM2SHORT(CMA_NEXT, 1503 CMA_ITEMORDER)); 1401 1504 } 1402 1505 … … 1405 1508 { 1406 1509 Win_Error(hwndCnr,hwndCnr,__FILE__,__LINE__, 1407 1510 GetPString(IDS_FILLDIRERR7TEXT)); 1408 1511 exit(0); 1409 1512 } 1410 1513 if (!drivesbuilt && hwndMain) 1411 1514 PostMsg(hwndMain, 1412 1413 1414 1515 UM_BUILDDRIVES, 1516 MPVOID, 1517 MPVOID); 1415 1518 DosSleep(33L); 1416 1519 fDummy = FALSE; … … 1421 1524 1422 1525 if (*suggest || 1423 1424 1526 (!(driveflags[1] & DRIVE_IGNORE) && 1527 fFirstTime)) 1425 1528 { 1426 1529 if (!DosDevConfig(&info, 1427 1428 1530 DEVINFO_FLOPPY) && 1531 info == 1) 1429 1532 { 1430 1533 if (!*suggest) 1431 1534 { 1432 1433 1434 1435 1436 1437 1535 *suggest = '/'; 1536 suggest[1] = 0; 1537 } 1538 else 1539 memmove(suggest + 2,suggest + 1,strlen(suggest)); 1540 suggest[1] = 'B'; 1438 1541 } 1439 1542 } … … 1442 1545 for(x = 2;x < 26;x++) 1443 1546 { 1444 1547 if (driveflags[x] & DRIVE_IGNORE) 1445 1548 { 1446 1447 1448 1449 1450 1549 includesyours = TRUE; 1550 sprintf(suggest + strlen(suggest), 1551 "%c", 1552 (char)(x + 'A')); 1553 } 1451 1554 } 1452 1555 strcat(suggest," %*"); 1453 1556 if (saymsg(MB_YESNO | MB_ICONEXCLAMATION, 1454 1455 1456 1457 1458 1557 (hwndParent) ? hwndParent : hwndCnr, 1558 GetPString(IDS_SUGGESTTITLETEXT), 1559 GetPString(IDS_SUGGEST1TEXT), 1560 (includesyours) ? GetPString(IDS_SUGGEST2TEXT) : NullStr, 1561 suggest) == MBID_YES) 1459 1562 { 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1563 char s[64]; 1564 1565 sprintf(s, "PARAMETERS=%s", suggest); 1566 WinCreateObject(WPProgram, 1567 "FM/2", 1568 s, 1569 FM3Folder, 1570 CO_UPDATEIFEXISTS); 1571 WinCreateObject(WPProgram, 1572 "FM/2 Lite", 1573 s, 1574 FM3Folder, 1575 CO_UPDATEIFEXISTS); 1576 WinCreateObject(WPProgram, 1577 "Archive Viewer/2", 1578 s, 1579 FM3Tools, 1580 CO_UPDATEIFEXISTS); 1581 WinCreateObject(WPProgram, 1582 "Dir Sizes", 1583 s, 1584 FM3Tools, 1585 CO_UPDATEIFEXISTS); 1586 WinCreateObject(WPProgram, 1587 "Visual Tree", 1588 s, 1589 FM3Tools, 1590 CO_UPDATEIFEXISTS); 1591 WinCreateObject(WPProgram, 1592 "Visual Directory", 1593 s, 1594 FM3Tools, 1595 CO_UPDATEIFEXISTS); 1596 WinCreateObject(WPProgram, 1597 "Global File Viewer", 1598 s, 1599 FM3Tools, 1600 CO_UPDATEIFEXISTS); 1601 WinCreateObject(WPProgram, 1602 "Databar", 1603 s, 1604 FM3Tools, 1605 CO_UPDATEIFEXISTS); 1503 1606 } 1504 1607 }
Note:
See TracChangeset
for help on using the changeset viewer.