source: trunk/dll/init.c@ 86

Last change on this file since 86 was 86, checked in by root, 21 years ago

InitFM3DLL: correct strings error mesage

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