source: trunk/dll/init.c@ 633

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

Util apps change final cleanup

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