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
RevLine 
[32]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
[161]9 Copyright (c) 2001, 2005 Steven H. Levine
[32]10
[133]11 11 Jun 02 SHL Add CheckVersion
12 11 Jun 03 SHL Add JFS and FAT32 support
13 25 Nov 03 SHL InitFM3DLL: correct strings error mesage
14 23 May 05 SHL Use datamin.h
[179]15 26 May 05 SHL Comments
[189]16 06 Jun 05 SHL indent -i2
[32]17
18***********************************************************************/
19
[2]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>
[133]36
[2]37#include "fm3dll.h"
38#include "fm3dlg.h"
[133]39#include "datamin.h"
[2]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
[189]47extern int _CRT_init(void);
[2]48extern void _CRT_term(void);
49
50/*
[189]51 extern HMODULE FM3ResHandle;
52 extern ULONG RVMajor,RVMinor;
53 */
[2]54
[189]55VOID FindSwapperDat(VOID)
56{
57 CHAR *filename = "C:\\CONFIG.SYS", input[8192], *p, *pp;
58 FILE *fp;
[2]59 FILEFINDBUF3 ffb;
[189]60 ULONG nm = 1L, size = sizeof(SwapperDat);
61 HDIR hdir = HDIR_CREATE;
62 APIRET rc = 1L;
[2]63
64 *SwapperDat = 0;
65 PrfQueryProfileData(fmprof,
[189]66 FM3Str,
67 "SwapperDat",
68 (PVOID) SwapperDat,
69 &size);
70 if (*SwapperDat)
71 {
[2]72 rc = DosFindFirst(SwapperDat,
[189]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 {
[2]82 DosFindClose(hdir);
[189]83 fp = fopen(SwapperDat, "r");
84 if (fp)
85 {
86 fclose(fp);
87 *SwapperDat = 0;
88 rc = 1L;
[2]89 }
90 }
91 else
92 *SwapperDat = 0;
93 }
[189]94 if (rc)
95 {
96 if (DosQuerySysInfo(QSV_BOOT_DRIVE,
97 QSV_BOOT_DRIVE,
98 (PVOID) & nm,
99 (ULONG) sizeof(ULONG)))
[2]100 nm = 3L;
[189]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 }
[2]168 }
169 fclose(fp);
170 }
171 }
172}
173
[189]174unsigned long _System _DLL_InitTerm(unsigned long hModule,
175 unsigned long ulFlag)
176{
[2]177
[189]178 switch (ulFlag)
179 {
180 case 0:
181 if (_CRT_init() == -1)
182 return 0UL;
183 FM3DllHandle = hModule;
184 {
185 char *env, stringfile[CCHMAXPATH];
[2]186
[189]187 strcpy(stringfile, "FM3RES.STR");
188 env = getenv("FM3INI");
189 if (env)
[2]190 {
191
[189]192 FILESTATUS3 fsa;
193 APIRET rc;
[2]194
[189]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 }
[2]216 }
[189]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;
[2]263 }
264 return 1UL;
265}
266
[189]267VOID APIENTRY DeInitFM3DLL(ULONG why)
268{
[2]269 /* cleanup */
[189]270 static CHAR s[CCHMAXPATH];
271 CHAR *enddir;
272 HDIR search_handle;
273 ULONG num_matches;
[2]274 static FILEFINDBUF3 f;
275
276 StopTimer();
277 StopPrinting = 1;
278
[189]279 if (LogFileHandle)
[2]280 fclose(LogFileHandle);
281
[189]282 if (fmprof)
283 {
[2]284 PrfCloseProfile(fmprof);
[189]285 fmprof = (HINI) 0;
286 if (fIniExisted)
287 {
[2]288 DosError(FERR_DISABLEHARDERR);
289 DosCopy("FM3.INI",
[189]290 "FM3INI.BAK",
291 DCPY_EXISTING);
[2]292 }
293 }
294
[189]295 if (fToolsChanged)
[2]296 save_tools(NULL);
297
298 _fcloseall();
299
300 save_dir(s);
[189]301 if (s[strlen(s) - 1] != '\\')
302 strcat(s, "\\");
[2]303 enddir = &s[strlen(s)];
[189]304 if (*ArcTempRoot)
305 {
306 strcat(s, ArcTempRoot);
307 strcat(s, "*");
[2]308 search_handle = HDIR_CREATE;
309 num_matches = 1L;
[189]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));
[2]335 DosFindClose(search_handle);
336 }
337 }
338
339 save_dir(s);
[189]340 if (s[strlen(s) - 1] != '\\')
341 strcat(s, "\\");
[2]342 enddir = &s[strlen(s)];
[189]343 strcat(s, LISTTEMPROOT);
344 strcat(s, "???");
[2]345 search_handle = HDIR_CREATE;
346 num_matches = 1L;
[189]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);
[2]363 }
[189]364 }
365 while (!DosFindNext(search_handle,
366 &f,
367 sizeof(FILEFINDBUF3),
368 &num_matches));
[2]369 DosFindClose(search_handle);
370 }
371
372 DosForceDelete("$FM2PLAY.$$$");
373
374 EndNote();
375
[189]376 if (FM3ModHandle)
[2]377 DosFreeModule(FM3ModHandle);
378
379 DosExitList(EXLST_REMOVE,
[189]380 DeInitFM3DLL);
[2]381}
382
[189]383BOOL InitFM3DLL(HAB hab, int argc, char **argv)
384{
[2]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;
[189]391 BOOL okay = FALSE;
[2]392
[189]393 if (!StringsLoaded())
394 {
395 DosBeep(50, 100);
[2]396 saymsg(MB_ENTER,
[189]397 HWND_DESKTOP,
398 "Error",
399 "FM3RES.STR isn't in right format, at least "
400 "for this version of FM/2.");
[2]401 return FALSE;
402 }
403
[189]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];
[2]409
[189]410 strcpy(dllfile, "FM3RES");
[2]411 env = getenv("FM3INI");
[189]412 if (env)
413 {
[2]414
415 FILESTATUS3 fsa;
[189]416 APIRET rc;
[2]417
418 DosError(FERR_DISABLEHARDERR);
419 rc = DosQueryPathInfo(env,
[189]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 }
[2]438 }
439 }
440 rcl = DosLoadModule(NULL,
[189]441 0,
442 dllfile,
443 &FM3ModHandle);
444 if (!rcl)
445 {
446 if (DosExitList(EXLST_ADD,
447 DeInitFM3DLL))
448 DosBeep(500, 100);
[2]449 rcq = DosQueryProcAddr(FM3ModHandle,
[189]450 1,
451 "ResVersion",
452 &pfnResVersion);
453 if (!rcq)
454 ret = pfnResVersion(&RVMajor, &RVMinor);
[2]455 }
[189]456 else
457 {
[2]458 saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
[189]459 HWND_DESKTOP,
460 GetPString(IDS_ERRORTEXT),
461 GetPString(IDS_FM3RESERROR1TEXT));
[2]462 return FALSE;
463 }
[189]464 if (RVMajor < VERMAJOR ||
465 (RVMajor == VERMAJOR && RVMinor < VERMINOR))
466 {
467 DosBeep(50, 100);
[2]468 saymsg(MB_ENTER,
[189]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);
[2]482 return FALSE;
483 }
484 }
485
[189]486 ArgDriveFlags(argc, argv);
[2]487 FillInDriveFlags(NULL);
488
[189]489 { /* try to ensure that FM/2 Utilities are available */
490 CHAR curpath[CCHMAXPATH + 8], *env;
[2]491 FILESTATUS3 fs3;
492
493 save_dir2(curpath);
[189]494 strcat(curpath, "\\UTILS");
495 if (!DosQueryPathInfo(curpath,
496 FIL_STANDARD,
497 &fs3,
498 sizeof(fs3)) &&
499 (fs3.attrFile & FILE_DIRECTORY))
500 {
[2]501 env = getenv("PATH");
[189]502 if (env)
503 {
504 if (!stristr(curpath, env))
505 fAddUtils = TRUE;
[2]506 }
507 }
508 }
[189]509 if (!*profile)
510 strcpy(profile, "FM3.INI");
[2]511 mypid = getpid();
512 /* give default appname if none set by caller */
[189]513 if (!*appname)
514 strcpy(appname, FM3Str);
[2]515 /* save appname; may be reset below */
[189]516 strcpy(realappname, appname);
517 if (!strcmp(appname, FM3Str))
[2]518 DosSetMaxFH(100L);
[189]519 else if (!strcmp(appname, "VDir") ||
520 !strcmp(appname, "VTree") ||
521 !strcmp(appname, "VCollect") ||
522 !strcmp(appname, "SEEALL") ||
523 !strcmp(appname, "FM/4"))
[2]524 DosSetMaxFH(60L);
525 else
526 DosSetMaxFH(40L);
527
[189]528 if (DosQuerySysInfo(QSV_VERSION_MAJOR,
529 QSV_VERSION_MINOR,
530 (PVOID) OS2ver,
531 (ULONG) sizeof(OS2ver)))
532 {
[2]533 OS2ver[0] = 2;
534 OS2ver[1] = 1;
535 }
536
537 /* set up default root names for temp archive goodies */
[189]538 if (!fAmAV2)
539 strcpy(ArcTempRoot, "$FM$ARC$");
[2]540 else
[189]541 strcpy(ArcTempRoot, "$AV$ARC$");
[2]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 */
[189]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);
[2]558 DosSleep(10);
[189]559 DosBeep(50, 100);
[2]560 return FALSE;
561 }
562
[189]563 { /* are we the workplace? */
[2]564 CHAR *env;
565
566 env = getenv("WORKPLACE__PROCESS");
[189]567 if (!env || stricmp(env, "NO"))
[2]568 fWorkPlace = TRUE;
569 }
570
[189]571 if ((!strchr(profile, '\\') && !strchr(profile, ':')) ||
572 !(fmprof = PrfOpenProfile((HAB) 0, profile)))
573 {
[2]574
575 /* figure out where to put INI file... */
[189]576 CHAR *env, inipath[CCHMAXPATH];
[2]577
578 DosError(FERR_DISABLEHARDERR);
579 save_dir2(HomePath);
580 DosError(FERR_DISABLEHARDERR);
[189]581 memset(driveserial, -1, sizeof(driveserial));
[2]582 *inipath = 0;
583 env = getenv("FM3INI");
[189]584 if (env)
585 {
[2]586
587 FILESTATUS3 fsa;
[189]588 APIRET rc;
[2]589
[189]590 strcpy(inipath, env);
[2]591 DosError(FERR_DISABLEHARDERR);
592 rc = DosQueryPathInfo(inipath,
[189]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 }
[2]604 }
605 }
[189]606 if (!env)
607 {
[2]608 env = searchpath(profile);
[189]609 if (!env)
610 env = profile;
611 strcpy(inipath, env);
[2]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
[189]618 if (!*inipath)
619 strcpy(inipath, profile);
[2]620 DosError(FERR_DISABLEHARDERR);
[189]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 }
[2]635 }
636 }
[189]637 fmprof = PrfOpenProfile((HAB) 0, inipath);
638 if (!fmprof)
639 {
640 strcpy(inipath, "FM3.INI");
641 fmprof = PrfOpenProfile((HAB) 0, inipath);
[2]642 }
[189]643 if (!fmprof)
644 {
645 DosBeep(50, 100);
[2]646 DosSleep(10);
[189]647 DosBeep(50, 100);
[2]648 DosSleep(10);
[189]649 DosBeep(50, 100);
[2]650 return FALSE;
651 }
652 }
653
654 FindSwapperDat();
655
656 {
657 ULONG size = sizeof(BOOL);
658
659 PrfQueryProfileData(fmprof,
[189]660 FM3Str,
661 "SeparateParms",
662 (PVOID) & fSeparateParms,
663 &size);
664 if (!fSeparateParms)
[2]665 strcpy(appname,
[189]666 FM3Str);
[2]667 }
668
669 /* start help */
[189]670 memset(&hini, 0, sizeof(HELPINIT));
[2]671 hini.cb = sizeof(HELPINIT);
672 hini.ulReturnCode = 0L;
673 hini.pszTutorialName = NULL;
[189]674 hini.phtHelpTable = (PHELPTABLE) MAKELONG(ID_HELPTABLE, 0xffff);
675 hini.hmodAccelActionBarModule = (HMODULE) 0;
[2]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";
[189]681 hwndHelp = WinCreateHelpInstance(hab, &hini);
682 if (!hwndHelp)
683 {
[2]684
[189]685 CHAR *env;
[2]686 static CHAR helppath[CCHMAXPATH];
687
688 env = getenv("FM3INI");
[189]689 if (env)
690 {
[2]691
692 FILESTATUS3 fsa;
[189]693 APIRET rc;
[2]694
[189]695 strcpy(helppath, env);
[2]696 DosError(FERR_DISABLEHARDERR);
[189]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 }
[2]708 }
709 }
710 }
[189]711 if (!hwndHelp)
712 {
[2]713 saymsg(MB_ENTER | MB_ICONEXCLAMATION,
[189]714 HWND_DESKTOP,
715 GetPString(IDS_FM2TROUBLETEXT),
716 GetPString(IDS_CANTLOADHELPTEXT),
717 GetPString(IDS_NOHELPACCEPTTEXT));
[2]718 }
719
720 /* a couple of default window procs so we don't have to look them up later */
[189]721 if (WinQueryClassInfo(hab, WC_CONTAINER, &clinfo))
[2]722 PFNWPCnr = clinfo.pfnWindowProc;
[179]723 // saymsg(MB_ENTER,HWND_DESKTOP,"Container flags:","%08lx",clinfo.flClassStyle);
[189]724 if (WinQueryClassInfo(hab, WC_FRAME, &clinfo))
[2]725 PFNWPFrame = clinfo.pfnWindowProc;
[179]726 // saymsg(MB_ENTER,HWND_DESKTOP,"Frame flags:","%08lx",clinfo.flClassStyle);
[189]727 if (WinQueryClassInfo(hab, WC_BUTTON, &clinfo))
[2]728 PFNWPButton = clinfo.pfnWindowProc;
[179]729 // saymsg(MB_ENTER,HWND_DESKTOP,"Button flags:","%08lx",clinfo.flClassStyle);
[189]730 if (WinQueryClassInfo(hab, WC_STATIC, &clinfo))
[2]731 PFNWPStatic = clinfo.pfnWindowProc;
[179]732 // saymsg(MB_ENTER,HWND_DESKTOP,"Static flags:","%08lx",clinfo.flClassStyle);
[189]733 if (WinQueryClassInfo(hab, WC_MLE, &clinfo))
[2]734 PFNWPMLE = clinfo.pfnWindowProc;
[179]735 // saymsg(MB_ENTER,HWND_DESKTOP,"MLE flags:","%08lx",clinfo.flClassStyle);
[189]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);
[2]745 return FALSE;
746 }
747
748 /* register window classes we use */
749 WinRegisterClass(hab,
[189]750 GetPString(IDS_WCMAINWND),
751 MainWndProc,
752 CS_SIZEREDRAW | CS_CLIPCHILDREN,
753 sizeof(PVOID) * 8);
[2]754 WinRegisterClass(hab,
[189]755 GetPString(IDS_WCMAINWND2),
756 MainWndProc2,
757 CS_SIZEREDRAW | CS_CLIPCHILDREN,
758 sizeof(PVOID) * 4);
[2]759 WinRegisterClass(hab,
[189]760 GetPString(IDS_WCTREECONTAINER),
761 TreeClientWndProc,
762 CS_SIZEREDRAW | CS_CLIPCHILDREN,
763 sizeof(PVOID) * 2);
[2]764 WinRegisterClass(hab,
[189]765 GetPString(IDS_WCDIRCONTAINER),
766 DirClientWndProc,
767 CS_SIZEREDRAW | CS_CLIPCHILDREN,
768 sizeof(PVOID) * 2);
[2]769 WinRegisterClass(hab,
[189]770 GetPString(IDS_WCCOLLECTOR),
771 CollectorClientWndProc,
772 CS_SIZEREDRAW | CS_CLIPCHILDREN,
773 sizeof(PVOID) * 2);
[2]774 WinRegisterClass(hab,
[189]775 GetPString(IDS_WCARCCONTAINER),
776 ArcClientWndProc,
777 CS_SIZEREDRAW | CS_CLIPCHILDREN,
778 sizeof(PVOID) * 2);
[2]779 WinRegisterClass(hab,
[189]780 GetPString(IDS_WCMLEEDITOR),
781 MLEEditorProc,
782 CS_SIZEREDRAW | CS_CLIPCHILDREN,
783 sizeof(PVOID) * 2);
[2]784 WinRegisterClass(hab,
[189]785 GetPString(IDS_WCINIEDITOR),
786 IniProc,
787 CS_SIZEREDRAW | CS_CLIPCHILDREN,
788 sizeof(PVOID) * 2);
[2]789 WinRegisterClass(hab,
[189]790 GetPString(IDS_WCTOOLBACK),
791 ToolBackProc,
792 CS_SIZEREDRAW,
793 sizeof(PVOID));
[2]794 WinRegisterClass(hab,
[189]795 GetPString(IDS_WCDRIVEBACK),
796 DriveBackProc,
797 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
798 sizeof(PVOID));
[2]799 WinRegisterClass(hab,
[189]800 GetPString(IDS_WCSEEALL),
801 SeeAllWndProc,
802 CS_SIZEREDRAW | CS_CLIPCHILDREN,
803 sizeof(PVOID));
[2]804 WinRegisterClass(hab,
[189]805 GetPString(IDS_WCNEWVIEW),
806 ViewWndProc,
807 CS_SIZEREDRAW | CS_CLIPCHILDREN,
808 sizeof(PVOID));
[2]809 WinRegisterClass(hab,
[189]810 GetPString(IDS_WCTOOLBUTTONS),
811 ChildButtonProc,
812 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
813 sizeof(PVOID));
[2]814 WinRegisterClass(hab,
[189]815 GetPString(IDS_WCDRIVEBUTTONS),
816 DriveProc,
817 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
818 sizeof(PVOID));
[2]819 WinRegisterClass(hab,
[189]820 GetPString(IDS_WCBUBBLE),
821 BubbleProc,
822 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
823 sizeof(ULONG) * 2);
[2]824 WinRegisterClass(hab,
[189]825 GetPString(IDS_WCSTATUS),
826 StatusProc,
827 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
828 sizeof(ULONG));
[2]829 WinRegisterClass(hab,
[189]830 GetPString(IDS_WCDIRSTATUS),
831 DirTextProc,
832 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
833 sizeof(ULONG));
[2]834 WinRegisterClass(hab,
[189]835 GetPString(IDS_WCTREESTATUS),
836 TreeStatProc,
837 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
838 sizeof(ULONG));
[2]839 WinRegisterClass(hab,
[189]840 GetPString(IDS_WCARCSTATUS),
841 ArcTextProc,
842 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
843 sizeof(ULONG));
[2]844 WinRegisterClass(hab,
[189]845 GetPString(IDS_WCCOLSTATUS),
846 CollectorTextProc,
847 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
848 sizeof(ULONG));
[2]849 WinRegisterClass(hab,
[189]850 GetPString(IDS_WCSEESTATUS),
851 SeeStatusProc,
852 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
853 sizeof(ULONG));
[2]854 WinRegisterClass(hab,
[189]855 GetPString(IDS_WCVIEWSTATUS),
856 ViewStatusProc,
857 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
858 sizeof(ULONG));
[2]859 WinRegisterClass(hab,
[189]860 GetPString(IDS_WCERRORWND),
861 NotifyWndProc,
862 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
863 sizeof(PVOID));
[2]864 WinRegisterClass(hab,
[189]865 GetPString(IDS_WCMINITIME),
866 MiniTimeProc,
867 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
868 sizeof(PVOID) * 2);
[2]869 WinRegisterClass(hab,
[189]870 GetPString(IDS_WCDATABAR),
871 DataProc,
872 CS_SIZEREDRAW,
873 sizeof(PVOID));
[2]874 WinRegisterClass(hab,
[189]875 GetPString(IDS_WCTREEOPENBUTTON),
876 OpenButtonProc,
877 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
878 sizeof(PVOID));
[2]879 WinRegisterClass(hab,
[189]880 GetPString(IDS_WCAUTOVIEW),
881 AutoViewProc,
882 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
883 sizeof(PVOID));
[2]884 WinRegisterClass(hab,
[189]885 GetPString(IDS_WCLED),
886 LEDProc,
887 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
888 sizeof(PVOID));
[2]889
890 /*
891 * set some defaults (note: everything else automatically initialized
892 * to 0)
893 */
894 detailssize = detailsea = detailslwdate = detailslwtime = detailsattr =
[189]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;
[2]903 ulCnrType = CCS_EXTENDSEL;
904 FilesToGet = 128L;
905 AutoviewHeight = 48L;
[189]906 strcpy(printer, "PRN");
[2]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,
[189]925 appname,
926 "ShowTarget",
927 (PVOID) & fShowTarget,
928 &size);
[2]929 size = sizeof(BOOL);
930 PrfQueryProfileData(fmprof,
[189]931 appname,
932 "CheckMM",
933 (PVOID) & fCheckMM,
934 &size);
[2]935 size = sizeof(BOOL);
936 PrfQueryProfileData(fmprof,
[189]937 appname,
938 "ChangeTarget",
939 (PVOID) & fChangeTarget,
940 &size);
[2]941 size = sizeof(BOOL);
942 PrfQueryProfileData(fmprof,
[189]943 appname,
944 "ConfirmTarget",
945 (PVOID) & fConfirmTarget,
946 &size);
[2]947 size = sizeof(BOOL);
948 PrfQueryProfileData(fmprof,
[189]949 FM3Str,
950 "CustomFileDlg",
951 (PVOID) & fCustomFileDlg,
952 &size);
[2]953 size = sizeof(BOOL);
954 PrfQueryProfileData(fmprof,
[189]955 FM3Str,
956 "SaveMiniCmds",
957 (PVOID) & fSaveMiniCmds,
958 &size);
[2]959 size = sizeof(BOOL);
960 PrfQueryProfileData(fmprof,
[189]961 appname,
962 "SaveBigCmds",
963 (PVOID) & fSaveBigCmds,
964 &size);
[2]965 size = sizeof(BOOL);
966 PrfQueryProfileData(fmprof,
[189]967 appname,
968 "NoFoldMenu",
969 (PVOID) & fNoFoldMenu,
970 &size);
[2]971 size = sizeof(BOOL);
972 PrfQueryProfileData(fmprof,
[189]973 FM3Str,
974 "ThreadNotes",
975 (PVOID) & fThreadNotes,
976 &size);
[2]977 size = sizeof(BOOL);
[189]978 PrfQueryProfileData(fmprof, FM3Str, "Prnpagenums", (PVOID) & prnpagenums, &size);
[2]979 size = sizeof(BOOL);
[189]980 PrfQueryProfileData(fmprof, FM3Str, "Prnalt", (PVOID) & prnalt, &size);
[2]981 size = sizeof(BOOL);
[189]982 PrfQueryProfileData(fmprof, FM3Str, "Prnformat", (PVOID) & prnformat, &size);
[2]983 size = sizeof(BOOL);
[189]984 PrfQueryProfileData(fmprof, FM3Str, "Prnformfeedbefore",
985 (PVOID) & prnformfeedbefore, &size);
[2]986 size = sizeof(BOOL);
987 PrfQueryProfileData(fmprof,
[189]988 FM3Str,
989 "Prnformfeedafter",
990 (PVOID) & prnformfeedafter,
991 &size);
[2]992 size = sizeof(ULONG);
[189]993 PrfQueryProfileData(fmprof, FM3Str, "Prntabspaces",
994 (PVOID) & prntabspaces, &size);
[2]995 size = sizeof(ULONG);
[189]996 PrfQueryProfileData(fmprof, FM3Str, "Prnwidth", (PVOID) & prnwidth, &size);
[2]997 size = sizeof(ULONG);
[189]998 PrfQueryProfileData(fmprof, FM3Str, "Prnlength", (PVOID) & prnlength, &size);
[2]999 size = sizeof(ULONG);
[189]1000 PrfQueryProfileData(fmprof, FM3Str, "Prntmargin", (PVOID) & prntmargin, &size);
[2]1001 size = sizeof(ULONG);
[189]1002 PrfQueryProfileData(fmprof, FM3Str, "Prnbmargin", (PVOID) & prnbmargin, &size);
[2]1003 size = sizeof(ULONG);
[189]1004 PrfQueryProfileData(fmprof, FM3Str, "Prnlmargin", (PVOID) & prnlmargin, &size);
[2]1005 size = sizeof(ULONG);
[189]1006 PrfQueryProfileData(fmprof, FM3Str, "Prnrmargin", (PVOID) & prnrmargin, &size);
[2]1007 size = sizeof(ULONG);
[189]1008 PrfQueryProfileData(fmprof, FM3Str, "Prnspacing", (PVOID) & prnspacing, &size);
[2]1009 size = sizeof(BOOL);
[189]1010 PrfQueryProfileData(fmprof, FM3Str, "NoDead", (PVOID) & fNoDead, &size);
[2]1011 size = sizeof(BOOL);
[189]1012 PrfQueryProfileData(fmprof, FM3Str, "NoFinger", (PVOID) & fNoFinger, &size);
[2]1013 size = sizeof(BOOL);
[189]1014 PrfQueryProfileData(fmprof, appname, "SwitchTree", (PVOID) & fSwitchTree,
1015 &size);
[2]1016 size = sizeof(BOOL);
[189]1017 PrfQueryProfileData(fmprof, appname, "SwitchTreeExpand",
1018 (PVOID) & fSwitchTreeExpand, &size);
[2]1019 size = sizeof(BOOL);
[189]1020 PrfQueryProfileData(fmprof, appname, "SwitchTreeOnFocus",
1021 (PVOID) & fSwitchTreeOnFocus, &size);
[2]1022 size = sizeof(BOOL);
[189]1023 PrfQueryProfileData(fmprof, appname, "CollapseFirst",
1024 (PVOID) & fCollapseFirst, &size);
[2]1025 size = sizeof(BOOL);
[189]1026 PrfQueryProfileData(fmprof, appname, "FilesInTree",
1027 (PVOID) & fFilesInTree, &size);
[2]1028 size = sizeof(BOOL);
[189]1029 PrfQueryProfileData(fmprof, FM3Str, "TopDir", (PVOID) & fTopDir, &size);
[2]1030 size = sizeof(BOOL);
[189]1031 PrfQueryProfileData(fmprof, FM3Str, "LookInDir", (PVOID) & fLookInDir, &size);
1032 PrfQueryProfileString(fmprof, appname, "DefArc", NULL, szDefArc, sizeof(szDefArc));
[2]1033 size = sizeof(ULONG);
[189]1034 PrfQueryProfileData(fmprof, FM3Str, "AutoviewHeight",
1035 (PVOID) & AutoviewHeight, &size);
[2]1036 size = sizeof(BOOL);
[189]1037 PrfQueryProfileData(fmprof, FM3Str, "KeepCmdLine", (PVOID) & fKeepCmdLine, &size);
1038 if (strcmp(realappname, "FM/4"))
1039 {
[2]1040 size = sizeof(BOOL);
1041 PrfQueryProfileData(fmprof,
[189]1042 FM3Str,
1043 "MoreButtons",
1044 (PVOID) & fMoreButtons,
1045 &size);
[2]1046 size = sizeof(BOOL);
1047 PrfQueryProfileData(fmprof,
[189]1048 FM3Str,
1049 "Drivebar",
1050 (PVOID) & fDrivebar,
1051 &size);
[2]1052 }
1053 else
1054 fDrivebar = fMoreButtons = TRUE;
1055 size = sizeof(BOOL);
1056 PrfQueryProfileData(fmprof,
[189]1057 appname,
1058 "NoSearch",
1059 (PVOID) & fNoSearch,
1060 &size);
[2]1061 size = sizeof(BOOL);
1062 PrfQueryProfileData(fmprof,
[189]1063 appname,
1064 "GuessType",
1065 (PVOID) & fGuessType,
1066 &size);
[2]1067 size = sizeof(BOOL);
1068 PrfQueryProfileData(fmprof,
[189]1069 appname,
1070 "ViewChild",
1071 (PVOID) & fViewChild,
1072 &size);
[2]1073 size = sizeof(BOOL);
1074 PrfQueryProfileData(fmprof,
[189]1075 appname,
1076 "ShowEnv",
1077 (PVOID) & fShowEnv,
1078 &size);
[2]1079 size = sizeof(BOOL);
1080 PrfQueryProfileData(fmprof,
[189]1081 appname,
1082 "LeaveTree",
1083 (PVOID) & fLeaveTree,
1084 &size);
[2]1085 size = sizeof(BOOL);
[189]1086 PrfQueryProfileData(fmprof, FM3Str, "Comments", (PVOID) & fComments, &size);
[2]1087 size = sizeof(ULONG);
[189]1088 PrfQueryProfileData(fmprof, appname, "WS_ANIMATE", (PVOID) & fwsAnimate, &size);
1089 if (fwsAnimate)
[2]1090 fwsAnimate = WS_ANIMATE;
1091 size = sizeof(ULONG);
1092 size = sizeof(BOOL);
[189]1093 PrfQueryProfileData(fmprof, appname, "SelectedAlways",
1094 (PVOID) & fSelectedAlways, &size);
[2]1095 size = sizeof(BOOL);
[189]1096 PrfQueryProfileData(fmprof, FM3Str, "ToolbarHelp", (PVOID) & fToolbarHelp, &size);
[2]1097 size = sizeof(BOOL);
[189]1098 PrfQueryProfileData(fmprof, FM3Str, "OtherHelp", (PVOID) & fOtherHelp, &size);
[2]1099 size = sizeof(BOOL);
[189]1100 PrfQueryProfileData(fmprof, FM3Str, "DrivebarHelp", (PVOID) & fDrivebarHelp, &size);
[2]1101 size = sizeof(BOOL);
1102 PrfQueryProfileData(fmprof,
[189]1103 appname,
1104 "AutoAddDirs",
1105 (PVOID) & fAutoAddDirs,
1106 &size);
[2]1107 size = sizeof(BOOL);
1108 PrfQueryProfileData(fmprof,
[189]1109 appname,
1110 "AutoAddAllDirs",
1111 (PVOID) & fAutoAddAllDirs,
1112 &size);
[2]1113 size = sizeof(BOOL);
[189]1114 PrfQueryProfileData(fmprof, FM3Str, "UserListSwitches",
1115 (PVOID) & fUserListSwitches, &size);
[2]1116 size = sizeof(BOOL);
[189]1117 PrfQueryProfileData(fmprof, appname, "UseNewViewer",
1118 (PVOID) & fUseNewViewer, &size);
[2]1119 size = sizeof(BOOL);
[189]1120 PrfQueryProfileData(fmprof, appname, "DefaultDeletePerm",
1121 (PVOID) & fDefaultDeletePerm, &size);
[2]1122 size = sizeof(BOOL);
[189]1123 PrfQueryProfileData(fmprof, FM3Str, "ExternalINIs",
1124 (PVOID) & fExternalINIs, &size);
[2]1125 size = sizeof(BOOL);
[189]1126 PrfQueryProfileData(fmprof, FM3Str, "ExternalCollector",
1127 (PVOID) & fExternalCollector, &size);
[2]1128 size = sizeof(BOOL);
[189]1129 PrfQueryProfileData(fmprof, FM3Str, "ExternalArcboxes",
1130 (PVOID) & fExternalArcboxes, &size);
[2]1131 size = sizeof(BOOL);
[189]1132 PrfQueryProfileData(fmprof, FM3Str, "ExternalViewer",
1133 (PVOID) & fExternalViewer, &size);
[2]1134 size = sizeof(BOOL);
[189]1135 PrfQueryProfileData(fmprof, FM3Str, "UseQProcStat",
1136 (PVOID) & fUseQProcStat, &size);
[2]1137 size = sizeof(BOOL);
[189]1138 PrfQueryProfileData(fmprof, FM3Str, "DataMin", (PVOID) & fDataMin, &size);
[2]1139 size = sizeof(BOOL);
[189]1140 PrfQueryProfileData(fmprof, appname, "DataToFore", (PVOID) & fDataToFore, &size);
[2]1141 size = sizeof(BOOL);
[189]1142 PrfQueryProfileData(fmprof, appname, "DataShowDrives",
1143 (PVOID) & fDataShowDrives, &size);
[2]1144 size = sizeof(BOOL);
[189]1145 PrfQueryProfileData(fmprof, appname, "DataInclRemote",
1146 (PVOID) & fDataInclRemote, &size);
[2]1147 size = sizeof(BOOL);
[189]1148 PrfQueryProfileData(fmprof, FM3Str, "SplitStatus", (PVOID) & fSplitStatus, &size);
[2]1149 size = sizeof(BOOL);
[189]1150 PrfQueryProfileData(fmprof, appname, "FolderAfterExtract",
1151 (PVOID) & fFolderAfterExtract, &size);
[2]1152 size = sizeof(BOOL);
[189]1153 PrfQueryProfileData(fmprof, FM3Str, "DullDatabar", (PVOID) & fDullMin, &size);
[2]1154 size = sizeof(BOOL);
[189]1155 PrfQueryProfileData(fmprof, appname, "BlueLED", (PVOID) & fBlueLED, &size);
[2]1156 size = sizeof(BOOL);
[189]1157 PrfQueryProfileData(fmprof, appname, "ConfirmDelete", (PVOID) & fConfirmDelete, &size);
[2]1158 size = sizeof(BOOL);
[189]1159 PrfQueryProfileData(fmprof, FM3Str, "SaveState", (PVOID) & fSaveState, &size);
[2]1160 size = sizeof(BOOL);
[189]1161 PrfQueryProfileData(fmprof, appname, "SyncUpdates", (PVOID) & fSyncUpdates, &size);
[2]1162 size = sizeof(BOOL);
[189]1163 PrfQueryProfileData(fmprof, appname, "LoadSubject", (PVOID) & fLoadSubject, &size);
[2]1164 size = sizeof(BOOL);
[189]1165 PrfQueryProfileData(fmprof, appname, "UnHilite", (PVOID) & fUnHilite, &size);
[2]1166 size = sizeof(BOOL);
[189]1167 PrfQueryProfileData(fmprof, FM3Str, "TileBackwards", (PVOID) & fTileBackwards,
1168 &size);
[2]1169 size = sizeof(BOOL);
[189]1170 PrfQueryProfileData(fmprof, appname, "LoadLongname", (PVOID) & fLoadLongnames, &size);
[2]1171 size = sizeof(BOOL);
[189]1172 PrfQueryProfileData(fmprof, appname, "VerifyWrites", (PVOID) & fVerify, &size);
[2]1173 DosSetVerify(fVerify);
1174 size = sizeof(BOOL);
[189]1175 PrfQueryProfileData(fmprof, appname, "DontMoveMouse", (PVOID) & fDontMoveMouse, &size);
[2]1176 size = sizeof(BOOL);
[189]1177 PrfQueryProfileData(fmprof, appname, "NoIconsFiles", (PVOID) & fNoIconsFiles, &size);
[2]1178 size = sizeof(BOOL);
[189]1179 PrfQueryProfileData(fmprof, appname, "NoIconsDirs", (PVOID) & fNoIconsDirs, &size);
[2]1180 size = sizeof(BOOL);
[189]1181 PrfQueryProfileData(fmprof, appname, "ForceUpper", (PVOID) & fForceUpper, &size);
[2]1182 size = sizeof(BOOL);
[189]1183 PrfQueryProfileData(fmprof, appname, "ForceLower", (PVOID) & fForceLower, &size);
[2]1184 size = sizeof(BOOL);
[189]1185 PrfQueryProfileData(fmprof, FM3Str, "TextTools", (PVOID) & fTextTools, &size);
[2]1186 size = sizeof(BOOL);
[189]1187 PrfQueryProfileData(fmprof, FM3Str, "ToolTitles", (PVOID) & fToolTitles, &size);
[2]1188 size = sizeof(BOOL);
[189]1189 PrfQueryProfileData(fmprof, appname, "DoubleClickOpens", (PVOID) & fDCOpens, &size);
[2]1190 size = sizeof(BOOL);
[189]1191 PrfQueryProfileData(fmprof, appname, "LinkSetsIcon", (PVOID) & fLinkSetsIcon, &size);
[2]1192 size = sizeof(INT);
[189]1193 PrfQueryProfileData(fmprof, appname, "Sort", (PVOID) & sortFlags, &size);
[2]1194 size = sizeof(INT);
[189]1195 PrfQueryProfileData(fmprof, appname, "TreeSort", (PVOID) & TreesortFlags, &size);
[2]1196 size = sizeof(INT);
1197 PrfQueryProfileData(fmprof,
[189]1198 appname,
1199 "CollectorSort",
1200 (PVOID) & CollectorsortFlags,
1201 &size);
[2]1202 size = sizeof(targetdir);
1203 PrfQueryProfileData(fmprof,
[189]1204 appname,
1205 "Targetdir",
1206 (PVOID) targetdir,
1207 &size);
1208 if (!IsValidDir(targetdir))
[2]1209 *targetdir = 0;
1210 size = sizeof(extractpath);
1211 PrfQueryProfileData(fmprof,
[189]1212 appname,
1213 "ExtractPath",
1214 (PVOID) extractpath,
1215 &size);
1216 if (!IsValidDir(extractpath))
[2]1217 *extractpath = 0;
1218 size = sizeof(printer);
[189]1219 PrfQueryProfileData(fmprof, appname, "Printer", (PVOID) printer, &size);
[2]1220 size = sizeof(dircompare);
[189]1221 PrfQueryProfileData(fmprof, appname, "DirCompare", (PVOID) dircompare, &size);
[2]1222 size = sizeof(viewer);
[189]1223 PrfQueryProfileData(fmprof, appname, "Viewer", (PVOID) viewer, &size);
[2]1224 size = sizeof(editor);
[189]1225 PrfQueryProfileData(fmprof, appname, "Editor", (PVOID) editor, &size);
[2]1226 size = sizeof(binview);
[189]1227 PrfQueryProfileData(fmprof, appname, "BinView", (PVOID) binview, &size);
[2]1228 size = sizeof(bined);
[189]1229 PrfQueryProfileData(fmprof, appname, "BinEd", (PVOID) bined, &size);
[2]1230 size = sizeof(compare);
[189]1231 PrfQueryProfileData(fmprof, appname, "Compare", (PVOID) compare, &size);
[2]1232 size = sizeof(virus);
[189]1233 PrfQueryProfileData(fmprof, appname, "Virus", (PVOID) virus, &size);
[2]1234 size = sizeof(ftprun);
[189]1235 PrfQueryProfileData(fmprof, appname, "FTPRun", (PVOID) ftprun, &size);
1236 if (!*ftprun && !size)
1237 strcpy(ftprun, "ftppm.exe");
[2]1238 size = sizeof(httprun);
[189]1239 PrfQueryProfileData(fmprof, appname, "HTTPRun", (PVOID) httprun, &size);
1240 if (!*httprun && !size)
1241 strcpy(httprun, "explore.exe -q");
[2]1242 size = sizeof(lasttoolbox);
[189]1243 PrfQueryProfileData(fmprof, FM3Str, "LastToolBox", (PVOID) lasttoolbox, &size);
[2]1244 size = sizeof(BOOL);
[189]1245 PrfQueryProfileData(fmprof, appname, "FollowTree", (PVOID) & fFollowTree, &size);
[2]1246 size = sizeof(BOOL);
[189]1247 PrfQueryProfileData(fmprof, appname, "StartMaximized", (PVOID) & fStartMaximized, &size);
1248 if (!fStartMaximized)
1249 {
[2]1250 size = sizeof(BOOL);
[189]1251 PrfQueryProfileData(fmprof, appname, "StartMinimized", (PVOID) & fStartMinimized, &size);
[2]1252 }
1253 size = sizeof(BOOL);
[189]1254 PrfQueryProfileData(fmprof, appname, "DefaultCopy", (PVOID) & fCopyDefault, &size);
[2]1255 size = sizeof(BOOL);
[189]1256 PrfQueryProfileData(fmprof, appname, "IdleCopy", (PVOID) & fRealIdle, &size);
[2]1257 size = sizeof(BOOL);
[189]1258 PrfQueryProfileData(fmprof, appname, "ArcStuffVisible",
1259 (PVOID) & fArcStuffVisible, &size);
[2]1260 size = sizeof(BOOL);
[189]1261 PrfQueryProfileData(fmprof, FM3Str, "NoTreeGap", (PVOID) & fNoTreeGap, &size);
[2]1262 size = sizeof(BOOL);
[189]1263 PrfQueryProfileData(fmprof, FM3Str, "VTreeOpensWPS", (PVOID) & fVTreeOpensWPS,
1264 &size);
[2]1265 size = sizeof(BOOL);
[189]1266 PrfQueryProfileData(fmprof, appname, "RemoteBug", (PVOID) & fRemoteBug, &size);
[2]1267 size = sizeof(BOOL);
[189]1268 PrfQueryProfileData(fmprof, appname, "Drag&DropDlg", (PVOID) & fDragndropDlg,
1269 &size);
[2]1270 size = sizeof(BOOL);
[189]1271 PrfQueryProfileData(fmprof, FM3Str, "UserComboBox", (PVOID) & fUserComboBox,
1272 &size);
[2]1273 size = sizeof(BOOL);
[189]1274 PrfQueryProfileData(fmprof, FM3Str, "MinDirOnOpen", (PVOID) & fMinOnOpen,
1275 &size);
[2]1276 size = sizeof(BOOL);
[189]1277 PrfQueryProfileData(fmprof, appname, "QuickArcFind", (PVOID) & fQuickArcFind,
1278 &size);
[2]1279 size = sizeof(BOOL);
[189]1280 PrfQueryProfileData(fmprof, FM3Str, "NoRemovableScan", (PVOID) & fNoRemovableScan,
1281 &size);
[2]1282 size = sizeof(ULONG);
[189]1283 PrfQueryProfileData(fmprof, FM3Str, "NoBrokenNotify", (PVOID) & NoBrokenNotify,
1284 &size);
[2]1285 size = sizeof(ULONG);
[189]1286 PrfQueryProfileData(fmprof, appname, "ContainerType", (PVOID) & ulCnrType, &size);
[2]1287 size = sizeof(ULONG);
[189]1288 PrfQueryProfileData(fmprof, appname, "FilesToGet", (PVOID) & FilesToGet, &size);
[2]1289 size = sizeof(BOOL);
[189]1290 PrfQueryProfileData(fmprof, FM3Str, "AutoView", (PVOID) & fAutoView, &size);
[2]1291 size = sizeof(BOOL);
[189]1292 PrfQueryProfileData(fmprof, FM3Str, "FM2Deletes", (PVOID) & fFM2Deletes, &size);
[2]1293 }
1294
1295 /* load pointers and icons we use */
[189]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);
[2]1315 else
[189]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);
[2]1321
1322 /*
1323 * set up color array used by seeall.c and newview.c color dialog
1324 */
[189]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;
[2]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
[189]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;
[2]1353
1354 {
1355 INT x;
1356
[189]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]);
[2]1369 }
1370 }
1371 }
1372
1373 hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
[189]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 {
[2]1384 WinSetWindowUShort(hwndFrame,
[189]1385 QWS_ID,
1386 MAIN_FRAME);
1387 if (!WinRestoreWindowPos(FM2Str,
1388 "MainWindowPos",
1389 hwndFrame))
1390 {
[2]1391
1392 ULONG fl = SWP_MOVE | SWP_SIZE;
1393 RECTL rcl;
[189]1394 ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 3L;
1395 ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
[2]1396
1397 WinQueryWindowRect(HWND_DESKTOP,
[189]1398 &rcl);
[2]1399 rcl.yBottom += icz;
1400 rcl.yTop -= bsz;
1401 rcl.xLeft += bsz;
1402 rcl.xRight -= bsz;
1403 WinSetWindowPos(hwndFrame,
[189]1404 HWND_TOP,
1405 rcl.xLeft,
1406 rcl.yBottom,
1407 rcl.xRight - rcl.xLeft,
1408 rcl.yTop - rcl.yBottom, fl);
[2]1409 }
[189]1410 if (fLogFile)
[2]1411 LogFileHandle = _fsopen("FM2.LOG",
[189]1412 "a+",
1413 SH_DENYWR);
1414 if (hwndHelp)
[2]1415 WinAssociateHelpInstance(hwndHelp,
[189]1416 hwndFrame);
[2]1417 PostMsg(hwndClient,
[189]1418 UM_SETUP,
1419 MPFROMLONG(argc),
1420 MPFROMP(argv));
[2]1421 }
1422 return hwndFrame;
1423}
[32]1424
[189]1425int CheckVersion(int vermajor, int verminor)
1426{
[179]1427 int ok = 0;
[32]1428
[179]1429 // fixme to do useful check - was missing in base source
1430
[32]1431#if 0
[189]1432 if (vermajor && verminor)
1433 {
[32]1434 *vermajor = VERMAJOR;
1435 *verminor = VERMINOR;
[179]1436 ok = 1;
[32]1437 }
1438#endif
[189]1439
[179]1440 ok = 1;
[32]1441
[179]1442 return ok;
[32]1443}
Note: See TracBrowser for help on using the repository browser.