source: trunk/dll/init.c@ 70

Last change on this file since 70 was 70, checked in by root, 22 years ago

Add JFS and FAT32 support

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