source: trunk/dll/init.c@ 189

Last change on this file since 189 was 189, checked in by root, 20 years ago

indent -i2

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