source: trunk/dll/init.c@ 133

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

Use datamin.h

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