source: trunk/dll/init.c@ 1920

Last change on this file since 1920 was 1920, checked in by Gregg Young, 7 hours ago

Fix a case of no temp directory where the TEMP variable points to an unformatted drive

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 65.3 KB
Line 
1
2/***********************************************************************
3
4 $Id: init.c 1920 2025-12-09 22:14:06Z gyoung $
5
6 Initialization
7
8 Copyright (c) 1993-98 M. Kimes
9 Copyright (c) 2001, 2015 Steven H. Levine
10
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
15 26 May 05 SHL Comments
16 06 Jun 05 SHL indent -i2
17 06 Jun 05 SHL Rework FindSwapperDat for VAC3.65 compat
18 13 Jul 06 SHL Use Runtime_Error
19 13 Jul 06 SHL Sync with current style
20 29 Jul 06 SHL Use xfgets
21 22 Oct 06 GKY Add NDFS32 support
22 18 Feb 07 GKY Add ISOFS, RAMFS support
23 30 Mar 07 GKY Defined golbals for removing GetPString for window class names
24 21 Apr 07 GKY Find FM2Utils by path or utils directory eleminate fAddUtils global
25 15 Jun 07 SHL Make OpenWatcom compatible
26 23 Jun 07 GKY Fix WORPLACE_PROCESS enviroment check logic
27 28 Jun 07 SHL Rework WORKPLACE_PROCESS check to match reality
28 03 Aug 07 GKY Enlarged and made setable everywhere Findbuf (speed file loading)
29 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
30 13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat
31 18 Aug 07 JBS Added code to read Details* keys from the INI file (Ticket 118)
32 19 Aug 07 SHL Ensure FilesToGet in valid range
33 21 Aug 07 GKY Make Subject column in dircnr sizable and movable from the rigth to the left pane
34 23 Aug 07 SHL InitFM3DLL: report INI file DosSetPathInfo error correctly
35 23 Aug 07 SHL Use BldFullPathName
36 25 Aug 07 SHL Work around DosSetPathInfo kernel defect
37 01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry
38 10 Nov 07 GKY Get thousands separator from country info for file sizes.
39 26 Nov 07 GKY Eliminate check of ext path on start up
40 17 Dec 07 GKY Make WPURLDEFAULTSETTINGS the fall back for ftp/httprun
41 13 Jan 08 GKY Get Subjectwidth/Subjectleft working in the collector.
42 12 Feb 08 SHL Compile OpenWatcom version into binary
43 29 Feb 08 GKY Changes to enable user settable command line length
44 29 Feb 08 GKY Refactor global command line variables to notebook.h
45 08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with
46 keys using a "DirCnr." prefix
47 20 Apr 08 GKY Change default cmd line length to 1024 Ask once if user wants to reset it.
48 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
49 all the details view settings (both the global variables and those in the
50 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
51 16 JUL 08 GKY Use TMP directory for temp files
52 17 Jul 08 SHL Reduce code bulk in fUseTmp setup
53 19 Jul 08 GKY Use pFM2SaveDirectory, MakeTempName and move temp files to TMP subdirectory if (TMP).
54 20 Jul 08 JBS Ticket 114: Support user-selectable env. strings in Tree container.
55 20 Jul 08 GKY Add support to delete orphaned tmp directories without deleting tmp of other
56 running sessions
57 23 Aug 08 GKY Check that space on TMP & FM2 save drives exceed 5 GiB; Done to allow user setting of
58 minimum size in future
59 29 Nov 08 GKY Remove or replace with a mutex semaphore DosEnterCriSec where appropriate.
60 30 Nov 08 GKY Add the option of creating a subdirectory from the arcname
61 for the extract path to arc container.
62 10 Dec 08 SHL Integrate exception handler support
63 25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis
64 28 Dec 08 GKY Check for LVM.EXE and remove Refresh removable media menu item as appropriate
65 28 Dec 08 GKY Rework partition submenu to gray out unavailable items (check for existence of files)
66 and have no default choice.
67 01 Jan 09 GKY Add option to rescan tree container on eject of removable media
68 03 Jan 09 GKY Avoid dbl scan of drive on startup by checking for first rescan drive.
69 03 Jan 09 GKY Check for system that is protectonly to gray out Dos/Win command lines and prevent
70 Dos/Win programs from being inserted into the execute dialog with message why.
71 11 Jan 09 GKY Move strings that shouldn't be translated (font names etc) compile time variables
72 03 Feb 09 SHL Switch to STRINGTABLE
73 07 Feb 09 GKY Move repeated strings to PCSZs.
74 07 Feb 09 GKY Add *DateFormat functions to format dates based on locale
75 07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error
76 08 Mar 09 GKY Additional strings move to PCSZs in init.c
77 08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used)
78 14 Mar 09 GKY PCSZ strings moved to compile time initialization
79 14 Mar 09 GKY Prevent execution of UM_SHOWME while drive scan is occuring replaces check for
80 saved drive containers.
81 06 Jun 09 GKY Add option to show file system type or drive label in tree
82 28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
83 12 Jul 09 GKY Add xDosQueryAppType and xDosAlloc... to allow FM/2 to load in high memory
84 22 Jul 09 GKY Code changes to use semaphores to serialize drive scanning
85 22 Jul 09 GKY Fix failure to restore the notebook setting for saving container states or not
86 12 Sep 09 GKY Change protectonly check to check for VKBD being loaded instead of starting
87 command.com. Prevents hang (at least until a Dos program is started) on a system
88 that has a broken MDOS install.
89 15 Nov 09 GKY Add more PCSZs
90 22 Nov 09 GKY Fix FindSwapperDat so the check for large file support actually occurs if the
91 fall back to config.sys is used to find it; use bstripcr to streamline code.
92 13 Dec 09 GKY Fixed separate paramenters. Please note that appname should be used in
93 profile calls for user settings that work and are setable in more than one
94 miniapp; FM3Str should be used for setting only relavent to FM/2 or that
95 aren't user settable; realappname should be used for setting applicable to
96 one or more miniapp but not to FM/2
97 17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR
98 CONSTANT * as CHAR *.
99 09 MAY 10 JBS Ticket 434: Make fDontSuggestAgain a "global" flag, not a per app flag
100 23 Oct 10 GKY Changes to populate and utilize a HELPTABLE for context specific help
101 20 Nov 10 GKY Rework scanning code to remove redundant scans, prevent double directory
102 entries in the tree container, fix related semaphore performance using
103 combination of event and mutex semaphores
104 20 Nov 10 GKY Check that pTmpDir IsValid and recreate if not found; Fixes hangs caused
105 by temp file creation failures.
106 03 Mar 11 SHL Try using FM3INI to create help instance if fm3.hlp not in current directory
107 06 Aug 11 GKY Fixed failure to initalize pFM2SaveDirectory if TEMP and TMP were not present
108 or invalid
109 22 Oct 11 GKY Thread notes dialog now reopens on startup if it was open on shutdown.
110 08 Jan 12 GKY Add support for changing PresParams in the notify status window
111 04 Aug 12 GKY Changes to use Unlock to unlock files if Unlock.exe is in path both from menu/toolbar and as part of
112 copy, move and delete operations
113 04 Aug 12 GKY Changes to allow copy and move over readonly files with a warning dialog; also added a warning dialog
114 for delete of readonly files
115 09 Feb 14 GKY Fix separate parameters. Moved to general page renamed separate settings
116 for apps.
117 09 Feb 14 GKY Modified wipeallf to allow suppression of the readonly warning on delete
118 of temporary files
119 16 Feb 14 GKY Add "#" command line switch to workaround problem with blank command shell
120 started from fm2 after fm2 has been started with stdout and stderr
121 redirected to a file.
122 22 Feb 14 GKY Cleanup of readonly check code suppress spurious error on blocked directory
123 delete and eliminated the check on additional temp file deletes
124 23 Feb 14 JBS Ticket #515: Corrected a mis-coded call to strtol which was causing the traps
125 described in this ticket. (Also changed it to strtoul.)
126 01 Mar 14 JBS Ticket #524: Made "searchapath" thread-safe. Function names and signatures were changed.
127 So calls to these functions had to be changed.
128 02 Mar 14 GKY Fixed typo that reversed the function of the saymsg dialog g/bzip check.
129 Added option to suppress message regarding missing bzip2.exe
130 or gzip.exe on TAR.B/GZ archives.
131 30 Aug 14 GKY Add semaphore hmtxFiltering to prevent freeing dcd while filtering. Prevents
132 a trap when FM2 is shutdown while directory containers are still populating
133 02 Aug 15 GKY Serialize local hard drive scanning to reduce drive thrashing continue to scan
134 all other drive types in separate threads.
135 12 Aug 15 JBS Ticket #522: Ensure no "highmem-unsafe" functions are called directly
136 Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions
137 19 Aug 15 SHL Delete obsoletes
138 20 Aug 15 SHL Support PCSZ_DOS...SEM
139 22 Aug 15 GKY Remove recurse scan code.
140 24 Aug 15 GKY Remove obsolete code fDontAsk?zip
141 20 Sep 15 GKY Move tree expand to a thread.
142 26 Sep 15 GKY Remove fInitialDriveScan code
143
144***********************************************************************/
145
146#include <stdlib.h>
147#include <string.h>
148#include <share.h>
149#include <process.h> // getpid
150#include <time.h>
151#include <ctype.h>
152
153#define INCL_DOS
154#define INCL_WIN
155#define INCL_MMIOOS2
156#define INCL_GPI
157#define INCL_DOSERRORS
158#define INCL_LONGLONG
159#define INCL_DOSNLS
160#include <os2.h>
161#include <os2me.h>
162
163#define DEFINE_GLOBALS 1
164
165#include "fm3dll.h"
166#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
167#include "init.h"
168#include "mkdir.h" // Data declaration(s)
169#include "dircnrs.h" // Data declaration(s)
170#include "comp.h" // Data declaration(s)
171#include "cmdline.h" // Data declaration(s)
172#include "fm2cmd.h" // Data declaration(s)
173#include "printer.h" // Data declaration(s)
174#include "flesh.h" // Data declaration(s)
175#include "worker.h" // Data declaration(s)
176#include "filldir.h" // Data declaration(s)
177#include "defview.h" // Data declaration(s)
178#include "draglist.h" // Data declaration(s)
179#include "fm3dlg.h"
180#include "datamin.h"
181#include "tools.h"
182#include "fm3str.h"
183#include "version.h"
184#include "pathutil.h" // BldFullPathName
185#include "arccnrs.h" // ArcClientWndProc
186#include "errutil.h" // Dos_Error...
187#include "strutil.h" // GetPString
188#include "valid.h" // ArgDriveFlags
189#include "autoview.h" // AutoViewProc
190#include "mainwnd.h" // BubbleProc, ChildButtonProc, DriveBackProc,
191 // DriveProc, LEDProc, MainWndProc, StatusProc
192 // ToolBackProc
193#include "collect.h" // CollectorClientWndProc, CollectorTextProc
194#include "getnames.h" // CustomFileDlg
195#include "notify.h" // EndNote
196#include "valid.h" // FillInDriveFlags, IsValidDir
197#include "inis.h" // IniProc
198#include "viewer.h" // MLEEditorProc
199#include "mainwnd2.h" // MainWndProc2
200#include "notify.h" // NotifyWndProc
201#include "treecnr.h" // OpenButtonProc
202#include "seeall.h" // SeeAllWndProc, SeeStatusProc
203#include "timer.h" // StartTimer, StopTimer
204#include "treecnr.h" // TreeClientWndProc, TreeStatProc
205#include "newview.h" // ViewStatusProc, ViewWndProc
206#include "subj.h" // Subject
207#include "select.h" // UnHilite
208#include "dirs.h" // save_dir
209#include "copyf.h" // unlinkf
210#include "wrappers.h" // xDosSetPathInfo
211#include "misc.h" // HeapThread, LoadDetailsSwitches
212#include "notebook.h" // command line variables (editor etc)
213#include "strips.h" // bstrip
214#include "killproc.h" // GetDosPgmName
215#include "srchpath.h" // Search*Path*ForFile
216#include "fortify.h"
217#include "excputil.h" // xbeginthread
218#include "systemf.h" // runemf2
219
220#ifdef PMPRINTF
221#define _PMPRINTF_ // Enable debug macros
222#include "PMPRINTF.H"
223#endif
224
225extern int _CRT_init(void);
226extern void _CRT_term(void);
227
228#ifdef __WATCOMC__
229#define a(x) #x
230#define b(x) a(x)
231// Must be global to prevent warnings
232PSZ pszBuiltWith = "Built with OpenWatcom version " b(__WATCOMC__);
233#undef b
234#undef a
235#endif
236
237static VOID FindSwapperDat(VOID);
238
239// Data definitions
240static PSZ pszSrcFile = __FILE__;
241unsigned __MaxThreads = {48};
242
243#pragma data_seg(GLOBAL1)
244HMTX hmtxFM2Delete;
245HMTX hmtxFM2Globals;
246
247HMTX hmtxFiltering;
248
249ULONG OS2ver[2];
250PFNWP PFNWPCnr;
251PFNWP PFNWPMLE;
252CHAR ThousandsSeparator[2];
253CHAR DateSeparator[2];
254CHAR TimeSeparator[2];
255ULONG ulTimeFmt;
256ULONG ulDateFmt;
257BOOL fDontSuggestAgain;
258BOOL fAmAV2;
259BOOL fChangeTarget;
260BOOL fIniExisted;
261BOOL fLogFile;
262BOOL fProtectOnly;
263BOOL fReminimize;
264BOOL fWantFirstTimeInit;
265BOOL fUseShellEnv;
266HPOINTER hptrApp;
267HPOINTER hptrArc;
268HPOINTER hptrArrow;
269HPOINTER hptrArt;
270HPOINTER hptrBusy;
271HPOINTER hptrCDROM;
272HPOINTER hptrDrive;
273HPOINTER hptrEW;
274HPOINTER hptrFloppy;
275HPOINTER hptrNS;
276HPOINTER hptrRamdisk;
277HPOINTER hptrRemote;
278HPOINTER hptrRemovable;
279HPOINTER hptrVirtual;
280HPOINTER hptrZipstrm;
281CHAR *pFM2SaveDirectory;
282CHAR *pTmpDir;
283
284#pragma data_seg(GLOBAL2)
285PCSZ PCSZ_ARCHIVERBB2 = "ARCHIVER.BB2";
286PCSZ PCSZ_ASSOCDAT = "ASSOC.DAT";
287PCSZ PCSZ_CMDLINESDAT = "CMDLINES.DAT";
288PCSZ PCSZ_CMDMINIDAT = "CMDMINI.DAT";
289PCSZ PCSZ_COMMANDSDAT = "COMMANDS.DAT";
290PCSZ PCSZ_FILTERSDAT = "FILTERS.DAT";
291PCSZ PCSZ_GREPMASKDAT = "GREPMASK.DAT";
292PCSZ PCSZ_PATTERNSDAT = "PATTERNS.DAT";
293PCSZ PCSZ_RESOURCEDAT = "RESOURCE.DAT";
294PCSZ PCSZ_QUICKTLSDAT = "QUICKTLS.DAT";
295PCSZ PCSZ_FM3TOOLSDAT = "FM3TOOLS.DAT";
296PCSZ PCSZ_USERDIRSDAT = "USERDIRS.DAT";
297PCSZ PCSZ_FM2PLAYEXE = "FM2PLAY.EXE";
298PCSZ PCSZ_IMAGEEXE = "IMAGE.EXE";
299PCSZ PCSZ_FM2PLAYTEMP = "$FM2PLAY.$$$";
300PCSZ PCSZ_LVMGUICMD = "LVMGUI.CMD";
301PCSZ PCSZ_DFSOS2EXE = "DFSOS2.EXE";
302PCSZ PCSZ_MINILVMEXE = "MINILVM.EXE";
303PCSZ PCSZ_FDISKPMEXE = "FDISKPM.EXE";
304PCSZ PCSZ_LVMEXE = "LVM.EXE";
305PCSZ PCSZ_UNLOCKEXE = "UNLOCK.EXE";
306PCSZ PCSZ_ARCCNR = "ArcCnr";
307PCSZ PCSZ_COLLECTOR = "Collector";
308PCSZ PCSZ_DIRCNR = "DirCnr";
309PCSZ PCSZ_DIRCMP = "DirCmp";
310PCSZ PCSZ_DIRSIZES = "DirSizes";
311PCSZ PCSZ_NOTIFYWND = "NotifyWnd";
312PCSZ PCSZ_TOOLBAR = "ToolBar";
313PCSZ PCSZ_TREECNR = "TreeCnr";
314PCSZ PCSZ_SHUTDOWNSTATE = "FM2Shutdown";
315PCSZ PCSZ_FM2TEMPTEXT = "FM/2_Temp";
316PCSZ DRF_FM2ARCHIVE = "DRF_FM2ARCHIVE";
317PCSZ DRMDRFFM2ARC = "<DRM_FM2ARCMEMBER,DRF_FM2ARCHIVE>";
318PCSZ DRMDRFOS2FILE = "<DRM_OS2FILE,DRF_UNKNOWN>";
319PCSZ DRM_FM2ARCMEMBER = "DRM_FM2ARCMEMBER";
320PCSZ DRM_OS2FILE = "DRM_OS2FILE";
321PCSZ FM2Str = "FM/2";
322HMODULE FM3DllHandle;
323PCSZ FM3Folder = "<FM3_Folder>";
324PCSZ FNT_HELVETICA = "Helvetica";
325PCSZ FNT_6HELVETICA = "6.Helvetica";
326PCSZ FNT_8HELVETICA = "8.Helvetica";
327PCSZ FNT_8HELVETICABOLD = "8.Helvetica.Bold";
328PCSZ FNT_10SYSTEMMONOTEXT = "10.System Monospaced";
329PCSZ FNT_10SYSTEMPROPORT = "10.System Proportional";
330PCSZ FNT_2SYSTEMVIO = "2.System VIO";
331PCSZ FNT_4SYSTEMVIO = "4.System VIO";
332PCSZ FNT_10SYSTEMVIO = "10.System VIO";
333PCSZ FNT_8TIMESNEWROMAN = "8.Times New Roman";
334CHAR HomePath[CCHMAXPATH];
335PCSZ LONGNAME = ".LONGNAME";
336CHAR *NullStr = "";
337PCSZ PCSZ_CM_ALLOCRECORD = "CM_ALLOCRECORD";
338PCSZ PCSZ_QUERYCNRINFO = "CM_QUERYCNRINFO";
339
340PCSZ PCSZ_DOSCREATEMUTEXSEM = "DosCreateMutexSem";
341PCSZ PCSZ_DOSREQUESTMUTEXSEM = "DosRequestMutexSem";
342PCSZ PCSZ_DOSRELEASEMUTEXSEM = "DosReleaseMutexSem";
343PCSZ PCSZ_DOSCREATEEVENTSEM = "DosCreateEventSem";
344PCSZ PCSZ_DOSWAITEVENTSEM = "DosWaitEventSem";
345PCSZ PCSZ_DOSPOSTEVENTSEM = "DosPostEventSem";
346PCSZ PCSZ_DOSRESETEVENTSEM = "DosResetEventSem";
347
348PCSZ PCSZ_DOSDUPHANDLE = "DosDupHandle";
349PCSZ PCSZ_DOSGETINFOBLOCKS = "DosGetInfoBlocks";
350PCSZ PCSZ_DOSQUERYPATHINFO = "DosQueryPathInfo";
351PCSZ PCSZ_DOSSEARCHPATH = "DosSearchPath";
352PCSZ PCSZ_DRGACCESSDRAGINFO = "DrgAccessDraginfo";
353PCSZ PCSZ_POSTMSG = "PostMsg";
354PCSZ PCSZ_WINCREATEWINDOW = "WinCreateWindow";
355PCSZ PCSZ_WINLOADACCELTABLE = "WinLoadAccelTable";
356PCSZ PCSZ_WINSETACCELTABLE = "WinSetAccelTable";
357PCSZ PCSZ_INIQUERYPRFTEXT = "PrfQueryProfile";
358PCSZ PCSZ_PRFOPENPROFILEFAILED = "PrfOpenProfile failed for %s";
359PCSZ PCSZ_PRFQUERYPROFILEDATA = "PrfQueryProfileData";
360PCSZ PCSZ_PRFQUERYPROFILESIZE = "PrfQueryProfileSize";
361PCSZ PCSZ_PRFQUERYPROFILESTRING = "PrfQueryProfileString";
362PCSZ PCSZ_FILLDIRQCURERRTEXT = "DosQCurDisk";
363PCSZ PCSZ_NODATA = "No Data";
364PCSZ PCSZ_BACKSLASH = "\\";
365PCSZ PCSZ_STARDOTEXE = "*.EXE";
366PCSZ PCSZ_STARDOTINI = "*.INI";
367PCSZ PCSZ_STARDOTLST = "*.LST";
368PCSZ PCSZ_STARDOTPMD = "*.PMD";
369PCSZ PCSZ_STARDOTTXT = "*.TXT";
370PCSZ PCSZ_FM3DOTINI = "FM3.INI";
371PCSZ PCSZ_FM3INI = "FM3INI";
372PCSZ PCSZ_FM3INIDOTBAK = "FM3INI.BAK";
373PCSZ PCSZ_FM3INIDOTBAD = "FM3INI.BAD";
374PCSZ PCSZ_FM3INIDOTBAD2 = "FM3INI.BAD2";
375PCSZ PCSZ_FM3RES = "FM3RES";
376PCSZ PCSZ_FM3DOTHLP = "FM3.HLP";
377PCSZ PCSZ_DOTEXE = ".EXE";
378PCSZ PCSZ_DOTCOM = ".COM";
379PCSZ PCSZ_DOTCMD = ".CMD";
380PCSZ PCSZ_DOTBTM = ".BTM";
381PCSZ PCSZ_DOTBAT = ".BAT";
382PCSZ PCSZ_DOTLST = ".LST";
383PCSZ PCSZ_DOTTLS = ".TLS";
384PCSZ PCSZ_DOTHLP = ".HLP";
385PCSZ PCSZ_DOTINF = ".INF";
386PCSZ PCSZ_DOTMP3 = ".MP3";
387PCSZ PCSZ_DOTMPG = ".MPG";
388PCSZ PCSZ_DOTMPEG = ".MPEG";
389PCSZ PCSZ_DOTOGG = ".OGG";
390PCSZ PCSZ_DOTFLAC = ".FLAC";
391PCSZ PCSZ_DOTJPEG = ".JPEG";
392PCSZ PCSZ_DOTJPG = ".JPG";
393PCSZ PCSZ_DOTICO = ".ICO";
394PCSZ PCSZ_DOTPTR = ".PTR";
395PCSZ PCSZ_DOTBB2 = ".BB2";
396PCSZ PCSZ_DOTBMP = ".BMP";
397PCSZ PCSZ_DOTCOMMENTS = ".COMMENTS";
398PCSZ PCSZ_PATH = "PATH";
399PCSZ PCSZ_LIBPATH = "LIBPATH";
400CHAR *pLibPathStrict = "SET LIBPATHSTRICT=TRUE";
401PCSZ PCSZ_WPURLDEFAULTSETTINGS = "WPURLDEFAULTSETTINGS";
402PCSZ Settings = "SETTINGS";
403PCSZ Details = "DETAILS";
404PCSZ PCSZ_TREE = "TREE";
405PCSZ PCSZ_ICON = "ICON";
406CHAR SwapperDat[CCHMAXPATH];
407PCSZ WC_OBJECTWINDOW = "WC_OBJECTWINDOW";
408PCSZ WC_BUBBLE = "WC_BUBBLE";
409PCSZ WC_TOOLBUTTONS = "WC_TOOLBUTTONS";
410PCSZ WC_DRIVEBUTTONS = "WC_DRIVEBUTTONS";
411PCSZ WC_DIRCONTAINER = "WC_DIRCONTAINER";
412PCSZ WC_DIRSTATUS = "WC_DIRSTATUS";
413PCSZ WC_TREECONTAINER = "WC_TREECONTAINER";
414PCSZ WC_TREEOPENBUTTON = "WC_TREEOPENBUTTON";
415PCSZ WC_TREESTATUS = "WC_TREESTATUS";
416PCSZ WC_MAINWND = "WC_MAINWND";
417PCSZ WC_MAINWND2 = "WC_MAINWND2";
418PCSZ WC_AUTOVIEW = "WC_AUTOVIEW";
419PCSZ WC_LED = "WC_LED";
420PCSZ WC_COLLECTOR = "WC_COLLECTOR";
421PCSZ WC_COLSTATUS = "WC_COLSTATUS";
422PCSZ WC_STATUS = "WC_STATUS";
423PCSZ WC_TOOLBACK = "WC_TOOLBACK";
424PCSZ WC_DRIVEBACK = "WC_DRIVEBACK";
425PCSZ WC_ARCCONTAINER = "WC_ARCCONTAINER";
426PCSZ WC_ARCSTATUS = "WC_ARCSTATUS";
427PCSZ WC_MLEEDITOR = "WC_MLEEDITOR";
428PCSZ WC_INIEDITOR = "WC_INIEDITOR";
429PCSZ WC_SEEALL = "WC_SEEALL";
430PCSZ WC_NEWVIEW = "WC_NEWVIEW";
431PCSZ WC_SEESTATUS = "WC_SEESTATUS";
432PCSZ WC_VIEWSTATUS = "WC_VIEWSTATUS";
433PCSZ WC_ERRORWND = "WC_ERRORWND";
434PCSZ WC_MINITIME = "WC_MINITIME";
435PCSZ WC_DATABAR = "WC_DATABAR";
436CHAR profile[CCHMAXPATH];
437ULONGLONG ullTmpSpaceNeeded = 5120000;
438
439BOOL CheckFileHeader(CHAR *filespec, CHAR *signature, LONG offset);
440
441VOID FindSwapperDat(VOID)
442{
443 CHAR filename[] = "C:\\CONFIG.SYS";
444 CHAR input[8192];
445 CHAR *p;
446 CHAR *pp;
447 FILE *fp;
448 FILEFINDBUF3L ffb;
449 ULONG nm;
450 ULONG size = sizeof(SwapperDat);
451 HDIR hdir = HDIR_CREATE;
452 APIRET rc = 1;
453 CHAR *moder = "r";
454
455 *SwapperDat = 0;
456 // Check already known
457 PrfQueryProfileData(fmprof, (CHAR *) FM3Str, "SwapperDat", SwapperDat, &size);
458 if (*SwapperDat) {
459 nm = 1;
460 rc = DosFindFirst(SwapperDat,
461 &hdir,
462 FILE_NORMAL | FILE_ARCHIVED |
463 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,
464 &ffb, sizeof(ffb), &nm, FIL_STANDARDL);
465 if (rc && rc != ERROR_FILE_NOT_FOUND && rc != ERROR_PATH_NOT_FOUND) {
466 FILEFINDBUF3 ffb;
467 rc = DosFindFirst(SwapperDat,
468 &hdir,
469 FILE_NORMAL | FILE_ARCHIVED |
470 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,
471 &ffb, sizeof(ffb), &nm, FIL_STANDARD);
472 fNoLargeFileSupport = TRUE;
473 }
474 if (!rc) {
475 DosFindClose(hdir);
476 fp = xfopen(SwapperDat, moder, pszSrcFile, __LINE__, TRUE);
477 if (fp) {
478 fclose(fp);
479 *SwapperDat = 0;
480 rc = 1; // Force config.sys scan
481 }
482 }
483 else
484 *SwapperDat = 0;
485 }
486 // If not defined in INI or INI wrong, scan config.sys for SWAPPATH statement
487 if (rc) {
488 if (DosQuerySysInfo(QSV_BOOT_DRIVE,
489 QSV_BOOT_DRIVE,
490 &nm,
491 sizeof(ULONG))) {
492 nm = 3; // Assume drive C:
493 }
494 *filename = (CHAR) nm + '@';
495 fp = xfsopen(filename, moder, SH_DENYNO, pszSrcFile, __LINE__, TRUE);
496 if (fp) {
497 while (!feof(fp)) {
498 if (!xfgets(input, sizeof(input), fp, pszSrcFile, __LINE__))
499 break;
500 lstrip(input);
501 if (!strnicmp(input, "SWAPPATH", 8)) {
502 p = input + 8;
503 while (*p == ' ')
504 p++;
505 if (*p == '=') {
506 p++;
507 bstripcr(p);
508 if (*p == '\"') {
509 p++;
510 pp = p;
511 while (*pp && *pp != '\"')
512 *pp += 1;
513 if (*pp)
514 *pp = 0;
515 }
516 else {
517 pp = strchr(p, ' ');
518 if (pp)
519 *pp = 0;
520 }
521 if (*p) {
522 strncpy(SwapperDat, p, CCHMAXPATH);
523 SwapperDat[CCHMAXPATH - 1] = 0;
524 BldFullPathName(SwapperDat, SwapperDat, "SWAPPER.DAT");
525 hdir = HDIR_CREATE;
526 nm = 1;
527 rc = DosFindFirst(SwapperDat,
528 &hdir,
529 FILE_NORMAL | FILE_ARCHIVED |
530 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,
531 &ffb, sizeof(ffb), &nm, FIL_STANDARDL);
532 if (rc){
533 FILEFINDBUF3 ffb;
534 rc = DosFindFirst(SwapperDat,
535 &hdir,
536 FILE_NORMAL | FILE_ARCHIVED |
537 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,
538 &ffb, sizeof(ffb), &nm, FIL_STANDARD);
539 fNoLargeFileSupport = TRUE;
540 }
541 if (!rc) {
542 DosFindClose(hdir);
543 PrfWriteProfileString(fmprof,
544 FM3Str, "SwapperDat", SwapperDat);
545 }
546 else
547 *SwapperDat = 0;
548 break;
549 }
550 }
551 } // if SWAPPATH
552 } // while
553 fclose(fp);
554 }
555 }
556}
557
558unsigned APIENTRY LibMain(unsigned hModule,
559 unsigned ulFlag)
560{
561 switch (ulFlag) {
562 case 0:
563 FM3DllHandle = hModule;
564
565 DosError(FERR_DISABLEHARDERR);
566 memset(&RGBBLACK, 0, sizeof(RGB2));
567 RGBGREY.bRed = RGBGREY.bGreen = RGBGREY.bBlue = (BYTE)204;
568 RGBGREY.fcOptions = 0;
569 FM3UL = *(ULONG *) FM3Str;
570 break;
571 case 1:
572 StopPrinting = 1;
573 if (fmprof)
574 PrfCloseProfile(fmprof);
575 DosError(FERR_ENABLEHARDERR);
576 break;
577 default:
578 return 0UL;
579 }
580 return 1UL;
581}
582
583VOID APIENTRY DeInitFM3DLL(ULONG why)
584{
585 // cleanup
586 static CHAR s[CCHMAXPATH];
587 CHAR *enddir, szTempFile[CCHMAXPATH];
588 HDIR search_handle;
589 ULONG num_matches;
590 FILEFINDBUF3 ffb;
591
592 StopTimer();
593 StopPrinting = 1;
594
595 if (LogFileHandle)
596 fclose(LogFileHandle);
597
598 if (fmprof) {
599 PrfCloseProfile(fmprof);
600 fmprof = (HINI) 0;
601 if (fIniExisted) {
602 DosError(FERR_DISABLEHARDERR);
603 DosCopy(PCSZ_FM3DOTINI, PCSZ_FM3INIDOTBAK, DCPY_EXISTING);
604 }
605 }
606
607 if (fToolsChanged)
608 save_tools(NULL);
609 fcloseall();
610 save_dir(s);
611 AddBackslashToPath(s);
612 enddir = &s[strlen(s)];
613 if (*ArcTempRoot) {
614 strcat(s, ArcTempRoot);
615 strcat(s, "*");
616 search_handle = HDIR_CREATE;
617 num_matches = 1L;
618 if (!DosFindFirst(s,
619 &search_handle,
620 FILE_NORMAL | FILE_DIRECTORY |
621 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN |
622 FILE_ARCHIVED,
623 &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) {
624 do {
625 strcpy(enddir, ffb.achName);
626 if (ffb.attrFile & FILE_DIRECTORY) {
627 wipeallf(TRUE, "%s\\*", s);
628 DosDeleteDir(s);
629 }
630 else
631 unlinkf(s);
632 }
633 while (!DosFindNext(search_handle,
634 &ffb, sizeof(ffb), &num_matches));
635 DosFindClose(search_handle);
636 }
637 }
638 if (pTmpDir)
639 strcpy(s, pTmpDir);
640 else
641 strcpy(s, pFM2SaveDirectory);
642 AddBackslashToPath(s);
643 enddir = &s[strlen(s)];
644 strcat(s, "$FM2LI$T.");
645 strcat(s, "???");
646 search_handle = HDIR_CREATE;
647 num_matches = 1;
648 if (!DosFindFirst(s,
649 &search_handle,
650 FILE_NORMAL | FILE_DIRECTORY |
651 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN |
652 FILE_ARCHIVED,
653 &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) {
654 do {
655 if (!(ffb.attrFile & FILE_DIRECTORY)) {
656 strcpy(enddir, ffb.achName);
657 unlinkf(s);
658 }
659 }
660 while (!DosFindNext(search_handle,
661 &ffb, sizeof(ffb), &num_matches));
662 DosFindClose(search_handle);
663 }
664 BldFullPathName(szTempFile, pTmpDir, PCSZ_FM2PLAYTEMP);
665 xDosForceDelete(szTempFile);
666 if (pTmpDir) {
667 wipeallf(TRUE, "%s\\*", pTmpDir);
668 DosDeleteDir(pTmpDir);
669 }
670 EndNote();
671 if (FM3ModHandle)
672 DosFreeModule(FM3ModHandle);
673
674 DosExitList(EXLST_REMOVE, DeInitFM3DLL);
675}
676
677BOOL InitFM3DLL(HAB hab, int argc, char **argv)
678{
679 /**
680 * this function should be called by any application using this DLL right
681 * after setting up a message queue
682 */
683
684 CLASSINFO clinfo;
685 APIRET rc;
686 APIRET rcl;
687 APIRET rcq;
688 PFN pfnResVersion;
689 ULONG RVMajor;
690 ULONG RVMinor;
691 ULONG ret;
692 FILESTATUS3 fs3;
693 PSZ env;
694 CHAR dllfile[CCHMAXPATH];
695 CHAR temp[CCHMAXPATH];
696 CHAR *p;
697 ULONG size;
698
699 strcpy(dllfile, PCSZ_FM3RES);
700 env = getenv(PCSZ_FM3INI);
701 if (env) {
702 DosError(FERR_DISABLEHARDERR);
703 rc = DosQueryPathInfo(env, FIL_STANDARD, &fs3, sizeof(fs3));
704 if (!rc) {
705 if (fs3.attrFile & FILE_DIRECTORY) {
706 BldFullPathName(dllfile, env, PCSZ_FM3RES); // 23 Aug 07 SHL
707 DosError(FERR_DISABLEHARDERR);
708 if (DosQueryPathInfo(dllfile, FIL_STANDARD, &fs3, sizeof(fs3)))
709 strcpy(dllfile, PCSZ_FM3RES);
710 }
711 }
712 }
713
714 rcl = DosLoadModule(NULL, 0, dllfile, &FM3ModHandle);
715 if (rcl) {
716 saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
717 HWND_DESKTOP,
718 GetPString(IDS_ERRORTEXT), GetPString(IDS_FM3RESERROR1TEXT));
719 return FALSE;
720 }
721
722 rc = DosExitList(EXLST_ADD, DeInitFM3DLL);
723 if (rc) {
724 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
725 "DosExitList");
726 }
727
728 rcq = DosQueryProcAddr(FM3ModHandle, 1, "ResVersion", &pfnResVersion);
729 if (!rcq)
730 ret = pfnResVersion(&RVMajor, &RVMinor);
731 else {
732 ret = 0;
733 RVMajor = 0;
734 RVMinor = 0;
735 }
736
737 if (RVMajor < VERMAJOR || (RVMajor == VERMAJOR && RVMinor < VERMINOR)) {
738 saymsg(MB_ENTER,
739 HWND_DESKTOP,
740 GetPString(IDS_ERRORTEXT),
741 GetPString(IDS_FM3RESERROR2TEXT),
742 !rcq ?
743 GetPString(IDS_FM3RESERROR3TEXT) :
744 !rcl ?
745 GetPString(IDS_FM3RESERROR4TEXT) :
746 GetPString(IDS_FM3RESERROR5TEXT), RVMajor, RVMinor, rcl, rcq, ret);
747 return FALSE;
748 }
749
750#ifdef PMPRINTF
751 PmPrintfDisplayInterfaceVersionInfo();
752 PmPrintfQueueNameThisProcess(NULL);
753#endif
754
755 if (!*profile)
756 strcpy(profile, PCSZ_FM3DOTINI);
757 mypid = getpid();
758 // give default appname if none set by caller
759 if (!*appname)
760 strcpy(appname, FM3Str);
761 // save appname; may be reset below
762 strcpy(realappname, appname);
763 if (!strcmp(appname, FM3Str))
764 DosSetMaxFH(100);
765 else if (!strcmp(appname, "VDir") ||
766 !strcmp(appname, "VTree") ||
767 !strcmp(appname, "VCollect") ||
768 !strcmp(appname, "SEEALL") || !strcmp(appname, "FM/4"))
769 DosSetMaxFH(60);
770 else
771 DosSetMaxFH(40);
772
773 if (DosQuerySysInfo(QSV_VERSION_MAJOR,
774 QSV_VERSION_MINOR,
775 OS2ver,
776 sizeof(OS2ver))) {
777 OS2ver[0] = 2;
778 OS2ver[1] = 1;
779 }
780
781 // Save the FM2 save directory name. This is the location of the ini, dat files etc.
782 rc = save_dir2(temp);
783 if (rc) {
784 saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
785 HWND_DESKTOP,
786 GetPString(IDS_ERRORTEXT), GetPString(IDS_FM3SAVEDIRERROR1TEXT));
787 return FALSE;
788 }
789 pFM2SaveDirectory = xstrdup(temp, pszSrcFile, __LINE__);
790 if (!pFM2SaveDirectory)
791 return FALSE; // already complained
792 // set up default root names for temp file storage and archive goodies
793 env = getenv("TEMP");
794 if (env != NULL) {
795 rc = 0;
796 DosError(FERR_DISABLEHARDERR);
797 rc = DosQueryPathInfo(env, FIL_STANDARD, &fs3, sizeof(fs3));
798 }
799 if (rc || env == NULL)
800 env = getenv("TMP");
801 if (env != NULL) {
802 DosError(FERR_DISABLEHARDERR);
803 rc = DosQueryPathInfo(env, FIL_STANDARD, &fs3, sizeof(fs3));
804 if (!rc) {
805 CHAR *enddir, szTempName[CCHMAXPATH];
806 FILEFINDBUF3 ffb;
807 HDIR search_handle;
808 ULONG num_matches, ul;
809
810 strcpy(szTempName, env);
811 AddBackslashToPath(szTempName);
812 enddir = &szTempName[strlen(szTempName)];
813 strcat(szTempName, "$FM2????.");
814 strcat(szTempName, "???");
815 search_handle = HDIR_CREATE;
816 num_matches = 1;
817 if (!DosFindFirst(szTempName,
818 &search_handle,
819 FILE_NORMAL | FILE_DIRECTORY |
820 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN |
821 FILE_ARCHIVED,
822 &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) {
823 do {
824 strcpy(enddir, ffb.achName);
825 p = strrchr(szTempName, '.');
826 if (p) {
827 p++;
828 ul = strtoul(p, NULL, 16);
829 GetDosPgmName(ul, temp);
830 if (!strstr(temp, "FM/2") &&
831 !strstr(temp, "AV/2")) {
832 wipeallf(TRUE, "%s\\*", szTempName);
833 DosDeleteDir(szTempName);
834 }
835 }
836 }
837 while (!DosFindNext(search_handle,
838 &ffb, sizeof(ffb), &num_matches));
839 DosFindClose(search_handle);
840 }
841 if (fs3.attrFile & FILE_DIRECTORY) {
842 strcpy(szTempName, env);
843 MakeTempName(szTempName, NULL, 1);
844 rc = DosCreateDir(szTempName, 0);
845 if (!rc)
846 pTmpDir = xstrdup(szTempName, pszSrcFile, __LINE__); // if writable
847 else
848 pTmpDir = xstrdup(pFM2SaveDirectory, pszSrcFile, __LINE__);
849 }
850 }
851 }
852 else
853 pTmpDir = xstrdup(pFM2SaveDirectory, pszSrcFile, __LINE__);
854 if (!pTmpDir)
855 pTmpDir = xstrdup(pFM2SaveDirectory, pszSrcFile, __LINE__);
856 // Check free space on TMP and FM2 Save drives
857#ifdef FM4_NOWARN_DSPACE //Quiet FM/4 for AN main frame backup solution
858 if (strcmp(appname, "FM/4"))
859#endif
860 {
861 if (pTmpDir && CheckDriveSpaceAvail(pTmpDir, ullTmpSpaceNeeded, 0) == 1) {
862 if (CheckDriveSpaceAvail(pFM2SaveDirectory, ullTmpSpaceNeeded, 0) == 0){
863 ret = saymsg(MB_YESNO,
864 HWND_DESKTOP,
865 NullStr,
866 GetPString(IDS_TMPDRIVESPACELIMITED),
867 pTmpDir);
868 if (ret == MBID_YES)
869 pTmpDir = pFM2SaveDirectory;
870 }
871 else
872 saymsg(MB_OK,
873 HWND_DESKTOP,
874 NullStr,
875 GetPString(IDS_SAVETMPDRIVESPACELIMITED),
876 pTmpDir,
877 pFM2SaveDirectory);
878 }
879 else if (CheckDriveSpaceAvail(pFM2SaveDirectory, ullTmpSpaceNeeded, 0) == 1)
880 saymsg(MB_OK,
881 HWND_DESKTOP,
882 NullStr,
883 GetPString(IDS_SAVEDRIVESPACELIMITED),
884 pFM2SaveDirectory);
885 }
886 BldFullPathName(ArcTempRoot, pTmpDir, fAmAV2 ? "$AV$ARC$" : "$FM$ARC$");
887
888 // initialize random number generator
889 srand(time(NULL) + clock());
890
891 priority_bumped();
892
893 // _heapmin() is done in a separate thread -- start it
894 if (xbeginthread(HeapThread,
895 32768,
896 MPVOID,
897 pszSrcFile,
898 __LINE__) == -1) {
899 return FALSE;
900 }
901
902 if (!StartFleshWorkThread())
903 return FALSE;
904
905 if (!StartExpandTreeThread())
906 return FALSE;
907
908 // timer messages are sent from a separate thread -- start it
909 if (!StartTimer()) {
910 Runtime_Error(pszSrcFile, __LINE__,
911 GetPString(IDS_COULDNTSTARTTHREADTEXT));
912 return FALSE;
913 }
914
915 // Are we the workplace shell?
916 env = getenv("WORKPLACE_PROCESS");
917 fWorkPlace = env != NULL &&
918 (stricmp(env, "YES") == 0 || atoi(env) == 1);
919
920 if ((!strchr(profile, '\\') && !strchr(profile, ':')) ||
921 !(fmprof = PrfOpenProfile((HAB)0, profile))) {
922 // figure out where to put INI file...
923 CHAR inipath[CCHMAXPATH];
924
925 DosError(FERR_DISABLEHARDERR);
926 strcpy(HomePath, pFM2SaveDirectory);
927 DosError(FERR_DISABLEHARDERR);
928 memset(driveserial, -1, sizeof(driveserial));
929 *inipath = 0;
930 env = getenv(PCSZ_FM3INI);
931 if (env) {
932 strcpy(inipath, env);
933 DosError(FERR_DISABLEHARDERR);
934 rc = DosQueryPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3));
935 if (!rc) {
936 if (fs3.attrFile & FILE_DIRECTORY)
937 BldFullPathName(inipath, inipath, profile);
938 }
939 }
940 else {
941 CHAR szFullFilename[CCHMAXPATH];
942 if (!SearchMultiplePathsForFile(profile, szFullFilename)) {
943 strcpy(inipath, szFullFilename);
944 } else {
945 strcpy(inipath, profile);
946 }
947 } // FIXME the DosCopies probably fail if the INI isn't in the FM2 directory GKY 06 Aug 11
948 if (!*inipath)
949 strcpy(inipath, profile);
950 DosError(FERR_DISABLEHARDERR);
951 rc = DosQueryPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3));
952 if (rc) {
953 if (rc == ERROR_FILE_NOT_FOUND) {
954 DosCopy(PCSZ_FM3INIDOTBAK, PCSZ_FM3DOTINI, 0);
955 }
956 rc = DosQueryPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3));
957 if (rc)
958 fWantFirstTimeInit = TRUE;
959 }
960 if (!fWantFirstTimeInit) {
961 // Check the ini file header and restore from backup if corupted
962 if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) {
963 saymsg(MB_ENTER,HWND_DESKTOP, GetPString(IDS_DEBUG_STRING),
964 GetPString(IDS_INIFAILURETEXT));
965 DosCopy(PCSZ_FM3DOTINI, PCSZ_FM3INIDOTBAD, DCPY_EXISTING);
966 DosCopy(PCSZ_FM3INIDOTBAK, PCSZ_FM3DOTINI, DCPY_EXISTING);
967 if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) {
968 DosCopy(PCSZ_FM3DOTINI, PCSZ_FM3INIDOTBAD2, DCPY_EXISTING);
969 fWantFirstTimeInit = TRUE;
970 }
971 }
972 }
973 // in some odd cases the INI file can get set to readonly status
974 // here we test it and reset the readonly bit if necessary
975 if (!fWantFirstTimeInit) {
976 fIniExisted = TRUE;
977 if (fs3.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) {
978 fs3.attrFile &= ~(FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM);
979 rc = xDosSetPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3), 0);
980 if (rc) {
981 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
982 GetPString(IDS_INIREADONLYTEXT), inipath);
983 }
984 }
985 }
986 fmprof = PrfOpenProfile((HAB)0, inipath);
987 if (!fmprof) {
988 strcpy(inipath, PCSZ_FM3DOTINI);
989 fmprof = PrfOpenProfile((HAB)0, inipath);
990 }
991
992 // 10 Jan 08 SHL FIXME to do first time if new ini
993 // 10 Jan 08 SHL post UM_FIRSTTIME to main window
994 if (!fmprof) {
995 Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__,
996 PCSZ_PRFOPENPROFILEFAILED, inipath);
997 return FALSE;
998 }
999 }
1000
1001 ArgDriveFlags(argc, argv);
1002 FillInDriveFlags(NULL);
1003
1004 FindSwapperDat();
1005
1006 // start help
1007 memset(&hini, 0, sizeof(HELPINIT));
1008 hini.cb = sizeof(HELPINIT);
1009 hini.phtHelpTable = (PHELPTABLE) MAKELONG(ID_HELPTABLE, 0xffff);
1010 hini.hmodAccelActionBarModule = (HMODULE) 0;
1011 hini.pszHelpWindowTitle = (PSZ)GetPString(IDS_FM2HELPTITLETEXT);
1012 hini.hmodHelpTableModule = FM3ModHandle;
1013 hini.fShowPanelId = CMIC_HIDE_PANEL_ID;
1014 hini.pszHelpLibraryName = (CHAR *) PCSZ_FM3DOTHLP;
1015 hwndHelp = WinCreateHelpInstance(hab, &hini);
1016 if (!hwndHelp) {
1017 CHAR helppath[CCHMAXPATH];
1018 env = getenv(PCSZ_FM3INI);
1019 if (env) {
1020 strcpy(helppath, env);
1021 DosError(FERR_DISABLEHARDERR);
1022 rc = DosQueryPathInfo(helppath, FIL_STANDARD, &fs3, sizeof(fs3));
1023 if (!rc) {
1024 if (fs3.attrFile & FILE_DIRECTORY) {
1025 BldFullPathName(helppath, helppath, PCSZ_FM3DOTHLP);
1026 hini.pszHelpLibraryName = helppath;
1027 hwndHelp = WinCreateHelpInstance(hab, &hini);
1028 if (!hwndHelp)
1029 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
1030 "WinCreateHelpInstance failed for %s with error 0x%x",
1031 hini.pszHelpLibraryName, hini.ulReturnCode);
1032 }
1033 }
1034 }
1035 }
1036 if (!hwndHelp) {
1037 saymsg(MB_ENTER | MB_ICONEXCLAMATION,
1038 HWND_DESKTOP,
1039 GetPString(IDS_FM2TROUBLETEXT),
1040 GetPString(IDS_CANTLOADHELPTEXT),
1041 GetPString(IDS_NOHELPACCEPTTEXT));
1042 }
1043
1044 // a couple of default window procs so we don't have to look them up later
1045 if (WinQueryClassInfo(hab, WC_CONTAINER, &clinfo))
1046 PFNWPCnr = clinfo.pfnWindowProc;
1047 if (WinQueryClassInfo(hab, WC_FRAME, &clinfo))
1048 PFNWPFrame = clinfo.pfnWindowProc;
1049 if (WinQueryClassInfo(hab, WC_BUTTON, &clinfo))
1050 PFNWPButton = clinfo.pfnWindowProc;
1051 if (WinQueryClassInfo(hab, WC_STATIC, &clinfo))
1052 PFNWPStatic = clinfo.pfnWindowProc;
1053 if (WinQueryClassInfo(hab, WC_MLE, &clinfo))
1054 PFNWPMLE = clinfo.pfnWindowProc;
1055 if (!PFNWPCnr || !PFNWPFrame || !PFNWPButton || !PFNWPStatic || !PFNWPMLE) {
1056 Runtime_Error(pszSrcFile, __LINE__, "WinQueryClassInfo");
1057 return FALSE;
1058 }
1059
1060 // register window classes we use
1061 WinRegisterClass(hab,
1062 (CHAR *) WC_MAINWND,
1063 MainWndProc,
1064 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 8);
1065 WinRegisterClass(hab,
1066 (CHAR *) WC_MAINWND2,
1067 MainWndProc2,
1068 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 4);
1069 WinRegisterClass(hab,
1070 (CHAR *) WC_TREECONTAINER,
1071 TreeClientWndProc,
1072 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
1073 WinRegisterClass(hab,
1074 (CHAR *) WC_DIRCONTAINER,
1075 DirClientWndProc,
1076 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
1077 WinRegisterClass(hab,
1078 (CHAR *) WC_COLLECTOR,
1079 CollectorClientWndProc,
1080 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
1081 WinRegisterClass(hab,
1082 (CHAR *) WC_ARCCONTAINER,
1083 ArcClientWndProc,
1084 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
1085 WinRegisterClass(hab,
1086 (CHAR *) WC_MLEEDITOR,
1087 MLEEditorProc,
1088 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
1089 WinRegisterClass(hab,
1090 (CHAR *) WC_INIEDITOR,
1091 IniProc,
1092 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
1093 WinRegisterClass(hab,
1094 (CHAR *) WC_TOOLBACK,
1095 ToolBackProc,
1096 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1097 sizeof(PVOID));
1098 WinRegisterClass(hab,
1099 (CHAR *) WC_DRIVEBACK,
1100 DriveBackProc,
1101 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1102 sizeof(PVOID));
1103 WinRegisterClass(hab,
1104 (CHAR *) WC_SEEALL,
1105 SeeAllWndProc,
1106 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID));
1107 WinRegisterClass(hab,
1108 (CHAR *) WC_NEWVIEW,
1109 ViewWndProc,
1110 CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID));
1111 WinRegisterClass(hab,
1112 (CHAR *) WC_TOOLBUTTONS,
1113 ChildButtonProc,
1114 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1115 sizeof(PVOID));
1116 WinRegisterClass(hab,
1117 (CHAR *) WC_DRIVEBUTTONS,
1118 DriveProc,
1119 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1120 sizeof(PVOID));
1121 WinRegisterClass(hab,
1122 (CHAR *) WC_BUBBLE,
1123 BubbleProc,
1124 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1125 sizeof(ULONG) * 2);
1126 WinRegisterClass(hab,
1127 (CHAR *) WC_STATUS,
1128 StatusProc,
1129 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1130 sizeof(ULONG));
1131 WinRegisterClass(hab,
1132 (CHAR *) WC_DIRSTATUS,
1133 DirTextProc,
1134 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1135 sizeof(ULONG));
1136 WinRegisterClass(hab,
1137 (CHAR *) WC_TREESTATUS,
1138 TreeStatProc,
1139 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1140 sizeof(ULONG));
1141 WinRegisterClass(hab,
1142 (CHAR *) WC_ARCSTATUS,
1143 ArcTextProc,
1144 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1145 sizeof(ULONG));
1146 WinRegisterClass(hab,
1147 (CHAR *) WC_COLSTATUS,
1148 CollectorTextProc,
1149 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1150 sizeof(ULONG));
1151 WinRegisterClass(hab,
1152 (CHAR *) WC_SEESTATUS,
1153 SeeStatusProc,
1154 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1155 sizeof(ULONG));
1156 WinRegisterClass(hab,
1157 (CHAR *) WC_VIEWSTATUS,
1158 ViewStatusProc,
1159 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1160 sizeof(ULONG));
1161 WinRegisterClass(hab,
1162 (CHAR *) WC_ERRORWND,
1163 NotifyWndProc,
1164 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1165 sizeof(PVOID));
1166 WinRegisterClass(hab,
1167 (CHAR *) WC_MINITIME,
1168 MiniTimeProc,
1169 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1170 sizeof(PVOID) * 2);
1171 WinRegisterClass(hab,
1172 (CHAR *) WC_DATABAR,
1173 DataProc, CS_SIZEREDRAW, sizeof(PVOID));
1174 WinRegisterClass(hab,
1175 (CHAR *) WC_TREEOPENBUTTON,
1176 OpenButtonProc,
1177 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1178 sizeof(PVOID));
1179 WinRegisterClass(hab,
1180 (CHAR *) WC_AUTOVIEW,
1181 AutoViewProc,
1182 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1183 sizeof(PVOID));
1184 WinRegisterClass(hab,
1185 (CHAR *) WC_LED,
1186 LEDProc,
1187 CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
1188 sizeof(PVOID));
1189
1190 rc = DosCreateMutexSem(NULL, &hmtxFM2Globals, 0L, FALSE);
1191 if (rc) {
1192 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
1193 PCSZ_DOSCREATEMUTEXSEM);
1194 }
1195 rc = DosCreateMutexSem(NULL, &hmtxFM2Delete, 0L, FALSE);
1196 if (rc) {
1197 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
1198 PCSZ_DOSCREATEMUTEXSEM);
1199 }
1200 rc = DosCreateMutexSem(NULL, &hmtxFiltering, 0L, FALSE);
1201 if (rc) {
1202 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
1203 PCSZ_DOSCREATEMUTEXSEM);
1204 }
1205
1206 /**
1207 * set some defaults (note: everything else automatically initialized
1208 * to 0)
1209 */
1210 dsDirCnrDefault.detailssize = dsDirCnrDefault.detailsea = dsDirCnrDefault.detailslwdate =
1211 dsDirCnrDefault.detailslwtime = dsDirCnrDefault.detailsattr = dsDirCnrDefault.detailsicon =
1212 fAutoTile = fConfirmDelete = fLoadSubject = fUnHilite =
1213 fLoadLongnames = fToolbar = fSaveState = fGuessType = fToolbarHelp =
1214 fAutoAddDirs = fUseNewViewer = fDataToFore = fDataShowDrives = fDataMin =
1215 fSplitStatus = fDragndropDlg = fQuickArcFind = fKeepCmdLine =
1216 fMoreButtons = fDrivebar = fCollapseFirst = fSwitchTreeOnDirChg =
1217 fSwitchTreeExpand = fNoSearch = fCustomFileDlg = fOtherHelp =
1218 fSaveMiniCmds = fUserComboBox = fFM2Deletes = fConfirmTarget =
1219 fShowTarget = fDrivebarHelp = fCheckMM = fEjectRemovableScan = TRUE;
1220 ulCnrType = CCS_EXTENDSEL;
1221 FilesToGet = FILESTOGET_MAX;
1222 MaxComLineStrg = MAXCOMLINESTRGDEFAULT;
1223 AutoviewHeight = 48;
1224 prnwidth = 80;
1225 prnlength = 66;
1226 prntmargin = 6;
1227 prnbmargin = 6;
1228 prnlmargin = 6;
1229 prnrmargin = 3;
1230 prnspacing = 1;
1231 prntabspaces = 8;
1232 CollectorsortFlags = sortFlags = SORT_FILENAME | SORT_DIRSFIRST;
1233 // Get default Country info
1234 {
1235 COUNTRYCODE Country = {0};
1236 ULONG ulInfoLen = 0;
1237 COUNTRYINFO CtryInfo = {0};
1238
1239 if (!DosQueryCtryInfo(sizeof(CtryInfo), &Country, &CtryInfo, &ulInfoLen)) {
1240 *ThousandsSeparator = CtryInfo.szThousandsSeparator[0];
1241 strcpy(DateSeparator, CtryInfo.szDateSeparator);
1242 strcpy(TimeSeparator, CtryInfo.szTimeSeparator);
1243 ulDateFmt = CtryInfo.fsDateFmt;
1244 ulTimeFmt = CtryInfo.fsTimeFmt;
1245 }
1246 else {
1247 strcpy(ThousandsSeparator, ",");
1248 strcpy(DateSeparator, "/");
1249 strcpy(TimeSeparator, ":");
1250 ulDateFmt = 0;
1251 ulTimeFmt = 0;
1252 }
1253 }
1254 {
1255 // Check for the existance of various partitioning tools to set up menu items
1256 ULONG ulAppType;
1257
1258 if (!SearchPathForFile(PCSZ_PATH, PCSZ_LVMGUICMD, NULL))
1259 fLVMGui = TRUE;
1260 if (!xDosQueryAppType(PCSZ_DFSOS2EXE, &ulAppType))
1261 fDFSee = TRUE;
1262 if (!xDosQueryAppType(PCSZ_MINILVMEXE, &ulAppType))
1263 fMiniLVM = TRUE;
1264 if (!xDosQueryAppType(PCSZ_FDISKPMEXE, &ulAppType))
1265 fFDisk = TRUE;
1266 if (!xDosQueryAppType(PCSZ_LVMEXE, &ulAppType))
1267 fLVM = TRUE;
1268
1269 // Check for unlock.exe
1270 if (!xDosQueryAppType(PCSZ_UNLOCKEXE, &ulAppType))
1271 fUnlock = TRUE;
1272
1273 // Check to see if we are running protect only
1274 if (!xDosQueryAppType(GetCmdSpec(TRUE), &ulAppType)) {
1275 HMODULE hmod;
1276 APIRET rc;
1277
1278 rc = DosQueryModuleHandle("VKBD", &hmod);
1279 if (rc != NO_ERROR) {
1280 fProtectOnly = TRUE;
1281 }
1282 else {
1283 rc = DosQueryModuleHandle("VMOUSE", &hmod);
1284 if (rc != NO_ERROR) {
1285 fProtectOnly = TRUE;
1286 }
1287 }
1288 }
1289 else
1290 fProtectOnly = TRUE;
1291 }
1292
1293 // load preferences from profile (INI) file
1294 /**
1295 * Separate paramenters -- Please note that appname should be used in
1296 * profile calls for user settings that work and are setable in more than one
1297 * miniapp; FM3Str should be used for setting only relavent to FM/2 or that
1298 * aren't user settable; realappname should be used for setting applicable to
1299 * one or more miniapp but not to FM/2
1300 */
1301 size = sizeof(BOOL);
1302 PrfQueryProfileData(fmprof, realappname, "SeparateParms", &fAppSeparateSettings, &size);
1303 if (!fAppSeparateSettings)
1304 strcpy(appname, FM3Str);
1305 else
1306 strcpy(appname, realappname);
1307 size = sizeof(ULONG);
1308 PrfQueryProfileData(fmprof, appname, "MaxComLineStrg", &MaxComLineStrg, &size);
1309 // Give user one chance to reset the default command line length to 1024 (4os2's unexpanded max)
1310 if (MaxComLineStrg == 2048) {
1311 BOOL MaxComLineChecked = FALSE;
1312
1313 size = sizeof(BOOL);
1314 PrfQueryProfileData(fmprof, appname, "MaxComLineChecked", &MaxComLineChecked, &size);
1315 if (!MaxComLineChecked) {
1316 ret = saymsg(MB_YESNO,
1317 HWND_DESKTOP,
1318 NullStr,
1319 GetPString(IDS_CHANGECMDLINELENGTHDEFAULT));
1320 if (ret == MBID_YES)
1321 MaxComLineStrg = 1024;
1322 MaxComLineChecked = TRUE;
1323 PrfWriteProfileData(fmprof, appname, "MaxComLineChecked", &MaxComLineChecked, sizeof(BOOL));
1324 }
1325 }
1326 if (MaxComLineStrg < CMDLNLNGTH_MIN)
1327 MaxComLineStrg = CMDLNLNGTH_MIN;
1328 else if (MaxComLineStrg > CMDLNLNGTH_MAX)
1329 MaxComLineStrg = CMDLNLNGTH_MAX;
1330 editor = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1331 if (!editor)
1332 return 0; // already complained
1333 viewer = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1334 if (!viewer)
1335 return 0; // already complained
1336 virus = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1337 if (!virus)
1338 return 0; // already complained
1339 compare = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1340 if (!compare)
1341 return 0; // already complained
1342 binview = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1343 if (!binview)
1344 return 0; // already complained
1345 bined = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1346 if (!bined)
1347 return 0; // already complained
1348 dircompare = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1349 if (!dircompare)
1350 return 0; // already complained
1351 ftprun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1352 if (!ftprun)
1353 return 0; // already complained
1354 httprun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1355 if (!httprun)
1356 return 0; // already complained
1357 mailrun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1358 if (!mailrun)
1359 return 0; // already complained
1360 pszTreeEnvVarList = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1361 if (!pszTreeEnvVarList)
1362 return 0; // already complained
1363 size = sizeof(BOOL);
1364 PrfQueryProfileData(fmprof, FM3Str, "DontSuggestAgain", &fDontSuggestAgain, &size);
1365 size = sizeof(BOOL);
1366 PrfQueryProfileData(fmprof, appname, "ShowTarget", &fShowTarget, &size);
1367 size = sizeof(BOOL);
1368 PrfQueryProfileData(fmprof, appname, "CheckMM", &fCheckMM, &size);
1369 size = sizeof(BOOL);
1370 PrfQueryProfileData(fmprof, appname, "ChangeTarget", &fChangeTarget, &size);
1371 size = sizeof(BOOL);
1372 PrfQueryProfileData(fmprof, appname, "ConfirmTarget", &fConfirmTarget, &size);
1373 size = sizeof(BOOL);
1374 PrfQueryProfileData(fmprof, appname, "CustomFileDlg", &fCustomFileDlg, &size);
1375 size = sizeof(BOOL);
1376 PrfQueryProfileData(fmprof, appname, "SaveMiniCmds", &fSaveMiniCmds, &size);
1377 size = sizeof(BOOL);
1378 PrfQueryProfileData(fmprof, appname, "SaveBigCmds", &fSaveBigCmds, &size);
1379 size = sizeof(BOOL);
1380 PrfQueryProfileData(fmprof, appname, "NoFoldMenu", &fNoFoldMenu, &size);
1381 size = sizeof(BOOL);
1382 PrfQueryProfileData(fmprof, FM3Str, "Prnpagenums", &prnpagenums, &size);
1383 size = sizeof(BOOL);
1384 PrfQueryProfileData(fmprof, FM3Str, "Prnalt", &prnalt, &size);
1385 size = sizeof(BOOL);
1386 PrfQueryProfileData(fmprof, FM3Str, "Prnformat", &prnformat, &size);
1387 size = sizeof(BOOL);
1388 PrfQueryProfileData(fmprof, FM3Str, "Prnformfeedbefore", &prnformfeedbefore, &size);
1389 size = sizeof(BOOL);
1390 PrfQueryProfileData(fmprof, FM3Str, "Prnformfeedafter",&prnformfeedafter, &size);
1391 size = sizeof(ULONG);
1392 PrfQueryProfileData(fmprof, FM3Str, "Prntabspaces", &prntabspaces, &size);
1393 size = sizeof(ULONG);
1394 PrfQueryProfileData(fmprof, FM3Str, "Prnwidth", &prnwidth, &size);
1395 size = sizeof(ULONG);
1396 PrfQueryProfileData(fmprof, FM3Str, "Prnlength", &prnlength, &size);
1397 size = sizeof(ULONG);
1398 PrfQueryProfileData(fmprof, FM3Str, "Prntmargin", &prntmargin, &size);
1399 size = sizeof(ULONG);
1400 PrfQueryProfileData(fmprof, FM3Str, "Prnbmargin", &prnbmargin, &size);
1401 size = sizeof(ULONG);
1402 PrfQueryProfileData(fmprof, FM3Str, "Prnlmargin", &prnlmargin, &size);
1403 size = sizeof(ULONG);
1404 PrfQueryProfileData(fmprof, FM3Str, "Prnrmargin", &prnrmargin, &size);
1405 size = sizeof(ULONG);
1406 PrfQueryProfileData(fmprof, FM3Str, "Prnspacing", &prnspacing, &size);
1407 size = sizeof(BOOL);
1408 PrfQueryProfileData(fmprof, appname, "NoDead", &fNoDead, &size);
1409 size = sizeof(BOOL);
1410 PrfQueryProfileData(fmprof, appname, "NoFinger", &fNoFinger, &size);
1411 size = sizeof(BOOL);
1412 PrfQueryProfileData(fmprof, appname, "AlertBeepOff", &fAlertBeepOff, &size);
1413 size = sizeof(BOOL);
1414 PrfQueryProfileData(fmprof, appname, "ErrorBeepOff", &fErrorBeepOff, &size);
1415 size = sizeof(BOOL);
1416 PrfQueryProfileData(fmprof, appname, "SwitchTree", &fSwitchTreeOnDirChg, &size);
1417 size = sizeof(BOOL);
1418 PrfQueryProfileData(fmprof, appname, "SwitchTreeExpand", &fSwitchTreeExpand, &size);
1419 size = sizeof(BOOL);
1420 PrfQueryProfileData(fmprof, appname, "SwitchTreeOnFocus", &fSwitchTreeOnFocus, &size);
1421 size = sizeof(BOOL);
1422 PrfQueryProfileData(fmprof, appname, "CollapseFirst", &fCollapseFirst, &size);
1423 size = sizeof(BOOL);
1424 PrfQueryProfileData(fmprof, appname, "FilesInTree", &fFilesInTree, &size);
1425 size = sizeof(BOOL);
1426 PrfQueryProfileData(fmprof, appname, "TopDir", &fTopDir, &size);
1427 size = sizeof(BOOL);
1428 PrfQueryProfileData(fmprof, appname, "LookInDir", &fLookInDir, &size);
1429 PrfQueryProfileString(fmprof, appname, "DefArc", NULL, szDefArc, sizeof(szDefArc));
1430 size = sizeof(ULONG);
1431 PrfQueryProfileData(fmprof, appname, "AutoviewHeight",
1432 &AutoviewHeight, &size);
1433 size = sizeof(BOOL);
1434 PrfQueryProfileData(fmprof, appname, "KeepCmdLine", &fKeepCmdLine, &size);
1435 if (strcmp(realappname, "FM/4")) {
1436 size = sizeof(BOOL);
1437 PrfQueryProfileData(fmprof, FM3Str, "MoreButtons", &fMoreButtons, &size);
1438 size = sizeof(BOOL);
1439 PrfQueryProfileData(fmprof, FM3Str, "Drivebar", &fDrivebar, &size);
1440 }
1441 size = sizeof(BOOL);
1442 PrfQueryProfileData(fmprof, appname, "NoSearch", &fNoSearch, &size);
1443 size = sizeof(BOOL);
1444 PrfQueryProfileData(fmprof, appname, "GuessType", &fGuessType, &size);
1445 size = sizeof(BOOL);
1446 PrfQueryProfileData(fmprof, appname, "ViewChild", &fViewChild, &size);
1447 size = sizeof(BOOL);
1448 PrfQueryProfileData(fmprof, appname, "ShowEnv", &fShowEnv, &size);
1449 PrfQueryProfileString(fmprof, appname, "TreeEnvVarList", "PATH;DPATH;LIBPATH;HELP;BOOKSHELF;",
1450 pszTreeEnvVarList, MaxComLineStrg);
1451 size = sizeof(BOOL);
1452 PrfQueryProfileData(fmprof, appname, "ShowDriveOnly", &fShowDriveOnly, &size);
1453 size = sizeof(BOOL);
1454 PrfQueryProfileData(fmprof, appname, "ShowFSTypeInTree", &fShowFSTypeInTree, &size);
1455 size = sizeof(BOOL);
1456 PrfQueryProfileData(fmprof, appname, "ShowDriveLabelInTree", &fShowDriveLabelInTree, &size);
1457 if (!fShowDriveOnly && !fShowFSTypeInTree && !fShowDriveLabelInTree)
1458 fShowDriveOnly = TRUE;
1459 size = sizeof(BOOL);
1460 PrfQueryProfileData(fmprof, appname, "LeaveTree", &fLeaveTree, &size);
1461 size = sizeof(BOOL);
1462 PrfQueryProfileData(fmprof, appname, "Comments", &fComments, &size);
1463 size = sizeof(ULONG);
1464 PrfQueryProfileData(fmprof, appname, "WS_ANIMATE", &fwsAnimate, &size);
1465 if (fwsAnimate)
1466 fwsAnimate = WS_ANIMATE;
1467 size = sizeof(BOOL);
1468 PrfQueryProfileData(fmprof, appname, "SelectedAlways", &fSelectedAlways, &size);
1469 size = sizeof(BOOL);
1470 PrfQueryProfileData(fmprof, appname, "ToolbarHelp", &fToolbarHelp, &size);
1471 size = sizeof(BOOL);
1472 PrfQueryProfileData(fmprof, appname, "OtherHelp", &fOtherHelp, &size);
1473 size = sizeof(BOOL);
1474 PrfQueryProfileData(fmprof, appname, "DrivebarHelp", &fDrivebarHelp, &size);
1475 size = sizeof(BOOL);
1476 PrfQueryProfileData(fmprof, appname, "AutoAddDirs", &fAutoAddDirs, &size);
1477 size = sizeof(BOOL);
1478 PrfQueryProfileData(fmprof, appname, "AutoAddAllDirs", &fAutoAddAllDirs, &size);
1479 size = sizeof(BOOL);
1480 PrfQueryProfileData(fmprof, FM3Str, "UserListSwitches", &fUserListSwitches, &size);
1481 size = sizeof(BOOL);
1482 PrfQueryProfileData(fmprof, appname, "UseNewViewer", &fUseNewViewer, &size);
1483 size = sizeof(BOOL);
1484 PrfQueryProfileData(fmprof, appname, "DefaultDeletePerm", &fDefaultDeletePerm, &size);
1485 size = sizeof(BOOL);
1486 PrfQueryProfileData(fmprof, FM3Str, "ExternalINIs", &fExternalINIs, &size);
1487 size = sizeof(BOOL);
1488 PrfQueryProfileData(fmprof, FM3Str, "ExternalCollector", &fExternalCollector, &size);
1489 size = sizeof(BOOL);
1490 PrfQueryProfileData(fmprof, FM3Str, "ExternalArcboxes", &fExternalArcboxes, &size);
1491 size = sizeof(BOOL);
1492 PrfQueryProfileData(fmprof, FM3Str, "ExternalViewer", &fExternalViewer, &size);
1493 size = sizeof(BOOL);
1494 PrfQueryProfileData(fmprof, FM3Str, "UseQProcStat", &fUseQProcStat, &size);
1495 size = sizeof(BOOL);
1496 PrfQueryProfileData(fmprof, FM3Str, "UseQSysState", &fUseQSysState, &size);
1497 size = sizeof(BOOL);
1498 PrfQueryProfileData(fmprof, appname, "DataMin", &fDataMin, &size);
1499 size = sizeof(BOOL);
1500 PrfQueryProfileData(fmprof, appname, "DataToFore", &fDataToFore, &size);
1501 size = sizeof(BOOL);
1502 PrfQueryProfileData(fmprof, appname, "DataShowDrives", &fDataShowDrives, &size);
1503 size = sizeof(BOOL);
1504 PrfQueryProfileData(fmprof, appname, "DataInclRemote", &fDataInclRemote, &size);
1505 size = sizeof(BOOL);
1506 PrfQueryProfileData(fmprof, FM3Str, "SplitStatus", &fSplitStatus, &size);
1507 size = sizeof(BOOL);
1508 PrfQueryProfileData(fmprof, appname, "FolderAfterExtract", &fFolderAfterExtract, &size);
1509 size = sizeof(BOOL);
1510 PrfQueryProfileData(fmprof, appname, "DullDatabar", &fDullMin, &size);
1511 size = sizeof(BOOL);
1512 PrfQueryProfileData(fmprof, appname, "BlueLED", &fBlueLED, &size);
1513 size = sizeof(BOOL);
1514 PrfQueryProfileData(fmprof, appname, "ConfirmDelete", &fConfirmDelete, &size);
1515 size = sizeof(BOOL);
1516 PrfQueryProfileData(fmprof, FM3Str, "SaveState", &fSaveState, &size);
1517 size = sizeof(BOOL);
1518 PrfQueryProfileData(fmprof, appname, "SyncUpdates", &fSyncUpdates, &size);
1519 size = sizeof(BOOL);
1520 PrfQueryProfileData(fmprof, appname, "LoadSubject", &fLoadSubject, &size);
1521 size = sizeof(BOOL);
1522 PrfQueryProfileData(fmprof, appname, "UnHilite", &fUnHilite, &size);
1523 size = sizeof(BOOL);
1524 PrfQueryProfileData(fmprof, FM3Str, "TileBackwards", &fTileBackwards, &size);
1525 size = sizeof(BOOL);
1526 PrfQueryProfileData(fmprof, appname, "LoadLongname", &fLoadLongnames, &size);
1527 size = sizeof(BOOL);
1528 PrfQueryProfileData(fmprof, appname, "VerifyWrites", &fVerify, &size);
1529 DosSetVerify(fVerify);
1530 size = sizeof(BOOL);
1531 PrfQueryProfileData(fmprof, appname, "DontMoveMouse", &fDontMoveMouse, &size);
1532 size = sizeof(BOOL);
1533 PrfQueryProfileData(fmprof, appname, "NoIconsFiles", &fNoIconsFiles, &size);
1534 size = sizeof(BOOL);
1535 PrfQueryProfileData(fmprof, appname, "NoIconsDirs", &fNoIconsDirs, &size);
1536 size = sizeof(BOOL);
1537 PrfQueryProfileData(fmprof, appname, "ForceUpper", &fForceUpper, &size);
1538 size = sizeof(BOOL);
1539 PrfQueryProfileData(fmprof, appname, "ForceLower", &fForceLower, &size);
1540 size = sizeof(BOOL);
1541 PrfQueryProfileData(fmprof, appname, "TextTools", &fTextTools, &size);
1542 size = sizeof(BOOL);
1543 PrfQueryProfileData(fmprof, appname, "ToolTitles", &fToolTitles, &size);
1544 size = sizeof(BOOL);
1545 PrfQueryProfileData(fmprof, appname, "DoubleClickOpens", &fDCOpens, &size);
1546 size = sizeof(BOOL);
1547 PrfQueryProfileData(fmprof, appname, "LinkSetsIcon", &fLinkSetsIcon, &size);
1548 size = sizeof(BOOL);
1549 PrfQueryProfileData(fmprof, appname, "WarnReadOnly", &fWarnReadOnly, &size);
1550 size = sizeof(INT);
1551 PrfQueryProfileData(fmprof, appname, "Sort", &sortFlags, &size);
1552 size = sizeof(INT);
1553 PrfQueryProfileData(fmprof, appname, "TreeSort", &TreesortFlags, &size);
1554 size = sizeof(INT);
1555 PrfQueryProfileData(fmprof, appname, "CollectorSort", &CollectorsortFlags, &size);
1556 PrfQueryProfileString(fmprof, appname, "Targetdir", NULL, targetdir, sizeof(targetdir));
1557 if (!IsValidDir(targetdir))
1558 *targetdir = 0;
1559 PrfQueryProfileString(fmprof, appname, "ExtractPath", NULL, extractpath, sizeof(extractpath));
1560 size = sizeof(BOOL);
1561 PrfQueryProfileData(fmprof, appname, "FileNamePathCnr", &fFileNameCnrPath, &size);
1562 PrfQueryProfileString(fmprof, appname, "Printer", "PRN", printer, sizeof(printer));
1563 PrfQueryProfileString(fmprof, appname, "DirCompare", NULL, dircompare, MaxComLineStrg);
1564 PrfQueryProfileString(fmprof, appname, "Viewer", NULL, viewer, MaxComLineStrg);
1565 PrfQueryProfileString(fmprof, appname, "Editor", NULL, editor, MaxComLineStrg);
1566 PrfQueryProfileString(fmprof, appname, "BinView", NULL, binview, MaxComLineStrg);
1567 PrfQueryProfileString(fmprof, appname, "BinEd", NULL, bined, MaxComLineStrg);
1568 PrfQueryProfileString(fmprof, appname, "Compare", NULL, compare, MaxComLineStrg);
1569 PrfQueryProfileString(fmprof, appname, "Virus", NULL, virus, MaxComLineStrg);
1570 size = sizeof(BOOL);
1571 PrfQueryProfileData(fmprof, appname, "FtpRunWPSDefault", &fFtpRunWPSDefault, &size);
1572 PrfQueryProfileString(fmprof, appname, "FTPRun", NULL, ftprun, MaxComLineStrg);
1573 if (!*ftprun)
1574 fFtpRunWPSDefault = TRUE;
1575 size = sizeof(BOOL);
1576 PrfQueryProfileData(fmprof, appname, "HttpRunWPSDefault", &fHttpRunWPSDefault, &size);
1577 PrfQueryProfileString(fmprof, appname, "HTTPRun", NULL, httprun, MaxComLineStrg);
1578 if (!*httprun)
1579 fHttpRunWPSDefault = TRUE;
1580 PrfQueryProfileString(fmprof, appname, "MailRun", NULL, mailrun, MaxComLineStrg);
1581 PrfQueryProfileString(fmprof, appname, "FtpRunDir", NULL, ftprundir, sizeof(ftprundir));
1582 PrfQueryProfileString(fmprof, appname, "HttpRunDir", NULL, httprundir, sizeof(httprundir));
1583 PrfQueryProfileString(fmprof, appname, "MailRunDir", NULL, mailrundir, sizeof(mailrundir));
1584 PrfQueryProfileString(fmprof, appname, "LastToolbar", NULL, lasttoolbar, sizeof(lasttoolbar));
1585 size = sizeof(BOOL);
1586 PrfQueryProfileData(fmprof, appname, "LibPathStrictHttpRun", &fLibPathStrictHttpRun, &size);
1587 size = sizeof(BOOL);
1588 PrfQueryProfileData(fmprof, appname, "LibPathStrictFtpRun", &fLibPathStrictFtpRun, &size);
1589 size = sizeof(BOOL);
1590 PrfQueryProfileData(fmprof, appname, "LibPathStrictMailRun", &fLibPathStrictMailRun, &size);
1591 size = sizeof(BOOL);
1592 PrfQueryProfileData(fmprof, appname, "NoMailtoMailRun", &fNoMailtoMailRun, &size);
1593 size = sizeof(BOOL);
1594 PrfQueryProfileData(fmprof, appname, "FollowTree", &fFollowTree, &size);
1595 size = sizeof(BOOL);
1596 PrfQueryProfileData(fmprof, appname, "StartMaximized", &fStartMaximized, &size);
1597 if (!fStartMaximized) {
1598 size = sizeof(BOOL);
1599 PrfQueryProfileData(fmprof, appname, "StartMinimized", &fStartMinimized, &size);
1600 }
1601 size = sizeof(BOOL);
1602 PrfQueryProfileData(fmprof, appname, "DefaultCopy", &fCopyDefault, &size);
1603 size = sizeof(BOOL);
1604 PrfQueryProfileData(fmprof, appname, "IdleCopy", &fRealIdle, &size);
1605 size = sizeof(BOOL);
1606 PrfQueryProfileData(fmprof, appname, "ArcStuffVisible", &fArcStuffVisible, &size);
1607 size = sizeof(BOOL);
1608 PrfQueryProfileData(fmprof, appname, "NoTreeGap", &fNoTreeGap, &size);
1609 size = sizeof(BOOL);
1610 PrfQueryProfileData(fmprof, FM3Str, "VTreeOpensWPS", &fVTreeOpensWPS, &size);
1611 size = sizeof(BOOL);
1612 PrfQueryProfileData(fmprof, appname, "RemoteBug", &fRemoteBug, &size);
1613 size = sizeof(BOOL);
1614 PrfQueryProfileData(fmprof, appname, "EjectRemovableScan", &fEjectRemovableScan, &size);
1615 size = sizeof(BOOL);
1616 PrfQueryProfileData(fmprof, appname, "EjectCDScan", &fEjectCDScan, &size);
1617 size = sizeof(BOOL);
1618 PrfQueryProfileData(fmprof, appname, "EjectFlpyScan", &fEjectFlpyScan, &size);
1619 size = sizeof(BOOL);
1620 PrfQueryProfileData(fmprof, appname, "Drag&DropDlg", &fDragndropDlg, &size);
1621 size = sizeof(BOOL);
1622 PrfQueryProfileData(fmprof, FM3Str, "UserComboBox", &fUserComboBox, &size);
1623 size = sizeof(BOOL);
1624 PrfQueryProfileData(fmprof, FM3Str, "MinDirOnOpen", &fMinOnOpen, &size);
1625 size = sizeof(BOOL);
1626 PrfQueryProfileData(fmprof, appname, "QuickArcFind", &fQuickArcFind, &size);
1627 size = sizeof(BOOL);
1628 PrfQueryProfileData(fmprof, appname, "NoRemovableScan", &fNoRemovableScan, &size);
1629 size = sizeof(ULONG);
1630 PrfQueryProfileData(fmprof, FM3Str, "NoBrokenNotify", &NoBrokenNotify, &size);
1631 size = sizeof(ULONG);
1632 PrfQueryProfileData(fmprof, appname, "ContainerType", &ulCnrType, &size);
1633 size = sizeof(ULONG);
1634 PrfQueryProfileData(fmprof, appname, "FilesToGet", &FilesToGet, &size);
1635 if (FilesToGet < FILESTOGET_MIN)
1636 FilesToGet = FILESTOGET_MIN;
1637 else if (FilesToGet > FILESTOGET_MAX)
1638 FilesToGet = FILESTOGET_MAX;
1639 size = sizeof(BOOL);
1640 PrfQueryProfileData(fmprof, appname, "AutoView", &fAutoView, &size);
1641 size = sizeof(BOOL);
1642 PrfQueryProfileData(fmprof, appname, "FM2Deletes", &fFM2Deletes, &size);
1643 size = sizeof(BOOL);
1644 PrfQueryProfileData(fmprof, appname, "TrashCan", &fTrashCan, &size);
1645 size = sizeof(BOOL);
1646 PrfQueryProfileData(fmprof, appname, "ThreadNotes", &fThreadNotes, &size);
1647 if (fThreadNotes)
1648 ShowNote();
1649
1650 LoadDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault, FALSE);
1651
1652 // load pointers and icons we use
1653 hptrArrow = WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, FALSE);
1654 hptrBusy = WinQuerySysPointer(HWND_DESKTOP, SPTR_WAIT, FALSE);
1655 hptrNS = WinQuerySysPointer(HWND_DESKTOP, SPTR_SIZENS, FALSE);
1656 hptrEW = WinQuerySysPointer(HWND_DESKTOP, SPTR_SIZEWE, FALSE);
1657 hptrFloppy = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FLOPPY_ICON);
1658 hptrDrive = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DRIVE_ICON);
1659 hptrRemovable = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, REMOVABLE_ICON);
1660 hptrCDROM = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, CDROM_ICON);
1661 hptrFile = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_ICON);
1662 hptrDir = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DIR_FRAME);
1663 hptrArc = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ARC_FRAME);
1664 hptrArt = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ART_ICON);
1665 hptrSystem = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_SYSTEM_ICON);
1666 hptrHidden = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_HIDDEN_ICON);
1667 hptrReadonly = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_READONLY_ICON);
1668 hptrLast = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, LASTITEM_ICON);
1669 hptrRemote = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, REMOTE_ICON);
1670 hptrVirtual = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, VIRTUAL_ICON);
1671 hptrRamdisk = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, RAMDISK_ICON);
1672 if (!fNoDead)
1673 hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER_ICON);
1674 else
1675 hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER2_ICON);
1676 hptrApp = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, APP_ICON);
1677 hptrDunno = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DUNNO_ICON);
1678 hptrEnv = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ENV_ICON);
1679 hptrZipstrm = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ZIPSTREAM_ICON);
1680
1681 // set up color array used by seeall.c and newview.c color dialog
1682
1683 standardcolors[0] = CLR_WHITE;
1684 standardcolors[1] = CLR_BLACK;
1685 standardcolors[2] = CLR_BLUE;
1686 standardcolors[3] = CLR_RED;
1687 standardcolors[4] = CLR_PINK;
1688 standardcolors[5] = CLR_GREEN;
1689 standardcolors[6] = CLR_CYAN;
1690 standardcolors[7] = CLR_YELLOW;
1691 standardcolors[8] = CLR_DARKGRAY;
1692 standardcolors[9] = CLR_DARKBLUE;
1693 standardcolors[10] = CLR_DARKRED;
1694 standardcolors[11] = CLR_DARKPINK;
1695 standardcolors[12] = CLR_DARKGREEN;
1696 standardcolors[13] = CLR_DARKCYAN;
1697 standardcolors[14] = CLR_BROWN;
1698 standardcolors[15] = CLR_PALEGRAY;
1699
1700 return TRUE;
1701}
1702
1703HWND StartFM3(HAB hab, INT argc, CHAR ** argv)
1704{
1705 HWND hwndFrame;
1706 HWND hwndClient;
1707 UINT x;
1708 ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
1709 FCF_SIZEBORDER | FCF_MINMAX |
1710 FCF_ACCELTABLE | FCF_MENU | FCF_ICON | FCF_TASKLIST | FCF_NOBYTEALIGN;
1711
1712 for (x = 1; x < argc; x++) {
1713 if (*argv[x] == '~' && !argv[x][1])
1714 fReminimize = TRUE;
1715 if (*argv[x] == '+' && !argv[x][1])
1716 fLogFile = TRUE;
1717 if (*argv[x] == '-') {
1718 if (!argv[x][1])
1719 fNoSaveState = TRUE;
1720 else
1721 strcpy(profile, &argv[x][1]);
1722 }
1723 if (*argv[x] == '#' && !argv[x][1])
1724 fUseShellEnv = TRUE;
1725 }
1726
1727 hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
1728 WS_VISIBLE,
1729 &FrameFlags,
1730 (CHAR *) WC_MAINWND,
1731 NULL,
1732 WS_VISIBLE | WS_ANIMATE,
1733 FM3ModHandle, MAIN_FRAME, &hwndClient);
1734 if (hwndFrame) {
1735 WinSetWindowUShort(hwndFrame, QWS_ID, MAIN_FRAME);
1736 hwndMainMenu = WinWindowFromID(hwndFrame, FID_MENU);
1737 if (!WinRestoreWindowPos((CHAR *) FM2Str, "MainWindowPos", hwndFrame)) {
1738
1739 ULONG fl = SWP_MOVE | SWP_SIZE;
1740 RECTL rcl;
1741 ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 3L;
1742 ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
1743
1744 WinQueryWindowRect(HWND_DESKTOP, &rcl);
1745 rcl.yBottom += icz;
1746 rcl.yTop -= bsz;
1747 rcl.xLeft += bsz;
1748 rcl.xRight -= bsz;
1749 WinSetWindowPos(hwndFrame,
1750 HWND_TOP,
1751 rcl.xLeft,
1752 rcl.yBottom,
1753 rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, fl);
1754 }
1755 if (fLogFile) {
1756 CHAR *modea = "a+";
1757
1758 LogFileHandle = xfsopen("FM2.LOG", modea, SH_DENYWR, pszSrcFile, __LINE__, TRUE);
1759 }
1760 if (hwndHelp)
1761 WinAssociateHelpInstance(hwndHelp, hwndFrame);
1762 PostMsg(hwndClient, UM_SETUP, MPFROMLONG(argc), MPFROMP(argv));
1763 }
1764 return hwndFrame;
1765}
1766
1767BOOL CheckFileHeader(CHAR *filespec, CHAR *signature, LONG offset)
1768{
1769 HFILE handle;
1770 ULONG action;
1771 ULONG len = strlen(signature);
1772 ULONG l;
1773 CHAR buffer[4096]; // 06 Oct 07 SHL Protect against NTFS defect
1774 BOOL ret = FALSE;
1775
1776 DosError(FERR_DISABLEHARDERR);
1777 if (DosOpen(filespec,
1778 &handle,
1779 &action,
1780 0,
1781 0,
1782 OPEN_ACTION_FAIL_IF_NEW |
1783 OPEN_ACTION_OPEN_IF_EXISTS,
1784 OPEN_FLAGS_FAIL_ON_ERROR |
1785 OPEN_FLAGS_NOINHERIT |
1786 OPEN_FLAGS_RANDOMSEQUENTIAL |
1787 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0))
1788 ret = FALSE;
1789 else {
1790 // Try signature match
1791 l = len;
1792 l = min(l, 79);
1793 if (!DosChgFilePtr(handle,
1794 abs(offset),
1795 (offset >= 0) ?
1796 FILE_BEGIN : FILE_END, &len)) {
1797 if (!DosRead(handle, buffer, l, &len) && len == l) {
1798 if (!memcmp(signature, buffer, l))
1799 ret = TRUE; // Matched
1800 }
1801 }
1802 }
1803 DosClose(handle); // Either way, we're done for now
1804 return ret; // Return TRUE if matched
1805}
1806
1807int CheckVersion(int vermajor, int verminor)
1808{
1809 int ok = 0;
1810
1811 // FIXME to do useful check - was missing in base source
1812
1813#if 0
1814 if (vermajor && verminor) {
1815 *vermajor = VERMAJOR;
1816 *verminor = VERMINOR;
1817 ok = 1;
1818 }
1819#endif
1820
1821 ok = 1;
1822
1823 return ok;
1824}
1825
1826#ifdef __WATCOMC__
1827#pragma alloc_text(INIT,LibMain,InitFM3DLL,DeInitFM3DLL)
1828#pragma alloc_text(INIT1,StartFM3,FindSwapperDat)
1829#endif
Note: See TracBrowser for help on using the repository browser.