source: trunk/dll/init.c@ 551

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

Indentation cleanup

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