source: trunk/dll/init.c@ 672

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

Util apps change final cleanup

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