Changeset 1335 for trunk/dll/init.c
- Timestamp:
- Dec 13, 2008, 12:49:02 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/init.c
r1333 r1335 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 … … 54 54 20 Jul 08 JBS Ticket 114: Support user-selectable env. strings in Tree container. 55 55 20 Jul 08 GKY Add support to delete orphaned tmp directories without deleting tmp of other 56 56 running sessions 57 57 23 Aug 08 GKY Check that space on TMP & FM2 save drives exceed 5 GiB; Done to allow user setting of 58 58 minimum size in future 59 59 29 Nov 08 GKY Remove or replace with a mutex semaphore DosEnterCriSec where appropriate. 60 60 30 Nov 08 GKY Add the option of creating a subdirectory from the arcname 61 for the extract path to arc container. 61 for the extract path to arc container. 62 10 Dec 08 SHL Integrate exception handler support 62 63 63 64 ***********************************************************************/ … … 66 67 #include <string.h> 67 68 #include <share.h> 68 #include <process.h> 69 #include <process.h> // getpid 69 70 #include <time.h> 70 71 #include <ctype.h> … … 108 109 #include "autoview.h" // AutoViewProc 109 110 #include "mainwnd.h" // BubbleProc, ChildButtonProc, DriveBackProc, 110 111 111 // DriveProc, LEDProc, MainWndProc, StatusProc 112 // ToolBackProc 112 113 #include "collect.h" // CollectorClientWndProc, CollectorTextProc 113 114 #include "getnames.h" // CustomFileDlg … … 134 135 #include "srchpath.h" // searchpath 135 136 #include "fortify.h" 137 #include "excputil.h" // xbeginthread 136 138 137 139 #ifdef __IBMC__ … … 258 260 nm = 1; 259 261 rc = DosFindFirst(SwapperDat, 260 261 262 263 262 &hdir, 263 FILE_NORMAL | FILE_ARCHIVED | 264 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, 265 &ffb, sizeof(ffb), &nm, FIL_STANDARDL); 264 266 if (rc && rc != ERROR_FILE_NOT_FOUND && rc != ERROR_PATH_NOT_FOUND) { 265 267 FILEFINDBUF3 ffb; 266 268 rc = DosFindFirst(SwapperDat, 267 268 269 270 269 &hdir, 270 FILE_NORMAL | FILE_ARCHIVED | 271 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, 272 &ffb, sizeof(ffb), &nm, FIL_STANDARD); 271 273 fNoLargeFileSupport = TRUE; 272 274 } … … 275 277 fp = fopen(SwapperDat, "r"); 276 278 if (fp) { 277 278 279 279 fclose(fp); 280 *SwapperDat = 0; 281 rc = 1; // Force config.sys scan 280 282 } 281 283 } … … 286 288 if (rc) { 287 289 if (DosQuerySysInfo(QSV_BOOT_DRIVE, 288 289 290 290 QSV_BOOT_DRIVE, 291 &nm, 292 sizeof(ULONG))) { 291 293 nm = 3; // Assume drive C: 292 294 } … … 295 297 if (fp) { 296 298 while (!feof(fp)) { 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 299 if (!xfgets(input, sizeof(input), fp, pszSrcFile, __LINE__)) 300 break; 301 lstrip(input); 302 if (!strnicmp(input, "SWAPPATH", 8)) { 303 p = input + 8; 304 while (*p == ' ') 305 p++; 306 if (*p == '=') { 307 p++; 308 stripcr(p); 309 rstrip(p); 310 while (*p == ' ') 311 p++; 312 if (*p == '\"') { 313 p++; 314 pp = p; 315 while (*pp && *pp != '\"') 316 *pp += 1; 317 if (*pp) 318 *pp = 0; 319 } 320 else { 321 pp = strchr(p, ' '); 322 if (pp) 323 *pp = 0; 324 } 325 if (*p) { 326 strncpy(SwapperDat, p, CCHMAXPATH); 327 SwapperDat[CCHMAXPATH - 1] = 0; 328 BldFullPathName(SwapperDat, SwapperDat, "SWAPPER.DAT"); 329 hdir = HDIR_CREATE; 330 nm = 1; 331 rc = DosFindFirst(SwapperDat, 332 &hdir, 333 FILE_NORMAL | FILE_ARCHIVED | 334 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, 335 &ffb, sizeof(ffb), &nm, FIL_STANDARD); 336 if (rc){ 337 FILEFINDBUF3 ffb; 338 rc = DosFindFirst(SwapperDat, 339 &hdir, 340 FILE_NORMAL | FILE_ARCHIVED | 341 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, 342 &ffb, sizeof(ffb), &nm, FIL_STANDARD); 343 fNoLargeFileSupport = TRUE; 344 } 345 if (!rc) { 346 DosFindClose(hdir); 347 PrfWriteProfileString(fmprof, 348 FM3Str, "SwapperDat", SwapperDat); 349 } 350 else 351 *SwapperDat = 0; 352 break; 353 } 354 } 355 } // if SWAPPATH 354 356 } // while 355 357 fclose(fp); … … 361 363 362 364 unsigned APIENTRY LibMain(unsigned hModule, 363 365 unsigned ulFlag) 364 366 { 365 367 CHAR *env; … … 380 382 rc = DosQueryPathInfo(env, FIL_STANDARD, &fsa, sizeof(fsa)); 381 383 if (!rc) { 382 383 384 385 386 387 384 if (fsa.attrFile & FILE_DIRECTORY) { 385 BldFullPathName(stringfile, env, "FM3RES.STR"); 386 DosError(FERR_DISABLEHARDERR); 387 if (DosQueryPathInfo(stringfile, FIL_STANDARD, &fsa, sizeof(fsa))) 388 strcpy(stringfile, "FM3RES.STR"); 389 } 388 390 } 389 391 } … … 475 477 476 478 unsigned long _System _DLL_InitTerm(unsigned long hModule, 477 479 unsigned long ulFlag) 478 480 { 479 481 CHAR *env; … … 493 495 rc = DosQueryPathInfo(env, FIL_STANDARD, &fsa, sizeof(fsa)); 494 496 if (!rc) { 495 496 497 498 499 500 497 if (fsa.attrFile & FILE_DIRECTORY) { 498 BldFullPathName(stringfile, env, "FM3RES.STR"); 499 DosError(FERR_DISABLEHARDERR); 500 if (DosQueryPathInfo(stringfile, FIL_STANDARD, &fsa, sizeof(fsa))) 501 strcpy(stringfile, "FM3RES.STR"); 502 } 501 503 } 502 504 } … … 629 631 num_matches = 1L; 630 632 if (!DosFindFirst(s, 631 632 633 634 635 633 &search_handle, 634 FILE_NORMAL | FILE_DIRECTORY | 635 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN | 636 FILE_ARCHIVED, 637 &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) { 636 638 do { 637 638 639 640 641 642 643 639 strcpy(enddir, ffb.achName); 640 if (ffb.attrFile & FILE_DIRECTORY) { 641 wipeallf("%s\\*", s); 642 DosDeleteDir(s); 643 } 644 else 645 unlinkf("%s", s); 644 646 } 645 647 while (!DosFindNext(search_handle, 646 648 &ffb, sizeof(ffb), &num_matches)); 647 649 DosFindClose(search_handle); 648 650 } … … 660 662 num_matches = 1; 661 663 if (!DosFindFirst(s, 662 663 664 665 666 664 &search_handle, 665 FILE_NORMAL | FILE_DIRECTORY | 666 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN | 667 FILE_ARCHIVED, 668 &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) { 667 669 do { 668 670 if (!(ffb.attrFile & FILE_DIRECTORY)) { 669 670 671 strcpy(enddir, ffb.achName); 672 unlinkf("%s", s); 671 673 } 672 674 } 673 675 while (!DosFindNext(search_handle, 674 676 &ffb, sizeof(ffb), &num_matches)); 675 677 DosFindClose(search_handle); 676 678 } … … 710 712 if (!StringsLoaded()) { 711 713 saymsg(MB_ENTER, 712 713 714 715 714 HWND_DESKTOP, 715 "Error", 716 "FM3RES.STR isn't in right format, at least " 717 "for this version of FM/2."); 716 718 return FALSE; 717 719 } … … 724 726 if (!rc) { 725 727 if (fs3.attrFile & FILE_DIRECTORY) { 726 727 728 729 728 BldFullPathName(dllfile, env, "FM3RES"); // 23 Aug 07 SHL 729 DosError(FERR_DISABLEHARDERR); 730 if (DosQueryPathInfo(dllfile, FIL_STANDARD, &fs3, sizeof(fs3))) 731 strcpy(dllfile, "FM3RES"); 730 732 } 731 733 } … … 734 736 if (rcl) { 735 737 saymsg(MB_CANCEL | MB_ICONEXCLAMATION, 736 737 738 HWND_DESKTOP, 739 GetPString(IDS_ERRORTEXT), GetPString(IDS_FM3RESERROR1TEXT)); 738 740 return FALSE; 739 741 } … … 742 744 if (rc) { 743 745 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 744 746 "DosExitList"); 745 747 } 746 748 rcq = DosQueryProcAddr(FM3ModHandle, 1, "ResVersion", &pfnResVersion); … … 750 752 if (RVMajor < VERMAJOR || (RVMajor == VERMAJOR && RVMinor < VERMINOR)) { 751 753 saymsg(MB_ENTER, 752 753 754 755 756 757 758 759 754 HWND_DESKTOP, 755 GetPString(IDS_ERRORTEXT), 756 GetPString(IDS_FM3RESERROR2TEXT), 757 !rcq ? 758 GetPString(IDS_FM3RESERROR3TEXT) : 759 !rcl ? 760 GetPString(IDS_FM3RESERROR4TEXT) : 761 GetPString(IDS_FM3RESERROR5TEXT), RVMajor, RVMinor, rcl, rcq, ret); 760 762 return FALSE; 761 763 } … … 775 777 DosSetMaxFH(100); 776 778 else if (!strcmp(appname, "VDir") || 777 778 779 779 !strcmp(appname, "VTree") || 780 !strcmp(appname, "VCollect") || 781 !strcmp(appname, "SEEALL") || !strcmp(appname, "FM/4")) 780 782 DosSetMaxFH(60); 781 783 else … … 783 785 784 786 if (DosQuerySysInfo(QSV_VERSION_MAJOR, 785 786 787 787 QSV_VERSION_MINOR, 788 OS2ver, 789 sizeof(OS2ver))) { 788 790 OS2ver[0] = 2; 789 791 OS2ver[1] = 1; … … 805 807 strcpy(szTempName, env); 806 808 if (szTempName[strlen(szTempName) - 1] != '\\') 807 809 strcat(szTempName, "\\"); 808 810 enddir = &szTempName[strlen(szTempName)]; 809 811 strcat(szTempName, "$FM2????."); … … 812 814 num_matches = 1; 813 815 if (!DosFindFirst(szTempName, 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 816 &search_handle, 817 FILE_NORMAL | FILE_DIRECTORY | 818 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN | 819 FILE_ARCHIVED, 820 &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) { 821 do { 822 strcpy(enddir, ffb.achName); 823 p = strrchr(szTempName, '.'); 824 if (p) { 825 p++; 826 ul = strtol(p, &p + 2, 16); 827 GetDosPgmName(ul, temp); 828 if (!strstr(temp, "FM/2") && 829 !strstr(temp, "AV/2")) { 830 wipeallf("%s\\*", szTempName); 831 DosDeleteDir(szTempName); 832 } 833 } 834 } 833 835 while (!DosFindNext(search_handle, 834 836 &ffb, sizeof(ffb), &num_matches)); 835 837 DosFindClose(search_handle); 836 838 } 837 839 if (fs3.attrFile & FILE_DIRECTORY) { 838 839 840 841 842 843 844 840 APIRET ret = 0; 841 strcpy(szTempName, env); 842 MakeTempName(szTempName, NULL, 1); 843 ret = DosCreateDir(szTempName, 0); 844 if (!ret) { //check writable 845 pTmpDir = xstrdup(szTempName, pszSrcFile, __LINE__); 846 } 845 847 } 846 848 } … … 858 860 if (pTmpDir && CheckDriveSpaceAvail(pTmpDir, ullTmpSpaceNeeded, 0) == 1) { 859 861 if (CheckDriveSpaceAvail(pFM2SaveDirectory, ullTmpSpaceNeeded, 0) == 0){ 860 861 862 863 864 865 866 862 ret = saymsg(MB_YESNO, 863 HWND_DESKTOP, 864 NullStr, 865 GetPString(IDS_TMPDRIVESPACELIMITED), 866 pTmpDir); 867 if (ret == MBID_YES) 868 pTmpDir = pFM2SaveDirectory; 867 869 } 868 870 else 869 870 871 872 873 874 871 saymsg(MB_OK, 872 HWND_DESKTOP, 873 NullStr, 874 GetPString(IDS_SAVETMPDRIVESPACELIMITED), 875 pTmpDir, 876 pFM2SaveDirectory); 875 877 } 876 878 else if (CheckDriveSpaceAvail(pFM2SaveDirectory, ullTmpSpaceNeeded, 0) == 1) 877 879 saymsg(MB_OK, 878 879 880 881 880 HWND_DESKTOP, 881 NullStr, 882 GetPString(IDS_SAVEDRIVESPACELIMITED), 883 pFM2SaveDirectory); 882 884 } 883 885 BldFullPathName(ArcTempRoot, pTmpDir, fAmAV2 ? "$AV$ARC$" : "$FM$ARC$"); … … 889 891 890 892 /* _heapmin() is done in a separate thread -- start it */ 891 if (_beginthread(HeapThread, NULL, 32768, NULL) == -1) { 892 Runtime_Error(pszSrcFile, __LINE__, 893 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 893 if (xbeginthread(HeapThread, 894 32768, 895 MPVOID, 896 pszSrcFile, 897 __LINE__) == -1) { 894 898 return FALSE; 895 899 } … … 898 902 if (!StartTimer()) { 899 903 Runtime_Error(pszSrcFile, __LINE__, 900 904 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 901 905 return FALSE; 902 906 } … … 905 909 env = getenv("WORKPLACE_PROCESS"); 906 910 fWorkPlace = env != NULL && 907 911 (stricmp(env, "YES") == 0 || atoi(env) == 1); 908 912 909 913 if ((!strchr(profile, '\\') && !strchr(profile, ':')) || … … 924 928 rc = DosQueryPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3)); 925 929 if (!rc) { 926 927 930 if (fs3.attrFile & FILE_DIRECTORY) 931 BldFullPathName(inipath, inipath, profile); 928 932 } 929 933 } … … 931 935 env = searchpath(profile); 932 936 if (!env) 933 937 env = profile; 934 938 strcpy(inipath, env); 935 939 } … … 948 952 else { 949 953 if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) { 950 951 952 953 954 955 956 957 958 954 saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING, 955 "Check INI header failed will attempt to replace with backup \\ 956 if backup fails or not found will open with new ini"); 957 DosCopy("FM3.INI", "FM3INI.BAD", DCPY_EXISTING); 958 DosCopy("FM3INI.BAK", "FM3.INI", DCPY_EXISTING); 959 if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) { 960 DosCopy("FM3.INI", "FM3INI2.BAD", DCPY_EXISTING); 961 fWantFirstTimeInit = TRUE; 962 } 959 963 } 960 964 if (!fWantFirstTimeInit) { 961 962 963 964 965 966 967 968 969 965 fIniExisted = TRUE; 966 if (fs3.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) { 967 fs3.attrFile &= ~(FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM); 968 rc = xDosSetPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3), 0); 969 if (rc) { 970 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 971 GetPString(IDS_INIREADONLYTEXT), inipath); 972 } 973 } 970 974 } 971 975 } … … 980 984 if (!fmprof) { 981 985 Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__, 982 986 "PrfOpenProfile"); 983 987 return FALSE; 984 988 } … … 989 993 size = sizeof(BOOL); 990 994 PrfQueryProfileData(fmprof, 991 992 993 994 995 FM3Str, 996 "SeparateParms", 997 &fSeparateParms, 998 &size); 995 999 if (!fSeparateParms) 996 1000 strcpy(appname, FM3Str); … … 1018 1022 rc = DosQueryPathInfo(helppath, FIL_STANDARD, &fs3, sizeof(fs3)); 1019 1023 if (!rc) { 1020 1021 1022 1023 1024 1024 if (fs3.attrFile & FILE_DIRECTORY) { 1025 BldFullPathName(helppath, helppath, "FM3.HLP"); 1026 hini.pszHelpLibraryName = helppath; 1027 hwndHelp = WinCreateHelpInstance(hab, &hini); 1028 } 1025 1029 } 1026 1030 } … … 1028 1032 if (!hwndHelp) { 1029 1033 saymsg(MB_ENTER | MB_ICONEXCLAMATION, 1030 1031 1032 1033 1034 HWND_DESKTOP, 1035 GetPString(IDS_FM2TROUBLETEXT), 1036 GetPString(IDS_CANTLOADHELPTEXT), 1037 GetPString(IDS_NOHELPACCEPTTEXT)); 1034 1038 } 1035 1039 … … 1057 1061 /* register window classes we use */ 1058 1062 WinRegisterClass(hab, 1059 1060 1061 1062 WinRegisterClass(hab, 1063 1064 1065 1066 WinRegisterClass(hab, 1067 1068 1069 1070 WinRegisterClass(hab, 1071 1072 1073 1074 WinRegisterClass(hab, 1075 1076 1077 1078 WinRegisterClass(hab, 1079 1080 1081 1082 WinRegisterClass(hab, 1083 1084 1085 1086 WinRegisterClass(hab, 1087 1088 1089 1090 WinRegisterClass(hab, 1091 1092 1093 1094 1095 WinRegisterClass(hab, 1096 1097 1098 1099 1100 WinRegisterClass(hab, 1101 1102 1103 1104 WinRegisterClass(hab, 1105 1106 1107 1108 WinRegisterClass(hab, 1109 1110 1111 1112 1113 WinRegisterClass(hab, 1114 1115 1116 1117 1118 WinRegisterClass(hab, 1119 1120 1121 1122 1123 WinRegisterClass(hab, 1124 1125 1126 1127 1128 WinRegisterClass(hab, 1129 1130 1131 1132 1133 WinRegisterClass(hab, 1134 1135 1136 1137 1138 WinRegisterClass(hab, 1139 1140 1141 1142 1143 WinRegisterClass(hab, 1144 1145 1146 1147 1148 WinRegisterClass(hab, 1149 1150 1151 1152 1153 WinRegisterClass(hab, 1154 1155 1156 1157 1158 WinRegisterClass(hab, 1159 1160 1161 1162 1163 WinRegisterClass(hab, 1164 1165 1166 1167 1168 WinRegisterClass(hab, 1169 1170 1171 WinRegisterClass(hab, 1172 1173 1174 1175 1176 WinRegisterClass(hab, 1177 1178 1179 1180 1181 WinRegisterClass(hab, 1182 1183 1184 1185 1063 WC_MAINWND, 1064 MainWndProc, 1065 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 8); 1066 WinRegisterClass(hab, 1067 WC_MAINWND2, 1068 MainWndProc2, 1069 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 4); 1070 WinRegisterClass(hab, 1071 WC_TREECONTAINER, 1072 TreeClientWndProc, 1073 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); 1074 WinRegisterClass(hab, 1075 WC_DIRCONTAINER, 1076 DirClientWndProc, 1077 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); 1078 WinRegisterClass(hab, 1079 WC_COLLECTOR, 1080 CollectorClientWndProc, 1081 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); 1082 WinRegisterClass(hab, 1083 WC_ARCCONTAINER, 1084 ArcClientWndProc, 1085 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); 1086 WinRegisterClass(hab, 1087 WC_MLEEDITOR, 1088 MLEEditorProc, 1089 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); 1090 WinRegisterClass(hab, 1091 WC_INIEDITOR, 1092 IniProc, 1093 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); 1094 WinRegisterClass(hab, 1095 WC_TOOLBACK, 1096 ToolBackProc, 1097 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1098 sizeof(PVOID)); 1099 WinRegisterClass(hab, 1100 WC_DRIVEBACK, 1101 DriveBackProc, 1102 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1103 sizeof(PVOID)); 1104 WinRegisterClass(hab, 1105 WC_SEEALL, 1106 SeeAllWndProc, 1107 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID)); 1108 WinRegisterClass(hab, 1109 WC_NEWVIEW, 1110 ViewWndProc, 1111 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID)); 1112 WinRegisterClass(hab, 1113 WC_TOOLBUTTONS, 1114 ChildButtonProc, 1115 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1116 sizeof(PVOID)); 1117 WinRegisterClass(hab, 1118 WC_DRIVEBUTTONS, 1119 DriveProc, 1120 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1121 sizeof(PVOID)); 1122 WinRegisterClass(hab, 1123 WC_BUBBLE, 1124 BubbleProc, 1125 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1126 sizeof(ULONG) * 2); 1127 WinRegisterClass(hab, 1128 WC_STATUS, 1129 StatusProc, 1130 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1131 sizeof(ULONG)); 1132 WinRegisterClass(hab, 1133 WC_DIRSTATUS, 1134 DirTextProc, 1135 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1136 sizeof(ULONG)); 1137 WinRegisterClass(hab, 1138 WC_TREESTATUS, 1139 TreeStatProc, 1140 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1141 sizeof(ULONG)); 1142 WinRegisterClass(hab, 1143 WC_ARCSTATUS, 1144 ArcTextProc, 1145 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1146 sizeof(ULONG)); 1147 WinRegisterClass(hab, 1148 WC_COLSTATUS, 1149 CollectorTextProc, 1150 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1151 sizeof(ULONG)); 1152 WinRegisterClass(hab, 1153 WC_SEESTATUS, 1154 SeeStatusProc, 1155 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1156 sizeof(ULONG)); 1157 WinRegisterClass(hab, 1158 WC_VIEWSTATUS, 1159 ViewStatusProc, 1160 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1161 sizeof(ULONG)); 1162 WinRegisterClass(hab, 1163 WC_ERRORWND, 1164 NotifyWndProc, 1165 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1166 sizeof(PVOID)); 1167 WinRegisterClass(hab, 1168 WC_MINITIME, 1169 MiniTimeProc, 1170 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1171 sizeof(PVOID) * 2); 1172 WinRegisterClass(hab, 1173 WC_DATABAR, 1174 DataProc, CS_SIZEREDRAW, sizeof(PVOID)); 1175 WinRegisterClass(hab, 1176 WC_TREEOPENBUTTON, 1177 OpenButtonProc, 1178 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1179 sizeof(PVOID)); 1180 WinRegisterClass(hab, 1181 WC_AUTOVIEW, 1182 AutoViewProc, 1183 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1184 sizeof(PVOID)); 1185 WinRegisterClass(hab, 1186 WC_LED, 1187 LEDProc, 1188 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, 1189 sizeof(PVOID)); 1186 1190 1187 1191 if (DosCreateMutexSem(NULL, &hmtxFM2Globals, 0L, FALSE)) 1188 1192 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 1189 1193 "DosCreateMutexSem"); 1190 1194 if (DosCreateMutexSem(NULL, &hmtxFM2Delete, 0L, FALSE)) 1191 1195 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 1192 1196 "DosCreateMutexSem"); 1193 1197 1194 1198 /* … … 1229 1233 1230 1234 DosQueryCtryInfo(sizeof(CtryInfo), &Country, 1231 1235 &CtryInfo, &ulInfoLen); 1232 1236 *ThousandsSeparator = CtryInfo.szThousandsSeparator[0]; 1233 1237 } … … 1244 1248 if (!MaxComLineChecked) { 1245 1249 ret = saymsg(MB_YESNO, 1246 1247 1248 1250 HWND_DESKTOP, 1251 NullStr, 1252 GetPString(IDS_CHANGECMDLINELENGTHDEFAULT)); 1249 1253 if (ret == MBID_YES) 1250 1254 MaxComLineStrg = 1024; 1251 1255 MaxComLineChecked = TRUE; 1252 1256 PrfWriteProfileData(fmprof, appname, "MaxComLineChecked", &MaxComLineChecked, sizeof(BOOL)); … … 1355 1359 size = sizeof(ULONG); 1356 1360 PrfQueryProfileData(fmprof, FM3Str, "AutoviewHeight", 1357 1361 &AutoviewHeight, &size); 1358 1362 size = sizeof(BOOL); 1359 1363 PrfQueryProfileData(fmprof, FM3Str, "KeepCmdLine", &fKeepCmdLine, &size); … … 1375 1379 PrfQueryProfileData(fmprof, appname, "ShowEnv", &fShowEnv, &size); 1376 1380 PrfQueryProfileString(fmprof, appname, "TreeEnvVarList", "PATH;DPATH;LIBPATH;HELP;BOOKSHELF;", 1377 1381 pszTreeEnvVarList, MaxComLineStrg); 1378 1382 size = sizeof(BOOL); 1379 1383 PrfQueryProfileData(fmprof, appname, "LeaveTree", &fLeaveTree, &size); … … 1445 1449 size = sizeof(ULONG); 1446 1450 if (PrfQueryProfileData(fmprof, 1447 1451 FM3Str, szKey, (PVOID) &numsaves, &size)) { 1448 1452 for (x = numsaves - 1; x >= 0; x--) { 1449 1450 1451 1452 1453 1454 1453 sprintf(szKey, "%s.DirCnrDir.%lu", GetPString(IDS_SHUTDOWNSTATE), x); 1454 size = sizeof(szDir); 1455 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) { 1456 drvNum = toupper(*szDir) - 'A'; 1457 fDrivetoSkip[drvNum] = TRUE; 1458 } 1455 1459 } 1456 1460 } … … 1646 1650 if (*argv[x] == '-') { 1647 1651 if (!argv[x][1]) 1648 1652 fNoSaveState = TRUE; 1649 1653 else 1650 1654 strcpy(profile, &argv[x][1]); 1651 1655 } 1652 1656 } 1653 1657 1654 1658 hwndFrame = WinCreateStdWindow(HWND_DESKTOP, 1655 1656 1657 1658 1659 1660 1659 WS_VISIBLE, 1660 &FrameFlags, 1661 WC_MAINWND, 1662 NULL, 1663 WS_VISIBLE | WS_ANIMATE, 1664 FM3ModHandle, MAIN_FRAME, &hwndClient); 1661 1665 if (hwndFrame) { 1662 1666 WinSetWindowUShort(hwndFrame, QWS_ID, MAIN_FRAME); … … 1675 1679 rcl.xRight -= bsz; 1676 1680 WinSetWindowPos(hwndFrame, 1677 1678 1679 1680 1681 HWND_TOP, 1682 rcl.xLeft, 1683 rcl.yBottom, 1684 rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, fl); 1681 1685 } 1682 1686 if (fLogFile) … … 1701 1705 DosError(FERR_DISABLEHARDERR); 1702 1706 if (DosOpen(filespec, 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1707 &handle, 1708 &action, 1709 0, 1710 0, 1711 OPEN_ACTION_FAIL_IF_NEW | 1712 OPEN_ACTION_OPEN_IF_EXISTS, 1713 OPEN_FLAGS_FAIL_ON_ERROR | 1714 OPEN_FLAGS_NOINHERIT | 1715 OPEN_FLAGS_RANDOMSEQUENTIAL | 1716 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0)) 1713 1717 ret = FALSE; 1714 1718 else { … … 1717 1721 l = min(l, 79); 1718 1722 if (!DosChgFilePtr(handle, 1719 1720 1721 1723 abs(offset), 1724 (offset >= 0) ? 1725 FILE_BEGIN : FILE_END, &len)) { 1722 1726 if (!DosRead(handle, buffer, l, &len) && len == l) { 1723 1724 1727 if (!memcmp(signature, buffer, l)) 1728 ret = TRUE; // Matched 1725 1729 } 1726 1730 }
Note:
See TracChangeset
for help on using the changeset viewer.