source: trunk/dll/init.c@ 2

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

Initial revision

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