source: trunk/dll/init.c@ 555

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

Added NTFS support (read only); minor dive icon code cleanup; update help files

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