Changeset 1156 for trunk/dll/init.c
- Timestamp:
- Sep 5, 2008, 11:39:19 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/init.c
r1130 r1156 44 44 29 Feb 08 GKY Refactor global command line variables to notebook.h 45 45 08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with 46 46 keys using a "DirCnr." prefix 47 47 20 Apr 08 GKY Change default cmd line length to 1024 Ask once if user wants to reset it. 48 48 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating 49 50 49 all the details view settings (both the global variables and those in the 50 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS. 51 51 16 JUL 08 GKY Use TMP directory for temp files 52 52 17 Jul 08 SHL Reduce code bulk in fUseTmp setup … … 82 82 #include "fm3str.h" 83 83 #include "version.h" 84 #include "pathutil.h" // BldFullPathName 85 #include "arccnrs.h" // ArcClientWndProc 86 #include "errutil.h" // Dos_Error... 87 #include "strutil.h" // GetPString 84 #include "pathutil.h" // BldFullPathName 85 #include "arccnrs.h" // ArcClientWndProc 86 #include "errutil.h" // Dos_Error... 87 #include "strutil.h" // GetPString 88 #include "valid.h" // ArgDriveFlags 89 #include "autoview.h" // AutoViewProc 90 #include "mainwnd.h" // BubbleProc, ChildButtonProc, DriveBackProc, 91 // DriveProc, LEDProc, MainWndProc, StatusProc 92 // ToolBackProc 93 #include "collect.h" // CollectorClientWndProc, CollectorTextProc 94 #include "getnames.h" // CustomFileDlg 95 #include "notify.h" // EndNote 96 #include "valid.h" // FillInDriveFlags, IsValidDir 97 #include "inis.h" // IniProc 98 #include "viewer.h" // MLEEditorProc 99 #include "mainwnd2.h" // MainWndProc2 100 #include "notify.h" // NotifyWndProc 101 #include "treecnr.h" // OpenButtonProc 102 #include "seeall.h" // SeeAllWndProc, SeeStatusProc 103 #include "init.h" 104 #include "timer.h" // StartTimer, StopTimer 105 #include "treecnr.h" // TreeClientWndProc, TreeStatProc 106 #include "newview.h" // ViewStatusProc, ViewWndProc 88 107 #include "fm3dll.h" 89 #include "notebook.h" // command line variables (editor etc) 108 #include "misc.h" // HeapThread, LoadDetailsSwitches 109 #include "notebook.h" // command line variables (editor etc) 90 110 #include "fortify.h" 91 111 92 112 #ifdef __IBMC__ 93 113 #pragma alloc_text(INIT,LibMain,InitFM3DLL,DeInitFM3DLL) 94 #pragma alloc_text(INIT1,StartFM3 ,FindSwapperDat)114 #pragma alloc_text(INIT1,StartFM3) 95 115 #endif 96 116 … … 108 128 109 129 static PSZ pszSrcFile = __FILE__; 130 131 VOID FindSwapperDat(VOID); 110 132 111 133 BOOL CheckFileHeader(CHAR *filespec, CHAR *signature, LONG offset); … … 130 152 nm = 1; 131 153 rc = DosFindFirst(SwapperDat, 132 133 134 135 154 &hdir, 155 FILE_NORMAL | FILE_ARCHIVED | 156 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, 157 &ffb, sizeof(ffb), &nm, FIL_STANDARDL); 136 158 if (rc && rc != ERROR_FILE_NOT_FOUND && rc != ERROR_PATH_NOT_FOUND) { 137 159 FILEFINDBUF3 ffb; 138 160 rc = DosFindFirst(SwapperDat, 139 140 141 142 161 &hdir, 162 FILE_NORMAL | FILE_ARCHIVED | 163 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, 164 &ffb, sizeof(ffb), &nm, FIL_STANDARD); 143 165 fNoLargeFileSupport = TRUE; 144 166 } … … 147 169 fp = fopen(SwapperDat, "r"); 148 170 if (fp) { 149 150 151 rc = 1;// Force config.sys scan171 fclose(fp); 172 *SwapperDat = 0; 173 rc = 1; // Force config.sys scan 152 174 } 153 175 } … … 158 180 if (rc) { 159 181 if (DosQuerySysInfo(QSV_BOOT_DRIVE, 160 161 162 163 nm = 3; 182 QSV_BOOT_DRIVE, 183 &nm, 184 sizeof(ULONG))) { 185 nm = 3; // Assume drive C: 164 186 } 165 187 *filename = (CHAR) nm + '@'; … … 167 189 if (fp) { 168 190 while (!feof(fp)) { 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 }// if SWAPPATH226 } 191 if (!xfgets(input, sizeof(input), fp, pszSrcFile, __LINE__)) 192 break; 193 lstrip(input); 194 if (!strnicmp(input, "SWAPPATH", 8)) { 195 p = input + 8; 196 while (*p == ' ') 197 p++; 198 if (*p == '=') { 199 p++; 200 stripcr(p); 201 rstrip(p); 202 while (*p == ' ') 203 p++; 204 if (*p == '\"') { 205 p++; 206 pp = p; 207 while (*pp && *pp != '\"') 208 *pp += 1; 209 if (*pp) 210 *pp = 0; 211 } 212 else { 213 pp = strchr(p, ' '); 214 if (pp) 215 *pp = 0; 216 } 217 if (*p) { 218 strncpy(SwapperDat, p, CCHMAXPATH); 219 SwapperDat[CCHMAXPATH - 1] = 0; 220 BldFullPathName(SwapperDat, SwapperDat, "SWAPPER.DAT"); 221 hdir = HDIR_CREATE; 222 nm = 1; 223 rc = DosFindFirst(SwapperDat, 224 &hdir, 225 FILE_NORMAL | FILE_ARCHIVED | 226 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, 227 &ffb, sizeof(ffb), &nm, FIL_STANDARD); 228 if (rc){ 229 FILEFINDBUF3 ffb; 230 rc = DosFindFirst(SwapperDat, 231 &hdir, 232 FILE_NORMAL | FILE_ARCHIVED | 233 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, 234 &ffb, sizeof(ffb), &nm, FIL_STANDARD); 235 fNoLargeFileSupport = TRUE; 236 } 237 if (!rc) { 238 DosFindClose(hdir); 239 PrfWriteProfileString(fmprof, 240 FM3Str, "SwapperDat", SwapperDat); 241 } 242 else 243 *SwapperDat = 0; 244 break; 245 } 246 } 247 } // if SWAPPATH 248 } // while 227 249 fclose(fp); 228 250 } … … 233 255 234 256 unsigned APIENTRY LibMain(unsigned hModule, 235 257 unsigned ulFlag) 236 258 { 237 259 CHAR *env; … … 252 274 rc = DosQueryPathInfo(env, FIL_STANDARD, &fsa, sizeof(fsa)); 253 275 if (!rc) { 254 255 256 257 258 259 276 if (fsa.attrFile & FILE_DIRECTORY) { 277 BldFullPathName(stringfile, env, "FM3RES.STR"); 278 DosError(FERR_DISABLEHARDERR); 279 if (DosQueryPathInfo(stringfile, FIL_STANDARD, &fsa, sizeof(fsa))) 280 strcpy(stringfile, "FM3RES.STR"); 281 } 260 282 } 261 283 } … … 347 369 348 370 unsigned long _System _DLL_InitTerm(unsigned long hModule, 349 371 unsigned long ulFlag) 350 372 { 351 373 CHAR *env; … … 365 387 rc = DosQueryPathInfo(env, FIL_STANDARD, &fsa, sizeof(fsa)); 366 388 if (!rc) { 367 368 369 370 371 372 389 if (fsa.attrFile & FILE_DIRECTORY) { 390 BldFullPathName(stringfile, env, "FM3RES.STR"); 391 DosError(FERR_DISABLEHARDERR); 392 if (DosQueryPathInfo(stringfile, FIL_STANDARD, &fsa, sizeof(fsa))) 393 strcpy(stringfile, "FM3RES.STR"); 394 } 373 395 } 374 396 } … … 501 523 num_matches = 1L; 502 524 if (!DosFindFirst(s, 503 504 505 506 507 525 &search_handle, 526 FILE_NORMAL | FILE_DIRECTORY | 527 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN | 528 FILE_ARCHIVED, 529 &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) { 508 530 do { 509 510 511 512 513 514 515 531 strcpy(enddir, ffb.achName); 532 if (ffb.attrFile & FILE_DIRECTORY) { 533 wipeallf("%s\\*", s); 534 DosDeleteDir(s); 535 } 536 else 537 unlinkf("%s", s); 516 538 } 517 539 while (!DosFindNext(search_handle, 518 540 &ffb, sizeof(ffb), &num_matches)); 519 541 DosFindClose(search_handle); 520 542 } … … 532 554 num_matches = 1; 533 555 if (!DosFindFirst(s, 534 535 536 537 538 556 &search_handle, 557 FILE_NORMAL | FILE_DIRECTORY | 558 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN | 559 FILE_ARCHIVED, 560 &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) { 539 561 do { 540 562 if (!(ffb.attrFile & FILE_DIRECTORY)) { 541 542 563 strcpy(enddir, ffb.achName); 564 unlinkf("%s", s); 543 565 } 544 566 } 545 567 while (!DosFindNext(search_handle, 546 568 &ffb, sizeof(ffb), &num_matches)); 547 569 DosFindClose(search_handle); 548 570 } … … 575 597 ULONG RVMinor = 0; 576 598 ULONG ret = 0; 577 FILESTATUS3 fs3; 599 FILESTATUS3 fs3; // 25 Aug 07 SHL 578 600 PSZ env; 579 601 CHAR dllfile[CCHMAXPATH]; … … 582 604 if (!StringsLoaded()) { 583 605 saymsg(MB_ENTER, 584 585 586 587 606 HWND_DESKTOP, 607 "Error", 608 "FM3RES.STR isn't in right format, at least " 609 "for this version of FM/2."); 588 610 return FALSE; 589 611 } … … 596 618 if (!rc) { 597 619 if (fs3.attrFile & FILE_DIRECTORY) { 598 BldFullPathName(dllfile, env, "FM3RES");// 23 Aug 07 SHL599 600 601 620 BldFullPathName(dllfile, env, "FM3RES"); // 23 Aug 07 SHL 621 DosError(FERR_DISABLEHARDERR); 622 if (DosQueryPathInfo(dllfile, FIL_STANDARD, &fs3, sizeof(fs3))) 623 strcpy(dllfile, "FM3RES"); 602 624 } 603 625 } … … 606 628 if (rcl) { 607 629 saymsg(MB_CANCEL | MB_ICONEXCLAMATION, 608 609 630 HWND_DESKTOP, 631 GetPString(IDS_ERRORTEXT), GetPString(IDS_FM3RESERROR1TEXT)); 610 632 return FALSE; 611 633 } … … 614 636 if (rc) { 615 637 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 616 638 "DosExitList"); 617 639 } 618 640 rcq = DosQueryProcAddr(FM3ModHandle, 1, "ResVersion", &pfnResVersion); … … 622 644 if (RVMajor < VERMAJOR || (RVMajor == VERMAJOR && RVMinor < VERMINOR)) { 623 645 saymsg(MB_ENTER, 624 625 626 627 628 629 630 631 646 HWND_DESKTOP, 647 GetPString(IDS_ERRORTEXT), 648 GetPString(IDS_FM3RESERROR2TEXT), 649 !rcq ? 650 GetPString(IDS_FM3RESERROR3TEXT) : 651 !rcl ? 652 GetPString(IDS_FM3RESERROR4TEXT) : 653 GetPString(IDS_FM3RESERROR5TEXT), RVMajor, RVMinor, rcl, rcq, ret); 632 654 return FALSE; 633 655 } … … 647 669 DosSetMaxFH(100); 648 670 else if (!strcmp(appname, "VDir") || 649 650 651 671 !strcmp(appname, "VTree") || 672 !strcmp(appname, "VCollect") || 673 !strcmp(appname, "SEEALL") || !strcmp(appname, "FM/4")) 652 674 DosSetMaxFH(60); 653 675 else … … 655 677 656 678 if (DosQuerySysInfo(QSV_VERSION_MAJOR, 657 658 659 679 QSV_VERSION_MINOR, 680 OS2ver, 681 sizeof(OS2ver))) { 660 682 OS2ver[0] = 2; 661 683 OS2ver[1] = 1; … … 684 706 num_matches = 1; 685 707 if (!DosFindFirst(szTempName, 686 687 688 689 690 708 &search_handle, 709 FILE_NORMAL | FILE_DIRECTORY | 710 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN | 711 FILE_ARCHIVED, 712 &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) { 691 713 do { 692 714 strcpy(enddir, ffb.achName); … … 704 726 } 705 727 while (!DosFindNext(search_handle, 706 728 &ffb, sizeof(ffb), &num_matches)); 707 729 DosFindClose(search_handle); 708 730 } … … 763 785 if (_beginthread(HeapThread, NULL, 32768, NULL) == -1) { 764 786 Runtime_Error(pszSrcFile, __LINE__, 765 787 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 766 788 return FALSE; 767 789 } … … 770 792 if (!StartTimer()) { 771 793 Runtime_Error(pszSrcFile, __LINE__, 772 794 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 773 795 return FALSE; 774 796 } … … 777 799 env = getenv("WORKPLACE_PROCESS"); 778 800 fWorkPlace = env != NULL && 779 801 (stricmp(env, "YES") == 0 || atoi(env) == 1); 780 802 781 803 if ((!strchr(profile, '\\') && !strchr(profile, ':')) || … … 796 818 rc = DosQueryPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3)); 797 819 if (!rc) { 798 799 820 if (fs3.attrFile & FILE_DIRECTORY) 821 BldFullPathName(inipath, inipath, profile); 800 822 } 801 823 } … … 803 825 env = searchpath(profile); 804 826 if (!env) 805 827 env = profile; 806 828 strcpy(inipath, env); 807 829 } … … 820 842 else { 821 843 if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) { 822 823 824 825 826 827 828 829 830 844 saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING, 845 "Check INI header failed will attempt to replace with backup \\ 846 if backup fails or not found will open with new ini"); 847 DosCopy("FM3.INI", "FM3INI.BAD", DCPY_EXISTING); 848 DosCopy("FM3INI.BAK", "FM3.INI", DCPY_EXISTING); 849 if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) { 850 DosCopy("FM3.INI", "FM3INI2.BAD", DCPY_EXISTING); 851 fWantFirstTimeInit = TRUE; 852 } 831 853 } 832 854 if (!fWantFirstTimeInit) { 833 834 835 836 837 838 839 840 841 855 fIniExisted = TRUE; 856 if (fs3.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) { 857 fs3.attrFile &= ~(FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM); 858 rc = xDosSetPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3), 0); 859 if (rc) { 860 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 861 GetPString(IDS_INIREADONLYTEXT), inipath); 862 } 863 } 842 864 } 843 865 } … … 852 874 if (!fmprof) { 853 875 Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__, 854 876 "PrfOpenProfile"); 855 877 return FALSE; 856 878 } … … 861 883 size = sizeof(BOOL); 862 884 PrfQueryProfileData(fmprof, 863 864 865 866 885 FM3Str, 886 "SeparateParms", 887 &fSeparateParms, 888 &size); 867 889 if (!fSeparateParms) 868 890 strcpy(appname, FM3Str); … … 882 904 hwndHelp = WinCreateHelpInstance(hab, &hini); 883 905 if (!hwndHelp) { 884 static CHAR helppath[CCHMAXPATH]; 906 static CHAR helppath[CCHMAXPATH]; // fixme to be local? 885 907 886 908 env = getenv("FM3INI"); … … 890 912 rc = DosQueryPathInfo(helppath, FIL_STANDARD, &fs3, sizeof(fs3)); 891 913 if (!rc) { 892 893 894 895 896 914 if (fs3.attrFile & FILE_DIRECTORY) { 915 BldFullPathName(helppath, helppath, "FM3.HLP"); 916 hini.pszHelpLibraryName = helppath; 917 hwndHelp = WinCreateHelpInstance(hab, &hini); 918 } 897 919 } 898 920 } … … 900 922 if (!hwndHelp) { 901 923 saymsg(MB_ENTER | MB_ICONEXCLAMATION, 902 903 904 905 924 HWND_DESKTOP, 925 GetPString(IDS_FM2TROUBLETEXT), 926 GetPString(IDS_CANTLOADHELPTEXT), 927 GetPString(IDS_NOHELPACCEPTTEXT)); 906 928 } 907 929 … … 929 951 /* register window classes we use */ 930 952 WinRegisterClass(hab, 931 932 933 934 WinRegisterClass(hab, 935 936 937 938 WinRegisterClass(hab, 939 940 941 942 WinRegisterClass(hab, 943 944 945 946 WinRegisterClass(hab, 947 948 949 950 WinRegisterClass(hab, 951 952 953 954 WinRegisterClass(hab, 955 956 957 958 WinRegisterClass(hab, 959 960 961 962 WinRegisterClass(hab, 963 964 965 966 967 WinRegisterClass(hab, 968 969 970 971 972 WinRegisterClass(hab, 973 974 975 976 WinRegisterClass(hab, 977 978 979 980 WinRegisterClass(hab, 981 982 983 984 985 WinRegisterClass(hab, 986 987 988 989 990 WinRegisterClass(hab, 991 992 993 994 995 WinRegisterClass(hab, 996 997 998 999 1000 WinRegisterClass(hab, 1001 1002 1003 1004 1005 WinRegisterClass(hab, 1006 1007 1008 1009 1010 WinRegisterClass(hab, 1011 1012 1013 1014 1015 WinRegisterClass(hab, 1016 1017 1018 1019 1020 WinRegisterClass(hab, 1021 1022 1023 1024 1025 WinRegisterClass(hab, 1026 1027 1028 1029 1030 WinRegisterClass(hab, 1031 1032 1033 1034 1035 WinRegisterClass(hab, 1036 1037 1038 1039 1040 WinRegisterClass(hab, 1041 1042 1043 WinRegisterClass(hab, 1044 1045 1046 1047 1048 WinRegisterClass(hab, 1049 1050 1051 1052 1053 WinRegisterClass(hab, 1054 1055 1056 1057 953 WC_MAINWND, 954 MainWndProc, 955 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 8); 956 WinRegisterClass(hab, 957 WC_MAINWND2, 958 MainWndProc2, 959 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 4); 960 WinRegisterClass(hab, 961 WC_TREECONTAINER, 962 TreeClientWndProc, 963 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); 964 WinRegisterClass(hab, 965 WC_DIRCONTAINER, 966 DirClientWndProc, 967 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); 968 WinRegisterClass(hab, 969 WC_COLLECTOR, 970 CollectorClientWndProc, 971 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); 972 WinRegisterClass(hab, 973 WC_ARCCONTAINER, 974 ArcClientWndProc, 975 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); 976 WinRegisterClass(hab, 977 WC_MLEEDITOR, 978 MLEEditorProc, 979 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); 980 WinRegisterClass(hab, 981 WC_INIEDITOR, 982 IniProc, 983 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); 984 WinRegisterClass(hab, 985 WC_TOOLBACK, 986 ToolBackProc, 987 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 988 sizeof(PVOID)); 989 WinRegisterClass(hab, 990 WC_DRIVEBACK, 991 DriveBackProc, 992 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 993 sizeof(PVOID)); 994 WinRegisterClass(hab, 995 WC_SEEALL, 996 SeeAllWndProc, 997 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID)); 998 WinRegisterClass(hab, 999 WC_NEWVIEW, 1000 ViewWndProc, 1001 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID)); 1002 WinRegisterClass(hab, 1003 WC_TOOLBUTTONS, 1004 ChildButtonProc, 1005 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1006 sizeof(PVOID)); 1007 WinRegisterClass(hab, 1008 WC_DRIVEBUTTONS, 1009 DriveProc, 1010 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1011 sizeof(PVOID)); 1012 WinRegisterClass(hab, 1013 WC_BUBBLE, 1014 BubbleProc, 1015 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1016 sizeof(ULONG) * 2); 1017 WinRegisterClass(hab, 1018 WC_STATUS, 1019 StatusProc, 1020 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1021 sizeof(ULONG)); 1022 WinRegisterClass(hab, 1023 WC_DIRSTATUS, 1024 DirTextProc, 1025 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1026 sizeof(ULONG)); 1027 WinRegisterClass(hab, 1028 WC_TREESTATUS, 1029 TreeStatProc, 1030 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1031 sizeof(ULONG)); 1032 WinRegisterClass(hab, 1033 WC_ARCSTATUS, 1034 ArcTextProc, 1035 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1036 sizeof(ULONG)); 1037 WinRegisterClass(hab, 1038 WC_COLSTATUS, 1039 CollectorTextProc, 1040 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1041 sizeof(ULONG)); 1042 WinRegisterClass(hab, 1043 WC_SEESTATUS, 1044 SeeStatusProc, 1045 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1046 sizeof(ULONG)); 1047 WinRegisterClass(hab, 1048 WC_VIEWSTATUS, 1049 ViewStatusProc, 1050 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1051 sizeof(ULONG)); 1052 WinRegisterClass(hab, 1053 WC_ERRORWND, 1054 NotifyWndProc, 1055 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1056 sizeof(PVOID)); 1057 WinRegisterClass(hab, 1058 WC_MINITIME, 1059 MiniTimeProc, 1060 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1061 sizeof(PVOID) * 2); 1062 WinRegisterClass(hab, 1063 WC_DATABAR, 1064 DataProc, CS_SIZEREDRAW, sizeof(PVOID)); 1065 WinRegisterClass(hab, 1066 WC_TREEOPENBUTTON, 1067 OpenButtonProc, 1068 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1069 sizeof(PVOID)); 1070 WinRegisterClass(hab, 1071 WC_AUTOVIEW, 1072 AutoViewProc, 1073 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1074 sizeof(PVOID)); 1075 WinRegisterClass(hab, 1076 WC_LED, 1077 LEDProc, 1078 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1079 sizeof(PVOID)); 1058 1080 1059 1081 /* … … 1094 1116 1095 1117 DosQueryCtryInfo(sizeof(CtryInfo), &Country, 1096 1118 &CtryInfo, &ulInfoLen); 1097 1119 *ThousandsSeparator = CtryInfo.szThousandsSeparator[0]; 1098 1120 } … … 1109 1131 if (!MaxComLineChecked) { 1110 1132 ret = saymsg(MB_YESNO, 1111 1112 1113 1133 HWND_DESKTOP, 1134 NullStr, 1135 GetPString(IDS_CHANGECMDLINELENGTHDEFAULT)); 1114 1136 if (ret == MBID_YES) 1115 1137 MaxComLineStrg = 1024; 1116 1138 MaxComLineChecked = TRUE; 1117 1139 PrfWriteProfileData(fmprof, appname, "MaxComLineChecked", &MaxComLineChecked, sizeof(BOOL)); … … 1181 1203 size = sizeof(BOOL); 1182 1204 PrfQueryProfileData(fmprof, FM3Str, "Prnformfeedbefore", 1183 1205 &prnformfeedbefore, &size); 1184 1206 size = sizeof(BOOL); 1185 1207 PrfQueryProfileData(fmprof, FM3Str, 1186 1208 "Prnformfeedafter",&prnformfeedafter, &size); 1187 1209 size = sizeof(ULONG); 1188 1210 PrfQueryProfileData(fmprof, FM3Str, "Prntabspaces", &prntabspaces, &size); … … 1209 1231 size = sizeof(BOOL); 1210 1232 PrfQueryProfileData(fmprof, appname, "SwitchTreeExpand", 1211 1233 &fSwitchTreeExpand, &size); 1212 1234 size = sizeof(BOOL); 1213 1235 PrfQueryProfileData(fmprof, appname, "SwitchTreeOnFocus", 1214 1236 &fSwitchTreeOnFocus, &size); 1215 1237 size = sizeof(BOOL); 1216 1238 PrfQueryProfileData(fmprof, appname, "CollapseFirst", 1217 1239 &fCollapseFirst, &size); 1218 1240 size = sizeof(BOOL); 1219 1241 PrfQueryProfileData(fmprof, appname, "FilesInTree", 1220 1242 &fFilesInTree, &size); 1221 1243 size = sizeof(BOOL); 1222 1244 PrfQueryProfileData(fmprof, FM3Str, "TopDir", &fTopDir, &size); … … 1224 1246 PrfQueryProfileData(fmprof, FM3Str, "LookInDir", &fLookInDir, &size); 1225 1247 PrfQueryProfileString(fmprof, appname, "DefArc", NULL, szDefArc, 1226 1248 sizeof(szDefArc)); 1227 1249 size = sizeof(ULONG); 1228 1250 PrfQueryProfileData(fmprof, FM3Str, "AutoviewHeight", 1229 1251 &AutoviewHeight, &size); 1230 1252 size = sizeof(BOOL); 1231 1253 PrfQueryProfileData(fmprof, FM3Str, "KeepCmdLine", &fKeepCmdLine, &size); … … 1259 1281 size = sizeof(BOOL); 1260 1282 PrfQueryProfileData(fmprof, appname, "SelectedAlways", 1261 1283 &fSelectedAlways, &size); 1262 1284 size = sizeof(BOOL); 1263 1285 PrfQueryProfileData(fmprof, FM3Str, "ToolbarHelp", &fToolbarHelp, &size); … … 1270 1292 size = sizeof(BOOL); 1271 1293 PrfQueryProfileData(fmprof, appname, 1272 1294 "AutoAddAllDirs", &fAutoAddAllDirs, &size); 1273 1295 size = sizeof(BOOL); 1274 1296 PrfQueryProfileData(fmprof, FM3Str, "UserListSwitches", 1275 1297 &fUserListSwitches, &size); 1276 1298 size = sizeof(BOOL); 1277 1299 PrfQueryProfileData(fmprof, appname, "UseNewViewer", 1278 1300 &fUseNewViewer, &size); 1279 1301 size = sizeof(BOOL); 1280 1302 PrfQueryProfileData(fmprof, appname, "DefaultDeletePerm", 1281 1303 &fDefaultDeletePerm, &size); 1282 1304 size = sizeof(BOOL); 1283 1305 PrfQueryProfileData(fmprof, FM3Str, "ExternalINIs", 1284 1306 &fExternalINIs, &size); 1285 1307 size = sizeof(BOOL); 1286 1308 PrfQueryProfileData(fmprof, FM3Str, "ExternalCollector", 1287 1309 &fExternalCollector, &size); 1288 1310 size = sizeof(BOOL); 1289 1311 PrfQueryProfileData(fmprof, FM3Str, "ExternalArcboxes", 1290 1312 &fExternalArcboxes, &size); 1291 1313 size = sizeof(BOOL); 1292 1314 PrfQueryProfileData(fmprof, FM3Str, "ExternalViewer", 1293 1315 &fExternalViewer, &size); 1294 1316 size = sizeof(BOOL); 1295 1317 PrfQueryProfileData(fmprof, FM3Str, "UseQProcStat", 1296 1318 &fUseQProcStat, &size); 1297 1319 size = sizeof(BOOL); 1298 1320 PrfQueryProfileData(fmprof, FM3Str, "UseQSysState", 1299 1321 &fUseQSysState, &size); 1300 1322 size = sizeof(BOOL); 1301 1323 PrfQueryProfileData(fmprof, FM3Str, "DataMin", &fDataMin, &size); … … 1304 1326 size = sizeof(BOOL); 1305 1327 PrfQueryProfileData(fmprof, appname, "DataShowDrives", 1306 1328 &fDataShowDrives, &size); 1307 1329 size = sizeof(BOOL); 1308 1330 PrfQueryProfileData(fmprof, appname, "DataInclRemote", 1309 1331 &fDataInclRemote, &size); 1310 1332 size = sizeof(BOOL); 1311 1333 PrfQueryProfileData(fmprof, FM3Str, "SplitStatus", &fSplitStatus, &size); 1312 1334 size = sizeof(BOOL); 1313 1335 PrfQueryProfileData(fmprof, appname, "FolderAfterExtract", 1314 1336 &fFolderAfterExtract, &size); 1315 1337 size = sizeof(BOOL); 1316 1338 PrfQueryProfileData(fmprof, FM3Str, "DullDatabar", &fDullMin, &size); … … 1319 1341 size = sizeof(BOOL); 1320 1342 PrfQueryProfileData(fmprof, appname, "ConfirmDelete", 1321 1343 &fConfirmDelete, &size); 1322 1344 size = sizeof(BOOL); 1323 1345 PrfQueryProfileData(fmprof, FM3Str, "SaveState", &fSaveState, &size); … … 1359 1381 size = sizeof(INT); 1360 1382 PrfQueryProfileData(fmprof, appname, 1361 1383 "CollectorSort", &CollectorsortFlags, &size); 1362 1384 size = sizeof(targetdir); 1363 1385 PrfQueryProfileData(fmprof, appname, "Targetdir", targetdir, &size); … … 1370 1392 size = MaxComLineStrg; 1371 1393 PrfQueryProfileData(fmprof, appname, "DirCompare", dircompare, 1372 1394 &size); 1373 1395 size = MaxComLineStrg; 1374 1396 PrfQueryProfileData(fmprof, appname, "Viewer", viewer, &size); … … 1405 1427 size = sizeof(lasttoolbar); 1406 1428 PrfQueryProfileData(fmprof, appname, "LastToolbar", lasttoolbar, 1407 1429 &size); 1408 1430 size = sizeof(BOOL); 1409 1431 PrfQueryProfileData(fmprof, appname, "LibPathStrictHttpRun", &fLibPathStrictHttpRun, 1410 1432 &size); 1411 1433 size = sizeof(BOOL); 1412 1434 PrfQueryProfileData(fmprof, appname, "LibPathStrictFtpRun", &fLibPathStrictFtpRun, 1413 1435 &size); 1414 1436 size = sizeof(BOOL); 1415 1437 PrfQueryProfileData(fmprof, appname, "LibPathStrictMailRun", &fLibPathStrictMailRun, 1416 1438 &size); 1417 1439 size = sizeof(BOOL); 1418 1440 PrfQueryProfileData(fmprof, appname, "NoMailtoMailRun", &fNoMailtoMailRun, 1419 1441 &size); 1420 1442 size = sizeof(BOOL); 1421 1443 PrfQueryProfileData(fmprof, appname, "FollowTree", &fFollowTree, 1422 1444 &size); 1423 1445 size = sizeof(BOOL); 1424 1446 PrfQueryProfileData(fmprof, appname, "StartMaximized", 1425 1447 &fStartMaximized, &size); 1426 1448 if (!fStartMaximized) { 1427 1449 size = sizeof(BOOL); 1428 1450 PrfQueryProfileData(fmprof, appname, "StartMinimized", 1429 1451 &fStartMinimized, &size); 1430 1452 } 1431 1453 size = sizeof(BOOL); … … 1435 1457 size = sizeof(BOOL); 1436 1458 PrfQueryProfileData(fmprof, appname, "ArcStuffVisible", 1437 1459 &fArcStuffVisible, &size); 1438 1460 size = sizeof(BOOL); 1439 1461 PrfQueryProfileData(fmprof, FM3Str, "NoTreeGap", &fNoTreeGap, &size); 1440 1462 size = sizeof(BOOL); 1441 1463 PrfQueryProfileData(fmprof, FM3Str, "VTreeOpensWPS", 1442 1464 &fVTreeOpensWPS, &size); 1443 1465 size = sizeof(BOOL); 1444 1466 PrfQueryProfileData(fmprof, appname, "RemoteBug", &fRemoteBug, &size); 1445 1467 size = sizeof(BOOL); 1446 1468 PrfQueryProfileData(fmprof, appname, "Drag&DropDlg", 1447 1469 &fDragndropDlg, &size); 1448 1470 size = sizeof(BOOL); 1449 1471 PrfQueryProfileData(fmprof, FM3Str, "UserComboBox", &fUserComboBox, &size); … … 1452 1474 size = sizeof(BOOL); 1453 1475 PrfQueryProfileData(fmprof, appname, "QuickArcFind", 1454 1476 &fQuickArcFind, &size); 1455 1477 size = sizeof(BOOL); 1456 1478 PrfQueryProfileData(fmprof, FM3Str, "NoRemovableScan", 1457 1479 &fNoRemovableScan, &size); 1458 1480 size = sizeof(ULONG); 1459 1481 PrfQueryProfileData(fmprof, FM3Str, "NoBrokenNotify", 1460 1482 &NoBrokenNotify, &size); 1461 1483 size = sizeof(ULONG); 1462 1484 PrfQueryProfileData(fmprof, appname, "ContainerType", &ulCnrType, 1463 1485 &size); 1464 1486 size = sizeof(ULONG); 1465 1487 PrfQueryProfileData(fmprof, appname, "FilesToGet", &FilesToGet, &size); … … 1544 1566 if (*argv[x] == '-') { 1545 1567 if (!argv[x][1]) 1546 1568 fNoSaveState = TRUE; 1547 1569 else 1548 1570 strcpy(profile, &argv[x][1]); 1549 1571 } 1550 1572 } 1551 1573 1552 1574 hwndFrame = WinCreateStdWindow(HWND_DESKTOP, 1553 1554 1555 1556 1557 1558 1575 WS_VISIBLE, 1576 &FrameFlags, 1577 WC_MAINWND, 1578 NULL, 1579 WS_VISIBLE | WS_ANIMATE, 1580 FM3ModHandle, MAIN_FRAME, &hwndClient); 1559 1581 if (hwndFrame) { 1560 1582 WinSetWindowUShort(hwndFrame, QWS_ID, MAIN_FRAME); … … 1573 1595 rcl.xRight -= bsz; 1574 1596 WinSetWindowPos(hwndFrame, 1575 1576 1577 1578 1597 HWND_TOP, 1598 rcl.xLeft, 1599 rcl.yBottom, 1600 rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, fl); 1579 1601 } 1580 1602 if (fLogFile) … … 1594 1616 ULONG l; 1595 1617 // CHAR buffer[80]; 1596 CHAR buffer[4096]; 1618 CHAR buffer[4096]; // 06 Oct 07 SHL Protect against NTFS defect 1597 1619 BOOL ret = FALSE; 1598 1620 1599 1621 DosError(FERR_DISABLEHARDERR); 1600 1622 if (DosOpen(filespec, 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1623 &handle, 1624 &action, 1625 0, 1626 0, 1627 OPEN_ACTION_FAIL_IF_NEW | 1628 OPEN_ACTION_OPEN_IF_EXISTS, 1629 OPEN_FLAGS_FAIL_ON_ERROR | 1630 OPEN_FLAGS_NOINHERIT | 1631 OPEN_FLAGS_RANDOMSEQUENTIAL | 1632 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0)) 1611 1633 ret = FALSE; 1612 1634 else { … … 1615 1637 l = min(l, 79); 1616 1638 if (!DosChgFilePtr(handle, 1617 1618 1619 1639 abs(offset), 1640 (offset >= 0) ? 1641 FILE_BEGIN : FILE_END, &len)) { 1620 1642 if (!DosRead(handle, buffer, l, &len) && len == l) { 1621 1622 ret = TRUE;// Matched1643 if (!memcmp(signature, buffer, l)) 1644 ret = TRUE; // Matched 1623 1645 } 1624 1646 } 1625 1647 } 1626 DosClose(handle); 1627 return ret; 1648 DosClose(handle); /* Either way, we're done for now */ 1649 return ret; /* Return TRUE if matched */ 1628 1650 } 1629 1651
Note:
See TracChangeset
for help on using the changeset viewer.