source: trunk/dll/init.c@ 201

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

Rework FindSwapperDat for VAC3.65 compat

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