source: trunk/dll/init.c@ 593

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

Changes to remove GetPString from window class names

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