[32] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: init.c 1112 2008-08-24 03:13:20Z gyoung $
|
---|
| 5 |
|
---|
| 6 | Initialization
|
---|
| 7 |
|
---|
| 8 | Copyright (c) 1993-98 M. Kimes
|
---|
[907] | 9 | Copyright (c) 2001, 2008 Steven H. Levine
|
---|
[32] | 10 |
|
---|
[133] | 11 | 11 Jun 02 SHL Add CheckVersion
|
---|
| 12 | 11 Jun 03 SHL Add JFS and FAT32 support
|
---|
| 13 | 25 Nov 03 SHL InitFM3DLL: correct strings error mesage
|
---|
| 14 | 23 May 05 SHL Use datamin.h
|
---|
[179] | 15 | 26 May 05 SHL Comments
|
---|
[189] | 16 | 06 Jun 05 SHL indent -i2
|
---|
[201] | 17 | 06 Jun 05 SHL Rework FindSwapperDat for VAC3.65 compat
|
---|
[339] | 18 | 13 Jul 06 SHL Use Runtime_Error
|
---|
| 19 | 13 Jul 06 SHL Sync with current style
|
---|
[404] | 20 | 29 Jul 06 SHL Use xfgets
|
---|
[526] | 21 | 22 Oct 06 GKY Add NDFS32 support
|
---|
[552] | 22 | 18 Feb 07 GKY Add ISOFS, RAMFS support
|
---|
[593] | 23 | 30 Mar 07 GKY Defined golbals for removing GetPString for window class names
|
---|
[627] | 24 | 21 Apr 07 GKY Find FM2Utils by path or utils directory eleminate fAddUtils global
|
---|
[690] | 25 | 15 Jun 07 SHL Make OpenWatcom compatible
|
---|
[705] | 26 | 23 Jun 07 GKY Fix WORPLACE_PROCESS enviroment check logic
|
---|
[718] | 27 | 28 Jun 07 SHL Rework WORKPLACE_PROCESS check to match reality
|
---|
[756] | 28 | 03 Aug 07 GKY Enlarged and made setable everywhere Findbuf (speed file loading)
|
---|
[775] | 29 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
|
---|
[783] | 30 | 13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat
|
---|
[784] | 31 | 18 Aug 07 JBS Added code to read Details* keys from the INI file (Ticket 118)
|
---|
[789] | 32 | 19 Aug 07 SHL Ensure FilesToGet in valid range
|
---|
[796] | 33 | 21 Aug 07 GKY Make Subject column in dircnr sizable and movable from the rigth to the left pane
|
---|
[803] | 34 | 23 Aug 07 SHL InitFM3DLL: report INI file DosSetPathInfo error correctly
|
---|
| 35 | 23 Aug 07 SHL Use BldFullPathName
|
---|
| 36 | 25 Aug 07 SHL Work around DosSetPathInfo kernel defect
|
---|
[827] | 37 | 01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry
|
---|
[860] | 38 | 10 Nov 07 GKY Get thousands separator from country info for file sizes.
|
---|
[878] | 39 | 26 Nov 07 GKY Eliminate check of ext path on start up
|
---|
[888] | 40 | 17 Dec 07 GKY Make WPURLDEFAULTSETTINGS the fall back for ftp/httprun
|
---|
[940] | 41 | 13 Jan 08 GKY Get Subjectwidth/Subjectleft working in the collector.
|
---|
[952] | 42 | 12 Feb 08 SHL Compile OpenWatcom version into binary
|
---|
[985] | 43 | 29 Feb 08 GKY Changes to enable user settable command line length
|
---|
| 44 | 29 Feb 08 GKY Refactor global command line variables to notebook.h
|
---|
[998] | 45 | 08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with
|
---|
[1077] | 46 | keys using a "DirCnr." prefix
|
---|
[1004] | 47 | 20 Apr 08 GKY Change default cmd line length to 1024 Ask once if user wants to reset it.
|
---|
[1065] | 48 | 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
|
---|
[1077] | 49 | all the details view settings (both the global variables and those in the
|
---|
| 50 | DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
|
---|
[1075] | 51 | 16 JUL 08 GKY Use TMP directory for temp files
|
---|
[1074] | 52 | 17 Jul 08 SHL Reduce code bulk in fUseTmp setup
|
---|
[1082] | 53 | 19 Jul 08 GKY Use pFM2SaveDirectory, MakeTempName and move temp files to TMP subdirectory if (TMP).
|
---|
[1083] | 54 | 20 Jul 08 JBS Ticket 114: Support user-selectable env. strings in Tree container.
|
---|
[1089] | 55 | 20 Jul 08 GKY Add support to delete orphaned tmp directories without deleting tmp of other
|
---|
| 56 | running sessions
|
---|
[1112] | 57 | 23 Aug 08 GKY Check that space on TMP & FM2 save drives exceed 5 GiB; Done to allow user setting of
|
---|
| 58 | minimum size in future
|
---|
[32] | 59 |
|
---|
| 60 | ***********************************************************************/
|
---|
| 61 |
|
---|
[2] | 62 | #include <stdlib.h>
|
---|
| 63 | #include <string.h>
|
---|
| 64 | #include <share.h>
|
---|
| 65 | #include <process.h>
|
---|
[133] | 66 |
|
---|
[803] | 67 | #define INCL_DOS
|
---|
| 68 | #define INCL_WIN
|
---|
| 69 | #define INCL_MMIOOS2
|
---|
| 70 | #define INCL_GPI
|
---|
| 71 | #define INCL_DOSERRORS
|
---|
[841] | 72 | #define INCL_LONGLONG
|
---|
[860] | 73 | #define INCL_DOSNLS
|
---|
[803] | 74 | #include <os2.h>
|
---|
| 75 | #include <os2me.h>
|
---|
| 76 |
|
---|
| 77 | #define DEFINE_GLOBALS 1
|
---|
| 78 |
|
---|
[2] | 79 | #include "fm3dlg.h"
|
---|
[133] | 80 | #include "datamin.h"
|
---|
[2] | 81 | #include "tools.h"
|
---|
| 82 | #include "fm3str.h"
|
---|
| 83 | #include "version.h"
|
---|
[907] | 84 | #include "pathutil.h" // BldFullPathName
|
---|
| 85 | #include "arccnrs.h" // ArcClientWndProc
|
---|
| 86 | #include "errutil.h" // Dos_Error...
|
---|
| 87 | #include "strutil.h" // GetPString
|
---|
| 88 | #include "fm3dll.h"
|
---|
[1077] | 89 | #include "notebook.h" // command line variables (editor etc)
|
---|
[1012] | 90 | #include "fortify.h"
|
---|
[2] | 91 |
|
---|
[783] | 92 | #ifdef __IBMC__
|
---|
[690] | 93 | #pragma alloc_text(INIT,LibMain,InitFM3DLL,DeInitFM3DLL)
|
---|
[783] | 94 | #pragma alloc_text(INIT1,StartFM3,FindSwapperDat)
|
---|
[690] | 95 | #endif
|
---|
| 96 |
|
---|
[189] | 97 | extern int _CRT_init(void);
|
---|
[2] | 98 | extern void _CRT_term(void);
|
---|
| 99 |
|
---|
[952] | 100 | #ifdef __WATCOMC__
|
---|
| 101 | #define a(x) #x
|
---|
| 102 | #define b(x) a(x)
|
---|
| 103 | // Must be global to prevent warnings
|
---|
| 104 | PSZ pszBuiltWith = "Built with OpenWatcom version " b(__WATCOMC__);
|
---|
| 105 | #undef b
|
---|
| 106 | #undef a
|
---|
| 107 | #endif
|
---|
| 108 |
|
---|
[339] | 109 | static PSZ pszSrcFile = __FILE__;
|
---|
[2] | 110 |
|
---|
[985] | 111 | BOOL CheckFileHeader(CHAR *filespec, CHAR *signature, LONG offset);
|
---|
| 112 |
|
---|
[189] | 113 | VOID FindSwapperDat(VOID)
|
---|
| 114 | {
|
---|
[201] | 115 | CHAR filename[] = "C:\\CONFIG.SYS";
|
---|
| 116 | CHAR input[8192];
|
---|
| 117 | CHAR *p;
|
---|
| 118 | CHAR *pp;
|
---|
[189] | 119 | FILE *fp;
|
---|
[849] | 120 | FILEFINDBUF3L ffb;
|
---|
[201] | 121 | ULONG nm;
|
---|
| 122 | ULONG size = sizeof(SwapperDat);
|
---|
[189] | 123 | HDIR hdir = HDIR_CREATE;
|
---|
[201] | 124 | APIRET rc = 1;
|
---|
[2] | 125 |
|
---|
| 126 | *SwapperDat = 0;
|
---|
[201] | 127 | // Check already known
|
---|
[803] | 128 | PrfQueryProfileData(fmprof, FM3Str, "SwapperDat", SwapperDat, &size);
|
---|
[551] | 129 | if (*SwapperDat) {
|
---|
[201] | 130 | nm = 1;
|
---|
[843] | 131 | rc = DosFindFirst(SwapperDat,
|
---|
| 132 | &hdir,
|
---|
| 133 | FILE_NORMAL | FILE_ARCHIVED |
|
---|
| 134 | FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,
|
---|
[850] | 135 | &ffb, sizeof(ffb), &nm, FIL_STANDARDL);
|
---|
| 136 | if (rc && rc != ERROR_FILE_NOT_FOUND && rc != ERROR_PATH_NOT_FOUND) {
|
---|
[849] | 137 | FILEFINDBUF3 ffb;
|
---|
| 138 | rc = DosFindFirst(SwapperDat,
|
---|
[850] | 139 | &hdir,
|
---|
| 140 | FILE_NORMAL | FILE_ARCHIVED |
|
---|
| 141 | FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,
|
---|
| 142 | &ffb, sizeof(ffb), &nm, FIL_STANDARD);
|
---|
[849] | 143 | fNoLargeFileSupport = TRUE;
|
---|
| 144 | }
|
---|
[551] | 145 | if (!rc) {
|
---|
[2] | 146 | DosFindClose(hdir);
|
---|
[189] | 147 | fp = fopen(SwapperDat, "r");
|
---|
[551] | 148 | if (fp) {
|
---|
[189] | 149 | fclose(fp);
|
---|
| 150 | *SwapperDat = 0;
|
---|
[551] | 151 | rc = 1; // Force config.sys scan
|
---|
[2] | 152 | }
|
---|
| 153 | }
|
---|
| 154 | else
|
---|
| 155 | *SwapperDat = 0;
|
---|
| 156 | }
|
---|
[201] | 157 | // If not defined in INI or INI wrong, scan config.sys for SWAPPATH statement
|
---|
[551] | 158 | if (rc) {
|
---|
[189] | 159 | if (DosQuerySysInfo(QSV_BOOT_DRIVE,
|
---|
| 160 | QSV_BOOT_DRIVE,
|
---|
[803] | 161 | &nm,
|
---|
| 162 | sizeof(ULONG))) {
|
---|
[551] | 163 | nm = 3; // Assume drive C:
|
---|
[201] | 164 | }
|
---|
[551] | 165 | *filename = (CHAR) nm + '@';
|
---|
[404] | 166 | fp = xfsopen(filename, "r", SH_DENYNO, pszSrcFile, __LINE__);
|
---|
[551] | 167 | if (fp) {
|
---|
[404] | 168 | while (!feof(fp)) {
|
---|
[551] | 169 | if (!xfgets(input, sizeof(input), fp, pszSrcFile, __LINE__))
|
---|
[189] | 170 | break;
|
---|
| 171 | lstrip(input);
|
---|
[551] | 172 | if (!strnicmp(input, "SWAPPATH", 8)) {
|
---|
[189] | 173 | p = input + 8;
|
---|
| 174 | while (*p == ' ')
|
---|
| 175 | p++;
|
---|
[551] | 176 | if (*p == '=') {
|
---|
[189] | 177 | p++;
|
---|
| 178 | stripcr(p);
|
---|
| 179 | rstrip(p);
|
---|
| 180 | while (*p == ' ')
|
---|
| 181 | p++;
|
---|
[551] | 182 | if (*p == '\"') {
|
---|
[189] | 183 | p++;
|
---|
| 184 | pp = p;
|
---|
| 185 | while (*pp && *pp != '\"')
|
---|
[689] | 186 | *pp += 1;
|
---|
[189] | 187 | if (*pp)
|
---|
| 188 | *pp = 0;
|
---|
| 189 | }
|
---|
[551] | 190 | else {
|
---|
[189] | 191 | pp = strchr(p, ' ');
|
---|
| 192 | if (pp)
|
---|
| 193 | *pp = 0;
|
---|
| 194 | }
|
---|
[551] | 195 | if (*p) {
|
---|
[189] | 196 | strncpy(SwapperDat, p, CCHMAXPATH);
|
---|
| 197 | SwapperDat[CCHMAXPATH - 1] = 0;
|
---|
[803] | 198 | BldFullPathName(SwapperDat, SwapperDat, "SWAPPER.DAT");
|
---|
[189] | 199 | hdir = HDIR_CREATE;
|
---|
[201] | 200 | nm = 1;
|
---|
[849] | 201 | rc = DosFindFirst(SwapperDat,
|
---|
[843] | 202 | &hdir,
|
---|
| 203 | FILE_NORMAL | FILE_ARCHIVED |
|
---|
| 204 | FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,
|
---|
[850] | 205 | &ffb, sizeof(ffb), &nm, FIL_STANDARD);
|
---|
| 206 | if (rc){
|
---|
| 207 | FILEFINDBUF3 ffb;
|
---|
| 208 | rc = DosFindFirst(SwapperDat,
|
---|
| 209 | &hdir,
|
---|
| 210 | FILE_NORMAL | FILE_ARCHIVED |
|
---|
| 211 | FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,
|
---|
| 212 | &ffb, sizeof(ffb), &nm, FIL_STANDARD);
|
---|
| 213 | fNoLargeFileSupport = TRUE;
|
---|
| 214 | }
|
---|
| 215 | if (!rc) {
|
---|
[189] | 216 | DosFindClose(hdir);
|
---|
| 217 | PrfWriteProfileString(fmprof,
|
---|
[551] | 218 | FM3Str, "SwapperDat", SwapperDat);
|
---|
[189] | 219 | }
|
---|
| 220 | else
|
---|
| 221 | *SwapperDat = 0;
|
---|
| 222 | break;
|
---|
| 223 | }
|
---|
| 224 | }
|
---|
[551] | 225 | } // if SWAPPATH
|
---|
| 226 | } // while
|
---|
[2] | 227 | fclose(fp);
|
---|
| 228 | }
|
---|
| 229 | }
|
---|
| 230 | }
|
---|
| 231 |
|
---|
[690] | 232 | #ifdef __WATCOMC__
|
---|
| 233 |
|
---|
| 234 | unsigned APIENTRY LibMain(unsigned hModule,
|
---|
[783] | 235 | unsigned ulFlag)
|
---|
[690] | 236 | {
|
---|
| 237 | CHAR *env;
|
---|
| 238 | CHAR stringfile[CCHMAXPATH];
|
---|
[849] | 239 | FILESTATUS3 fsa;
|
---|
[690] | 240 | APIRET rc;
|
---|
| 241 |
|
---|
| 242 | switch (ulFlag) {
|
---|
| 243 | case 0:
|
---|
| 244 | // 14 Jun 07 SHL Already done for us
|
---|
| 245 | // if (_CRT_init() == -1)
|
---|
| 246 | // return 0UL;
|
---|
| 247 | FM3DllHandle = hModule;
|
---|
| 248 | strcpy(stringfile, "FM3RES.STR");
|
---|
| 249 | env = getenv("FM3INI");
|
---|
| 250 | if (env) {
|
---|
| 251 | DosError(FERR_DISABLEHARDERR);
|
---|
[849] | 252 | rc = DosQueryPathInfo(env, FIL_STANDARD, &fsa, sizeof(fsa));
|
---|
[690] | 253 | if (!rc) {
|
---|
| 254 | if (fsa.attrFile & FILE_DIRECTORY) {
|
---|
[803] | 255 | BldFullPathName(stringfile, env, "FM3RES.STR");
|
---|
[690] | 256 | DosError(FERR_DISABLEHARDERR);
|
---|
[849] | 257 | if (DosQueryPathInfo(stringfile, FIL_STANDARD, &fsa, sizeof(fsa)))
|
---|
[690] | 258 | strcpy(stringfile, "FM3RES.STR");
|
---|
| 259 | }
|
---|
| 260 | }
|
---|
| 261 | }
|
---|
| 262 | LoadStrings(stringfile);
|
---|
| 263 |
|
---|
| 264 | DosError(FERR_DISABLEHARDERR);
|
---|
| 265 | /* strings here to prevent multiple occurences in DLL */
|
---|
| 266 | FM2Str = "FM/2";
|
---|
| 267 | FM3Str = "FM/3";
|
---|
| 268 | NullStr = "";
|
---|
| 269 | Default = "DEFAULT";
|
---|
| 270 | Settings = "SETTINGS";
|
---|
| 271 | WPProgram = "WPProgram";
|
---|
| 272 | FM3Folder = "<FM3_Folder>";
|
---|
| 273 | FM3Tools = "<FM3_Tools>";
|
---|
| 274 | DRM_OS2FILE = "DRM_OS2FILE";
|
---|
| 275 | DRM_FM2ARCMEMBER = "DRM_FM2ARCMEMBER";
|
---|
| 276 | DRF_FM2ARCHIVE = "DRF_FM2ARCHIVE";
|
---|
| 277 | DRMDRFLIST = "<DRM_OS2FILE,DRF_UNKNOWN>,"
|
---|
| 278 | "<DRM_DISCARD,DRF_UNKNOWN>," "<DRM_PRINT,DRF_UNKNOWN>";
|
---|
| 279 | DRMDRFOS2FILE = "<DRM_OS2FILE,DRF_UNKNOWN>";
|
---|
| 280 | DRMDRFFM2ARC = "<DRM_FM2ARCMEMBER,DRF_FM2ARCHIVE>";
|
---|
| 281 | DRM_FM2INIRECORD = "DRM_FM2INIRECORD";
|
---|
| 282 | DRF_FM2INI = "DRF_FM2INI";
|
---|
| 283 | SUBJECT = ".SUBJECT";
|
---|
| 284 | LONGNAME = ".LONGNAME";
|
---|
| 285 | HPFS = "HPFS";
|
---|
| 286 | JFS = "JFS";
|
---|
| 287 | CDFS = "CDFS";
|
---|
| 288 | ISOFS = "ISOFS";
|
---|
| 289 | FAT32 = "FAT32";
|
---|
| 290 | HPFS386 = "HPFS386";
|
---|
| 291 | CBSIFS = "CBSIFS";
|
---|
| 292 | NDFS32 = "NDFS32";
|
---|
| 293 | RAMFS = "RAMFS";
|
---|
| 294 | NTFS = "NTFS";
|
---|
| 295 | WC_OBJECTWINDOW = "WC_OBJECTWINDOW";
|
---|
| 296 | WC_BUBBLE = "WC_BUBBLE";
|
---|
| 297 | WC_TOOLBUTTONS = "WC_TOOLBUTTONS";
|
---|
| 298 | WC_DRIVEBUTTONS = "WC_DRIVEBUTTONS";
|
---|
| 299 | WC_DIRCONTAINER = "WC_DIRCONTAINER";
|
---|
| 300 | WC_DIRSTATUS = "WC_DIRSTATUS";
|
---|
| 301 | WC_TREECONTAINER = "WC_TREECONTAINER";
|
---|
| 302 | WC_TREEOPENBUTTON = "WC_TREEOPENBUTTON";
|
---|
| 303 | WC_TREESTATUS = "WC_TREESTATUS";
|
---|
| 304 | WC_MAINWND = "WC_MAINWND";
|
---|
| 305 | WC_MAINWND2 = "WC_MAINWND2";
|
---|
| 306 | WC_AUTOVIEW = "WC_AUTOVIEW";
|
---|
| 307 | WC_LED = "WC_LED";
|
---|
| 308 | WC_COLLECTOR = "WC_COLLECTOR";
|
---|
| 309 | WC_COLSTATUS = "WC_COLSTATUS";
|
---|
| 310 | WC_STATUS = "WC_STATUS";
|
---|
| 311 | WC_TOOLBACK = "WC_TOOLBACK";
|
---|
| 312 | WC_DRIVEBACK = "WC_DRIVEBACK";
|
---|
| 313 | WC_ARCCONTAINER = "WC_ARCCONTAINER";
|
---|
| 314 | WC_ARCSTATUS = "WC_ARCSTATUS";
|
---|
| 315 | WC_MLEEDITOR = "WC_MLEEDITOR";
|
---|
| 316 | WC_INIEDITOR = "WC_INIEDITOR";
|
---|
| 317 | WC_SEEALL = "WC_SEEALL";
|
---|
| 318 | WC_NEWVIEW = "WC_NEWVIEW";
|
---|
| 319 | WC_SEESTATUS = "WC_SEESTATUS";
|
---|
| 320 | WC_VIEWSTATUS = "WC_VIEWSTATUS";
|
---|
| 321 | WC_ERRORWND = "WC_ERRORWND";
|
---|
| 322 | WC_MINITIME = "WC_MINITIME";
|
---|
| 323 | WC_DATABAR = "WC_DATABAR";
|
---|
| 324 |
|
---|
| 325 | /* end of strings */
|
---|
| 326 | memset(&RGBBLACK, 0, sizeof(RGB2));
|
---|
| 327 | RGBGREY.bRed = RGBGREY.bGreen = RGBGREY.bBlue = (BYTE)204;
|
---|
| 328 | RGBGREY.fcOptions = 0;
|
---|
[803] | 329 | FM3UL = *(ULONG *)FM3Str;
|
---|
[690] | 330 | DEBUG_STRING = "Debug -- please report to author";
|
---|
| 331 | break;
|
---|
| 332 | case 1:
|
---|
| 333 | StopPrinting = 1;
|
---|
| 334 | if (fmprof)
|
---|
| 335 | PrfCloseProfile(fmprof);
|
---|
| 336 | DosError(FERR_ENABLEHARDERR);
|
---|
| 337 | // 14 Jun 07 SHL Already done for us
|
---|
| 338 | // _CRT_term();
|
---|
| 339 | break;
|
---|
| 340 | default:
|
---|
| 341 | return 0UL;
|
---|
| 342 | }
|
---|
| 343 | return 1UL;
|
---|
| 344 | }
|
---|
| 345 |
|
---|
| 346 | #else // __IBMC__
|
---|
| 347 |
|
---|
[189] | 348 | unsigned long _System _DLL_InitTerm(unsigned long hModule,
|
---|
| 349 | unsigned long ulFlag)
|
---|
| 350 | {
|
---|
[201] | 351 | CHAR *env;
|
---|
| 352 | CHAR stringfile[CCHMAXPATH];
|
---|
[849] | 353 | FILESTATUS3 fsa;
|
---|
[201] | 354 | APIRET rc;
|
---|
[2] | 355 |
|
---|
[551] | 356 | switch (ulFlag) {
|
---|
[189] | 357 | case 0:
|
---|
| 358 | if (_CRT_init() == -1)
|
---|
| 359 | return 0UL;
|
---|
| 360 | FM3DllHandle = hModule;
|
---|
[201] | 361 | strcpy(stringfile, "FM3RES.STR");
|
---|
| 362 | env = getenv("FM3INI");
|
---|
[551] | 363 | if (env) {
|
---|
[201] | 364 | DosError(FERR_DISABLEHARDERR);
|
---|
[849] | 365 | rc = DosQueryPathInfo(env, FIL_STANDARD, &fsa, sizeof(fsa));
|
---|
[551] | 366 | if (!rc) {
|
---|
| 367 | if (fsa.attrFile & FILE_DIRECTORY) {
|
---|
[803] | 368 | BldFullPathName(stringfile, env, "FM3RES.STR");
|
---|
[201] | 369 | DosError(FERR_DISABLEHARDERR);
|
---|
[849] | 370 | if (DosQueryPathInfo(stringfile, FIL_STANDARD, &fsa, sizeof(fsa)))
|
---|
[201] | 371 | strcpy(stringfile, "FM3RES.STR");
|
---|
[189] | 372 | }
|
---|
[2] | 373 | }
|
---|
[189] | 374 | }
|
---|
[201] | 375 | LoadStrings(stringfile);
|
---|
| 376 |
|
---|
[189] | 377 | DosError(FERR_DISABLEHARDERR);
|
---|
| 378 | /* strings here to prevent multiple occurences in DLL */
|
---|
| 379 | FM2Str = "FM/2";
|
---|
| 380 | FM3Str = "FM/3";
|
---|
| 381 | NullStr = "";
|
---|
| 382 | Default = "DEFAULT";
|
---|
| 383 | Settings = "SETTINGS";
|
---|
| 384 | WPProgram = "WPProgram";
|
---|
| 385 | FM3Folder = "<FM3_Folder>";
|
---|
| 386 | FM3Tools = "<FM3_Tools>";
|
---|
| 387 | DRM_OS2FILE = "DRM_OS2FILE";
|
---|
| 388 | DRM_FM2ARCMEMBER = "DRM_FM2ARCMEMBER";
|
---|
| 389 | DRF_FM2ARCHIVE = "DRF_FM2ARCHIVE";
|
---|
| 390 | DRMDRFLIST = "<DRM_OS2FILE,DRF_UNKNOWN>,"
|
---|
[551] | 391 | "<DRM_DISCARD,DRF_UNKNOWN>," "<DRM_PRINT,DRF_UNKNOWN>";
|
---|
[189] | 392 | DRMDRFOS2FILE = "<DRM_OS2FILE,DRF_UNKNOWN>";
|
---|
| 393 | DRMDRFFM2ARC = "<DRM_FM2ARCMEMBER,DRF_FM2ARCHIVE>";
|
---|
| 394 | DRM_FM2INIRECORD = "DRM_FM2INIRECORD";
|
---|
| 395 | DRF_FM2INI = "DRF_FM2INI";
|
---|
| 396 | SUBJECT = ".SUBJECT";
|
---|
| 397 | LONGNAME = ".LONGNAME";
|
---|
| 398 | HPFS = "HPFS";
|
---|
| 399 | JFS = "JFS";
|
---|
| 400 | CDFS = "CDFS";
|
---|
[552] | 401 | ISOFS = "ISOFS";
|
---|
[189] | 402 | FAT32 = "FAT32";
|
---|
| 403 | HPFS386 = "HPFS386";
|
---|
| 404 | CBSIFS = "CBSIFS";
|
---|
[526] | 405 | NDFS32 = "NDFS32";
|
---|
[552] | 406 | RAMFS = "RAMFS";
|
---|
[555] | 407 | NTFS = "NTFS";
|
---|
[593] | 408 | WC_OBJECTWINDOW = "WC_OBJECTWINDOW";
|
---|
| 409 | WC_BUBBLE = "WC_BUBBLE";
|
---|
| 410 | WC_TOOLBUTTONS = "WC_TOOLBUTTONS";
|
---|
| 411 | WC_DRIVEBUTTONS = "WC_DRIVEBUTTONS";
|
---|
| 412 | WC_DIRCONTAINER = "WC_DIRCONTAINER";
|
---|
| 413 | WC_DIRSTATUS = "WC_DIRSTATUS";
|
---|
| 414 | WC_TREECONTAINER = "WC_TREECONTAINER";
|
---|
| 415 | WC_TREEOPENBUTTON = "WC_TREEOPENBUTTON";
|
---|
| 416 | WC_TREESTATUS = "WC_TREESTATUS";
|
---|
| 417 | WC_MAINWND = "WC_MAINWND";
|
---|
| 418 | WC_MAINWND2 = "WC_MAINWND2";
|
---|
| 419 | WC_AUTOVIEW = "WC_AUTOVIEW";
|
---|
| 420 | WC_LED = "WC_LED";
|
---|
| 421 | WC_COLLECTOR = "WC_COLLECTOR";
|
---|
| 422 | WC_COLSTATUS = "WC_COLSTATUS";
|
---|
| 423 | WC_STATUS = "WC_STATUS";
|
---|
| 424 | WC_TOOLBACK = "WC_TOOLBACK";
|
---|
| 425 | WC_DRIVEBACK = "WC_DRIVEBACK";
|
---|
| 426 | WC_ARCCONTAINER = "WC_ARCCONTAINER";
|
---|
| 427 | WC_ARCSTATUS = "WC_ARCSTATUS";
|
---|
| 428 | WC_MLEEDITOR = "WC_MLEEDITOR";
|
---|
| 429 | WC_INIEDITOR = "WC_INIEDITOR";
|
---|
| 430 | WC_SEEALL = "WC_SEEALL";
|
---|
| 431 | WC_NEWVIEW = "WC_NEWVIEW";
|
---|
| 432 | WC_SEESTATUS = "WC_SEESTATUS";
|
---|
| 433 | WC_VIEWSTATUS = "WC_VIEWSTATUS";
|
---|
| 434 | WC_ERRORWND = "WC_ERRORWND";
|
---|
| 435 | WC_MINITIME = "WC_MINITIME";
|
---|
| 436 | WC_DATABAR = "WC_DATABAR";
|
---|
| 437 |
|
---|
[189] | 438 | /* end of strings */
|
---|
| 439 | memset(&RGBBLACK, 0, sizeof(RGB2));
|
---|
[689] | 440 | RGBGREY.bRed = RGBGREY.bGreen = RGBGREY.bBlue = (BYTE)204;
|
---|
[189] | 441 | RGBGREY.fcOptions = 0;
|
---|
[803] | 442 | FM3UL = *(ULONG *)FM3Str;
|
---|
[189] | 443 | DEBUG_STRING = "Debug -- please report to author";
|
---|
| 444 | break;
|
---|
| 445 | case 1:
|
---|
| 446 | StopPrinting = 1;
|
---|
| 447 | if (fmprof)
|
---|
| 448 | PrfCloseProfile(fmprof);
|
---|
| 449 | DosError(FERR_ENABLEHARDERR);
|
---|
| 450 | _CRT_term();
|
---|
| 451 | break;
|
---|
| 452 | default:
|
---|
| 453 | return 0UL;
|
---|
[2] | 454 | }
|
---|
| 455 | return 1UL;
|
---|
| 456 | }
|
---|
| 457 |
|
---|
[690] | 458 | #endif // __IBMC__
|
---|
| 459 |
|
---|
[189] | 460 | VOID APIENTRY DeInitFM3DLL(ULONG why)
|
---|
| 461 | {
|
---|
[2] | 462 | /* cleanup */
|
---|
[189] | 463 | static CHAR s[CCHMAXPATH];
|
---|
[1075] | 464 | CHAR *enddir, szTempFile[CCHMAXPATH];
|
---|
[189] | 465 | HDIR search_handle;
|
---|
| 466 | ULONG num_matches;
|
---|
[843] | 467 | FILEFINDBUF3 ffb;
|
---|
[2] | 468 |
|
---|
| 469 | StopTimer();
|
---|
| 470 | StopPrinting = 1;
|
---|
| 471 |
|
---|
[189] | 472 | if (LogFileHandle)
|
---|
[2] | 473 | fclose(LogFileHandle);
|
---|
| 474 |
|
---|
[551] | 475 | if (fmprof) {
|
---|
[2] | 476 | PrfCloseProfile(fmprof);
|
---|
[189] | 477 | fmprof = (HINI) 0;
|
---|
[551] | 478 | if (fIniExisted) {
|
---|
[2] | 479 | DosError(FERR_DISABLEHARDERR);
|
---|
[551] | 480 | DosCopy("FM3.INI", "FM3INI.BAK", DCPY_EXISTING);
|
---|
[2] | 481 | }
|
---|
| 482 | }
|
---|
| 483 |
|
---|
[189] | 484 | if (fToolsChanged)
|
---|
[2] | 485 | save_tools(NULL);
|
---|
| 486 |
|
---|
[689] | 487 | # ifdef __IBMC__
|
---|
[2] | 488 | _fcloseall();
|
---|
[689] | 489 | # else // __WATCOMC__
|
---|
| 490 | fcloseall();
|
---|
| 491 | # endif
|
---|
[2] | 492 |
|
---|
| 493 | save_dir(s);
|
---|
[189] | 494 | if (s[strlen(s) - 1] != '\\')
|
---|
| 495 | strcat(s, "\\");
|
---|
[2] | 496 | enddir = &s[strlen(s)];
|
---|
[551] | 497 | if (*ArcTempRoot) {
|
---|
[189] | 498 | strcat(s, ArcTempRoot);
|
---|
| 499 | strcat(s, "*");
|
---|
[2] | 500 | search_handle = HDIR_CREATE;
|
---|
| 501 | num_matches = 1L;
|
---|
[843] | 502 | if (!DosFindFirst(s,
|
---|
| 503 | &search_handle,
|
---|
| 504 | FILE_NORMAL | FILE_DIRECTORY |
|
---|
| 505 | FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN |
|
---|
| 506 | FILE_ARCHIVED,
|
---|
| 507 | &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) {
|
---|
[551] | 508 | do {
|
---|
[843] | 509 | strcpy(enddir, ffb.achName);
|
---|
| 510 | if (ffb.attrFile & FILE_DIRECTORY) {
|
---|
[189] | 511 | wipeallf("%s\\*", s);
|
---|
| 512 | DosDeleteDir(s);
|
---|
| 513 | }
|
---|
| 514 | else
|
---|
| 515 | unlinkf("%s", s);
|
---|
| 516 | }
|
---|
[843] | 517 | while (!DosFindNext(search_handle,
|
---|
| 518 | &ffb, sizeof(ffb), &num_matches));
|
---|
[2] | 519 | DosFindClose(search_handle);
|
---|
| 520 | }
|
---|
| 521 | }
|
---|
[1082] | 522 | if (pTmpDir)
|
---|
| 523 | strcpy(s, pTmpDir);
|
---|
| 524 | else
|
---|
[1104] | 525 | strcpy(s, pFM2SaveDirectory);
|
---|
[189] | 526 | if (s[strlen(s) - 1] != '\\')
|
---|
| 527 | strcat(s, "\\");
|
---|
[2] | 528 | enddir = &s[strlen(s)];
|
---|
[1089] | 529 | strcat(s, "$FM2LI$T.");
|
---|
[189] | 530 | strcat(s, "???");
|
---|
[2] | 531 | search_handle = HDIR_CREATE;
|
---|
[838] | 532 | num_matches = 1;
|
---|
[843] | 533 | if (!DosFindFirst(s,
|
---|
| 534 | &search_handle,
|
---|
| 535 | FILE_NORMAL | FILE_DIRECTORY |
|
---|
| 536 | FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN |
|
---|
| 537 | FILE_ARCHIVED,
|
---|
| 538 | &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) {
|
---|
[551] | 539 | do {
|
---|
[843] | 540 | if (!(ffb.attrFile & FILE_DIRECTORY)) {
|
---|
| 541 | strcpy(enddir, ffb.achName);
|
---|
[189] | 542 | unlinkf("%s", s);
|
---|
[2] | 543 | }
|
---|
[189] | 544 | }
|
---|
[843] | 545 | while (!DosFindNext(search_handle,
|
---|
| 546 | &ffb, sizeof(ffb), &num_matches));
|
---|
[2] | 547 | DosFindClose(search_handle);
|
---|
| 548 | }
|
---|
[1075] | 549 | BldFullPathName(szTempFile, pTmpDir, "$FM2PLAY.$$$");
|
---|
| 550 | DosForceDelete(szTempFile);
|
---|
[1082] | 551 | if (pTmpDir) {
|
---|
| 552 | wipeallf("%s\\*", pTmpDir);
|
---|
| 553 | DosDeleteDir(pTmpDir);
|
---|
| 554 | }
|
---|
[2] | 555 | EndNote();
|
---|
[189] | 556 | if (FM3ModHandle)
|
---|
[2] | 557 | DosFreeModule(FM3ModHandle);
|
---|
| 558 |
|
---|
[551] | 559 | DosExitList(EXLST_REMOVE, DeInitFM3DLL);
|
---|
[2] | 560 | }
|
---|
| 561 |
|
---|
[189] | 562 | BOOL InitFM3DLL(HAB hab, int argc, char **argv)
|
---|
| 563 | {
|
---|
[2] | 564 | /*
|
---|
| 565 | * this function should be called by any application using this DLL right
|
---|
| 566 | * after setting up a message queue
|
---|
| 567 | */
|
---|
| 568 |
|
---|
| 569 | CLASSINFO clinfo;
|
---|
[201] | 570 | APIRET rc;
|
---|
| 571 | APIRET rcl = 1;
|
---|
| 572 | APIRET rcq = 1;
|
---|
[803] | 573 | PFN pfnResVersion = (PFN)NULL;
|
---|
[201] | 574 | ULONG RVMajor = 0;
|
---|
| 575 | ULONG RVMinor = 0;
|
---|
| 576 | ULONG ret = 0;
|
---|
[849] | 577 | FILESTATUS3 fs3; // 25 Aug 07 SHL
|
---|
[803] | 578 | PSZ env;
|
---|
[201] | 579 | CHAR dllfile[CCHMAXPATH];
|
---|
| 580 | ULONG size;
|
---|
[2] | 581 |
|
---|
[551] | 582 | if (!StringsLoaded()) {
|
---|
[2] | 583 | saymsg(MB_ENTER,
|
---|
[189] | 584 | HWND_DESKTOP,
|
---|
| 585 | "Error",
|
---|
| 586 | "FM3RES.STR isn't in right format, at least "
|
---|
| 587 | "for this version of FM/2.");
|
---|
[2] | 588 | return FALSE;
|
---|
| 589 | }
|
---|
| 590 |
|
---|
[201] | 591 | strcpy(dllfile, "FM3RES");
|
---|
| 592 | env = getenv("FM3INI");
|
---|
[551] | 593 | if (env) {
|
---|
[201] | 594 | DosError(FERR_DISABLEHARDERR);
|
---|
[849] | 595 | rc = DosQueryPathInfo(env, FIL_STANDARD, &fs3, sizeof(fs3));
|
---|
[551] | 596 | if (!rc) {
|
---|
[803] | 597 | if (fs3.attrFile & FILE_DIRECTORY) {
|
---|
| 598 | BldFullPathName(dllfile, env, "FM3RES"); // 23 Aug 07 SHL
|
---|
[201] | 599 | DosError(FERR_DISABLEHARDERR);
|
---|
[849] | 600 | if (DosQueryPathInfo(dllfile, FIL_STANDARD, &fs3, sizeof(fs3)))
|
---|
[201] | 601 | strcpy(dllfile, "FM3RES");
|
---|
[2] | 602 | }
|
---|
| 603 | }
|
---|
[201] | 604 | }
|
---|
[551] | 605 | rcl = DosLoadModule(NULL, 0, dllfile, &FM3ModHandle);
|
---|
| 606 | if (rcl) {
|
---|
[339] | 607 | saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
|
---|
| 608 | HWND_DESKTOP,
|
---|
[551] | 609 | GetPString(IDS_ERRORTEXT), GetPString(IDS_FM3RESERROR1TEXT));
|
---|
[339] | 610 | return FALSE;
|
---|
| 611 | }
|
---|
| 612 | else {
|
---|
| 613 | rc = DosExitList(EXLST_ADD, DeInitFM3DLL);
|
---|
[551] | 614 | if (rc) {
|
---|
[803] | 615 | Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 616 | "DosExitList");
|
---|
[339] | 617 | }
|
---|
[551] | 618 | rcq = DosQueryProcAddr(FM3ModHandle, 1, "ResVersion", &pfnResVersion);
|
---|
[201] | 619 | if (!rcq)
|
---|
| 620 | ret = pfnResVersion(&RVMajor, &RVMinor);
|
---|
| 621 | }
|
---|
[551] | 622 | if (RVMajor < VERMAJOR || (RVMajor == VERMAJOR && RVMinor < VERMINOR)) {
|
---|
[201] | 623 | saymsg(MB_ENTER,
|
---|
| 624 | HWND_DESKTOP,
|
---|
| 625 | GetPString(IDS_ERRORTEXT),
|
---|
| 626 | GetPString(IDS_FM3RESERROR2TEXT),
|
---|
| 627 | !rcq ?
|
---|
[551] | 628 | GetPString(IDS_FM3RESERROR3TEXT) :
|
---|
| 629 | !rcl ?
|
---|
| 630 | GetPString(IDS_FM3RESERROR4TEXT) :
|
---|
| 631 | GetPString(IDS_FM3RESERROR5TEXT), RVMajor, RVMinor, rcl, rcq, ret);
|
---|
[201] | 632 | return FALSE;
|
---|
[2] | 633 | }
|
---|
| 634 |
|
---|
[189] | 635 | ArgDriveFlags(argc, argv);
|
---|
[2] | 636 | FillInDriveFlags(NULL);
|
---|
| 637 |
|
---|
[189] | 638 | if (!*profile)
|
---|
| 639 | strcpy(profile, "FM3.INI");
|
---|
[2] | 640 | mypid = getpid();
|
---|
| 641 | /* give default appname if none set by caller */
|
---|
[189] | 642 | if (!*appname)
|
---|
| 643 | strcpy(appname, FM3Str);
|
---|
[2] | 644 | /* save appname; may be reset below */
|
---|
[189] | 645 | strcpy(realappname, appname);
|
---|
| 646 | if (!strcmp(appname, FM3Str))
|
---|
[803] | 647 | DosSetMaxFH(100);
|
---|
[189] | 648 | else if (!strcmp(appname, "VDir") ||
|
---|
| 649 | !strcmp(appname, "VTree") ||
|
---|
| 650 | !strcmp(appname, "VCollect") ||
|
---|
[551] | 651 | !strcmp(appname, "SEEALL") || !strcmp(appname, "FM/4"))
|
---|
[803] | 652 | DosSetMaxFH(60);
|
---|
[2] | 653 | else
|
---|
[803] | 654 | DosSetMaxFH(40);
|
---|
[2] | 655 |
|
---|
[189] | 656 | if (DosQuerySysInfo(QSV_VERSION_MAJOR,
|
---|
| 657 | QSV_VERSION_MINOR,
|
---|
[803] | 658 | OS2ver,
|
---|
| 659 | sizeof(OS2ver))) {
|
---|
[2] | 660 | OS2ver[0] = 2;
|
---|
| 661 | OS2ver[1] = 1;
|
---|
| 662 | }
|
---|
| 663 |
|
---|
[1082] | 664 | // set up default root names for temp file storage and archive goodies
|
---|
[1069] | 665 | env = getenv("TMP");
|
---|
[1074] | 666 | if (env == NULL)
|
---|
| 667 | env = getenv("TEMP");
|
---|
[1069] | 668 | if (env != NULL) {
|
---|
| 669 | DosError(FERR_DISABLEHARDERR);
|
---|
| 670 | rc = DosQueryPathInfo(env, FIL_STANDARD, &fs3, sizeof(fs3));
|
---|
| 671 | if (!rc) {
|
---|
[1089] | 672 | CHAR *enddir, *p, szTempName[CCHMAXPATH], temp[CCHMAXPATH];
|
---|
| 673 | FILEFINDBUF3 ffb;
|
---|
| 674 | HDIR search_handle;
|
---|
| 675 | ULONG num_matches, ul;
|
---|
| 676 |
|
---|
| 677 | strcpy(szTempName, env);
|
---|
| 678 | if (szTempName[strlen(szTempName) - 1] != '\\')
|
---|
| 679 | strcat(szTempName, "\\");
|
---|
| 680 | enddir = &szTempName[strlen(szTempName)];
|
---|
| 681 | strcat(szTempName, "$FM2????.");
|
---|
| 682 | strcat(szTempName, "???");
|
---|
| 683 | search_handle = HDIR_CREATE;
|
---|
| 684 | num_matches = 1;
|
---|
| 685 | if (!DosFindFirst(szTempName,
|
---|
| 686 | &search_handle,
|
---|
| 687 | FILE_NORMAL | FILE_DIRECTORY |
|
---|
| 688 | FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN |
|
---|
| 689 | FILE_ARCHIVED,
|
---|
| 690 | &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) {
|
---|
| 691 | do {
|
---|
| 692 | strcpy(enddir, ffb.achName);
|
---|
| 693 | p = strrchr(szTempName, '.');
|
---|
| 694 | if (p) {
|
---|
| 695 | p++;
|
---|
| 696 | ul = strtol(p, &p + 2, 16);
|
---|
| 697 | GetDosPgmName(ul, temp);
|
---|
| 698 | if (!strstr(temp, "FM/2") &&
|
---|
| 699 | !strstr(temp, "AV/2")) {
|
---|
| 700 | wipeallf("%s\\*", szTempName);
|
---|
| 701 | DosDeleteDir(szTempName);
|
---|
| 702 | }
|
---|
| 703 | }
|
---|
| 704 | }
|
---|
| 705 | while (!DosFindNext(search_handle,
|
---|
| 706 | &ffb, sizeof(ffb), &num_matches));
|
---|
| 707 | DosFindClose(search_handle);
|
---|
| 708 | }
|
---|
[1069] | 709 | if (fs3.attrFile & FILE_DIRECTORY) {
|
---|
[1082] | 710 | APIRET ret = 0;
|
---|
| 711 | strcpy(szTempName, env);
|
---|
| 712 | MakeTempName(szTempName, NULL, 1);
|
---|
| 713 | ret = DosCreateDir(szTempName, 0);
|
---|
[1089] | 714 | if (!ret) { //check writable
|
---|
[1082] | 715 | pTmpDir = xstrdup(szTempName, pszSrcFile, __LINE__);
|
---|
[1089] | 716 | } //fixme to check freespace > 5 MB
|
---|
[1069] | 717 | }
|
---|
| 718 | }
|
---|
| 719 | }
|
---|
[2] | 720 |
|
---|
[1082] | 721 | //Save the FM2 save directory name. This is the location of the ini, dat files etc.
|
---|
| 722 | {
|
---|
| 723 | CHAR temp[CCHMAXPATH];
|
---|
| 724 | save_dir2(temp);
|
---|
| 725 | pFM2SaveDirectory = xstrdup(temp, pszSrcFile, __LINE__);
|
---|
| 726 | }
|
---|
[1112] | 727 | {
|
---|
| 728 | CHAR szKBTmp[20];
|
---|
[1082] | 729 |
|
---|
[1112] | 730 | ullTmpSpaceNeeded = 5120000;
|
---|
| 731 | CommaFmtULL(szKBTmp, sizeof(szKBTmp),
|
---|
| 732 | ullTmpSpaceNeeded, 'M');
|
---|
| 733 | printf("%s\r", szKBTmp); fflush(stdout);
|
---|
| 734 | if (pTmpDir && CheckDriveSpaceAvail(pTmpDir, ullTmpSpaceNeeded, 0) == 1) {
|
---|
| 735 | if (CheckDriveSpaceAvail(pFM2SaveDirectory, ullTmpSpaceNeeded, 0) == 0){
|
---|
| 736 | ret = saymsg(MB_YESNO,
|
---|
| 737 | HWND_DESKTOP,
|
---|
| 738 | NullStr,
|
---|
| 739 | GetPString(IDS_TMPDRIVESPACELIMITED),
|
---|
| 740 | pTmpDir,
|
---|
| 741 | szKBTmp);
|
---|
| 742 | if (ret == MBID_YES)
|
---|
| 743 | pTmpDir = pFM2SaveDirectory;
|
---|
| 744 | }
|
---|
| 745 | else
|
---|
| 746 | saymsg(MB_OK,
|
---|
| 747 | HWND_DESKTOP,
|
---|
| 748 | NullStr,
|
---|
| 749 | GetPString(IDS_SAVETMPDRIVESPACELIMITED),
|
---|
| 750 | pTmpDir,
|
---|
| 751 | szKBTmp,
|
---|
| 752 | pFM2SaveDirectory,
|
---|
| 753 | szKBTmp);
|
---|
| 754 | }
|
---|
| 755 | else if (CheckDriveSpaceAvail(pFM2SaveDirectory, ullTmpSpaceNeeded, 0) == 1)
|
---|
| 756 | saymsg(MB_OK,
|
---|
| 757 | HWND_DESKTOP,
|
---|
| 758 | NullStr,
|
---|
| 759 | GetPString(IDS_SAVEDRIVESPACELIMITED),
|
---|
| 760 | pFM2SaveDirectory,
|
---|
| 761 | szKBTmp);
|
---|
| 762 | }
|
---|
| 763 | BldFullPathName(ArcTempRoot, pTmpDir, fAmAV2 ? "$AV$ARC$" : "$FM$ARC$");
|
---|
| 764 |
|
---|
[1082] | 765 | // initialize random number generator
|
---|
[2] | 766 | srand(time(NULL) + clock());
|
---|
| 767 |
|
---|
| 768 | priority_bumped();
|
---|
| 769 |
|
---|
| 770 | /* _heapmin() is done in a separate thread -- start it */
|
---|
[551] | 771 | if (_beginthread(HeapThread, NULL, 32768, NULL) == -1) {
|
---|
| 772 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 773 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
[339] | 774 | return FALSE;
|
---|
| 775 | }
|
---|
[917] | 776 |
|
---|
[189] | 777 | /* timer messages are sent from a separate thread -- start it */
|
---|
[803] | 778 | if (!StartTimer()) {
|
---|
| 779 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 780 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
[2] | 781 | return FALSE;
|
---|
[803] | 782 | }
|
---|
[2] | 783 |
|
---|
[718] | 784 | /* Are we the workplace shell? */
|
---|
[705] | 785 | env = getenv("WORKPLACE_PROCESS");
|
---|
[718] | 786 | fWorkPlace = env != NULL &&
|
---|
| 787 | (stricmp(env, "YES") == 0 || atoi(env) == 1);
|
---|
| 788 |
|
---|
[189] | 789 | if ((!strchr(profile, '\\') && !strchr(profile, ':')) ||
|
---|
[803] | 790 | !(fmprof = PrfOpenProfile((HAB)0, profile)))
|
---|
| 791 | {
|
---|
[2] | 792 | /* figure out where to put INI file... */
|
---|
[803] | 793 | CHAR inipath[CCHMAXPATH];
|
---|
[2] | 794 |
|
---|
| 795 | DosError(FERR_DISABLEHARDERR);
|
---|
[1104] | 796 | strcpy(HomePath, pFM2SaveDirectory);
|
---|
[2] | 797 | DosError(FERR_DISABLEHARDERR);
|
---|
[189] | 798 | memset(driveserial, -1, sizeof(driveserial));
|
---|
[2] | 799 | *inipath = 0;
|
---|
| 800 | env = getenv("FM3INI");
|
---|
[551] | 801 | if (env) {
|
---|
[189] | 802 | strcpy(inipath, env);
|
---|
[2] | 803 | DosError(FERR_DISABLEHARDERR);
|
---|
[849] | 804 | rc = DosQueryPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3));
|
---|
[551] | 805 | if (!rc) {
|
---|
[803] | 806 | if (fs3.attrFile & FILE_DIRECTORY)
|
---|
| 807 | BldFullPathName(inipath, inipath, profile);
|
---|
[2] | 808 | }
|
---|
| 809 | }
|
---|
[551] | 810 | if (!env) {
|
---|
[2] | 811 | env = searchpath(profile);
|
---|
[189] | 812 | if (!env)
|
---|
| 813 | env = profile;
|
---|
| 814 | strcpy(inipath, env);
|
---|
[2] | 815 | }
|
---|
[201] | 816 |
|
---|
[2] | 817 | /* in some odd cases the INI file can get set to readonly status */
|
---|
| 818 | /* here we test it and reset the readonly bit if necessary */
|
---|
[201] | 819 | if (!*inipath)
|
---|
| 820 | strcpy(inipath, profile);
|
---|
| 821 | DosError(FERR_DISABLEHARDERR);
|
---|
[803] | 822 |
|
---|
[917] | 823 | rc = DosQueryPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3));
|
---|
| 824 | if (rc) {
|
---|
| 825 | if (rc == ERROR_FILE_NOT_FOUND)
|
---|
| 826 | fWantFirstTimeInit = TRUE;
|
---|
| 827 | }
|
---|
| 828 | else {
|
---|
[989] | 829 | if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) {
|
---|
[1077] | 830 | saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,
|
---|
| 831 | "Check INI header failed will attempt to replace with backup \\
|
---|
| 832 | if backup fails or not found will open with new ini");
|
---|
| 833 | DosCopy("FM3.INI", "FM3INI.BAD", DCPY_EXISTING);
|
---|
| 834 | DosCopy("FM3INI.BAK", "FM3.INI", DCPY_EXISTING);
|
---|
| 835 | if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) {
|
---|
| 836 | DosCopy("FM3.INI", "FM3INI2.BAD", DCPY_EXISTING);
|
---|
| 837 | fWantFirstTimeInit = TRUE;
|
---|
| 838 | }
|
---|
[2] | 839 | }
|
---|
[989] | 840 | if (!fWantFirstTimeInit) {
|
---|
[1077] | 841 | fIniExisted = TRUE;
|
---|
| 842 | if (fs3.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) {
|
---|
| 843 | fs3.attrFile &= ~(FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM);
|
---|
| 844 | rc = xDosSetPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3), 0);
|
---|
| 845 | if (rc) {
|
---|
| 846 | Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 847 | GetPString(IDS_INIREADONLYTEXT), inipath);
|
---|
| 848 | }
|
---|
| 849 | }
|
---|
[989] | 850 | }
|
---|
[2] | 851 | }
|
---|
[803] | 852 | fmprof = PrfOpenProfile((HAB)0, inipath);
|
---|
[551] | 853 | if (!fmprof) {
|
---|
[189] | 854 | strcpy(inipath, "FM3.INI");
|
---|
[803] | 855 | fmprof = PrfOpenProfile((HAB)0, inipath);
|
---|
[2] | 856 | }
|
---|
[201] | 857 |
|
---|
[917] | 858 | // 10 Jan 08 SHL fixme to do first time if new ini
|
---|
| 859 | // 10 Jan 08 SHL post UM_FIRSTTIME to main window
|
---|
[551] | 860 | if (!fmprof) {
|
---|
| 861 | Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__,
|
---|
[1077] | 862 | "PrfOpenProfile");
|
---|
[2] | 863 | return FALSE;
|
---|
| 864 | }
|
---|
| 865 | }
|
---|
| 866 |
|
---|
| 867 | FindSwapperDat();
|
---|
| 868 |
|
---|
[201] | 869 | size = sizeof(BOOL);
|
---|
| 870 | PrfQueryProfileData(fmprof,
|
---|
| 871 | FM3Str,
|
---|
[803] | 872 | "SeparateParms",
|
---|
| 873 | &fSeparateParms,
|
---|
| 874 | &size);
|
---|
[201] | 875 | if (!fSeparateParms)
|
---|
| 876 | strcpy(appname, FM3Str);
|
---|
[2] | 877 |
|
---|
| 878 | /* start help */
|
---|
[189] | 879 | memset(&hini, 0, sizeof(HELPINIT));
|
---|
[2] | 880 | hini.cb = sizeof(HELPINIT);
|
---|
[849] | 881 | hini.ulReturnCode = 0;
|
---|
[2] | 882 | hini.pszTutorialName = NULL;
|
---|
[189] | 883 | hini.phtHelpTable = (PHELPTABLE) MAKELONG(ID_HELPTABLE, 0xffff);
|
---|
| 884 | hini.hmodAccelActionBarModule = (HMODULE) 0;
|
---|
[2] | 885 | hini.idAccelTable = 0;
|
---|
| 886 | hini.idActionBar = 0;
|
---|
| 887 | hini.pszHelpWindowTitle = GetPString(IDS_FM2HELPTITLETEXT);
|
---|
| 888 | hini.fShowPanelId = CMIC_HIDE_PANEL_ID;
|
---|
| 889 | hini.pszHelpLibraryName = "FM3.HLP";
|
---|
[189] | 890 | hwndHelp = WinCreateHelpInstance(hab, &hini);
|
---|
[551] | 891 | if (!hwndHelp) {
|
---|
[201] | 892 | static CHAR helppath[CCHMAXPATH]; // fixme to be local?
|
---|
[2] | 893 |
|
---|
| 894 | env = getenv("FM3INI");
|
---|
[551] | 895 | if (env) {
|
---|
[189] | 896 | strcpy(helppath, env);
|
---|
[2] | 897 | DosError(FERR_DISABLEHARDERR);
|
---|
[849] | 898 | rc = DosQueryPathInfo(helppath, FIL_STANDARD, &fs3, sizeof(fs3));
|
---|
[551] | 899 | if (!rc) {
|
---|
[803] | 900 | if (fs3.attrFile & FILE_DIRECTORY) {
|
---|
| 901 | BldFullPathName(helppath, helppath, "FM3.HLP");
|
---|
[189] | 902 | hini.pszHelpLibraryName = helppath;
|
---|
| 903 | hwndHelp = WinCreateHelpInstance(hab, &hini);
|
---|
| 904 | }
|
---|
[2] | 905 | }
|
---|
| 906 | }
|
---|
| 907 | }
|
---|
[551] | 908 | if (!hwndHelp) {
|
---|
[2] | 909 | saymsg(MB_ENTER | MB_ICONEXCLAMATION,
|
---|
[189] | 910 | HWND_DESKTOP,
|
---|
| 911 | GetPString(IDS_FM2TROUBLETEXT),
|
---|
| 912 | GetPString(IDS_CANTLOADHELPTEXT),
|
---|
| 913 | GetPString(IDS_NOHELPACCEPTTEXT));
|
---|
[2] | 914 | }
|
---|
| 915 |
|
---|
| 916 | /* a couple of default window procs so we don't have to look them up later */
|
---|
[189] | 917 | if (WinQueryClassInfo(hab, WC_CONTAINER, &clinfo))
|
---|
[2] | 918 | PFNWPCnr = clinfo.pfnWindowProc;
|
---|
[179] | 919 | // saymsg(MB_ENTER,HWND_DESKTOP,"Container flags:","%08lx",clinfo.flClassStyle);
|
---|
[189] | 920 | if (WinQueryClassInfo(hab, WC_FRAME, &clinfo))
|
---|
[2] | 921 | PFNWPFrame = clinfo.pfnWindowProc;
|
---|
[179] | 922 | // saymsg(MB_ENTER,HWND_DESKTOP,"Frame flags:","%08lx",clinfo.flClassStyle);
|
---|
[189] | 923 | if (WinQueryClassInfo(hab, WC_BUTTON, &clinfo))
|
---|
[2] | 924 | PFNWPButton = clinfo.pfnWindowProc;
|
---|
[179] | 925 | // saymsg(MB_ENTER,HWND_DESKTOP,"Button flags:","%08lx",clinfo.flClassStyle);
|
---|
[189] | 926 | if (WinQueryClassInfo(hab, WC_STATIC, &clinfo))
|
---|
[2] | 927 | PFNWPStatic = clinfo.pfnWindowProc;
|
---|
[179] | 928 | // saymsg(MB_ENTER,HWND_DESKTOP,"Static flags:","%08lx",clinfo.flClassStyle);
|
---|
[189] | 929 | if (WinQueryClassInfo(hab, WC_MLE, &clinfo))
|
---|
[2] | 930 | PFNWPMLE = clinfo.pfnWindowProc;
|
---|
[179] | 931 | // saymsg(MB_ENTER,HWND_DESKTOP,"MLE flags:","%08lx",clinfo.flClassStyle);
|
---|
[551] | 932 | if (!PFNWPCnr || !PFNWPFrame || !PFNWPButton || !PFNWPStatic || !PFNWPMLE) {
|
---|
[339] | 933 | Runtime_Error(pszSrcFile, __LINE__, "WinQueryClassInfo");
|
---|
[2] | 934 | return FALSE;
|
---|
| 935 | }
|
---|
| 936 |
|
---|
| 937 | /* register window classes we use */
|
---|
| 938 | WinRegisterClass(hab,
|
---|
[593] | 939 | WC_MAINWND,
|
---|
[189] | 940 | MainWndProc,
|
---|
[551] | 941 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 8);
|
---|
[2] | 942 | WinRegisterClass(hab,
|
---|
[593] | 943 | WC_MAINWND2,
|
---|
[189] | 944 | MainWndProc2,
|
---|
[551] | 945 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 4);
|
---|
[2] | 946 | WinRegisterClass(hab,
|
---|
[593] | 947 | WC_TREECONTAINER,
|
---|
[189] | 948 | TreeClientWndProc,
|
---|
[551] | 949 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
|
---|
[2] | 950 | WinRegisterClass(hab,
|
---|
[593] | 951 | WC_DIRCONTAINER,
|
---|
[189] | 952 | DirClientWndProc,
|
---|
[551] | 953 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
|
---|
[2] | 954 | WinRegisterClass(hab,
|
---|
[593] | 955 | WC_COLLECTOR,
|
---|
[189] | 956 | CollectorClientWndProc,
|
---|
[551] | 957 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
|
---|
[2] | 958 | WinRegisterClass(hab,
|
---|
[593] | 959 | WC_ARCCONTAINER,
|
---|
[189] | 960 | ArcClientWndProc,
|
---|
[551] | 961 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
|
---|
[2] | 962 | WinRegisterClass(hab,
|
---|
[593] | 963 | WC_MLEEDITOR,
|
---|
[189] | 964 | MLEEditorProc,
|
---|
[551] | 965 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
|
---|
[2] | 966 | WinRegisterClass(hab,
|
---|
[593] | 967 | WC_INIEDITOR,
|
---|
[189] | 968 | IniProc,
|
---|
[551] | 969 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
|
---|
[2] | 970 | WinRegisterClass(hab,
|
---|
[593] | 971 | WC_TOOLBACK,
|
---|
[952] | 972 | ToolBackProc,
|
---|
| 973 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 974 | sizeof(PVOID));
|
---|
[2] | 975 | WinRegisterClass(hab,
|
---|
[593] | 976 | WC_DRIVEBACK,
|
---|
[189] | 977 | DriveBackProc,
|
---|
| 978 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 979 | sizeof(PVOID));
|
---|
[2] | 980 | WinRegisterClass(hab,
|
---|
[593] | 981 | WC_SEEALL,
|
---|
[189] | 982 | SeeAllWndProc,
|
---|
[551] | 983 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID));
|
---|
[2] | 984 | WinRegisterClass(hab,
|
---|
[593] | 985 | WC_NEWVIEW,
|
---|
[189] | 986 | ViewWndProc,
|
---|
[551] | 987 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID));
|
---|
[2] | 988 | WinRegisterClass(hab,
|
---|
[593] | 989 | WC_TOOLBUTTONS,
|
---|
[189] | 990 | ChildButtonProc,
|
---|
| 991 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 992 | sizeof(PVOID));
|
---|
[2] | 993 | WinRegisterClass(hab,
|
---|
[593] | 994 | WC_DRIVEBUTTONS,
|
---|
[189] | 995 | DriveProc,
|
---|
| 996 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 997 | sizeof(PVOID));
|
---|
[2] | 998 | WinRegisterClass(hab,
|
---|
[593] | 999 | WC_BUBBLE,
|
---|
[189] | 1000 | BubbleProc,
|
---|
| 1001 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 1002 | sizeof(ULONG) * 2);
|
---|
[2] | 1003 | WinRegisterClass(hab,
|
---|
[593] | 1004 | WC_STATUS,
|
---|
[189] | 1005 | StatusProc,
|
---|
| 1006 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 1007 | sizeof(ULONG));
|
---|
[2] | 1008 | WinRegisterClass(hab,
|
---|
[593] | 1009 | WC_DIRSTATUS,
|
---|
[189] | 1010 | DirTextProc,
|
---|
| 1011 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 1012 | sizeof(ULONG));
|
---|
[2] | 1013 | WinRegisterClass(hab,
|
---|
[593] | 1014 | WC_TREESTATUS,
|
---|
[189] | 1015 | TreeStatProc,
|
---|
| 1016 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 1017 | sizeof(ULONG));
|
---|
[2] | 1018 | WinRegisterClass(hab,
|
---|
[593] | 1019 | WC_ARCSTATUS,
|
---|
[189] | 1020 | ArcTextProc,
|
---|
| 1021 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 1022 | sizeof(ULONG));
|
---|
[2] | 1023 | WinRegisterClass(hab,
|
---|
[593] | 1024 | WC_COLSTATUS,
|
---|
[189] | 1025 | CollectorTextProc,
|
---|
| 1026 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 1027 | sizeof(ULONG));
|
---|
[2] | 1028 | WinRegisterClass(hab,
|
---|
[593] | 1029 | WC_SEESTATUS,
|
---|
[189] | 1030 | SeeStatusProc,
|
---|
| 1031 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 1032 | sizeof(ULONG));
|
---|
[2] | 1033 | WinRegisterClass(hab,
|
---|
[593] | 1034 | WC_VIEWSTATUS,
|
---|
[189] | 1035 | ViewStatusProc,
|
---|
| 1036 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 1037 | sizeof(ULONG));
|
---|
[2] | 1038 | WinRegisterClass(hab,
|
---|
[593] | 1039 | WC_ERRORWND,
|
---|
[189] | 1040 | NotifyWndProc,
|
---|
| 1041 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 1042 | sizeof(PVOID));
|
---|
[2] | 1043 | WinRegisterClass(hab,
|
---|
[593] | 1044 | WC_MINITIME,
|
---|
[189] | 1045 | MiniTimeProc,
|
---|
| 1046 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 1047 | sizeof(PVOID) * 2);
|
---|
[2] | 1048 | WinRegisterClass(hab,
|
---|
[593] | 1049 | WC_DATABAR,
|
---|
[551] | 1050 | DataProc, CS_SIZEREDRAW, sizeof(PVOID));
|
---|
[2] | 1051 | WinRegisterClass(hab,
|
---|
[593] | 1052 | WC_TREEOPENBUTTON,
|
---|
[189] | 1053 | OpenButtonProc,
|
---|
| 1054 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 1055 | sizeof(PVOID));
|
---|
[2] | 1056 | WinRegisterClass(hab,
|
---|
[593] | 1057 | WC_AUTOVIEW,
|
---|
[189] | 1058 | AutoViewProc,
|
---|
| 1059 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 1060 | sizeof(PVOID));
|
---|
[2] | 1061 | WinRegisterClass(hab,
|
---|
[593] | 1062 | WC_LED,
|
---|
[189] | 1063 | LEDProc,
|
---|
| 1064 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
---|
| 1065 | sizeof(PVOID));
|
---|
[2] | 1066 |
|
---|
| 1067 | /*
|
---|
[201] | 1068 | * set some defaults (note: everything else automatically initialized
|
---|
[2] | 1069 | * to 0)
|
---|
| 1070 | */
|
---|
[1065] | 1071 | dsDirCnrDefault.detailssize = dsDirCnrDefault.detailsea = dsDirCnrDefault.detailslwdate =
|
---|
| 1072 | dsDirCnrDefault.detailslwtime = dsDirCnrDefault.detailsattr = dsDirCnrDefault.detailsicon =
|
---|
| 1073 | fAutoTile = fConfirmDelete = fLoadSubject = fUnHilite =
|
---|
[189] | 1074 | fLoadLongnames = fToolbar = fSaveState = fGuessType = fToolbarHelp =
|
---|
| 1075 | fAutoAddDirs = fUseNewViewer = fDataToFore = fDataShowDrives =
|
---|
| 1076 | fSplitStatus = fDragndropDlg = fQuickArcFind = fKeepCmdLine =
|
---|
| 1077 | fMoreButtons = fDrivebar = fCollapseFirst = fSwitchTree =
|
---|
| 1078 | fSwitchTreeExpand = fNoSearch = fCustomFileDlg = fOtherHelp =
|
---|
| 1079 | fSaveMiniCmds = fUserComboBox = fFM2Deletes = fConfirmTarget =
|
---|
[850] | 1080 | fShowTarget = fDrivebarHelp = fCheckMM = TRUE;
|
---|
[2] | 1081 | ulCnrType = CCS_EXTENDSEL;
|
---|
[789] | 1082 | FilesToGet = FILESTOGET_MIN;
|
---|
[985] | 1083 | MaxComLineStrg = MAXCOMLINESTRGDEFAULT;
|
---|
[752] | 1084 | AutoviewHeight = 48;
|
---|
[189] | 1085 | strcpy(printer, "PRN");
|
---|
[2] | 1086 | prnwidth = 80;
|
---|
| 1087 | prnlength = 66;
|
---|
| 1088 | prntmargin = 6;
|
---|
| 1089 | prnbmargin = 6;
|
---|
| 1090 | prnlmargin = 6;
|
---|
| 1091 | prnrmargin = 3;
|
---|
| 1092 | prnspacing = 1;
|
---|
| 1093 | prntabspaces = 8;
|
---|
| 1094 | CollectorsortFlags = sortFlags = SORT_DIRSFIRST;
|
---|
| 1095 |
|
---|
[860] | 1096 | //Get default Country info
|
---|
| 1097 | {
|
---|
| 1098 | COUNTRYCODE Country = {0};
|
---|
| 1099 | ULONG ulInfoLen = 0;
|
---|
| 1100 | COUNTRYINFO CtryInfo = {0};
|
---|
| 1101 |
|
---|
| 1102 | DosQueryCtryInfo(sizeof(CtryInfo), &Country,
|
---|
[917] | 1103 | &CtryInfo, &ulInfoLen);
|
---|
[860] | 1104 | *ThousandsSeparator = CtryInfo.szThousandsSeparator[0];
|
---|
| 1105 | }
|
---|
| 1106 |
|
---|
[201] | 1107 | // load preferences from profile (INI) file
|
---|
[985] | 1108 | size = sizeof(ULONG);
|
---|
| 1109 | PrfQueryProfileData(fmprof, appname, "MaxComLineStrg", &MaxComLineStrg, &size);
|
---|
[1004] | 1110 | // Give user one chance to reset the default command line length to 1024 (4os2's unexpanded max)
|
---|
| 1111 | if (MaxComLineStrg == 2048) {
|
---|
| 1112 | BOOL MaxComLineChecked = FALSE;
|
---|
| 1113 |
|
---|
| 1114 | size = sizeof(BOOL);
|
---|
| 1115 | PrfQueryProfileData(fmprof, appname, "MaxComLineChecked", &MaxComLineChecked, &size);
|
---|
| 1116 | if (!MaxComLineChecked) {
|
---|
| 1117 | ret = saymsg(MB_YESNO,
|
---|
[1077] | 1118 | HWND_DESKTOP,
|
---|
| 1119 | NullStr,
|
---|
| 1120 | GetPString(IDS_CHANGECMDLINELENGTHDEFAULT));
|
---|
[1004] | 1121 | if (ret == MBID_YES)
|
---|
[1077] | 1122 | MaxComLineStrg = 1024;
|
---|
[1004] | 1123 | MaxComLineChecked = TRUE;
|
---|
| 1124 | PrfWriteProfileData(fmprof, appname, "MaxComLineChecked", &MaxComLineChecked, sizeof(BOOL));
|
---|
| 1125 | }
|
---|
| 1126 | }
|
---|
[985] | 1127 | if (MaxComLineStrg < CMDLNLNGTH_MIN)
|
---|
| 1128 | MaxComLineStrg = CMDLNLNGTH_MIN;
|
---|
| 1129 | else if (MaxComLineStrg > CMDLNLNGTH_MAX)
|
---|
| 1130 | MaxComLineStrg = CMDLNLNGTH_MAX;
|
---|
| 1131 | editor = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
| 1132 | if (!editor)
|
---|
| 1133 | return 0; //already complained
|
---|
| 1134 | viewer = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
| 1135 | if (!viewer)
|
---|
| 1136 | return 0; //already complained
|
---|
| 1137 | virus = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
| 1138 | if (!virus)
|
---|
| 1139 | return 0; //already complained
|
---|
| 1140 | compare = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
| 1141 | if (!compare)
|
---|
| 1142 | return 0; //already complained
|
---|
| 1143 | binview = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
| 1144 | if (!binview)
|
---|
| 1145 | return 0; //already complained
|
---|
| 1146 | bined = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
| 1147 | if (!bined)
|
---|
| 1148 | return 0; //already complained
|
---|
| 1149 | dircompare = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
| 1150 | if (!dircompare)
|
---|
| 1151 | return 0; //already complained
|
---|
| 1152 | ftprun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
| 1153 | if (!ftprun)
|
---|
| 1154 | return 0; //already complained
|
---|
| 1155 | httprun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
| 1156 | if (!httprun)
|
---|
| 1157 | return 0; //already complained
|
---|
| 1158 | mailrun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
| 1159 | if (!mailrun)
|
---|
| 1160 | return 0; //already complained
|
---|
[1083] | 1161 | pszTreeEnvVarList = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
| 1162 | if (!pszTreeEnvVarList)
|
---|
| 1163 | return 0; //already complained
|
---|
[201] | 1164 | size = sizeof(BOOL);
|
---|
[803] | 1165 | PrfQueryProfileData(fmprof, appname, "ShowTarget", &fShowTarget, &size);
|
---|
[201] | 1166 | size = sizeof(BOOL);
|
---|
[803] | 1167 | PrfQueryProfileData(fmprof, appname, "CheckMM", &fCheckMM, &size);
|
---|
[201] | 1168 | size = sizeof(BOOL);
|
---|
[803] | 1169 | PrfQueryProfileData(fmprof, appname, "ChangeTarget", &fChangeTarget, &size);
|
---|
[201] | 1170 | size = sizeof(BOOL);
|
---|
[803] | 1171 | PrfQueryProfileData(fmprof, appname, "ConfirmTarget", &fConfirmTarget, &size);
|
---|
[201] | 1172 | size = sizeof(BOOL);
|
---|
[803] | 1173 | PrfQueryProfileData(fmprof, FM3Str, "CustomFileDlg", &fCustomFileDlg, &size);
|
---|
[201] | 1174 | size = sizeof(BOOL);
|
---|
[803] | 1175 | PrfQueryProfileData(fmprof, FM3Str, "SaveMiniCmds", &fSaveMiniCmds, &size);
|
---|
[201] | 1176 | size = sizeof(BOOL);
|
---|
[803] | 1177 | PrfQueryProfileData(fmprof, appname, "SaveBigCmds", &fSaveBigCmds, &size);
|
---|
[201] | 1178 | size = sizeof(BOOL);
|
---|
[803] | 1179 | PrfQueryProfileData(fmprof, appname, "NoFoldMenu", &fNoFoldMenu, &size);
|
---|
[201] | 1180 | size = sizeof(BOOL);
|
---|
[803] | 1181 | PrfQueryProfileData(fmprof, FM3Str, "ThreadNotes", &fThreadNotes, &size);
|
---|
[551] | 1182 | size = sizeof(BOOL);
|
---|
[803] | 1183 | PrfQueryProfileData(fmprof, FM3Str, "Prnpagenums", &prnpagenums, &size);
|
---|
[201] | 1184 | size = sizeof(BOOL);
|
---|
[803] | 1185 | PrfQueryProfileData(fmprof, FM3Str, "Prnalt", &prnalt, &size);
|
---|
[201] | 1186 | size = sizeof(BOOL);
|
---|
[803] | 1187 | PrfQueryProfileData(fmprof, FM3Str, "Prnformat", &prnformat, &size);
|
---|
[201] | 1188 | size = sizeof(BOOL);
|
---|
| 1189 | PrfQueryProfileData(fmprof, FM3Str, "Prnformfeedbefore",
|
---|
[803] | 1190 | &prnformfeedbefore, &size);
|
---|
[201] | 1191 | size = sizeof(BOOL);
|
---|
[803] | 1192 | PrfQueryProfileData(fmprof, FM3Str,
|
---|
| 1193 | "Prnformfeedafter",&prnformfeedafter, &size);
|
---|
[201] | 1194 | size = sizeof(ULONG);
|
---|
[803] | 1195 | PrfQueryProfileData(fmprof, FM3Str, "Prntabspaces", &prntabspaces, &size);
|
---|
[201] | 1196 | size = sizeof(ULONG);
|
---|
[803] | 1197 | PrfQueryProfileData(fmprof, FM3Str, "Prnwidth", &prnwidth, &size);
|
---|
[201] | 1198 | size = sizeof(ULONG);
|
---|
[803] | 1199 | PrfQueryProfileData(fmprof, FM3Str, "Prnlength", &prnlength, &size);
|
---|
[201] | 1200 | size = sizeof(ULONG);
|
---|
[803] | 1201 | PrfQueryProfileData(fmprof, FM3Str, "Prntmargin", &prntmargin, &size);
|
---|
[201] | 1202 | size = sizeof(ULONG);
|
---|
[803] | 1203 | PrfQueryProfileData(fmprof, FM3Str, "Prnbmargin", &prnbmargin, &size);
|
---|
[201] | 1204 | size = sizeof(ULONG);
|
---|
[803] | 1205 | PrfQueryProfileData(fmprof, FM3Str, "Prnlmargin", &prnlmargin, &size);
|
---|
[201] | 1206 | size = sizeof(ULONG);
|
---|
[803] | 1207 | PrfQueryProfileData(fmprof, FM3Str, "Prnrmargin", &prnrmargin, &size);
|
---|
[201] | 1208 | size = sizeof(ULONG);
|
---|
[803] | 1209 | PrfQueryProfileData(fmprof, FM3Str, "Prnspacing", &prnspacing, &size);
|
---|
[201] | 1210 | size = sizeof(BOOL);
|
---|
[803] | 1211 | PrfQueryProfileData(fmprof, FM3Str, "NoDead", &fNoDead, &size);
|
---|
[201] | 1212 | size = sizeof(BOOL);
|
---|
[803] | 1213 | PrfQueryProfileData(fmprof, FM3Str, "NoFinger", &fNoFinger, &size);
|
---|
[201] | 1214 | size = sizeof(BOOL);
|
---|
[803] | 1215 | PrfQueryProfileData(fmprof, appname, "SwitchTree", &fSwitchTree, &size);
|
---|
[201] | 1216 | size = sizeof(BOOL);
|
---|
| 1217 | PrfQueryProfileData(fmprof, appname, "SwitchTreeExpand",
|
---|
[803] | 1218 | &fSwitchTreeExpand, &size);
|
---|
[201] | 1219 | size = sizeof(BOOL);
|
---|
| 1220 | PrfQueryProfileData(fmprof, appname, "SwitchTreeOnFocus",
|
---|
[803] | 1221 | &fSwitchTreeOnFocus, &size);
|
---|
[201] | 1222 | size = sizeof(BOOL);
|
---|
| 1223 | PrfQueryProfileData(fmprof, appname, "CollapseFirst",
|
---|
[803] | 1224 | &fCollapseFirst, &size);
|
---|
[201] | 1225 | size = sizeof(BOOL);
|
---|
| 1226 | PrfQueryProfileData(fmprof, appname, "FilesInTree",
|
---|
[803] | 1227 | &fFilesInTree, &size);
|
---|
[201] | 1228 | size = sizeof(BOOL);
|
---|
[803] | 1229 | PrfQueryProfileData(fmprof, FM3Str, "TopDir", &fTopDir, &size);
|
---|
[201] | 1230 | size = sizeof(BOOL);
|
---|
[803] | 1231 | PrfQueryProfileData(fmprof, FM3Str, "LookInDir", &fLookInDir, &size);
|
---|
[551] | 1232 | PrfQueryProfileString(fmprof, appname, "DefArc", NULL, szDefArc,
|
---|
| 1233 | sizeof(szDefArc));
|
---|
[201] | 1234 | size = sizeof(ULONG);
|
---|
| 1235 | PrfQueryProfileData(fmprof, FM3Str, "AutoviewHeight",
|
---|
[803] | 1236 | &AutoviewHeight, &size);
|
---|
[201] | 1237 | size = sizeof(BOOL);
|
---|
[803] | 1238 | PrfQueryProfileData(fmprof, FM3Str, "KeepCmdLine", &fKeepCmdLine, &size);
|
---|
[551] | 1239 | if (strcmp(realappname, "FM/4")) {
|
---|
[2] | 1240 | size = sizeof(BOOL);
|
---|
[803] | 1241 | PrfQueryProfileData(fmprof, FM3Str, "MoreButtons", &fMoreButtons, &size);
|
---|
[2] | 1242 | size = sizeof(BOOL);
|
---|
[803] | 1243 | PrfQueryProfileData(fmprof, FM3Str, "Drivebar", &fDrivebar, &size);
|
---|
[201] | 1244 | }
|
---|
| 1245 | else
|
---|
| 1246 | fDrivebar = fMoreButtons = TRUE;
|
---|
| 1247 | size = sizeof(BOOL);
|
---|
[803] | 1248 | PrfQueryProfileData(fmprof, appname, "NoSearch", &fNoSearch, &size);
|
---|
[201] | 1249 | size = sizeof(BOOL);
|
---|
[803] | 1250 | PrfQueryProfileData(fmprof, appname, "GuessType", &fGuessType, &size);
|
---|
[201] | 1251 | size = sizeof(BOOL);
|
---|
[803] | 1252 | PrfQueryProfileData(fmprof, appname, "ViewChild", &fViewChild, &size);
|
---|
[201] | 1253 | size = sizeof(BOOL);
|
---|
[803] | 1254 | PrfQueryProfileData(fmprof, appname, "ShowEnv", &fShowEnv, &size);
|
---|
[1083] | 1255 | size = MaxComLineStrg;
|
---|
| 1256 | PrfQueryProfileData(fmprof, appname, "TreeEnvVarList", pszTreeEnvVarList, &size);
|
---|
[201] | 1257 | size = sizeof(BOOL);
|
---|
[803] | 1258 | PrfQueryProfileData(fmprof, appname, "LeaveTree", &fLeaveTree, &size);
|
---|
[201] | 1259 | size = sizeof(BOOL);
|
---|
[803] | 1260 | PrfQueryProfileData(fmprof, FM3Str, "Comments", &fComments, &size);
|
---|
[201] | 1261 | size = sizeof(ULONG);
|
---|
[803] | 1262 | PrfQueryProfileData(fmprof, appname, "WS_ANIMATE", &fwsAnimate, &size);
|
---|
[201] | 1263 | if (fwsAnimate)
|
---|
| 1264 | fwsAnimate = WS_ANIMATE;
|
---|
| 1265 | size = sizeof(ULONG);
|
---|
| 1266 | size = sizeof(BOOL);
|
---|
| 1267 | PrfQueryProfileData(fmprof, appname, "SelectedAlways",
|
---|
[803] | 1268 | &fSelectedAlways, &size);
|
---|
[201] | 1269 | size = sizeof(BOOL);
|
---|
[803] | 1270 | PrfQueryProfileData(fmprof, FM3Str, "ToolbarHelp", &fToolbarHelp, &size);
|
---|
[201] | 1271 | size = sizeof(BOOL);
|
---|
[803] | 1272 | PrfQueryProfileData(fmprof, FM3Str, "OtherHelp", &fOtherHelp, &size);
|
---|
[201] | 1273 | size = sizeof(BOOL);
|
---|
[803] | 1274 | PrfQueryProfileData(fmprof, FM3Str, "DrivebarHelp", &fDrivebarHelp, &size);
|
---|
[201] | 1275 | size = sizeof(BOOL);
|
---|
[803] | 1276 | PrfQueryProfileData(fmprof, appname, "AutoAddDirs", &fAutoAddDirs, &size);
|
---|
[201] | 1277 | size = sizeof(BOOL);
|
---|
[803] | 1278 | PrfQueryProfileData(fmprof, appname,
|
---|
| 1279 | "AutoAddAllDirs", &fAutoAddAllDirs, &size);
|
---|
[201] | 1280 | size = sizeof(BOOL);
|
---|
| 1281 | PrfQueryProfileData(fmprof, FM3Str, "UserListSwitches",
|
---|
[803] | 1282 | &fUserListSwitches, &size);
|
---|
[201] | 1283 | size = sizeof(BOOL);
|
---|
| 1284 | PrfQueryProfileData(fmprof, appname, "UseNewViewer",
|
---|
[803] | 1285 | &fUseNewViewer, &size);
|
---|
[201] | 1286 | size = sizeof(BOOL);
|
---|
| 1287 | PrfQueryProfileData(fmprof, appname, "DefaultDeletePerm",
|
---|
[803] | 1288 | &fDefaultDeletePerm, &size);
|
---|
[201] | 1289 | size = sizeof(BOOL);
|
---|
| 1290 | PrfQueryProfileData(fmprof, FM3Str, "ExternalINIs",
|
---|
[803] | 1291 | &fExternalINIs, &size);
|
---|
[201] | 1292 | size = sizeof(BOOL);
|
---|
| 1293 | PrfQueryProfileData(fmprof, FM3Str, "ExternalCollector",
|
---|
[803] | 1294 | &fExternalCollector, &size);
|
---|
[201] | 1295 | size = sizeof(BOOL);
|
---|
| 1296 | PrfQueryProfileData(fmprof, FM3Str, "ExternalArcboxes",
|
---|
[803] | 1297 | &fExternalArcboxes, &size);
|
---|
[201] | 1298 | size = sizeof(BOOL);
|
---|
| 1299 | PrfQueryProfileData(fmprof, FM3Str, "ExternalViewer",
|
---|
[803] | 1300 | &fExternalViewer, &size);
|
---|
[201] | 1301 | size = sizeof(BOOL);
|
---|
| 1302 | PrfQueryProfileData(fmprof, FM3Str, "UseQProcStat",
|
---|
[850] | 1303 | &fUseQProcStat, &size);
|
---|
[201] | 1304 | size = sizeof(BOOL);
|
---|
[828] | 1305 | PrfQueryProfileData(fmprof, FM3Str, "UseQSysState",
|
---|
| 1306 | &fUseQSysState, &size);
|
---|
| 1307 | size = sizeof(BOOL);
|
---|
[803] | 1308 | PrfQueryProfileData(fmprof, FM3Str, "DataMin", &fDataMin, &size);
|
---|
[201] | 1309 | size = sizeof(BOOL);
|
---|
[803] | 1310 | PrfQueryProfileData(fmprof, appname, "DataToFore", &fDataToFore, &size);
|
---|
[201] | 1311 | size = sizeof(BOOL);
|
---|
| 1312 | PrfQueryProfileData(fmprof, appname, "DataShowDrives",
|
---|
[803] | 1313 | &fDataShowDrives, &size);
|
---|
[201] | 1314 | size = sizeof(BOOL);
|
---|
| 1315 | PrfQueryProfileData(fmprof, appname, "DataInclRemote",
|
---|
[803] | 1316 | &fDataInclRemote, &size);
|
---|
[201] | 1317 | size = sizeof(BOOL);
|
---|
[803] | 1318 | PrfQueryProfileData(fmprof, FM3Str, "SplitStatus", &fSplitStatus, &size);
|
---|
[201] | 1319 | size = sizeof(BOOL);
|
---|
| 1320 | PrfQueryProfileData(fmprof, appname, "FolderAfterExtract",
|
---|
[803] | 1321 | &fFolderAfterExtract, &size);
|
---|
[201] | 1322 | size = sizeof(BOOL);
|
---|
[803] | 1323 | PrfQueryProfileData(fmprof, FM3Str, "DullDatabar", &fDullMin, &size);
|
---|
[201] | 1324 | size = sizeof(BOOL);
|
---|
[803] | 1325 | PrfQueryProfileData(fmprof, appname, "BlueLED", &fBlueLED, &size);
|
---|
[201] | 1326 | size = sizeof(BOOL);
|
---|
[551] | 1327 | PrfQueryProfileData(fmprof, appname, "ConfirmDelete",
|
---|
[803] | 1328 | &fConfirmDelete, &size);
|
---|
[201] | 1329 | size = sizeof(BOOL);
|
---|
[803] | 1330 | PrfQueryProfileData(fmprof, FM3Str, "SaveState", &fSaveState, &size);
|
---|
[201] | 1331 | size = sizeof(BOOL);
|
---|
[803] | 1332 | PrfQueryProfileData(fmprof, appname, "SyncUpdates", &fSyncUpdates, &size);
|
---|
[201] | 1333 | size = sizeof(BOOL);
|
---|
[803] | 1334 | PrfQueryProfileData(fmprof, appname, "LoadSubject", &fLoadSubject, &size);
|
---|
[201] | 1335 | size = sizeof(BOOL);
|
---|
[803] | 1336 | PrfQueryProfileData(fmprof, appname, "UnHilite", &fUnHilite, &size);
|
---|
[201] | 1337 | size = sizeof(BOOL);
|
---|
[803] | 1338 | PrfQueryProfileData(fmprof, FM3Str, "TileBackwards", &fTileBackwards, &size);
|
---|
[201] | 1339 | size = sizeof(BOOL);
|
---|
[803] | 1340 | PrfQueryProfileData(fmprof, appname, "LoadLongname", &fLoadLongnames, &size);
|
---|
[551] | 1341 | size = sizeof(BOOL);
|
---|
[803] | 1342 | PrfQueryProfileData(fmprof, appname, "VerifyWrites", &fVerify, &size);
|
---|
[201] | 1343 | DosSetVerify(fVerify);
|
---|
| 1344 | size = sizeof(BOOL);
|
---|
[803] | 1345 | PrfQueryProfileData(fmprof, appname, "DontMoveMouse", &fDontMoveMouse, &size);
|
---|
[201] | 1346 | size = sizeof(BOOL);
|
---|
[803] | 1347 | PrfQueryProfileData(fmprof, appname, "NoIconsFiles", &fNoIconsFiles, &size);
|
---|
[201] | 1348 | size = sizeof(BOOL);
|
---|
[803] | 1349 | PrfQueryProfileData(fmprof, appname, "NoIconsDirs", &fNoIconsDirs, &size);
|
---|
[201] | 1350 | size = sizeof(BOOL);
|
---|
[803] | 1351 | PrfQueryProfileData(fmprof, appname, "ForceUpper", &fForceUpper, &size);
|
---|
[201] | 1352 | size = sizeof(BOOL);
|
---|
[803] | 1353 | PrfQueryProfileData(fmprof, appname, "ForceLower", &fForceLower, &size);
|
---|
[201] | 1354 | size = sizeof(BOOL);
|
---|
[803] | 1355 | PrfQueryProfileData(fmprof, FM3Str, "TextTools", &fTextTools, &size);
|
---|
[201] | 1356 | size = sizeof(BOOL);
|
---|
[803] | 1357 | PrfQueryProfileData(fmprof, FM3Str, "ToolTitles", &fToolTitles, &size);
|
---|
[201] | 1358 | size = sizeof(BOOL);
|
---|
[803] | 1359 | PrfQueryProfileData(fmprof, appname, "DoubleClickOpens", &fDCOpens, &size);
|
---|
[201] | 1360 | size = sizeof(BOOL);
|
---|
[803] | 1361 | PrfQueryProfileData(fmprof, appname, "LinkSetsIcon", &fLinkSetsIcon, &size);
|
---|
[201] | 1362 | size = sizeof(INT);
|
---|
[803] | 1363 | PrfQueryProfileData(fmprof, appname, "Sort", &sortFlags, &size);
|
---|
[201] | 1364 | size = sizeof(INT);
|
---|
[803] | 1365 | PrfQueryProfileData(fmprof, appname, "TreeSort", &TreesortFlags, &size);
|
---|
[201] | 1366 | size = sizeof(INT);
|
---|
[803] | 1367 | PrfQueryProfileData(fmprof, appname,
|
---|
| 1368 | "CollectorSort", &CollectorsortFlags, &size);
|
---|
[201] | 1369 | size = sizeof(targetdir);
|
---|
[803] | 1370 | PrfQueryProfileData(fmprof, appname, "Targetdir", targetdir, &size);
|
---|
[201] | 1371 | if (!IsValidDir(targetdir))
|
---|
| 1372 | *targetdir = 0;
|
---|
| 1373 | size = sizeof(extractpath);
|
---|
[803] | 1374 | PrfQueryProfileData(fmprof, appname, "ExtractPath", extractpath, &size);
|
---|
[201] | 1375 | size = sizeof(printer);
|
---|
[803] | 1376 | PrfQueryProfileData(fmprof, appname, "Printer", printer, &size);
|
---|
[985] | 1377 | size = MaxComLineStrg;
|
---|
[803] | 1378 | PrfQueryProfileData(fmprof, appname, "DirCompare", dircompare,
|
---|
[551] | 1379 | &size);
|
---|
[985] | 1380 | size = MaxComLineStrg;
|
---|
[803] | 1381 | PrfQueryProfileData(fmprof, appname, "Viewer", viewer, &size);
|
---|
[985] | 1382 | size = MaxComLineStrg;
|
---|
[803] | 1383 | PrfQueryProfileData(fmprof, appname, "Editor", editor, &size);
|
---|
[985] | 1384 | size = MaxComLineStrg;
|
---|
[803] | 1385 | PrfQueryProfileData(fmprof, appname, "BinView", binview, &size);
|
---|
[985] | 1386 | size = MaxComLineStrg;
|
---|
[803] | 1387 | PrfQueryProfileData(fmprof, appname, "BinEd", bined, &size);
|
---|
[985] | 1388 | size = MaxComLineStrg;
|
---|
[803] | 1389 | PrfQueryProfileData(fmprof, appname, "Compare", compare, &size);
|
---|
[985] | 1390 | size = MaxComLineStrg;
|
---|
[803] | 1391 | PrfQueryProfileData(fmprof, appname, "Virus", virus, &size);
|
---|
[892] | 1392 | size = sizeof(BOOL);
|
---|
| 1393 | PrfQueryProfileData(fmprof, appname, "FtpRunWPSDefault", &fFtpRunWPSDefault, &size);
|
---|
[985] | 1394 | size = MaxComLineStrg;
|
---|
[803] | 1395 | PrfQueryProfileData(fmprof, appname, "FTPRun", ftprun, &size);
|
---|
[917] | 1396 | if (!*ftprun)
|
---|
[892] | 1397 | fFtpRunWPSDefault = TRUE;
|
---|
| 1398 | size = sizeof(BOOL);
|
---|
| 1399 | PrfQueryProfileData(fmprof, appname, "HttpRunWPSDefault", &fHttpRunWPSDefault, &size);
|
---|
[985] | 1400 | size = MaxComLineStrg;
|
---|
[803] | 1401 | PrfQueryProfileData(fmprof, appname, "HTTPRun", httprun, &size);
|
---|
[917] | 1402 | if (!*httprun)
|
---|
[892] | 1403 | fHttpRunWPSDefault = TRUE;
|
---|
[985] | 1404 | size = MaxComLineStrg;
|
---|
[892] | 1405 | PrfQueryProfileData(fmprof, appname, "MailRun", mailrun, &size);
|
---|
| 1406 | size = sizeof(ftprundir);
|
---|
| 1407 | PrfQueryProfileData(fmprof, appname, "FtpRunDir", ftprundir, &size);
|
---|
| 1408 | size = sizeof(httprundir);
|
---|
| 1409 | PrfQueryProfileData(fmprof, appname, "HttpRunDir", httprundir, &size);
|
---|
| 1410 | size = sizeof(mailrundir);
|
---|
[898] | 1411 | PrfQueryProfileData(fmprof, appname, "MailRunDir", mailrundir, &size);
|
---|
[201] | 1412 | size = sizeof(lasttoolbox);
|
---|
[803] | 1413 | PrfQueryProfileData(fmprof, FM3Str, "LastToolBox", lasttoolbox,
|
---|
[917] | 1414 | &size);
|
---|
[892] | 1415 | size = sizeof(BOOL);
|
---|
| 1416 | PrfQueryProfileData(fmprof, appname, "LibPathStrictHttpRun", &fLibPathStrictHttpRun,
|
---|
[917] | 1417 | &size);
|
---|
[892] | 1418 | size = sizeof(BOOL);
|
---|
| 1419 | PrfQueryProfileData(fmprof, appname, "LibPathStrictFtpRun", &fLibPathStrictFtpRun,
|
---|
[917] | 1420 | &size);
|
---|
[896] | 1421 | size = sizeof(BOOL);
|
---|
| 1422 | PrfQueryProfileData(fmprof, appname, "LibPathStrictMailRun", &fLibPathStrictMailRun,
|
---|
[917] | 1423 | &size);
|
---|
[898] | 1424 | size = sizeof(BOOL);
|
---|
| 1425 | PrfQueryProfileData(fmprof, appname, "NoMailtoMailRun", &fNoMailtoMailRun,
|
---|
[551] | 1426 | &size);
|
---|
[201] | 1427 | size = sizeof(BOOL);
|
---|
[803] | 1428 | PrfQueryProfileData(fmprof, appname, "FollowTree", &fFollowTree,
|
---|
[551] | 1429 | &size);
|
---|
[201] | 1430 | size = sizeof(BOOL);
|
---|
[551] | 1431 | PrfQueryProfileData(fmprof, appname, "StartMaximized",
|
---|
[803] | 1432 | &fStartMaximized, &size);
|
---|
[551] | 1433 | if (!fStartMaximized) {
|
---|
[2] | 1434 | size = sizeof(BOOL);
|
---|
[551] | 1435 | PrfQueryProfileData(fmprof, appname, "StartMinimized",
|
---|
[803] | 1436 | &fStartMinimized, &size);
|
---|
[2] | 1437 | }
|
---|
[201] | 1438 | size = sizeof(BOOL);
|
---|
[803] | 1439 | PrfQueryProfileData(fmprof, appname, "DefaultCopy", &fCopyDefault, &size);
|
---|
[201] | 1440 | size = sizeof(BOOL);
|
---|
[803] | 1441 | PrfQueryProfileData(fmprof, appname, "IdleCopy", &fRealIdle, &size);
|
---|
[201] | 1442 | size = sizeof(BOOL);
|
---|
| 1443 | PrfQueryProfileData(fmprof, appname, "ArcStuffVisible",
|
---|
[803] | 1444 | &fArcStuffVisible, &size);
|
---|
[201] | 1445 | size = sizeof(BOOL);
|
---|
[803] | 1446 | PrfQueryProfileData(fmprof, FM3Str, "NoTreeGap", &fNoTreeGap, &size);
|
---|
[201] | 1447 | size = sizeof(BOOL);
|
---|
[551] | 1448 | PrfQueryProfileData(fmprof, FM3Str, "VTreeOpensWPS",
|
---|
[803] | 1449 | &fVTreeOpensWPS, &size);
|
---|
[201] | 1450 | size = sizeof(BOOL);
|
---|
[803] | 1451 | PrfQueryProfileData(fmprof, appname, "RemoteBug", &fRemoteBug, &size);
|
---|
[201] | 1452 | size = sizeof(BOOL);
|
---|
[551] | 1453 | PrfQueryProfileData(fmprof, appname, "Drag&DropDlg",
|
---|
[803] | 1454 | &fDragndropDlg, &size);
|
---|
[551] | 1455 | size = sizeof(BOOL);
|
---|
[803] | 1456 | PrfQueryProfileData(fmprof, FM3Str, "UserComboBox", &fUserComboBox, &size);
|
---|
[201] | 1457 | size = sizeof(BOOL);
|
---|
[803] | 1458 | PrfQueryProfileData(fmprof, FM3Str, "MinDirOnOpen", &fMinOnOpen, &size);
|
---|
[201] | 1459 | size = sizeof(BOOL);
|
---|
[551] | 1460 | PrfQueryProfileData(fmprof, appname, "QuickArcFind",
|
---|
[803] | 1461 | &fQuickArcFind, &size);
|
---|
[201] | 1462 | size = sizeof(BOOL);
|
---|
[551] | 1463 | PrfQueryProfileData(fmprof, FM3Str, "NoRemovableScan",
|
---|
[803] | 1464 | &fNoRemovableScan, &size);
|
---|
[551] | 1465 | size = sizeof(ULONG);
|
---|
| 1466 | PrfQueryProfileData(fmprof, FM3Str, "NoBrokenNotify",
|
---|
[803] | 1467 | &NoBrokenNotify, &size);
|
---|
[551] | 1468 | size = sizeof(ULONG);
|
---|
[803] | 1469 | PrfQueryProfileData(fmprof, appname, "ContainerType", &ulCnrType,
|
---|
[201] | 1470 | &size);
|
---|
| 1471 | size = sizeof(ULONG);
|
---|
[803] | 1472 | PrfQueryProfileData(fmprof, appname, "FilesToGet", &FilesToGet, &size);
|
---|
[789] | 1473 | if (FilesToGet < FILESTOGET_MIN)
|
---|
| 1474 | FilesToGet = FILESTOGET_MIN;
|
---|
| 1475 | else if (FilesToGet > FILESTOGET_MAX)
|
---|
| 1476 | FilesToGet = FILESTOGET_MAX;
|
---|
[201] | 1477 | size = sizeof(BOOL);
|
---|
[803] | 1478 | PrfQueryProfileData(fmprof, FM3Str, "AutoView", &fAutoView, &size);
|
---|
[201] | 1479 | size = sizeof(BOOL);
|
---|
[803] | 1480 | PrfQueryProfileData(fmprof, FM3Str, "FM2Deletes", &fFM2Deletes, &size);
|
---|
[1045] | 1481 | size = sizeof(BOOL);
|
---|
| 1482 | PrfQueryProfileData(fmprof, FM3Str, "TrashCan", &fTrashCan, &size);
|
---|
[2] | 1483 |
|
---|
[1065] | 1484 | LoadDetailsSwitches("DirCnr", &dsDirCnrDefault);
|
---|
[784] | 1485 |
|
---|
[2] | 1486 | /* load pointers and icons we use */
|
---|
[189] | 1487 | hptrArrow = WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, FALSE);
|
---|
| 1488 | hptrBusy = WinQuerySysPointer(HWND_DESKTOP, SPTR_WAIT, FALSE);
|
---|
| 1489 | hptrNS = WinQuerySysPointer(HWND_DESKTOP, SPTR_SIZENS, FALSE);
|
---|
| 1490 | hptrEW = WinQuerySysPointer(HWND_DESKTOP, SPTR_SIZEWE, FALSE);
|
---|
| 1491 | hptrFloppy = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FLOPPY_ICON);
|
---|
| 1492 | hptrDrive = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DRIVE_ICON);
|
---|
| 1493 | hptrRemovable = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, REMOVABLE_ICON);
|
---|
| 1494 | hptrCDROM = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, CDROM_ICON);
|
---|
| 1495 | hptrFile = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_ICON);
|
---|
| 1496 | hptrDir = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DIR_FRAME);
|
---|
| 1497 | hptrArc = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ARC_FRAME);
|
---|
| 1498 | hptrArt = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ART_ICON);
|
---|
| 1499 | hptrSystem = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_SYSTEM_ICON);
|
---|
| 1500 | hptrHidden = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_HIDDEN_ICON);
|
---|
[552] | 1501 | hptrReadonly = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_READONLY_ICON);
|
---|
[189] | 1502 | hptrLast = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, LASTITEM_ICON);
|
---|
| 1503 | hptrRemote = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, REMOTE_ICON);
|
---|
[552] | 1504 | hptrVirtual = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, VIRTUAL_ICON);
|
---|
| 1505 | hptrRamdisk = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, RAMDISK_ICON);
|
---|
[189] | 1506 | if (!fNoDead)
|
---|
| 1507 | hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER_ICON);
|
---|
[2] | 1508 | else
|
---|
[189] | 1509 | hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER2_ICON);
|
---|
| 1510 | hptrApp = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, APP_ICON);
|
---|
| 1511 | hptrDunno = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DUNNO_ICON);
|
---|
| 1512 | hptrEnv = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ENV_ICON);
|
---|
| 1513 | hptrZipstrm = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ZIPSTREAM_ICON);
|
---|
[2] | 1514 |
|
---|
[201] | 1515 | // set up color array used by seeall.c and newview.c color dialog
|
---|
| 1516 |
|
---|
[189] | 1517 | standardcolors[0] = CLR_WHITE;
|
---|
| 1518 | standardcolors[1] = CLR_BLACK;
|
---|
| 1519 | standardcolors[2] = CLR_BLUE;
|
---|
| 1520 | standardcolors[3] = CLR_RED;
|
---|
| 1521 | standardcolors[4] = CLR_PINK;
|
---|
| 1522 | standardcolors[5] = CLR_GREEN;
|
---|
| 1523 | standardcolors[6] = CLR_CYAN;
|
---|
| 1524 | standardcolors[7] = CLR_YELLOW;
|
---|
| 1525 | standardcolors[8] = CLR_DARKGRAY;
|
---|
| 1526 | standardcolors[9] = CLR_DARKBLUE;
|
---|
[2] | 1527 | standardcolors[10] = CLR_DARKRED;
|
---|
| 1528 | standardcolors[11] = CLR_DARKPINK;
|
---|
| 1529 | standardcolors[12] = CLR_DARKGREEN;
|
---|
| 1530 | standardcolors[13] = CLR_DARKCYAN;
|
---|
| 1531 | standardcolors[14] = CLR_BROWN;
|
---|
| 1532 | standardcolors[15] = CLR_PALEGRAY;
|
---|
| 1533 |
|
---|
| 1534 | return TRUE;
|
---|
| 1535 | }
|
---|
| 1536 |
|
---|
[189] | 1537 | HWND StartFM3(HAB hab, INT argc, CHAR ** argv)
|
---|
| 1538 | {
|
---|
[201] | 1539 | HWND hwndFrame;
|
---|
| 1540 | HWND hwndClient;
|
---|
| 1541 | UINT x;
|
---|
[189] | 1542 | ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
|
---|
[551] | 1543 | FCF_SIZEBORDER | FCF_MINMAX |
|
---|
| 1544 | FCF_ACCELTABLE | FCF_MENU | FCF_ICON | FCF_TASKLIST | FCF_NOBYTEALIGN;
|
---|
[2] | 1545 |
|
---|
[551] | 1546 | for (x = 1; x < argc; x++) {
|
---|
[201] | 1547 | if (*argv[x] == '~' && !argv[x][1])
|
---|
| 1548 | fReminimize = TRUE;
|
---|
| 1549 | if (*argv[x] == '+' && !argv[x][1])
|
---|
| 1550 | fLogFile = TRUE;
|
---|
[551] | 1551 | if (*argv[x] == '-') {
|
---|
[201] | 1552 | if (!argv[x][1])
|
---|
| 1553 | fNoSaveState = TRUE;
|
---|
| 1554 | else
|
---|
| 1555 | strcpy(profile, &argv[x][1]);
|
---|
[2] | 1556 | }
|
---|
| 1557 | }
|
---|
| 1558 |
|
---|
| 1559 | hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
|
---|
[189] | 1560 | WS_VISIBLE,
|
---|
| 1561 | &FrameFlags,
|
---|
[593] | 1562 | WC_MAINWND,
|
---|
[189] | 1563 | NULL,
|
---|
| 1564 | WS_VISIBLE | WS_ANIMATE,
|
---|
[551] | 1565 | FM3ModHandle, MAIN_FRAME, &hwndClient);
|
---|
| 1566 | if (hwndFrame) {
|
---|
| 1567 | WinSetWindowUShort(hwndFrame, QWS_ID, MAIN_FRAME);
|
---|
[875] | 1568 | hwndMainMenu = WinWindowFromID(hwndFrame, FID_MENU);
|
---|
[551] | 1569 | if (!WinRestoreWindowPos(FM2Str, "MainWindowPos", hwndFrame)) {
|
---|
[2] | 1570 |
|
---|
| 1571 | ULONG fl = SWP_MOVE | SWP_SIZE;
|
---|
| 1572 | RECTL rcl;
|
---|
[189] | 1573 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 3L;
|
---|
| 1574 | ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
|
---|
[2] | 1575 |
|
---|
[551] | 1576 | WinQueryWindowRect(HWND_DESKTOP, &rcl);
|
---|
[2] | 1577 | rcl.yBottom += icz;
|
---|
| 1578 | rcl.yTop -= bsz;
|
---|
| 1579 | rcl.xLeft += bsz;
|
---|
| 1580 | rcl.xRight -= bsz;
|
---|
| 1581 | WinSetWindowPos(hwndFrame,
|
---|
[189] | 1582 | HWND_TOP,
|
---|
| 1583 | rcl.xLeft,
|
---|
| 1584 | rcl.yBottom,
|
---|
[551] | 1585 | rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, fl);
|
---|
[2] | 1586 | }
|
---|
[189] | 1587 | if (fLogFile)
|
---|
[551] | 1588 | LogFileHandle = _fsopen("FM2.LOG", "a+", SH_DENYWR);
|
---|
[189] | 1589 | if (hwndHelp)
|
---|
[551] | 1590 | WinAssociateHelpInstance(hwndHelp, hwndFrame);
|
---|
| 1591 | PostMsg(hwndClient, UM_SETUP, MPFROMLONG(argc), MPFROMP(argv));
|
---|
[2] | 1592 | }
|
---|
| 1593 | return hwndFrame;
|
---|
| 1594 | }
|
---|
[32] | 1595 |
|
---|
[985] | 1596 | BOOL CheckFileHeader(CHAR *filespec, CHAR *signature, LONG offset)
|
---|
| 1597 | {
|
---|
| 1598 | HFILE handle;
|
---|
| 1599 | ULONG action;
|
---|
| 1600 | ULONG len = strlen(signature);
|
---|
| 1601 | ULONG l;
|
---|
| 1602 | // CHAR buffer[80];
|
---|
| 1603 | CHAR buffer[4096]; // 06 Oct 07 SHL Protect against NTFS defect
|
---|
| 1604 | BOOL ret = FALSE;
|
---|
| 1605 |
|
---|
| 1606 | DosError(FERR_DISABLEHARDERR);
|
---|
| 1607 | if (DosOpen(filespec,
|
---|
| 1608 | &handle,
|
---|
| 1609 | &action,
|
---|
| 1610 | 0,
|
---|
| 1611 | 0,
|
---|
| 1612 | OPEN_ACTION_FAIL_IF_NEW |
|
---|
| 1613 | OPEN_ACTION_OPEN_IF_EXISTS,
|
---|
| 1614 | OPEN_FLAGS_FAIL_ON_ERROR |
|
---|
| 1615 | OPEN_FLAGS_NOINHERIT |
|
---|
| 1616 | OPEN_FLAGS_RANDOMSEQUENTIAL |
|
---|
| 1617 | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0))
|
---|
| 1618 | ret = FALSE;
|
---|
| 1619 | else {
|
---|
| 1620 | // Try signature match
|
---|
| 1621 | l = len;
|
---|
| 1622 | l = min(l, 79);
|
---|
| 1623 | if (!DosChgFilePtr(handle,
|
---|
| 1624 | abs(offset),
|
---|
| 1625 | (offset >= 0) ?
|
---|
| 1626 | FILE_BEGIN : FILE_END, &len)) {
|
---|
| 1627 | if (!DosRead(handle, buffer, l, &len) && len == l) {
|
---|
| 1628 | if (!memcmp(signature, buffer, l))
|
---|
[1077] | 1629 | ret = TRUE; // Matched
|
---|
[985] | 1630 | }
|
---|
| 1631 | }
|
---|
| 1632 | }
|
---|
| 1633 | DosClose(handle); /* Either way, we're done for now */
|
---|
| 1634 | return ret; /* Return TRUE if matched */
|
---|
| 1635 | }
|
---|
| 1636 |
|
---|
[189] | 1637 | int CheckVersion(int vermajor, int verminor)
|
---|
| 1638 | {
|
---|
[179] | 1639 | int ok = 0;
|
---|
[32] | 1640 |
|
---|
[179] | 1641 | // fixme to do useful check - was missing in base source
|
---|
| 1642 |
|
---|
[32] | 1643 | #if 0
|
---|
[551] | 1644 | if (vermajor && verminor) {
|
---|
[32] | 1645 | *vermajor = VERMAJOR;
|
---|
| 1646 | *verminor = VERMINOR;
|
---|
[179] | 1647 | ok = 1;
|
---|
[32] | 1648 | }
|
---|
| 1649 | #endif
|
---|
[189] | 1650 |
|
---|
[179] | 1651 | ok = 1;
|
---|
[32] | 1652 |
|
---|
[179] | 1653 | return ok;
|
---|
[32] | 1654 | }
|
---|
[783] | 1655 |
|
---|
| 1656 | #ifdef __WATCOMC__
|
---|
| 1657 | #pragma alloc_text(INIT,LibMain,InitFM3DLL,DeInitFM3DLL)
|
---|
| 1658 | #pragma alloc_text(INIT1,StartFM3,FindSwapperDat)
|
---|
| 1659 | #endif
|
---|