source: trunk/dll/init.c@ 926

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

Background color on toolbar now can be change with drag drop; ticket 161. Set command line string length to 2048

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