source: trunk/dll/init.c@ 32

Last change on this file since 32 was 32, checked in by root, 23 years ago

Add CheckVersion

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