source: trunk/dll/init.c@ 940

Last change on this file since 940 was 940, checked in by Gregg Young, 18 years ago

Minor cleanup, added comments and History for recent changes

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