source: trunk/dll/init.c@ 380

Last change on this file since 380 was 339, checked in by root, 19 years ago

Use Runtime_Error
Sync with current style

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