source: trunk/dll/init.c@ 1753

Last change on this file since 1753 was 1753, checked in by Gregg Young, 11 years ago

Fixed typo that reversed the function of the saymsg dialog g/bzip check. Added option to suppress message regarding missing bzip2.exe or gzip.exe on TAR.B/GZ archives. Ticket 526

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