source: trunk/dll/init.c@ 888

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

runemf2 now quotes executable strings if needed (Ticket 180); it also reports where it was called from on errors

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