source: trunk/dll/init.c@ 617

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

Changes to remove GetPString from window class names

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