- Timestamp:
- Jun 18, 2005, 5:51:49 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/dll/filldir.c (modified) (37 diffs)
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 const PFILEFINDBUF4 pffb,const BOOL partial,67 DIRCNRDATA *dcd)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 memset(pfealist,0,1532);125 pfealist->cbList = 1024;126 eaop.fpGEA2List = pgealist;127 eaop.fpFEA2List = pfealist;128 eaop.oError = 0;129 rc = DosQueryPathInfo(pci->szFileName,FIL_QUERYEASFROMLIST,130 (PVOID)&eaop,(ULONG)sizeof(EAOP2));131 if (!rc) {132 pfea = &eaop.fpFEA2List->list[0];133 value = pfea->szName + pfea->cbName + 1;134 value[pfea->cbValue] = 0;135 if (*(USHORT *)value == EAT_ASCII)136 strncpy(pci->szSubject,value + (sizeof(USHORT) * 2),39);137 pci->szSubject[39] = 0;138 }139 free(pfealist);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 memset(pfealist,0,1532);173 pfealist->cbList = 1024;174 eaop.fpGEA2List = pgealist;175 eaop.fpFEA2List = pfealist;176 eaop.oError = 0;177 rc = DosQueryPathInfo(pci->szFileName,FIL_QUERYEASFROMLIST,178 (PVOID)&eaop,(ULONG)sizeof(EAOP2));179 if (!rc)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 pfea = &eaop.fpFEA2List->list[0];182 value = pfea->szName + pfea->cbName + 1;183 value[pfea->cbValue] = 0;184 if (*(USHORT *)value == EAT_ASCII)185 strncpy(pci->szLongname,value + (sizeof(USHORT) * 2),CCHMAXPATHCOMP);186 pci->szLongname[CCHMAXPATHCOMP - 1] = 0;187 }188 free(pfealist);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 p = pci->szFileName;354 p = pci->szFileName; 253 355 else 254 p++;356 p++; 255 357 } 256 358 else if ((dcd && dcd->type == TREE_FRAME) || 257 (!(pffb->attrFile & FILE_DIRECTORY) || !*(p + 1)))359 (!(pffb->attrFile & FILE_DIRECTORY) || !*(p + 1))) 258 360 { 259 361 p++; … … 294 396 { 295 397 pci->szDispAttr[y++] = 296 (CHAR)((pci->attrFile & (1 << x)) ? attrstring[x] : '-');398 (CHAR)((pci->attrFile & (1 << x)) ? attrstring[x] : '-'); 297 399 } 298 400 } … … 311 413 { 312 414 if(!Filter((PMINIRECORDCORE)pci,(PVOID)&dcd->mask)) 313 pci->rc.flRecordAttr |= CRA_FILTERED;415 pci->rc.flRecordAttr |= CRA_FILTERED; 314 416 } 315 417 else if((!(dcd->mask.attrFile & FILE_HIDDEN) && 316 (pci->attrFile & FILE_HIDDEN)) ||317 (!(dcd->mask.attrFile & FILE_SYSTEM) &&318 (pci->attrFile & FILE_SYSTEM)) ||319 (!(dcd->mask.attrFile & FILE_READONLY) &&320 (pci->attrFile & FILE_READONLY)) ||321 (!(dcd->mask.attrFile & FILE_ARCHIVED) &&322 (pci->attrFile & FILE_ARCHIVED)))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 PCNRITEM pci,436 PCNRITEM pci, 335 437 const PSZ pszFileName, 336 const PFILESTATUS4 pfsa4,337 const BOOL partial,338 DIRCNRDATA *dcd) // Optional438 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 memset(pfealist,0,1532);378 pfealist->cbList = 1024;379 eaop.fpGEA2List = pgealist;380 eaop.fpFEA2List = pfealist;381 eaop.oError = 0;382 rc = DosQueryPathInfo(pci->szFileName,FIL_QUERYEASFROMLIST,383 (PVOID)&eaop,384 (ULONG)sizeof(EAOP2));385 if (!rc) {386 pfea = &eaop.fpFEA2List->list[0];387 value = pfea->szName + pfea->cbName + 1;388 value[pfea->cbValue] = 0;389 if (*(USHORT *)value == EAT_ASCII)390 strncpy(pci->szSubject,value + (sizeof(USHORT) * 2),39);391 pci->szSubject[39] = 0;392 }393 free(pfealist);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 memset(pfealist,0,1532);426 pfealist->cbList = 1024;427 eaop.fpGEA2List = pgealist;428 eaop.fpFEA2List = pfealist;429 eaop.oError = 0;430 rc = DosQueryPathInfo(pci->szFileName,FIL_QUERYEASFROMLIST,431 (PVOID)&eaop,(ULONG)sizeof(EAOP2));432 if (!rc) {433 pfea = &eaop.fpFEA2List->list[0];434 value = pfea->szName + pfea->cbName + 1;435 value[pfea->cbValue] = 0;436 if (*(USHORT *)value == EAT_ASCII)437 strncpy(pci->szLongname,value + (sizeof(USHORT) * 2),CCHMAXPATHCOMP);438 pci->szLongname[CCHMAXPATHCOMP - 1] = 0;439 }440 free(pfealist);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 p = strrchr(pci->szFileName,':');590 p = strrchr(pci->szFileName,':'); 488 591 if (!p) 489 p = pci->szFileName;592 p = pci->szFileName; 490 593 else 491 p++;594 p++; 492 595 } 493 596 else if ((dcd && dcd->type == TREE_FRAME) || 494 !(pfsa4->attrFile & FILE_DIRECTORY) ||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 attrstring[x] : '-');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 (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED)) !=538 (FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_ARCHIVED))))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 pci->rc.flRecordAttr |= CRA_FILTERED;646 pci->rc.flRecordAttr |= CRA_FILTERED; 544 647 } 545 648 else if ((!(dcd->mask.attrFile & FILE_HIDDEN) && 546 (pci->attrFile & FILE_HIDDEN)) ||547 (!(dcd->mask.attrFile & FILE_SYSTEM) &&548 (pci->attrFile & FILE_SYSTEM)) ||549 (!(dcd->mask.attrFile & FILE_READONLY) &&550 (pci->attrFile & FILE_READONLY)) ||551 (!(dcd->mask.attrFile & FILE_ARCHIVED) &&552 (pci->attrFile & FILE_ARCHIVED)))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 const CHAR *szDirBase, const BOOL filestoo,563 const BOOL recurse,const BOOL partial,564 CHAR *stopflag,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; /* file system gets confused */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 FILE_NORMAL | ((filestoo) ? FILE_DIRECTORY :637 MUST_HAVE_DIRECTORY) | FILE_READONLY |638 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,639 paffbFound, ulM * sizeof(FILEFINDBUF4),640 &ulFileCnt, FIL_QUERYEASIZE);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 * remove . and .. from list if present649 * also counter file system bugs that sometimes650 * allows normal files to slip through when651 * only directories should appear (only a few652 * network file systems exhibit such a problem).653 */654 register ULONG x;655 656 if (stopflag && *stopflag)657 goto Abort;658 pByte = (PBYTE)paffbFound;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 pffbFile = (PFILEFINDBUF4)pByte;662 if (!*pffbFile->achName ||663 (!filestoo && !(pffbFile->attrFile & FILE_DIRECTORY)) ||664 (((pffbFile->attrFile & FILE_DIRECTORY) &&665 pffbFile->achName[0] == '.') &&666 (!pffbFile->achName[1] || (pffbFile->achName[1] == '.' &&667 !pffbFile->achName[2]))))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 else672 papffbSelected[x++] = pffbFile; 673 if (!pffbFile->oNextEntryOffset)774 else 775 papffbSelected[x++] = pffbFile; // Count file 776 if (!pffbFile->oNextEntryOffset) 674 777 { 675 ulFileCnt = x; 676 break;677 }678 pByte += pffbFile->oNextEntryOffset;679 }680 if (ulFileCnt)778 ulFileCnt = x; // Adjust count 779 break; 780 } 781 pByte += pffbFile->oNextEntryOffset; 782 } 783 if (ulFileCnt) 681 784 { 682 if (stopflag && *stopflag)683 goto Abort;684 if (fSyncUpdates)785 if (stopflag && *stopflag) 786 goto Abort; 787 if (fSyncUpdates) 685 788 { 686 pciFirst = WinSendMsg(hwndCnr, CM_ALLOCRECORD,687 MPFROMLONG(ulExtraBytes),688 MPFROMLONG(ulFileCnt));689 if (pciFirst)789 pciFirst = WinSendMsg(hwndCnr, CM_ALLOCRECORD, 790 MPFROMLONG(ulExtraBytes), 791 MPFROMLONG(ulFileCnt)); 792 if (pciFirst) 690 793 { 691 register INT i;692 693 pci = pciFirst;694 ullTotalBytes = 0;695 for(i = 0; i < ulFileCnt; i++) {696 pffbFile = papffbSelected[i];697 ullBytes = FillInRecordFromFFB(hwndCnr,pci,pszFileSpec,698 pffbFile,partial,dcd);699 pci = (PCNRITEM)pci->rc.preccNextRecord;700 ullTotalBytes += ullBytes;701 }702 if (ulFileCnt)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 memset(&ri,0,sizeof(RECORDINSERT));705 ri.cb = sizeof(RECORDINSERT);706 ri.pRecordOrder = (PRECORDCORE) CMA_END;707 ri.pRecordParent = (PRECORDCORE) pciParent;708 ri.zOrder = (ULONG) CMA_TOP;709 ri.cRecordsInsert = ulFileCnt;710 ri.fInvalidateRecord = (!fSyncUpdates && dcd &&711 dcd->type == DIR_FRAME) ?712 FALSE : TRUE;713 if (!WinSendMsg(hwndCnr,714 CM_INSERTRECORD,715 MPFROMP(pciFirst),716 MPFROMP(&ri)))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 DosSleep(100);719 WinSetFocus(HWND_DESKTOP,hwndCnr);720 if (!WinSendMsg(hwndCnr,721 CM_INSERTRECORD,722 MPFROMP(pciFirst),723 MPFROMP(&ri)))821 DosSleep(100); 822 WinSetFocus(HWND_DESKTOP,hwndCnr); 823 if (!WinSendMsg(hwndCnr, 824 CM_INSERTRECORD, 825 MPFROMP(pciFirst), 826 MPFROMP(&ri))) 724 827 { 725 Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__,726 GetPString(IDS_FILLDIRERR2TEXT));727 ok = FALSE;728 ullTotalBytes = 0;729 if (WinIsWindow((HAB)0,hwndCnr))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 pci = pciFirst;732 while (pci)834 pci = pciFirst; 835 while (pci) 733 836 { 734 pcit = (PCNRITEM)pci->rc.preccNextRecord;735 WinSendMsg(hwndCnr,736 CM_FREERECORD,737 MPFROMP(&pci),738 MPFROMSHORT(1));739 pci = pcit;740 }741 }742 }743 }744 }745 }746 else837 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 Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__,749 GetPString(IDS_FILLDIRERR3TEXT));750 ok = FALSE;751 ullTotalBytes = 0;752 }753 if (ok)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 ullReturnBytes += ullTotalBytes;756 ulReturnFiles += ulFileCnt;757 }758 }759 else858 ullReturnBytes += ullTotalBytes; 859 ulReturnFiles += ulFileCnt; 860 } 861 } 862 else 760 863 { 761 paffbTemp = realloc(paffbTotal,sizeof(FILEFINDBUF4) *762 (ulFileCnt + ulTotal));763 if (paffbTemp)864 paffbTemp = realloc(paffbTotal,sizeof(FILEFINDBUF4) * 865 (ulFileCnt + ulTotal)); 866 if (paffbTemp) 764 867 { 765 paffbTotal = paffbTemp;766 for(x = 0;x < ulFileCnt;x++)767 paffbTotal[x + ulTotal] = *papffbSelected[x];768 ulTotal += ulFileCnt;769 }770 else868 paffbTotal = paffbTemp; 869 for(x = 0;x < ulFileCnt;x++) 870 paffbTotal[x + ulTotal] = *papffbSelected[x]; 871 ulTotal += ulFileCnt; 872 } 873 else 771 874 { 772 saymsg(MB_ENTER,773 HWND_DESKTOP,774 GetPString(IDS_ERRORTEXT),775 GetPString(IDS_OUTOFMEMORY));776 break;777 }778 }779 }780 if (stopflag && *stopflag)781 goto Abort;782 ulFileCnt = ulM;783 DosError(FERR_DISABLEHARDERR);784 rc = DosFindNext(hdir, paffbFound, ulM * sizeof(FILEFINDBUF4),785 &ulFileCnt);786 priority_normal();787 if (rc)788 DosError(FERR_DISABLEHARDERR);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 if (paffbFound)794 free(paffbFound);795 if (papffbSelected)796 free(papffbSelected);797 papffbSelected = NULL;798 paffbFound = NULL;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 if (stopflag && *stopflag)805 goto Abort;806 807 pciFirst = WinSendMsg(hwndCnr, CM_ALLOCRECORD,808 MPFROMLONG(ulExtraBytes),809 MPFROMLONG(ulTotal));810 if (pciFirst)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 register INT i;813 814 pci = pciFirst;815 ullTotalBytes = 0;816 pByte2 = (PBYTE)paffbTotal;817 for(i = 0; i < ulTotal; i++)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 pffbFile = (PFILEFINDBUF4)pByte2;820 ullBytes = FillInRecordFromFFB(hwndCnr,pci,pszFileSpec,821 pffbFile,partial,dcd);822 pci = (PCNRITEM)pci->rc.preccNextRecord;823 ullTotalBytes += ullBytes;824 825 pByte2 += sizeof(FILEFINDBUF4);826 }827 if (ulTotal)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 memset(&ri,0,sizeof(RECORDINSERT));830 ri.cb = sizeof(RECORDINSERT);831 ri.pRecordOrder = (PRECORDCORE) CMA_END;832 ri.pRecordParent = (PRECORDCORE) pciParent;833 ri.zOrder = (ULONG) CMA_TOP;834 ri.cRecordsInsert = ulTotal;835 ri.fInvalidateRecord = (!fSyncUpdates && dcd &&836 dcd->type == DIR_FRAME) ?837 FALSE : TRUE;838 if (!WinSendMsg(hwndCnr,CM_INSERTRECORD,839 MPFROMP(pciFirst),MPFROMP(&ri)))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 DosSleep(100);842 WinSetFocus(HWND_DESKTOP,hwndCnr);843 if (!WinSendMsg(hwndCnr,CM_INSERTRECORD,844 MPFROMP(pciFirst),MPFROMP(&ri)))845 {846 Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__,847 GetPString(IDS_FILLDIRERR5TEXT));848 ok = FALSE;849 ullTotalBytes = 0;850 if (WinIsWindow((HAB)0,hwndCnr))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 pci = pciFirst;853 while (pci)955 pci = pciFirst; 956 while (pci) 854 957 { 855 pcit = (PCNRITEM)pci->rc.preccNextRecord;856 WinSendMsg(hwndCnr,CM_FREERECORD,857 MPFROMP(&pci),MPFROMSHORT(1));858 pci = pcit;859 }860 }861 }862 }863 }864 }865 else958 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 Win_Error(hwndCnr,HWND_DESKTOP,__FILE__,__LINE__,868 GetPString(IDS_FILLDIRERR3TEXT));869 ok = FALSE;870 ullTotalBytes = 0;871 }872 if (ok)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 ullReturnBytes += ullTotalBytes;875 ulReturnFiles += ulFileCnt;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 MPFROM2SHORT(0,CMA_ERASE));985 MPFROM2SHORT(0,CMA_ERASE)); 883 986 } 884 987 Abort: … … 897 1000 { 898 1001 pci = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pciParent), 899 MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));1002 MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER)); 900 1003 while (pci && (INT)pci != -1) 901 1004 { 902 1005 if (pci->attrFile & FILE_DIRECTORY) 903 Stubby(hwndCnr,pci);1006 Stubby(hwndCnr,pci); 904 1007 pci = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci), 905 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));1008 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 906 1009 } 907 1010 } … … 917 1020 918 1021 VOID FillDirCnr(HWND hwndCnr, 919 CHAR *pszDirectory,920 DIRCNRDATA *dcd,921 PULONGLONG pullTotalBytes)1022 CHAR *pszDirectory, 1023 DIRCNRDATA *dcd, 1024 PULONGLONG pullTotalBytes) 922 1025 { 923 1026 ProcessDirectory(hwndCnr, 924 (PCNRITEM)NULL,1027 (PCNRITEM)NULL, 925 1028 pszDirectory, 926 1029 TRUE, 927 1030 FALSE, 928 1031 TRUE, 929 dcd ? &dcd->stopflag : NULL,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 DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS |954 DRIVE_INCLUDEFILES | DRIVE_SLOW);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 QSV_BOOT_DRIVE,962 (PVOID)&startdrive,963 (ULONG)sizeof(ULONG)) &&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 &ulDriveMap);1072 &ulDriveMap); 970 1073 if (rc) 971 1074 { 972 1075 Dos_Error(MB_CANCEL, 973 rc,974 HWND_DESKTOP,975 __FILE__,976 __LINE__,977 GetPString(IDS_FILLDIRERR6TEXT));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 CM_ALLOCRECORD,986 MPFROMLONG(EXTRA_RECORD_BYTES2),987 MPFROMLONG((ULONG)numtoinsert));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 *szDrive = (CHAR)x + 'A';995 996 {997 CHAR s[80];998 ULONG flags = 0;1097 *szDrive = (CHAR)x + 'A'; 1098 1099 { 1100 CHAR s[80]; 1101 ULONG flags = 0; 999 1102 ULONG size = sizeof(ULONG); 1000 1103 1001 sprintf(s,"%c.DriveFlags",toupper(*szDrive));1002 if (PrfQueryProfileData(fmprof,appname,s,&flags,&size) &&1003 size == sizeof(ULONG))1104 sprintf(s,"%c.DriveFlags",toupper(*szDrive)); 1105 if (PrfQueryProfileData(fmprof,appname,s,&flags,&size) && 1106 size == sizeof(ULONG)) 1004 1107 { 1005 driveflags[toupper(*szDrive) - 'A'] |= flags;1108 driveflags[toupper(*szDrive) - 'A'] |= flags; 1006 1109 } 1007 }1008 1009 if (x > 1)1110 } 1111 1112 if (x > 1) 1010 1113 { 1011 if (!(driveflags[x] & DRIVE_NOPRESCAN))1114 if (!(driveflags[x] & DRIVE_NOPRESCAN)) 1012 1115 { 1013 *FileSystem = 0;1014 drvtype = 0;1015 removable = CheckDrive(*szDrive,FileSystem,&drvtype);1016 driveserial[x] = -1;1017 if (removable != -1)1116 *FileSystem = 0; 1117 drvtype = 0; 1118 removable = CheckDrive(*szDrive,FileSystem,&drvtype); 1119 driveserial[x] = -1; 1120 if (removable != -1) 1018 1121 { 1019 struct {1020 ULONG serial;1021 CHAR volumelength;1022 CHAR volumelabel[CCHMAXPATH];1023 } volser;1024 1025 DosError(FERR_DISABLEHARDERR);1026 if (!DosQueryFSInfo((ULONG)x,1027 FSIL_VOLSER,1028 &volser,1029 sizeof(volser)))1030 {1031 driveserial[x] = volser.serial;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 else1035 driveflags[x] |= DRIVE_INVALID;1036 memset(&fsa4,0,sizeof(FILESTATUS4));1037 driveflags[x] |= ((removable == -1 || removable == 1) ?1038 DRIVE_REMOVABLE : 0);1039 if (drvtype & DRIVE_REMOTE)1040 driveflags[x] |= DRIVE_REMOTE;1041 if (strcmp(FileSystem,HPFS) &&1042 strcmp(FileSystem,JFS) &&1043 strcmp(FileSystem,CDFS) &&1044 strcmp(FileSystem,FAT32) &&1045 strcmp(FileSystem,HPFS386))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 driveflags[x] |= DRIVE_NOLONGNAMES;1150 driveflags[x] |= DRIVE_NOLONGNAMES; 1048 1151 } 1049 if (!strcmp(FileSystem,CDFS))1152 if (!strcmp(FileSystem,CDFS)) 1050 1153 { 1051 removable = 1;1052 driveflags[x] |= DRIVE_REMOVABLE | DRIVE_NOTWRITEABLE |1053 DRIVE_CDROM;1054 }1055 else if (!stricmp(FileSystem,CBSIFS))1154 removable = 1; 1155 driveflags[x] |= DRIVE_REMOVABLE | DRIVE_NOTWRITEABLE | 1156 DRIVE_CDROM; 1157 } 1158 else if (!stricmp(FileSystem,CBSIFS)) 1056 1159 { 1057 driveflags[x] |= DRIVE_ZIPSTREAM;1058 driveflags[x] &= ~DRIVE_REMOTE;1059 if (drvtype & DRIVE_REMOVABLE)1060 driveflags[x] |= DRIVE_REMOVABLE;1061 if (!(drvtype & DRIVE_NOLONGNAMES))1062 driveflags[x] &= ~DRIVE_NOLONGNAMES;1063 }1064 1065 pci->rc.flRecordAttr |= CRA_RECORDREADONLY;1066 if ((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum)1067 pci->rc.flRecordAttr |= (CRA_CURSORED | CRA_SELECTED);1068 1069 if (removable == 0)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 pci->attrFile |= FILE_DIRECTORY;1072 DosError(FERR_DISABLEHARDERR);1073 rc = DosQueryPathInfo(szDrive,1074 FIL_QUERYEASIZE,1075 &fsa4,1076 (ULONG)sizeof(FILESTATUS4));1077 if (rc == 58)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 DosError(FERR_DISABLEHARDERR);1080 rc = DosQueryPathInfo(szDrive,1081 FIL_STANDARD,1082 &fsa4,1083 (ULONG)sizeof(FILESTATUS3));1084 fsa4.cbList = 0;1085 }1086 if (rc && !didonce)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 if (!*suggest)1191 if (!*suggest) 1089 1192 { 1090 *suggest = '/';1091 suggest[1] = 0;1092 }1093 sprintf(suggest + strlen(suggest),1094 "%c",1095 toupper(*szDrive));1096 strcpy(pci->szFileName,szDrive);1097 pci->pszFileName = pci->szFileName;1098 pci->rc.pszIcon = pci->pszFileName;1099 pci->attrFile = FILE_DIRECTORY;1100 strcpy(pci->szDispAttr,"----D-");1101 pci->pszDispAttr = pci->szDispAttr;1102 driveserial[x] = -1;1103 }1104 else1105 FillInRecordFromFSA(hwndCnr,1106 pci,1107 szDrive,1108 &fsa4,1109 TRUE,1110 NULL);1111 }1112 else1193 *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 strcpy(pci->szFileName,szDrive);1115 pci->pszFileName = pci->szFileName;1116 pci->rc.pszIcon = pci->pszFileName;1117 pci->attrFile = FILE_DIRECTORY;1118 strcpy(pci->szDispAttr,"----D-");1119 pci->pszDispAttr = pci->szDispAttr;1120 }1121 *pci->szFileName = toupper(*pci->szFileName);1122 if (driveflags[x] & DRIVE_CDROM)1123 pci->rc.hptrIcon = hptrCDROM;1124 else1125 pci->rc.hptrIcon = (driveflags[x] & DRIVE_REMOVABLE) ?1126 hptrRemovable :1127 (driveflags[x] & DRIVE_REMOTE) ?1128 hptrRemote :1129 (driveflags[x] & DRIVE_ZIPSTREAM) ?1130 hptrZipstrm : hptrDrive;1131 }1132 else1217 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 pci->rc.hptrIcon = hptrDunno;1135 strcpy(pci->szFileName,szDrive);1136 pci->pszFileName = pci->szFileName;1137 pci->rc.pszIcon = pci->pszFileName;1138 pci->attrFile = FILE_DIRECTORY;1139 strcpy(pci->szDispAttr,"----D-");1140 pci->pszDispAttr = pci->szDispAttr;1141 driveserial[x] = -1;1142 }1143 }1144 else1237 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 pci->rc.hptrIcon = hptrFloppy;1147 strcpy(pci->szFileName,szDrive);1148 pci->pszFileName = pci->szFileName;1149 pci->rc.pszIcon = pci->pszFileName;1150 pci->attrFile = FILE_DIRECTORY;1151 strcpy(pci->szDispAttr,"----D-");1152 pci->pszDispAttr = pci->szDispAttr;1153 driveflags[x] |= (DRIVE_REMOVABLE | DRIVE_NOLONGNAMES);1154 driveserial[x] = -1;1155 }1156 pci->rc.flRecordAttr |= CRA_RECORDREADONLY;1157 pci = (PCNRITEM)pci->rc.preccNextRecord; /* next rec */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 driveflags[x] |= DRIVE_INVALID;1263 driveflags[x] |= DRIVE_INVALID; 1161 1264 } 1162 1265 PostMsg(hwndMain, 1163 UM_BUILDDRIVES,1164 MPVOID,1165 MPVOID);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 CM_INSERTRECORD,1181 MPFROMP(pciFirst),1182 MPFROMP(&ri)))1183 Win_Error(hwndCnr,hwndCnr,__FILE__,__LINE__,1184 GetPString(IDS_FILLDIRERR5TEXT));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 CM_QUERYRECORD,1191 MPVOID,1192 MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER));1293 CM_QUERYRECORD, 1294 MPVOID, 1295 MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER)); 1193 1296 while(pci && (INT)pci != -1) 1194 1297 { 1195 if ((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum)1298 if ((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum) 1196 1299 { 1197 WinSendMsg(hwndCnr,1198 CM_SETRECORDEMPHASIS,1199 MPFROMP(pci),1200 MPFROM2SHORT(TRUE,CRA_CURSORED));1201 break;1202 }1203 pci = (PCNRITEM)WinSendMsg(hwndCnr,1204 CM_QUERYRECORD,1205 MPFROMP(pci),1206 MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER));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 MAIN_DRIVELIST),1213 LM_DELETEALL,1214 MPVOID,1215 MPVOID);1315 MAIN_DRIVELIST), 1316 LM_DELETEALL, 1317 MPVOID, 1318 MPVOID); 1216 1319 1217 1320 if (fShowEnv) … … 1220 1323 1221 1324 pciParent = WinSendMsg(hwndCnr, 1222 CM_ALLOCRECORD,1223 MPFROMLONG(EXTRA_RECORD_BYTES2),1224 MPFROMLONG(1));1325 CM_ALLOCRECORD, 1326 MPFROMLONG(EXTRA_RECORD_BYTES2), 1327 MPFROMLONG(1)); 1225 1328 if (pciParent) 1226 1329 { 1227 pciParent->flags |= RECFLAGS_ENV;1228 strcpy(pciParent->szFileName,GetPString(IDS_ENVVARSTEXT));1229 pciParent->pszFileName = pciParent->szFileName;1230 pciParent->rc.hptrIcon = hptrEnv;1231 pciParent->rc.pszIcon = pciParent->pszFileName;1232 strcpy(pciParent->szDispAttr,"------");1233 pciParent->pszDispAttr = pciParent->szDispAttr;1234 memset(&ri,0,sizeof(RECORDINSERT));1235 ri.cb = sizeof(RECORDINSERT);1236 ri.pRecordOrder = (PRECORDCORE)CMA_END;1237 ri.pRecordParent = (PRECORDCORE)NULL;1238 ri.zOrder = (ULONG)CMA_TOP;1239 ri.cRecordsInsert = 1;1240 ri.fInvalidateRecord = FALSE;1241 if (WinSendMsg(hwndCnr,1242 CM_INSERTRECORD,1243 MPFROMP(pciParent),1244 MPFROMP(&ri))) {1245 1246 char *p,*pp;1247 1248 p = GetPString(IDS_ENVVARNAMES);1249 while(*p == ' ')1250 p++;1251 while (*p)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 *FileSystem = 0;1254 pp = FileSystem;1255 while(*p && *p != ' ')1256 *pp++ = *p++;1257 *pp = 0;1258 while(*p == ' ')1259 p++;1260 if (*FileSystem &&1261 (!stricmp(FileSystem,"LIBPATH") ||1262 getenv(FileSystem)))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 pci = WinSendMsg(hwndCnr,1265 CM_ALLOCRECORD,1266 MPFROMLONG(EXTRA_RECORD_BYTES2),1267 MPFROMLONG(1));1268 if (pci)1367 pci = WinSendMsg(hwndCnr, 1368 CM_ALLOCRECORD, 1369 MPFROMLONG(EXTRA_RECORD_BYTES2), 1370 MPFROMLONG(1)); 1371 if (pci) 1269 1372 { 1270 pci->flags |= RECFLAGS_ENV;1271 sprintf(pci->szFileName,1272 "%%%s%%",1273 FileSystem);1274 pci->pszFileName = pci->szFileName;1275 pci->rc.hptrIcon = hptrEnv;1276 pci->rc.pszIcon = pci->pszFileName;1277 strcpy(pci->szDispAttr,"------");1278 pci->pszDispAttr = pci->szDispAttr;1279 memset(&ri,0,sizeof(RECORDINSERT));1280 ri.cb = sizeof(RECORDINSERT);1281 ri.pRecordOrder = (PRECORDCORE)CMA_END;1282 ri.pRecordParent = (PRECORDCORE)pciParent;1283 ri.zOrder = (ULONG)CMA_TOP;1284 ri.cRecordsInsert = 1;1285 ri.fInvalidateRecord = FALSE;1286 if (!WinSendMsg(hwndCnr,1287 CM_INSERTRECORD,1288 MPFROMP(pci),1289 MPFROMP(&ri))) {1290 Win_Error(hwndCnr,hwndCnr,__FILE__,__LINE__,1291 GetPString(IDS_FILLDIRERR5TEXT));1292 WinSendMsg(hwndCnr,1293 CM_FREERECORD,1294 MPFROMP(&pci),1295 MPFROMSHORT(1));1296 }1297 }1298 }1299 }1300 WinSendMsg(hwndCnr,1301 CM_INVALIDATERECORD,1302 MPFROMP(&pciParent),1303 MPFROM2SHORT(1,CMA_ERASE | CMA_REPOSITION));1304 }1305 else1306 WinSendMsg(hwndCnr,1307 CM_FREERECORD,1308 MPFROMP(&pciParent),1309 MPFROMSHORT(1));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 CM_QUERYRECORD,1316 MPVOID,1317 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));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 CM_QUERYRECORD,1322 MPFROMP(pci),1323 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));1424 CM_QUERYRECORD, 1425 MPFROMP(pci), 1426 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 1324 1427 if (!(pci->flags & RECFLAGS_ENV)) 1325 1428 { 1326 if ((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum ||1327 toupper(*pci->szFileName) > 'B')1429 if ((ULONG)(toupper(*pci->szFileName) - '@') == ulDriveNum || 1430 toupper(*pci->szFileName) > 'B') 1328 1431 { 1329 if (!(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_INVALID) &&1330 !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_NOPRESCAN) &&1331 (!fNoRemovableScan ||1332 !(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE)))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 if (!Stubby(hwndCnr,pci))1437 if (!Stubby(hwndCnr,pci)) 1335 1438 { 1336 WinSendMsg(hwndCnr,1337 CM_INVALIDATERECORD,1338 MPFROMP(&pci),1339 MPFROM2SHORT(1,CMA_ERASE | CMA_REPOSITION));1340 goto SkipBadRec;1341 }1342 }1343 }1344 else1345 WinSendMsg(hwndCnr,1346 CM_INVALIDATERECORD,1347 MPFROMP(&pci),1348 MPFROM2SHORT(1,CMA_ERASE | CMA_REPOSITION));1349 1350 WinSendMsg(WinWindowFromID(WinQueryWindow(hwndParent,QW_PARENT),1351 MAIN_DRIVELIST),1352 LM_INSERTITEM,1353 MPFROM2SHORT(LIT_SORTASCENDING,0),1354 MPFROMP(pci->szFileName));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 MAIN_DRIVELIST),LM_SELECTITEM,MPFROM2SHORT(0,0),1363 MPFROMLONG(TRUE));1465 MAIN_DRIVELIST),LM_SELECTITEM,MPFROM2SHORT(0,0), 1466 MPFROMLONG(TRUE)); 1364 1467 1365 1468 pci = (PCNRITEM)WinSendMsg(hwndCnr, 1366 CM_QUERYRECORD,1367 MPVOID,1368 MPFROM2SHORT(CMA_FIRST,1369 CMA_ITEMORDER));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 CM_QUERYRECORD,1374 MPFROMP(pci),1375 MPFROM2SHORT(CMA_NEXT,1376 CMA_ITEMORDER));1476 CM_QUERYRECORD, 1477 MPFROMP(pci), 1478 MPFROM2SHORT(CMA_NEXT, 1479 CMA_ITEMORDER)); 1377 1480 if (pci->flags & RECFLAGS_ENV) 1378 1481 { 1379 pci = (PCNRITEM)WinSendMsg(hwndCnr,1380 CM_QUERYRECORD,1381 MPFROMP(pci),1382 MPFROM2SHORT(CMA_FIRSTCHILD,1383 CMA_ITEMORDER));1384 while (pci && (INT)pci != -1)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 if (pci->flags & RECFLAGS_ENV)1387 FleshEnv(hwndCnr,pci);1388 pci = (PCNRITEM)WinSendMsg(hwndCnr,1389 CM_QUERYRECORD,1390 MPFROMP(pci),1391 MPFROM2SHORT(CMA_NEXT,1392 CMA_ITEMORDER));1393 }1394 break;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 CM_QUERYRECORD,1398 MPFROMP(pci),1399 MPFROM2SHORT(CMA_NEXT,1400 CMA_ITEMORDER));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 GetPString(IDS_FILLDIRERR7TEXT));1510 GetPString(IDS_FILLDIRERR7TEXT)); 1408 1511 exit(0); 1409 1512 } 1410 1513 if (!drivesbuilt && hwndMain) 1411 1514 PostMsg(hwndMain, 1412 UM_BUILDDRIVES,1413 MPVOID,1414 MPVOID);1515 UM_BUILDDRIVES, 1516 MPVOID, 1517 MPVOID); 1415 1518 DosSleep(33L); 1416 1519 fDummy = FALSE; … … 1421 1524 1422 1525 if (*suggest || 1423 (!(driveflags[1] & DRIVE_IGNORE) &&1424 fFirstTime))1526 (!(driveflags[1] & DRIVE_IGNORE) && 1527 fFirstTime)) 1425 1528 { 1426 1529 if (!DosDevConfig(&info, 1427 DEVINFO_FLOPPY) &&1428 info == 1)1530 DEVINFO_FLOPPY) && 1531 info == 1) 1429 1532 { 1430 if (!*suggest)1533 if (!*suggest) 1431 1534 { 1432 *suggest = '/';1433 suggest[1] = 0;1434 }1435 else1436 memmove(suggest + 2,suggest + 1,strlen(suggest));1437 suggest[1] = 'B';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 if (driveflags[x] & DRIVE_IGNORE)1547 if (driveflags[x] & DRIVE_IGNORE) 1445 1548 { 1446 includesyours = TRUE;1447 sprintf(suggest + strlen(suggest),1448 "%c",1449 (char)(x + 'A'));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 (hwndParent) ? hwndParent : hwndCnr,1455 GetPString(IDS_SUGGESTTITLETEXT),1456 GetPString(IDS_SUGGEST1TEXT),1457 (includesyours) ? GetPString(IDS_SUGGEST2TEXT) : NullStr,1458 suggest) == MBID_YES)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 char s[64];1461 1462 sprintf(s, "PARAMETERS=%s", suggest);1463 WinCreateObject(WPProgram,1464 "FM/2",1465 s,1466 FM3Folder,1467 CO_UPDATEIFEXISTS);1468 WinCreateObject(WPProgram,1469 "FM/2 Lite",1470 s,1471 FM3Folder,1472 CO_UPDATEIFEXISTS);1473 WinCreateObject(WPProgram,1474 "Archive Viewer/2",1475 s,1476 FM3Tools,1477 CO_UPDATEIFEXISTS);1478 WinCreateObject(WPProgram,1479 "Dir Sizes",1480 s,1481 FM3Tools,1482 CO_UPDATEIFEXISTS);1483 WinCreateObject(WPProgram,1484 "Visual Tree",1485 s,1486 FM3Tools,1487 CO_UPDATEIFEXISTS);1488 WinCreateObject(WPProgram,1489 "Visual Directory",1490 s,1491 FM3Tools,1492 CO_UPDATEIFEXISTS);1493 WinCreateObject(WPProgram,1494 "Global File Viewer",1495 s,1496 FM3Tools,1497 CO_UPDATEIFEXISTS);1498 WinCreateObject(WPProgram,1499 "Databar",1500 s,1501 FM3Tools,1502 CO_UPDATEIFEXISTS);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.
