source: trunk/dll/init.c@ 952

Last change on this file since 952 was 952, checked in by Steven Levine, 18 years ago

Compile OpenWatcom version into binary

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