source: trunk/dll/init.c@ 551

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

Indentation cleanup

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