source: trunk/dll/init.c@ 404

Last change on this file since 404 was 404, checked in by root, 19 years ago

Use xfgets

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