source: trunk/dll/init.c@ 552

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

font cleanup; new image and archiver masks; messages moved to string file; new drive flags including David's icons mostly working

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