source: trunk/dll/init.c@ 526

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

Add NDFS32 support

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