source: trunk/dll/init.c@ 552

Last change on this file since 552 was 552, checked in by Gregg Young, 18 years ago

font cleanup; new image and archiver masks; messages moved to string file; new drive flags including David's icons mostly working

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