Changeset 1163
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/assoc.c
r1119 r1163 38 38 #include "errutil.h" // Dos_Error... 39 39 #include "strutil.h" // GetPString 40 #include "assoc.h" 40 41 #include "fm3dll.h" 41 42 #include "fortify.h" … … 69 70 70 71 static PSZ pszSrcFile = __FILE__; 72 73 static VOID load_associations(VOID); 74 static VOID save_associations(VOID); 71 75 72 76 MRESULT EXPENTRY AssocTextProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) -
trunk/dll/copyf.c
r1082 r1163 12 12 14 Oct 02 SHL Drop obsolete debug code 13 13 10 Nov 02 SHL docopyf - don't forget to terminate longname 14 14 optimize longname logic 15 15 01 Aug 04 SHL Rework lstrip/rstrip usage 16 16 28 May 05 SHL Drop debug code … … 34 34 35 35 #include "fm3str.h" 36 #include "errutil.h" // Dos_Error... 37 #include "strutil.h" // GetPString 36 #include "errutil.h" // Dos_Error... 37 #include "strutil.h" // GetPString 38 #include "copyf.h" 39 #include "literal.h" // fixup 38 40 #include "fm3dll.h" 39 41 #include "fortify.h" … … 41 43 static PSZ pszSrcFile = __FILE__; 42 44 45 //static CHAR default_disk(VOID); 46 //static INT unlink_allf(CHAR * string, ...); 47 43 48 #ifndef WinMoveObject 44 49 HOBJECT APIENTRY WinMoveObject(HOBJECT hObjectofObject, 45 50 HOBJECT hObjectofDest, ULONG ulReserved); 46 51 #endif 47 52 #ifndef WinCopyObject 48 53 HOBJECT APIENTRY WinCopyObject(HOBJECT hObjectofObject, 49 54 HOBJECT hObjectofDest, ULONG ulReserved); 50 55 #endif 51 56 … … 90 95 (*p)++; 91 96 while (strchr("*?<>\":/\\|+=;,[]. ", *p)) 92 97 (*p)++; 93 98 *p = toupper(*p); 94 99 } … … 96 101 p--; 97 102 if (p >= o && *p == '.') 98 103 p--; 99 104 goto Loop; 100 105 } … … 126 131 f = oldname + (f - buffer); 127 132 strupr(buffer); 128 while (*f == '.') 133 while (*f == '.') /* skip leading '.'s */ 129 134 f++; 130 135 s = f; 131 while (*f && *f != '.' && f < s + 8) { 136 while (*f && *f != '.' && f < s + 8) { /* skip past rootname */ 132 137 *p = toupper(*f); 133 138 p++; … … 184 189 (*p)++; 185 190 while (strchr("*?<>\":/\\|+=;,[]. ", *p)) 186 191 (*p)++; 187 192 *p = toupper(*p); 188 193 } … … 190 195 p--; 191 196 if (p >= o && *p == '.') 192 197 p--; 193 198 goto Loop; 194 199 } … … 218 223 while (*value) { 219 224 if (*value == '/') 220 225 *value = '\\'; 221 226 value++; 222 227 } … … 235 240 pfealist = xmallocz(1536, pszSrcFile, __LINE__); 236 241 if (pfealist) { 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 242 pfealist->cbList = 1024; 243 eaop.fpGEA2List = pgealist; 244 eaop.fpFEA2List = pfealist; 245 eaop.oError = 0L; 246 DosError(FERR_DISABLEHARDERR); 247 rc = DosQueryPathInfo(oldname, 248 FIL_QUERYEASFROMLIST, 249 (PVOID) & eaop, (ULONG) sizeof(EAOP2)); 250 if (!rc) { 251 pfea = &eaop.fpFEA2List->list[0]; 252 value = pfea->szName + pfea->cbName + 1; 253 value[pfea->cbValue] = 0; 254 if (*(USHORT *) value == EAT_ASCII) 255 strncat(longname, 256 value + (sizeof(USHORT) * 2), 257 CCHMAXPATH - strlen(longname)); 258 longname[CCHMAXPATH - 1] = 0; 259 } 260 free(pfealist); 256 261 } 257 262 free(pgealist); … … 290 295 ealen = sizeof(FEALIST) + 10; 291 296 rc = DosAllocMem((PPVOID) & pfealist, 292 297 ealen + 32L, OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE); 293 298 if (rc) 294 299 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 295 300 GetPString(IDS_OUTOFMEMORY)); 296 301 else { 297 302 memset(pfealist, 0, ealen + 1); … … 317 322 DosError(FERR_DISABLEHARDERR); 318 323 rc = xDosSetPathInfo(filename, FIL_QUERYEASIZE, 319 324 &eaop, sizeof(eaop), DSPI_WRTTHRU); 320 325 DosFreeMem(pfealist); 321 326 if (rc) … … 341 346 p = strrchr(oldname, '\\'); 342 347 if (p && *(p + 1)) { 343 344 345 346 347 348 349 350 348 strcpy(srce, p + 1); 349 DosError(FERR_DISABLEHARDERR); 350 if (!DosEditName(1L, srce, dest, result, (ULONG) sizeof(result))) { 351 p = strrchr(newname, '\\'); 352 p++; 353 strcpy(p, result); 354 ret = TRUE; 355 } 351 356 } 352 357 } … … 355 360 } 356 361 362 #if 0 // JBS 357 363 CHAR default_disk(VOID) 358 364 { … … 363 369 return (CHAR) toupper((INT) ulDriveNum) + '@'; 364 370 } 371 #endif 365 372 366 373 #ifdef NEVER … … 385 392 386 393 if (fb.attrFile & FILE_DIRECTORY) { 387 388 389 390 391 392 393 394 395 396 rc = docopyallf(type,, "%s",);/* recurse */394 DosError(FERR_ENABLEHARDERR); 395 rc = DosCreateDir(); 396 if (rc == ERROR_INVALID_NAME || rc == ERROR_FILENAME_EXCED_RANGE) { 397 398 /* truncate directory name */ 399 /* create that directory */ 400 /* update containers for name used */ 401 402 } 403 rc = docopyallf(type,, "%s",); /* recurse */ 397 404 } 398 405 else 399 rc = docopyf(type,, "%s",);/* copy file */406 rc = docopyf(type,, "%s",); /* copy file */ 400 407 DosError(FERR_DISABLEHARDERR); 401 408 } while (!rc && !DosFindNext()); … … 434 441 va_end(ap); 435 442 436 if (!oldname || !*oldname || !*fullnewname) 443 if (!oldname || !*oldname || !*fullnewname) /* bad string args */ 437 444 return (APIRET) - 1; 438 445 439 446 DosError(FERR_DISABLEHARDERR); 440 447 if (DosQueryPathInfo(oldname, FIL_STANDARDL, &st, sizeof(FILESTATUS3L))) 441 return (APIRET) - 2; 448 return (APIRET) - 2; /* no source */ 442 449 443 450 AdjustWildcardName(oldname, fullnewname); 444 451 MakeFullName(oldname); 445 452 MakeFullName(fullnewname); 446 olddisk = toupper(*oldname); 447 newdisk = toupper(*fullnewname); 453 olddisk = toupper(*oldname); /* source drive */ 454 newdisk = toupper(*fullnewname); /* destination drive */ 448 455 if (!(driveflags[toupper(*oldname) - 'A'] & DRIVE_NOLONGNAMES)) 449 456 *longname = 0; … … 453 460 p = RootName(longname); 454 461 if (p != longname) 455 462 memmove(longname, p, strlen(p) + 1); 456 463 } 457 464 } … … 473 480 hobjsrc = WinQueryObject(oldname); 474 481 if (hobjsrc) { 475 476 477 478 479 480 481 482 483 484 485 486 487 482 strcpy(dir, fullnewname); 483 p = strrchr(dir, '\\'); 484 if (p < dir + 3) 485 p++; 486 *p = 0; 487 ret = ERROR_PATH_NOT_FOUND; 488 hobjdest = WinQueryObject(dir); 489 if (hobjdest) { 490 ret = ERROR_GEN_FAILURE; 491 hobjsrc = WinMoveObject(hobjsrc, hobjdest, 0); 492 if (hobjsrc) 493 ret = 0; 494 } 488 495 } 489 496 } … … 498 505 hobjsrc = WinQueryObject(oldname); 499 506 if (hobjsrc) { 500 501 502 503 504 505 506 507 508 509 510 511 512 507 strcpy(dir, fullnewname); 508 p = strrchr(dir, '\\'); 509 if (p < dir + 3) 510 p++; 511 *p = 0; 512 ret = ERROR_PATH_NOT_FOUND; 513 hobjdest = WinQueryObject(dir); 514 if (hobjdest) { 515 ret = ERROR_GEN_FAILURE; 516 hobjsrc = WinCopyObject(hobjsrc, hobjdest, 0); 517 if (hobjsrc) 518 ret = 0; 519 } 513 520 } 514 521 } … … 517 524 case MOVE: 518 525 *dir = 0; 519 if (olddisk == newdisk) { 526 if (olddisk == newdisk) { /* same drive */ 520 527 /* make temporary copy in case move fails */ 521 528 if (IsFile(fullnewname) != -1 && stricmp(oldname, fullnewname)) { 522 523 524 525 526 527 528 529 529 strcpy(dir, fullnewname); 530 p = strrchr(dir, '\\'); 531 if (p) 532 *p = 0; 533 strcat(dir, "\\"); 534 MakeTempName(dir, NULL, 0); 535 if (DosMove(fullnewname, dir)) 536 *dir = 0; 530 537 } 531 538 DosError(FERR_DISABLEHARDERR); 532 ret = DosMove(oldname, fullnewname); 533 if (ret && *dir) { 534 535 536 539 ret = DosMove(oldname, fullnewname); /* move it */ 540 if (ret && *dir) { /* failed -- clean up */ 541 DosError(FERR_DISABLEHARDERR); 542 if (!DosMove(dir, fullnewname)) 543 Broadcast((HAB) 0, hwndMain, UM_UPDATERECORD, MPFROMP(dir), MPVOID); 537 544 } 538 545 else if (!ret && *dir) { 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 } 559 } 560 else { 546 if (!IsFile(dir)) { 547 if (!strchr(dir, '?') && !strchr(dir, '*')) 548 wipeallf("%s\\*", dir); 549 DosError(FERR_DISABLEHARDERR); 550 if (DosDeleteDir(dir)) { 551 make_deleteable(dir); 552 DosDeleteDir(dir); 553 } 554 } 555 else if (IsFile(dir) > 0) { 556 DosError(FERR_DISABLEHARDERR); 557 if (DosForceDelete(dir)) { 558 make_deleteable(dir); 559 DosForceDelete(dir); 560 } 561 if (zaplong) 562 ZapLongName(dir); 563 Broadcast((HAB) 0, hwndMain, UM_UPDATERECORD, MPFROMP(dir), MPVOID); 564 } 565 } 566 } 567 else { /* different drives */ 561 568 DosError(FERR_DISABLEHARDERR); 562 ret = DosCopy(oldname, fullnewname, DCPY_EXISTING); 569 ret = DosCopy(oldname, fullnewname, DCPY_EXISTING); /* <=-NOTE! */ 563 570 if (ret == ERROR_DISK_CHANGE) { 564 565 566 571 DosError(FERR_ENABLEHARDERR); 572 ret = DosCopy(oldname, fullnewname, DCPY_EXISTING); 573 diskchange = TRUE; 567 574 } 568 575 if (ret == ERROR_INVALID_NAME || ret == ERROR_FILENAME_EXCED_RANGE) { 569 if (TruncName(fullnewname, shortname)) {/* make 8.3 filename */570 571 572 if (!ret) {/* success -- write longname ea */573 574 575 576 577 578 579 576 if (TruncName(fullnewname, shortname)) { /* make 8.3 filename */ 577 DosError(FERR_DISABLEHARDERR); 578 ret = DosCopy(oldname, shortname, DCPY_EXISTING); 579 if (!ret) { /* success -- write longname ea */ 580 WriteLongName(shortname, fullnewname); 581 strcpy(fullnewname, shortname); 582 /* broadcast fixup msg to windows */ 583 Broadcast((HAB) 0, 584 hwndMain, UM_UPDATERECORD, MPFROMP(shortname), MPVOID); 585 } 586 } 580 587 } 581 588 else if (!ret && *longname) { 582 589 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 } 600 if (!ret) { 601 602 603 604 605 606 607 608 609 if (!rc && st2.cbFile == st.cbFile) {/* seems to have worked... */610 611 612 613 DosQueryPathInfo(oldname, FIL_STANDARDL, &dummy, sizeof(FILESTATUS3L));/* force disk change */614 615 if (!(st2.attrFile & FILE_DIRECTORY))/* erase file */616 617 else {/* remove directory */618 619 620 621 622 623 624 625 590 CHAR fixname[CCHMAXPATH]; 591 592 strcpy(fixname, fullnewname); 593 p = strrchr(fixname, '\\'); 594 if (p) { 595 p++; 596 *p = 0; 597 } 598 strcat(fixname, longname); 599 DosError(FERR_DISABLEHARDERR); 600 DosMove(fullnewname, fixname); 601 strcpy(fullnewname, fixname); 602 if (zaplong) 603 ZapLongName(fixname); 604 Broadcast((HAB) 0, 605 hwndMain, UM_UPDATERECORD, MPFROMP(fixname), MPVOID); 606 } 607 if (!ret) { /* double-check success */ 608 DosError(FERR_DISABLEHARDERR); 609 rc = DosQueryPathInfo(fullnewname, 610 FIL_STANDARDL, &st2, sizeof(FILESTATUS3L)); 611 if (rc == ERROR_DISK_CHANGE) { 612 DosError(FERR_ENABLEHARDERR); 613 rc = DosQueryPathInfo(fullnewname, 614 FIL_STANDARDL, &st2, sizeof(FILESTATUS3L)); 615 } 616 if (!rc && st2.cbFile == st.cbFile) { /* seems to have worked... */ 617 DosError(FERR_DISABLEHARDERR); 618 if (diskchange) { 619 DosError(FERR_ENABLEHARDERR); 620 DosQueryPathInfo(oldname, FIL_STANDARDL, &dummy, sizeof(FILESTATUS3L)); /* force disk change */ 621 } 622 if (!(st2.attrFile & FILE_DIRECTORY)) /* erase file */ 623 unlinkf("%s", oldname); 624 else { /* remove directory */ 625 wipeallf("%s\\*", oldname); 626 DosError(FERR_DISABLEHARDERR); 627 if (DosDeleteDir(oldname)) { 628 make_deleteable(oldname); 629 DosDeleteDir(oldname); 630 } 631 } 632 } 626 633 } 627 634 } … … 630 637 case COPY: 631 638 DosError(FERR_DISABLEHARDERR); 632 ret = DosCopy(oldname, fullnewname, DCPY_EXISTING); 639 ret = DosCopy(oldname, fullnewname, DCPY_EXISTING); /* <=-NOTE! */ 633 640 if (ret == ERROR_DISK_CHANGE) { 634 641 DosError(FERR_ENABLEHARDERR); … … 638 645 if (ret == ERROR_INVALID_NAME || ret == ERROR_FILENAME_EXCED_RANGE) { 639 646 if (TruncName(fullnewname, shortname)) { 640 641 642 643 644 645 646 647 647 DosError((diskchange) ? FERR_ENABLEHARDERR : FERR_DISABLEHARDERR); 648 ret = DosCopy(oldname, shortname, DCPY_EXISTING); 649 if (!ret) { 650 WriteLongName(shortname, fullnewname); 651 strcpy(fullnewname, shortname); 652 Broadcast((HAB) 0, 653 hwndMain, UM_UPDATERECORD, MPFROMP(shortname), MPVOID); 654 } 648 655 } 649 656 } … … 655 662 p = strrchr(fixname, '\\'); 656 663 if (p) { 657 658 664 p++; 665 *p = 0; 659 666 } 660 667 strcat(fixname, longname); … … 662 669 DosMove(fullnewname, fixname); 663 670 if (zaplong) 664 671 ZapLongName(fixname); 665 672 Broadcast((HAB) 0, hwndMain, UM_UPDATERECORD, MPFROMP(fixname), MPVOID); 666 673 } 667 674 return ret; 668 675 669 default: 676 default: /* shouldn't happen */ 670 677 Runtime_Error(pszSrcFile, __LINE__, "bad case %u", type); 671 678 break; 672 679 } 673 return (APIRET) - 3; 680 return (APIRET) - 3; /* bad type */ 674 681 } 675 682 … … 717 724 return -1; 718 725 719 { 726 { /* safety net -- disallow deleting a root dir or partial name */ 720 727 CHAR temp; 721 728 … … 726 733 *p = 0; 727 734 if (IsRoot(str) || !IsFullName(str)) { 728 729 730 731 735 /* under no circumstances! */ 736 Runtime_Error(pszSrcFile, __LINE__, "bad name %s", str); 737 free(str); 738 return -1; 732 739 } 733 740 *p = temp; … … 736 743 737 744 p = s; 738 p = strrchr(s, '\\'); 745 p = strrchr(s, '\\'); /* strip s to just path */ 739 746 if (!p) 740 747 p = strrchr(s, ':'); … … 764 771 DosError(FERR_DISABLEHARDERR); 765 772 if (!DosFindFirst(str, &search_handle, FILE_NORMAL | FILE_DIRECTORY | 766 767 773 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN | FILE_ARCHIVED, 774 f, sizeof(FILEFINDBUF3), &num_matches, FIL_STANDARD)) { 768 775 769 776 strcpy(ss, s); … … 773 780 strcpy(p, f->achName); 774 781 if (f->attrFile & FILE_DIRECTORY) { 775 776 wipeallf("%s/%s", ss, mask);/* recurse to wipe files */777 778 if (DosDeleteDir(ss)) {/* remove directory */779 780 781 782 783 782 if (strcmp(f->achName, ".") && strcmp(f->achName, "..")) { 783 wipeallf("%s/%s", ss, mask); /* recurse to wipe files */ 784 DosError(FERR_DISABLEHARDERR); 785 if (DosDeleteDir(ss)) { /* remove directory */ 786 make_deleteable(ss); 787 DosError(FERR_DISABLEHARDERR); 788 DosDeleteDir(ss); 789 } 790 } 784 791 } 785 792 else { 786 787 788 789 790 791 792 793 793 DosError(FERR_DISABLEHARDERR); 794 if (DosForceDelete(ss)) { 795 make_deleteable(ss); 796 DosError(FERR_DISABLEHARDERR); 797 rc = (INT) DosForceDelete(ss); 798 if (rc) 799 return rc; 800 } 794 801 } 795 802 num_matches = 1; 796 803 DosError(FERR_DISABLEHARDERR); 797 804 } while (!DosFindNext(search_handle, f, sizeof(FILEFINDBUF3), 798 805 &num_matches)); 799 806 DosFindClose(search_handle); 800 807 } … … 806 813 } 807 814 815 #if 0 // JBS 808 816 INT unlink_allf(CHAR * string, ...) 809 817 { … … 834 842 835 843 p = s; 836 p = strrchr(s, '\\'); 844 p = strrchr(s, '\\'); /* strip s to just path */ 837 845 if (!p) 838 846 p = strrchr(s, ':'); … … 858 866 DosError(FERR_DISABLEHARDERR); 859 867 if (!DosFindFirst(str, &search_handle, FILE_NORMAL, f, 860 868 sizeof(FILEFINDBUF3), &num_matches, FIL_STANDARD)) { 861 869 862 870 strcpy(ss, s); … … 869 877 DosError(FERR_DISABLEHARDERR); 870 878 } while (!DosFindNext(search_handle, f, sizeof(FILEFINDBUF3), 871 879 &num_matches)); 872 880 DosFindClose(search_handle); 873 881 } … … 878 886 return 0; 879 887 } 888 #endif 880 889 881 890 INT unlinkf(CHAR * string, ...) -
trunk/dll/killproc.c
r1077 r1163 39 39 #include "strutil.h" // GetPString 40 40 #include "pathutil.h" // BldFullPathName 41 #include "killproc.h" 42 #include "systemf.h" // ShowSession 41 43 #include "fm3dll.h" 42 44 #include "fortify.h" -
trunk/dll/mkdir.c
r1104 r1163 27 27 #include "strutil.h" // GetPString 28 28 #include "notebook.h" // targetdirectoy 29 #include "mkdir.h" 30 #include "walkem.h" // WalkTargetDlgProc 29 31 #include "fm3dll.h" 30 32 -
trunk/dll/notify.c
r1063 r1163 1 2 1 /*********************************************************************** 3 2 … … 21 20 #include <string.h> 22 21 #include <ctype.h> 23 #include <stddef.h> 24 #include <process.h> 22 #include <stddef.h> // _threadid 23 #include <process.h> // _beginthread 25 24 26 25 #define INCL_DOS 27 26 #define INCL_WIN 28 27 #define INCL_GPI 29 #define INCL_LONGLONG 28 #define INCL_LONGLONG // dircnrs.h 30 29 31 30 #include "fm3dlg.h" 32 31 #include "fm3str.h" 33 #include "errutil.h" // Dos_Error... 34 #include "strutil.h" // GetPString 32 #include "errutil.h" // Dos_Error... 33 #include "strutil.h" // GetPString 34 #include "notify.h" 35 35 #include "fm3dll.h" 36 36 #include "fortify.h" … … 40 40 static PSZ pszSrcFile = __FILE__; 41 41 42 static volatile HWND hwndNotify; // 16 Apr 08 SHL 42 static volatile HWND hwndNotify; // 16 Apr 08 SHL 43 44 VOID StartNotes(CHAR * s); 43 45 44 46 /** … … 58 60 59 61 if (!WinStartTimer(WinQueryAnchorBlock(hwnd), hwnd, ID_TIMER2, 5000)) { 60 61 62 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, "WinStartTimer"); 63 WinDestroyWindow(hwnd); 62 64 } 63 65 else { 64 66 65 66 67 68 69 70 71 72 73 74 75 76 77 78 67 RGB2 rgb2F, rgb2; 68 69 memset(&rgb2F, 0, sizeof(RGB2)); 70 rgb2F.bRed = (BYTE)65; 71 rgb2.bRed = rgb2.bGreen = rgb2.bBlue = (BYTE)255; 72 rgb2.fcOptions = 0; 73 SetPresParams(hwnd, &rgb2, &rgb2F, &rgb2, GetPString(IDS_8HELVTEXT)); 74 if (hwndMain) { 75 if (hwndStatus) 76 WinShowWindow(hwndStatus, FALSE); 77 if (hwndStatus2) 78 WinShowWindow(hwndStatus2, FALSE); 79 } 80 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID); 79 81 } 80 82 return rc; … … 105 107 HPS hps = WinGetPS(hwnd); 106 108 if (hps) { 107 108 109 110 111 112 113 114 115 116 109 if (WinQueryWindowPos(hwnd, &swp)) { 110 ptl.x = 0; 111 ptl.y = 0; 112 GpiMove(hps, &ptl); 113 GpiSetColor(hps, CLR_RED); 114 ptl.x = swp.cx - 1; 115 ptl.y = swp.cy - 1; 116 GpiBox(hps, DRO_OUTLINE, &ptl, 2, 2); 117 } 118 WinReleasePS(hwnd); 117 119 } 118 120 return mr; … … 132 134 if (!showing && hwndMain) { 133 135 if (hwndStatus) 134 136 WinShowWindow(hwndStatus, TRUE); 135 137 if (hwndStatus2) 136 138 WinShowWindow(hwndStatus2, TRUE); 137 139 } 138 140 break; … … 162 164 WinQueryWindowPos(hwndStatus2, &swpS2); 163 165 x = hwndMain ? (hwndStatus ? swpS.x - 1 : 164 166 WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER)) : 0; 165 167 y = hwndMain ? (hwndStatus ? swpS.y - 1 : 166 168 WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER)) : 0; 167 169 if (hwndMain && hwndStatus) { 168 170 if (hwndStatus2) 169 171 cx = swpS2.cx + swpS.cx + 8; 170 172 else 171 173 cx = swpS.cx + 6; 172 174 } 173 175 else … … 179 181 p = xmalloc(strlen(str) + 2, pszSrcFile, __LINE__); 180 182 if (!p) 181 183 p = str; 182 184 else { 183 184 185 strcpy(p + 1, str); 186 *p = ' '; 185 187 } 186 188 } … … 189 191 190 192 hwnd = WinCreateWindow(hwndP, 191 192 193 194 193 WC_ERRORWND, 194 p, 195 SS_TEXT | DT_LEFT | DT_VCENTER | WS_VISIBLE, 196 x, y, cx, cy, hwndP, HWND_TOP, id++, NULL, NULL); 195 197 if (!hwndP) 196 198 Win_Error2(hwndP, hwndP, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); … … 244 246 else if (status == 107) 245 247 sprintf(&errortext[strlen(errortext)], 246 248 GetPString(IDS_PHANTOMTEXT), toupper(*filename)); 247 249 else if (status == 19) 248 250 strcat(errortext, GetPString(IDS_DISKWRITEPROTEXTTEXT)); … … 270 272 // Already have notes dialog - pass message on 271 273 if (mp2) { 272 273 274 275 276 274 WinSendDlgItemMsg(hwndNotify, 275 NOTE_LISTBOX, 276 LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0), mp2); 277 PostMsg(hwndNotify, UM_NOTIFY, MPVOID, MPVOID); 278 free((CHAR *)mp2); 277 279 } 278 280 WinDismissDlg(hwnd, 0); … … 285 287 BOOL dummy = TRUE; 286 288 PrfWriteProfileData(fmprof, 287 289 FM3Str, "ThreadNotes", &dummy, sizeof(BOOL)); 288 290 } 289 291 if (mp2) { 290 292 WinSendDlgItemMsg(hwnd, 291 292 293 NOTE_LISTBOX, 294 LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0), mp2); 293 295 free((CHAR *)mp2); 294 296 } … … 308 310 { 309 311 ULONG size = sizeof(SWP), 310 312 fl = SWP_ZORDER | SWP_FOCUSDEACTIVATE | SWP_SHOW; 311 313 SWP swp; 312 314 313 315 if (PrfQueryProfileData(fmprof, 314 315 316 317 318 319 320 316 FM3Str, "NoteWndSwp", (PVOID) & swp, &size)) { 317 if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) { 318 fl |= SWP_MINIMIZE; 319 fl &= (~SWP_SHOW); 320 } 321 else 322 fl |= (SWP_MOVE | SWP_SIZE); 321 323 } 322 324 WinSetWindowPos(hwnd, HWND_BOTTOM, swp.x, swp.y, swp.cx, swp.cy, fl); 323 325 if (fl & SWP_MINIMIZE) { 324 325 326 327 326 WinSetWindowUShort(hwnd, QWS_XRESTORE, (USHORT) swp.x); 327 WinSetWindowUShort(hwnd, QWS_CXRESTORE, (USHORT) swp.cx); 328 WinSetWindowUShort(hwnd, QWS_YRESTORE, (USHORT) swp.y); 329 WinSetWindowUShort(hwnd, QWS_CYRESTORE, (USHORT) swp.cy); 328 330 } 329 331 } … … 339 341 WinQueryWindowPos(hwnd, &swp); 340 342 if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE))) { 341 342 343 344 345 346 347 348 349 343 szbx = SysVal(SV_CXSIZEBORDER); 344 szby = SysVal(SV_CYSIZEBORDER); 345 titl = SysVal(SV_CYTITLEBAR); 346 WinSetWindowPos(WinWindowFromID(hwnd, NOTE_LISTBOX), 347 HWND_TOP, 348 szbx, 349 szby, 350 swp.cx - (szbx * 2L), 351 (swp.cy - titl) - (szby * 2L), SWP_MOVE | SWP_SIZE); 350 352 } 351 353 if (!(swp.fl & SWP_MAXIMIZE)) { 352 353 354 355 356 357 358 359 354 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) { 355 swp.x = WinQueryWindowUShort(hwnd, QWS_XRESTORE); 356 swp.y = WinQueryWindowUShort(hwnd, QWS_YRESTORE); 357 swp.cx = WinQueryWindowUShort(hwnd, QWS_CXRESTORE); 358 swp.cy = WinQueryWindowUShort(hwnd, QWS_CYRESTORE); 359 } 360 PrfWriteProfileData(fmprof, 361 FM3Str, "NoteWndSwp", (PVOID) & swp, sizeof(SWP)); 360 362 } 361 363 } … … 370 372 SHORT y; 371 373 SHORT x = (SHORT)WinSendDlgItemMsg(hwnd, 372 373 374 NOTE_LISTBOX, 375 LM_QUERYITEMCOUNT, MPVOID, MPVOID); 374 376 if (x > 60) { 375 376 377 378 379 377 for (y = 0; y < x - 50; y++) { 378 WinSendDlgItemMsg(hwnd, 379 NOTE_LISTBOX, 380 LM_DELETEITEM, MPFROMSHORT(y), MPVOID); 381 } 380 382 } 381 383 } … … 385 387 { 386 388 SHORT x = (SHORT) WinSendDlgItemMsg(hwnd, 387 388 389 NOTE_LISTBOX, 390 LM_QUERYITEMCOUNT, MPVOID, MPVOID); 389 391 if (x > 0) 390 391 392 392 WinSendDlgItemMsg(hwnd, 393 NOTE_LISTBOX, 394 LM_SETTOPINDEX, MPFROMSHORT(x), MPVOID); 393 395 } 394 396 return 0; … … 396 398 case UM_SHOWME: 397 399 WinSetWindowPos(hwnd, 398 399 400 401 400 HWND_TOP, 401 0, 402 0, 403 0, 0, SWP_SHOW | SWP_RESTORE | SWP_ZORDER | SWP_ACTIVATE); 402 404 return 0; 403 405 … … 413 415 fThreadNotes = FALSE; 414 416 PrfWriteProfileData(fmprof, 415 417 FM3Str, "ThreadNotes", &fThreadNotes, sizeof(BOOL)); 416 418 hwndNotify = (HWND) 0; 417 419 } … … 439 441 if (hmq) { 440 442 if (!hwndNotify) 441 442 443 443 WinDlgBox(HWND_DESKTOP, 444 HWND_DESKTOP, 445 NoteWndProc, FM3ModHandle, NOTE_FRAME, (CHAR *)args); 444 446 WinDestroyMsgQueue(hmq); 445 447 } … … 463 465 USHORT i; 464 466 for (i = 0; !hwndNotify && i < 10; i++) 465 467 DosSleep(10); 466 468 if (!hwndNotify) 467 469 Runtime_Error(pszSrcFile, __LINE__, "Can not create Notify window"); 468 470 } 469 471 } … … 485 487 if (*p) { 486 488 if (!hwndNotify) { 487 488 489 fThreadNotes = FALSE; 490 StartNotes(NULL); 489 491 } 490 492 if (hwndNotify) { 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 493 s = xmalloc(strlen(p) + 14, pszSrcFile, __LINE__); 494 if (s) { 495 sprintf(s, "%08lx %s", _threadid, p); 496 while (!once) { 497 if ((SHORT) WinSendDlgItemMsg(hwndNotify, 498 NOTE_LISTBOX, 499 LM_INSERTITEM, 500 MPFROM2SHORT(LIT_END, 0), 501 MPFROMP(s)) >= 0) { 502 ret = TRUE; 503 PostMsg(hwndNotify, UM_NOTIFY, MPVOID, MPVOID); 504 break; 505 } 506 PostMsg(hwndNotify, UM_CONTAINER_FILLED, MPVOID, MPVOID); 507 once = TRUE; 506 508 } 507 509 free(s); 508 510 } 509 511 } 510 512 } … … 544 546 if (hwndNotify) 545 547 WinSetWindowPos(hwndNotify, 546 547 548 548 HWND_BOTTOM, 549 0, 550 0, 0, 0, SWP_MINIMIZE | SWP_ZORDER | SWP_FOCUSDEACTIVATE); 549 551 } 550 552 -
trunk/dll/objcnr.c
r1063 r1163 28 28 #include <string.h> 29 29 #include <ctype.h> 30 #include <process.h> 30 #include <process.h> // _beginthread 31 31 32 32 #define INCL_DOS … … 37 37 #include "fm3dlg.h" 38 38 #include "fm3str.h" 39 #include "errutil.h" // Dos_Error... 40 #include "strutil.h" // GetPString 39 #include "errutil.h" // Dos_Error... 40 #include "strutil.h" // GetPString 41 #include "objcnr.h" 41 42 #include "fm3dll.h" 43 #include "select.h" // ExpandAll 42 44 43 45 #include "fortify.h" … … 67 69 68 70 static VOID ProcessDir(HWND hwndCnr, 69 70 71 71 CHAR *filename, 72 PCNRITEM pciParent, 73 CHAR *stopflag) 72 74 { 73 75 CHAR maskstr[CCHMAXPATH], *endpath, *p; … … 84 86 pffbArray = xmalloc(ulBufBytes, pszSrcFile, __LINE__); 85 87 if (!pffbArray) 86 return; 88 return; // Error already reported 87 89 strcpy(maskstr, filename); 88 90 if (maskstr[strlen(maskstr) - 1] != '\\') … … 93 95 ulFindCnt = 1; 94 96 rc = xDosFindFirst(filename, &hdir, 95 96 97 97 FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED | 98 FILE_SYSTEM | FILE_HIDDEN | MUST_HAVE_DIRECTORY, 99 pffbArray, ulBufBytes, &ulFindCnt, FIL_STANDARDL); 98 100 if (!rc) 99 101 DosFindClose(hdir); … … 104 106 if ((!rc && (pffbArray->attrFile & FILE_DIRECTORY))) { 105 107 pciP = WinSendMsg(hwndCnr, 106 107 108 108 CM_ALLOCRECORD, 109 MPFROMLONG(EXTRA_RECORD_BYTES), 110 MPFROMLONG(1)); 109 111 if (!pciP) { 110 112 Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_ALLOCRECORD"); … … 121 123 p = strrchr(pciP->pszFileName, '\\'); 122 124 if (!p) 123 125 pciP->pszDisplayName = pciP->pszFileName; 124 126 else if (*(p + 1)) 125 127 p++; 126 128 pciP->pszDisplayName = p; 127 129 } … … 136 138 free(pffbArray); 137 139 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 138 140 GetPString(IDS_CANTFINDDIRTEXT), filename); 139 141 return; 140 142 } … … 144 146 pciP->rc.hptrIcon = hptr; 145 147 146 if (!pciP->rc.hptrIcon || pciP->rc.hptrIcon == hptrFile) 148 if (!pciP->rc.hptrIcon || pciP->rc.hptrIcon == hptrFile) /* OS/2 bug bug bug bug */ 147 149 pciP->rc.hptrIcon = hptrDir; 148 150 … … 166 168 ulFindCnt = ulFindMax; 167 169 rc = xDosFindFirst(maskstr, &hdir, 168 169 170 170 FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED | 171 FILE_SYSTEM | FILE_HIDDEN | MUST_HAVE_DIRECTORY, 172 pffbArray, ulBufBytes, &ulFindCnt, FIL_STANDARDL); 171 173 if (!rc) { 172 174 PFILEFINDBUF3L pffbFile; … … 176 178 pffbFile = pffbArray; 177 179 for (x = 0; x < ulFindCnt; x++) { 178 179 180 181 182 183 184 185 186 187 188 189 190 180 if (*stopflag) 181 break; 182 if ((pffbFile->attrFile & FILE_DIRECTORY) && 183 // Skip . and .. 184 (pffbFile->achName[0] != '.' || 185 (pffbFile->achName[1] && 186 (pffbFile->achName[1] != '.' || pffbFile->achName[2])))) { 187 strcpy(endpath, pffbFile->achName); 188 ProcessDir(hwndCnr, maskstr, pciP, stopflag); 189 } 190 if (!pffbFile->oNextEntryOffset) 191 break; 192 pffbFile = (PFILEFINDBUF3L)((PBYTE)pffbFile + pffbFile->oNextEntryOffset); 191 193 } // for 192 DosSleep(0); 194 DosSleep(0); // Let's others at same priority get some work done 193 195 if (*stopflag) 194 196 break; 195 197 ulFindCnt = ulFindMax; 196 198 rc = xDosFindNext(hdir, pffbArray, ulBufBytes, &ulFindCnt, FIL_STANDARDL); … … 201 203 if (rc && rc != ERROR_NO_MORE_FILES) { 202 204 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 203 205 GetPString(IDS_CANTFINDDIRTEXT), filename); 204 206 } 205 207 206 208 free(pffbArray); 207 209 WinSendMsg(hwndCnr, CM_INVALIDATERECORD, MPFROMP(&pciP), 208 210 MPFROM2SHORT(1, 0)); 209 211 } 210 212 … … 231 233 WinCancelShutdown(hmq, TRUE); 232 234 ProcessDir(dirsize->hwndCnr, dirsize->filename, (PCNRITEM) NULL, 233 235 dirsize->stopflag); 234 236 DosPostEventSem(CompactSem); 235 237 WinDestroyMsgQueue(hmq); … … 238 240 } 239 241 PostMsg(WinQueryWindow(dirsize->hwndCnr, QW_PARENT), UM_CONTAINER_FILLED, 240 242 MPVOID, MPVOID); 241 243 free(dirsize); 242 244 # ifdef FORTIFY … … 254 256 Runtime_Error(pszSrcFile, __LINE__, "objcnrwnd set"); 255 257 WinSetWindowPos(objcnrwnd, HWND_TOP, 0, 0, 0, 0, 256 258 SWP_RESTORE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER); 257 259 WinDismissDlg(hwnd, 0); 258 260 break; … … 280 282 dirsize = xmalloc(sizeof(DIRSIZE), pszSrcFile, __LINE__); 281 283 if (!dirsize) { 282 283 284 WinDismissDlg(hwnd, 0); 285 break; 284 286 } 285 287 dirsize->stopflag = (CHAR *)&data->stopflag; … … 287 289 dirsize->hwndCnr = WinWindowFromID(hwnd, OBJCNR_CNR); 288 290 if (_beginthread(FillCnrsThread, NULL, 65536 * 8, (PVOID) dirsize) == 289 290 291 291 -1) { 292 Runtime_Error(pszSrcFile, __LINE__, 293 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 292 294 free(dirsize); 293 295 # ifdef FORTIFY 294 296 Fortify_LeaveScope(); 295 297 # endif 296 297 298 WinDismissDlg(hwnd, 0); 299 break; 298 300 } 299 301 else 300 302 data->working = TRUE; 301 303 } 302 304 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID); … … 311 313 cnri.cb = sizeof(CNRINFO); 312 314 WinSendDlgItemMsg(hwnd, OBJCNR_CNR, CM_QUERYCNRINFO, 313 315 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO))); 314 316 cnri.cyLineSpacing = 0; 315 317 cnri.cxTreeIndent = 12L; 316 318 cnri.pszCnrTitle = GetPString(IDS_WORKINGTEXT); 317 319 cnri.flWindowAttr = CV_TREE | CV_FLOW | 318 320 CA_CONTAINERTITLE | CA_TITLESEPARATOR | CA_TREELINE; 319 321 if (WinQueryWindowUShort(hwnd, QWS_ID) == QTREE_FRAME) 320 322 cnri.flWindowAttr |= CV_MINI; 321 323 WinSendDlgItemMsg(hwnd, OBJCNR_CNR, CM_SETCNRINFO, MPFROMP(&cnri), 322 323 324 MPFROMLONG(CMA_FLWINDOWATTR | CMA_LINESPACING | 325 CMA_CXTREEINDENT)); 324 326 } 325 327 return 0; … … 329 331 // WinEnableWindowUpdate(WinWindowFromID(hwnd,OBJCNR_CNR),TRUE); 330 332 WinSendDlgItemMsg(hwnd, OBJCNR_CNR, CM_INVALIDATERECORD, MPVOID, 331 333 MPFROM2SHORT(0, CMA_ERASE | CMA_INVALIDATE)); 332 334 data = INSTDATA(hwnd); 333 335 if (data) { 334 336 data->working = FALSE; 335 337 if (data->dying) 336 338 WinDismissDlg(hwnd, 0); 337 339 { 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 340 PCNRITEM pci; 341 USHORT id; 342 343 id = WinQueryWindowUShort(hwnd, QWS_ID); 344 pci = (PCNRITEM) WinSendDlgItemMsg(hwnd, OBJCNR_CNR, 345 CM_QUERYRECORD, 346 MPVOID, 347 MPFROM2SHORT(CMA_FIRST, 348 CMA_ITEMORDER)); 349 if (pci && (INT) pci != -1) { 350 ExpandAll(WinWindowFromID(hwnd, OBJCNR_CNR), TRUE, pci); 351 if (id == QTREE_FRAME) 352 pci = (PCNRITEM) WinSendDlgItemMsg(hwnd, OBJCNR_CNR, 353 CM_QUERYRECORD, 354 MPFROMP(pci), 355 MPFROM2SHORT(CMA_FIRSTCHILD, 356 CMA_ITEMORDER)); 357 } 358 if ((!pci || (INT) pci == -1) && id == QTREE_FRAME) { 359 Notify(GetPString(IDS_NODIRSUNDERTEXT)); 360 WinDismissDlg(hwnd, 0); 361 break; 362 } 361 363 } 362 364 } … … 368 370 if (SHORT2FROMMP(mp1) == CN_ENTER) { 369 371 370 371 372 373 372 PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord; 373 374 if (pci && (INT) pci != -1) 375 WinSendDlgItemMsg(hwnd, DID_OK, BM_CLICK, MPVOID, MPVOID); 374 376 } 375 377 break; … … 382 384 if (hwndHelp) { 383 385 384 385 386 387 388 389 390 391 392 393 394 395 386 USHORT id; 387 388 id = WinQueryWindowUShort(hwnd, QWS_ID); 389 390 if (id == QTREE_FRAME) 391 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 392 MPFROM2SHORT(HELP_QUICKTREE, 0), 393 MPFROMSHORT(HM_RESOURCEID)); 394 else 395 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 396 MPFROM2SHORT(HELP_OBJECTPATH, 0), 397 MPFROMSHORT(HM_RESOURCEID)); 396 398 } 397 399 break; … … 402 404 if (data) { 403 405 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 406 PCNRITEM pci; 407 408 if (data->working) { 409 Runtime_Error(pszSrcFile, __LINE__, "working unexpected"); 410 break; 411 } 412 if (SHORT1FROMMP(mp1) == OBJCNR_DESKTOP) { 413 WinDismissDlg(hwnd, 2); 414 break; 415 } 416 pci = (PCNRITEM) WinSendDlgItemMsg(hwnd, OBJCNR_CNR, 417 CM_QUERYRECORDEMPHASIS, 418 MPFROMLONG(CMA_FIRST), 419 MPFROMSHORT(CRA_CURSORED)); 420 if (pci && (INT) pci != -1) 421 strcpy(data->dirname, pci->pszFileName); 422 WinDismissDlg(hwnd, 1); 421 423 } 422 424 break; … … 425 427 data = INSTDATA(hwnd); 426 428 if (data) { 427 428 429 430 431 432 429 if (data->working) { 430 data->dying = (CHAR)TRUE; 431 data->stopflag = (CHAR)0xff; 432 break; 433 } 434 WinDismissDlg(hwnd, 0); 433 435 } 434 436 break; -
trunk/dll/printer.c
r1063 r1163 1 2 1 /*********************************************************************** 3 2 … … 32 31 #include "errutil.h" // Dos_Error... 33 32 #include "strutil.h" // GetPString 33 #include "notify.h" // AddNote 34 #include "defview.h" // QuickView 35 #include "printer.h" 34 36 #include "fm3dll.h" 35 37 #include "fortify.h" … … 40 42 41 43 static HMTX PrintSem = 0; 44 45 static BOOL PrinterReady(CHAR * printdevname); 46 static BOOL SayPrinterReady(HWND hwnd); 42 47 43 48 BOOL PrinterReady(CHAR * printdevname) -
trunk/dll/seticon.c
r1047 r1163 24 24 #include "fm3dlg.h" 25 25 #include "errutil.h" // Dos_Error... 26 #include "seticon.h" 26 27 #include "fm3dll.h" 27 28 #include "fortify.h" -
trunk/dll/timer.c
r907 r1163 24 24 #include "errutil.h" // Dos_Error... 25 25 #include "strutil.h" // GetPString 26 #include "timer.h" 26 27 #include "fm3dll.h" 27 28 -
trunk/dll/update.c
r1047 r1163 34 34 #include "filldir.h" // FillInRecordFromFFB 35 35 #include "dircnrs.h" 36 #include "flesh.h" // Flesh, Stubby 37 #include "update.h" 36 38 #include "fm3dll.h" 37 39 #include "fortify.h"
Note:
See TracChangeset
for help on using the changeset viewer.