source: trunk/dll/init.c@ 179

Last change on this file since 179 was 179, checked in by root, 20 years ago

Comments

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