source: trunk/dll/init.c@ 1778

Last change on this file since 1778 was 1778, checked in by Steven Levine, 11 years ago

Rework dircnrs.c DirObjWndProc UM_RESCAN to avoid hanging FM/2 Lite when
drive tree hidden. Also speeds up startup if Switch Tree on directory change
not enabled.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 65.8 KB
Line 
1
2/***********************************************************************
3
4 $Id: init.c 1778 2014-06-26 22:30:54Z stevenhl $
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 = fSwitchTreeOnDirChg =
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 {
1222 // Check for the existance of various partitioning tools to set up menu items
1223 ULONG ulAppType;
1224
1225 if (!SearchPathForFile(PCSZ_PATH, PCSZ_LVMGUICMD, NULL))
1226 fLVMGui = TRUE;
1227 if (!xDosQueryAppType(PCSZ_DFSOS2EXE, &ulAppType))
1228 fDFSee = TRUE;
1229 if (!xDosQueryAppType(PCSZ_MINILVMEXE, &ulAppType))
1230 fMiniLVM = TRUE;
1231 if (!xDosQueryAppType(PCSZ_FDISKPMEXE, &ulAppType))
1232 fFDisk = TRUE;
1233 if (!xDosQueryAppType(PCSZ_LVMEXE, &ulAppType))
1234 fLVM = TRUE;
1235
1236 //Check for unlock.exe
1237 if (!xDosQueryAppType(PCSZ_UNLOCKEXE, &ulAppType))
1238 fUnlock = TRUE;
1239
1240 // Check to see if we are running protect only
1241 if (!xDosQueryAppType(GetCmdSpec(TRUE), &ulAppType)) {
1242 HMODULE hmod;
1243 APIRET rc;
1244
1245 rc = DosQueryModuleHandle("VKBD", &hmod);
1246 if (rc != NO_ERROR) {
1247 fProtectOnly = TRUE;
1248 //DbgMsg(pszSrcFile, __LINE__, "DosQModuleHandle VKBD returned %d fProtectOnly=%d", rc, fProtectOnly);
1249 }
1250 else {
1251 rc = DosQueryModuleHandle("VMOUSE", &hmod);
1252 if (rc != NO_ERROR) {
1253 fProtectOnly = TRUE;
1254 //DbgMsg(pszSrcFile, __LINE__, "DosQModuleHandle VMOUSE returned %d fProtectOnly=%d", rc, fProtectOnly);
1255 }
1256 }
1257 }
1258 else
1259 fProtectOnly = TRUE;
1260 }
1261
1262 // load preferences from profile (INI) file
1263 /**
1264 * Separate paramenters -- Please note that appname should be used in
1265 * profile calls for user settings that work and are setable in more than one
1266 * miniapp; FM3Str should be used for setting only relavent to FM/2 or that
1267 * aren't user settable; realappname should be used for setting applicable to
1268 * one or more miniapp but not to FM/2
1269 */
1270 size = sizeof(BOOL);
1271 PrfQueryProfileData(fmprof, realappname, "SeparateParms", &fAppSeparateSettings, &size);
1272 if (!fAppSeparateSettings)
1273 strcpy(appname, FM3Str);
1274 else
1275 strcpy(appname, realappname);
1276 size = sizeof(ULONG);
1277 PrfQueryProfileData(fmprof, appname, "MaxComLineStrg", &MaxComLineStrg, &size);
1278 // Give user one chance to reset the default command line length to 1024 (4os2's unexpanded max)
1279 if (MaxComLineStrg == 2048) {
1280 BOOL MaxComLineChecked = FALSE;
1281
1282 size = sizeof(BOOL);
1283 PrfQueryProfileData(fmprof, appname, "MaxComLineChecked", &MaxComLineChecked, &size);
1284 if (!MaxComLineChecked) {
1285 ret = saymsg(MB_YESNO,
1286 HWND_DESKTOP,
1287 NullStr,
1288 GetPString(IDS_CHANGECMDLINELENGTHDEFAULT));
1289 if (ret == MBID_YES)
1290 MaxComLineStrg = 1024;
1291 MaxComLineChecked = TRUE;
1292 PrfWriteProfileData(fmprof, appname, "MaxComLineChecked", &MaxComLineChecked, sizeof(BOOL));
1293 }
1294 }
1295 if (MaxComLineStrg < CMDLNLNGTH_MIN)
1296 MaxComLineStrg = CMDLNLNGTH_MIN;
1297 else if (MaxComLineStrg > CMDLNLNGTH_MAX)
1298 MaxComLineStrg = CMDLNLNGTH_MAX;
1299 editor = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1300 if (!editor)
1301 return 0; //already complained
1302 viewer = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1303 if (!viewer)
1304 return 0; //already complained
1305 virus = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1306 if (!virus)
1307 return 0; //already complained
1308 compare = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1309 if (!compare)
1310 return 0; //already complained
1311 binview = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1312 if (!binview)
1313 return 0; //already complained
1314 bined = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1315 if (!bined)
1316 return 0; //already complained
1317 dircompare = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1318 if (!dircompare)
1319 return 0; //already complained
1320 ftprun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1321 if (!ftprun)
1322 return 0; //already complained
1323 httprun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1324 if (!httprun)
1325 return 0; //already complained
1326 mailrun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1327 if (!mailrun)
1328 return 0; //already complained
1329 pszTreeEnvVarList = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1330 if (!pszTreeEnvVarList)
1331 return 0; //already complained
1332 size = sizeof(BOOL);
1333 PrfQueryProfileData(fmprof, FM3Str, "DontSuggestAgain", &fDontSuggestAgain, &size);
1334 size = sizeof(BOOL);
1335 PrfQueryProfileData(fmprof, appname, "ShowTarget", &fShowTarget, &size);
1336 size = sizeof(BOOL);
1337 PrfQueryProfileData(fmprof, appname, "CheckMM", &fCheckMM, &size);
1338 size = sizeof(BOOL);
1339 PrfQueryProfileData(fmprof, appname, "ChangeTarget", &fChangeTarget, &size);
1340 size = sizeof(BOOL);
1341 PrfQueryProfileData(fmprof, appname, "ConfirmTarget", &fConfirmTarget, &size);
1342 size = sizeof(BOOL);
1343 PrfQueryProfileData(fmprof, appname, "CustomFileDlg", &fCustomFileDlg, &size);
1344 size = sizeof(BOOL);
1345 PrfQueryProfileData(fmprof, appname, "SaveMiniCmds", &fSaveMiniCmds, &size);
1346 size = sizeof(BOOL);
1347 PrfQueryProfileData(fmprof, appname, "SaveBigCmds", &fSaveBigCmds, &size);
1348 size = sizeof(BOOL);
1349 PrfQueryProfileData(fmprof, appname, "NoFoldMenu", &fNoFoldMenu, &size);
1350 size = sizeof(BOOL);
1351 PrfQueryProfileData(fmprof, FM3Str, "Prnpagenums", &prnpagenums, &size);
1352 size = sizeof(BOOL);
1353 PrfQueryProfileData(fmprof, FM3Str, "Prnalt", &prnalt, &size);
1354 size = sizeof(BOOL);
1355 PrfQueryProfileData(fmprof, FM3Str, "Prnformat", &prnformat, &size);
1356 size = sizeof(BOOL);
1357 PrfQueryProfileData(fmprof, FM3Str, "Prnformfeedbefore", &prnformfeedbefore, &size);
1358 size = sizeof(BOOL);
1359 PrfQueryProfileData(fmprof, FM3Str, "Prnformfeedafter",&prnformfeedafter, &size);
1360 size = sizeof(ULONG);
1361 PrfQueryProfileData(fmprof, FM3Str, "Prntabspaces", &prntabspaces, &size);
1362 size = sizeof(ULONG);
1363 PrfQueryProfileData(fmprof, FM3Str, "Prnwidth", &prnwidth, &size);
1364 size = sizeof(ULONG);
1365 PrfQueryProfileData(fmprof, FM3Str, "Prnlength", &prnlength, &size);
1366 size = sizeof(ULONG);
1367 PrfQueryProfileData(fmprof, FM3Str, "Prntmargin", &prntmargin, &size);
1368 size = sizeof(ULONG);
1369 PrfQueryProfileData(fmprof, FM3Str, "Prnbmargin", &prnbmargin, &size);
1370 size = sizeof(ULONG);
1371 PrfQueryProfileData(fmprof, FM3Str, "Prnlmargin", &prnlmargin, &size);
1372 size = sizeof(ULONG);
1373 PrfQueryProfileData(fmprof, FM3Str, "Prnrmargin", &prnrmargin, &size);
1374 size = sizeof(ULONG);
1375 PrfQueryProfileData(fmprof, FM3Str, "Prnspacing", &prnspacing, &size);
1376 size = sizeof(BOOL);
1377 PrfQueryProfileData(fmprof, appname, "NoDead", &fNoDead, &size);
1378 size = sizeof(BOOL);
1379 PrfQueryProfileData(fmprof, appname, "NoFinger", &fNoFinger, &size);
1380 size = sizeof(BOOL);
1381 PrfQueryProfileData(fmprof, appname, "AlertBeepOff", &fAlertBeepOff, &size);
1382 size = sizeof(BOOL);
1383 PrfQueryProfileData(fmprof, appname, "ErrorBeepOff", &fErrorBeepOff, &size);
1384 size = sizeof(BOOL);
1385 PrfQueryProfileData(fmprof, appname, "SwitchTree", &fSwitchTreeOnDirChg, &size);
1386 size = sizeof(BOOL);
1387 PrfQueryProfileData(fmprof, appname, "SwitchTreeExpand", &fSwitchTreeExpand, &size);
1388 size = sizeof(BOOL);
1389 PrfQueryProfileData(fmprof, appname, "SwitchTreeOnFocus", &fSwitchTreeOnFocus, &size);
1390 size = sizeof(BOOL);
1391 PrfQueryProfileData(fmprof, appname, "CollapseFirst", &fCollapseFirst, &size);
1392 size = sizeof(BOOL);
1393 PrfQueryProfileData(fmprof, appname, "FilesInTree", &fFilesInTree, &size);
1394 size = sizeof(BOOL);
1395 PrfQueryProfileData(fmprof, appname, "TopDir", &fTopDir, &size);
1396 size = sizeof(BOOL);
1397 PrfQueryProfileData(fmprof, appname, "LookInDir", &fLookInDir, &size);
1398 PrfQueryProfileString(fmprof, appname, "DefArc", NULL, szDefArc, sizeof(szDefArc));
1399 size = sizeof(ULONG);
1400 PrfQueryProfileData(fmprof, appname, "AutoviewHeight",
1401 &AutoviewHeight, &size);
1402 size = sizeof(BOOL);
1403 PrfQueryProfileData(fmprof, appname, "KeepCmdLine", &fKeepCmdLine, &size);
1404 if (strcmp(realappname, "FM/4")) {
1405 size = sizeof(BOOL);
1406 PrfQueryProfileData(fmprof, FM3Str, "MoreButtons", &fMoreButtons, &size);
1407 size = sizeof(BOOL);
1408 PrfQueryProfileData(fmprof, FM3Str, "Drivebar", &fDrivebar, &size);
1409 }
1410 size = sizeof(BOOL);
1411 PrfQueryProfileData(fmprof, appname, "NoSearch", &fNoSearch, &size);
1412 size = sizeof(BOOL);
1413 PrfQueryProfileData(fmprof, appname, "GuessType", &fGuessType, &size);
1414 size = sizeof(BOOL);
1415 PrfQueryProfileData(fmprof, appname, "ViewChild", &fViewChild, &size);
1416 size = sizeof(BOOL);
1417 PrfQueryProfileData(fmprof, appname, "ShowEnv", &fShowEnv, &size);
1418 PrfQueryProfileString(fmprof, appname, "TreeEnvVarList", "PATH;DPATH;LIBPATH;HELP;BOOKSHELF;",
1419 pszTreeEnvVarList, MaxComLineStrg);
1420 size = sizeof(BOOL);
1421 PrfQueryProfileData(fmprof, appname, "ShowDriveOnly", &fShowDriveOnly, &size);
1422 size = sizeof(BOOL);
1423 PrfQueryProfileData(fmprof, appname, "ShowFSTypeInTree", &fShowFSTypeInTree, &size);
1424 size = sizeof(BOOL);
1425 PrfQueryProfileData(fmprof, appname, "ShowDriveLabelInTree", &fShowDriveLabelInTree, &size);
1426 if (!fShowDriveOnly && !fShowFSTypeInTree && !fShowDriveLabelInTree)
1427 fShowDriveOnly = TRUE;
1428 size = sizeof(BOOL);
1429 PrfQueryProfileData(fmprof, appname, "LeaveTree", &fLeaveTree, &size);
1430 size = sizeof(BOOL);
1431 PrfQueryProfileData(fmprof, appname, "Comments", &fComments, &size);
1432 size = sizeof(ULONG);
1433 PrfQueryProfileData(fmprof, appname, "WS_ANIMATE", &fwsAnimate, &size);
1434 if (fwsAnimate)
1435 fwsAnimate = WS_ANIMATE;
1436 size = sizeof(BOOL);
1437 PrfQueryProfileData(fmprof, appname, "SelectedAlways", &fSelectedAlways, &size);
1438 size = sizeof(BOOL);
1439 PrfQueryProfileData(fmprof, appname, "ToolbarHelp", &fToolbarHelp, &size);
1440 size = sizeof(BOOL);
1441 PrfQueryProfileData(fmprof, appname, "OtherHelp", &fOtherHelp, &size);
1442 size = sizeof(BOOL);
1443 PrfQueryProfileData(fmprof, appname, "DrivebarHelp", &fDrivebarHelp, &size);
1444 size = sizeof(BOOL);
1445 PrfQueryProfileData(fmprof, appname, "AutoAddDirs", &fAutoAddDirs, &size);
1446 size = sizeof(BOOL);
1447 PrfQueryProfileData(fmprof, appname, "AutoAddAllDirs", &fAutoAddAllDirs, &size);
1448 size = sizeof(BOOL);
1449 PrfQueryProfileData(fmprof, FM3Str, "UserListSwitches", &fUserListSwitches, &size);
1450 size = sizeof(BOOL);
1451 PrfQueryProfileData(fmprof, appname, "UseNewViewer", &fUseNewViewer, &size);
1452 size = sizeof(BOOL);
1453 PrfQueryProfileData(fmprof, appname, "DefaultDeletePerm", &fDefaultDeletePerm, &size);
1454 size = sizeof(BOOL);
1455 PrfQueryProfileData(fmprof, FM3Str, "ExternalINIs", &fExternalINIs, &size);
1456 size = sizeof(BOOL);
1457 PrfQueryProfileData(fmprof, FM3Str, "ExternalCollector", &fExternalCollector, &size);
1458 size = sizeof(BOOL);
1459 PrfQueryProfileData(fmprof, FM3Str, "ExternalArcboxes", &fExternalArcboxes, &size);
1460 size = sizeof(BOOL);
1461 PrfQueryProfileData(fmprof, FM3Str, "ExternalViewer", &fExternalViewer, &size);
1462 size = sizeof(BOOL);
1463 PrfQueryProfileData(fmprof, FM3Str, "UseQProcStat", &fUseQProcStat, &size);
1464 size = sizeof(BOOL);
1465 PrfQueryProfileData(fmprof, FM3Str, "UseQSysState", &fUseQSysState, &size);
1466 size = sizeof(BOOL);
1467 PrfQueryProfileData(fmprof, appname, "DataMin", &fDataMin, &size);
1468 size = sizeof(BOOL);
1469 PrfQueryProfileData(fmprof, appname, "DataToFore", &fDataToFore, &size);
1470 size = sizeof(BOOL);
1471 PrfQueryProfileData(fmprof, appname, "DataShowDrives", &fDataShowDrives, &size);
1472 size = sizeof(BOOL);
1473 PrfQueryProfileData(fmprof, appname, "DataInclRemote", &fDataInclRemote, &size);
1474 size = sizeof(BOOL);
1475 PrfQueryProfileData(fmprof, FM3Str, "SplitStatus", &fSplitStatus, &size);
1476 size = sizeof(BOOL);
1477 PrfQueryProfileData(fmprof, appname, "FolderAfterExtract", &fFolderAfterExtract, &size);
1478 size = sizeof(BOOL);
1479 PrfQueryProfileData(fmprof, appname, "DullDatabar", &fDullMin, &size);
1480 size = sizeof(BOOL);
1481 PrfQueryProfileData(fmprof, appname, "BlueLED", &fBlueLED, &size);
1482 size = sizeof(BOOL);
1483 PrfQueryProfileData(fmprof, appname, "ConfirmDelete", &fConfirmDelete, &size);
1484 size = sizeof(BOOL);
1485 PrfQueryProfileData(fmprof, FM3Str, "SaveState", &fSaveState, &size);
1486 size = sizeof(BOOL);
1487 PrfQueryProfileData(fmprof, appname, "SyncUpdates", &fSyncUpdates, &size);
1488 size = sizeof(BOOL);
1489 PrfQueryProfileData(fmprof, appname, "LoadSubject", &fLoadSubject, &size);
1490 size = sizeof(BOOL);
1491 PrfQueryProfileData(fmprof, appname, "UnHilite", &fUnHilite, &size);
1492 size = sizeof(BOOL);
1493 PrfQueryProfileData(fmprof, FM3Str, "TileBackwards", &fTileBackwards, &size);
1494 size = sizeof(BOOL);
1495 PrfQueryProfileData(fmprof, appname, "LoadLongname", &fLoadLongnames, &size);
1496 size = sizeof(BOOL);
1497 PrfQueryProfileData(fmprof, appname, "VerifyWrites", &fVerify, &size);
1498 DosSetVerify(fVerify);
1499 size = sizeof(BOOL);
1500 PrfQueryProfileData(fmprof, appname, "DontMoveMouse", &fDontMoveMouse, &size);
1501 size = sizeof(BOOL);
1502 PrfQueryProfileData(fmprof, appname, "NoIconsFiles", &fNoIconsFiles, &size);
1503 size = sizeof(BOOL);
1504 PrfQueryProfileData(fmprof, appname, "NoIconsDirs", &fNoIconsDirs, &size);
1505 size = sizeof(BOOL);
1506 PrfQueryProfileData(fmprof, appname, "ForceUpper", &fForceUpper, &size);
1507 size = sizeof(BOOL);
1508 PrfQueryProfileData(fmprof, appname, "ForceLower", &fForceLower, &size);
1509 size = sizeof(BOOL);
1510 PrfQueryProfileData(fmprof, appname, "TextTools", &fTextTools, &size);
1511 size = sizeof(BOOL);
1512 PrfQueryProfileData(fmprof, appname, "ToolTitles", &fToolTitles, &size);
1513 size = sizeof(BOOL);
1514 PrfQueryProfileData(fmprof, appname, "DoubleClickOpens", &fDCOpens, &size);
1515 size = sizeof(BOOL);
1516 PrfQueryProfileData(fmprof, appname, "LinkSetsIcon", &fLinkSetsIcon, &size);
1517 size = sizeof(BOOL);
1518 PrfQueryProfileData(fmprof, appname, "WarnReadOnly", &fWarnReadOnly, &size);
1519 size = sizeof(INT);
1520 PrfQueryProfileData(fmprof, appname, "Sort", &sortFlags, &size);
1521 size = sizeof(INT);
1522 PrfQueryProfileData(fmprof, appname, "TreeSort", &TreesortFlags, &size);
1523 size = sizeof(INT);
1524 PrfQueryProfileData(fmprof, appname, "CollectorSort", &CollectorsortFlags, &size);
1525 PrfQueryProfileString(fmprof, appname, "Targetdir", NULL, targetdir, sizeof(targetdir));
1526 if (!IsValidDir(targetdir))
1527 *targetdir = 0;
1528 PrfQueryProfileString(fmprof, appname, "ExtractPath", NULL, extractpath, sizeof(extractpath));
1529 size = sizeof(BOOL);
1530 PrfQueryProfileData(fmprof, appname, "FileNamePathCnr", &fFileNameCnrPath, &size);
1531 PrfQueryProfileString(fmprof, appname, "Printer", "PRN", printer, sizeof(printer));
1532 PrfQueryProfileString(fmprof, appname, "DirCompare", NULL, dircompare, MaxComLineStrg);
1533 PrfQueryProfileString(fmprof, appname, "Viewer", NULL, viewer, MaxComLineStrg);
1534 PrfQueryProfileString(fmprof, appname, "Editor", NULL, editor, MaxComLineStrg);
1535 PrfQueryProfileString(fmprof, appname, "BinView", NULL, binview, MaxComLineStrg);
1536 PrfQueryProfileString(fmprof, appname, "BinEd", NULL, bined, MaxComLineStrg);
1537 PrfQueryProfileString(fmprof, appname, "Compare", NULL, compare, MaxComLineStrg);
1538 PrfQueryProfileString(fmprof, appname, "Virus", NULL, virus, MaxComLineStrg);
1539 size = sizeof(BOOL);
1540 PrfQueryProfileData(fmprof, appname, "FtpRunWPSDefault", &fFtpRunWPSDefault, &size);
1541 PrfQueryProfileString(fmprof, appname, "FTPRun", NULL, ftprun, MaxComLineStrg);
1542 if (!*ftprun)
1543 fFtpRunWPSDefault = TRUE;
1544 size = sizeof(BOOL);
1545 PrfQueryProfileData(fmprof, appname, "HttpRunWPSDefault", &fHttpRunWPSDefault, &size);
1546 PrfQueryProfileString(fmprof, appname, "HTTPRun", NULL, httprun, MaxComLineStrg);
1547 if (!*httprun)
1548 fHttpRunWPSDefault = TRUE;
1549 PrfQueryProfileString(fmprof, appname, "MailRun", NULL, mailrun, MaxComLineStrg);
1550 PrfQueryProfileString(fmprof, appname, "FtpRunDir", NULL, ftprundir, sizeof(ftprundir));
1551 PrfQueryProfileString(fmprof, appname, "HttpRunDir", NULL, httprundir, sizeof(httprundir));
1552 PrfQueryProfileString(fmprof, appname, "MailRunDir", NULL, mailrundir, sizeof(mailrundir));
1553 PrfQueryProfileString(fmprof, appname, "LastToolbar", NULL, lasttoolbar, sizeof(lasttoolbar));
1554 size = sizeof(BOOL);
1555 PrfQueryProfileData(fmprof, appname, "LibPathStrictHttpRun", &fLibPathStrictHttpRun, &size);
1556 size = sizeof(BOOL);
1557 PrfQueryProfileData(fmprof, appname, "LibPathStrictFtpRun", &fLibPathStrictFtpRun, &size);
1558 size = sizeof(BOOL);
1559 PrfQueryProfileData(fmprof, appname, "LibPathStrictMailRun", &fLibPathStrictMailRun, &size);
1560 size = sizeof(BOOL);
1561 PrfQueryProfileData(fmprof, appname, "NoMailtoMailRun", &fNoMailtoMailRun, &size);
1562 size = sizeof(BOOL);
1563 PrfQueryProfileData(fmprof, appname, "FollowTree", &fFollowTree, &size);
1564 size = sizeof(BOOL);
1565 PrfQueryProfileData(fmprof, appname, "StartMaximized", &fStartMaximized, &size);
1566 if (!fStartMaximized) {
1567 size = sizeof(BOOL);
1568 PrfQueryProfileData(fmprof, appname, "StartMinimized", &fStartMinimized, &size);
1569 }
1570 size = sizeof(BOOL);
1571 PrfQueryProfileData(fmprof, appname, "DefaultCopy", &fCopyDefault, &size);
1572 size = sizeof(BOOL);
1573 PrfQueryProfileData(fmprof, appname, "IdleCopy", &fRealIdle, &size);
1574 size = sizeof(BOOL);
1575 PrfQueryProfileData(fmprof, appname, "ArcStuffVisible", &fArcStuffVisible, &size);
1576 size = sizeof(BOOL);
1577 PrfQueryProfileData(fmprof, appname, "NoTreeGap", &fNoTreeGap, &size);
1578 size = sizeof(BOOL);
1579 PrfQueryProfileData(fmprof, FM3Str, "VTreeOpensWPS", &fVTreeOpensWPS, &size);
1580 size = sizeof(BOOL);
1581 PrfQueryProfileData(fmprof, appname, "RemoteBug", &fRemoteBug, &size);
1582 size = sizeof(BOOL);
1583 PrfQueryProfileData(fmprof, appname, "RScanLocal", &fRScanLocal, &size);
1584 size = sizeof(BOOL);
1585 PrfQueryProfileData(fmprof, appname, "RScanRemote", &fRScanRemote, &size);
1586 size = sizeof(BOOL);
1587 PrfQueryProfileData(fmprof, appname, "RScanVirtual", &fRScanVirtual, &size);
1588 size = sizeof(BOOL);
1589 PrfQueryProfileData(fmprof, appname, "RScanSlow", &fRScanSlow, &size);
1590 size = sizeof(BOOL);
1591 PrfQueryProfileData(fmprof, appname, "RScanNoWrite", &fRScanNoWrite, &size);
1592 size = sizeof(BOOL);
1593 PrfQueryProfileData(fmprof, appname, "EjectRemovableScan", &fEjectRemovableScan, &size);
1594 size = sizeof(BOOL);
1595 PrfQueryProfileData(fmprof, appname, "EjectCDScan", &fEjectCDScan, &size);
1596 size = sizeof(BOOL);
1597 PrfQueryProfileData(fmprof, appname, "EjectFlpyScan", &fEjectFlpyScan, &size);
1598 size = sizeof(BOOL);
1599 PrfQueryProfileData(fmprof, appname, "Drag&DropDlg", &fDragndropDlg, &size);
1600 size = sizeof(BOOL);
1601 PrfQueryProfileData(fmprof, FM3Str, "UserComboBox", &fUserComboBox, &size);
1602 size = sizeof(BOOL);
1603 PrfQueryProfileData(fmprof, FM3Str, "MinDirOnOpen", &fMinOnOpen, &size);
1604 size = sizeof(BOOL);
1605 PrfQueryProfileData(fmprof, appname, "QuickArcFind", &fQuickArcFind, &size);
1606 size = sizeof(BOOL);
1607 PrfQueryProfileData(fmprof, appname, "NoRemovableScan", &fNoRemovableScan, &size);
1608 size = sizeof(ULONG);
1609 PrfQueryProfileData(fmprof, FM3Str, "NoBrokenNotify", &NoBrokenNotify, &size);
1610 size = sizeof(ULONG);
1611 PrfQueryProfileData(fmprof, appname, "ContainerType", &ulCnrType, &size);
1612 size = sizeof(ULONG);
1613 PrfQueryProfileData(fmprof, appname, "FilesToGet", &FilesToGet, &size);
1614 if (FilesToGet < FILESTOGET_MIN)
1615 FilesToGet = FILESTOGET_MIN;
1616 else if (FilesToGet > FILESTOGET_MAX)
1617 FilesToGet = FILESTOGET_MAX;
1618 size = sizeof(BOOL);
1619 PrfQueryProfileData(fmprof, appname, "AutoView", &fAutoView, &size);
1620 size = sizeof(BOOL);
1621 PrfQueryProfileData(fmprof, appname, "FM2Deletes", &fFM2Deletes, &size);
1622 size = sizeof(BOOL);
1623 PrfQueryProfileData(fmprof, appname, "TrashCan", &fTrashCan, &size);
1624 size = sizeof(BOOL);
1625 PrfQueryProfileData(fmprof, appname, "ThreadNotes", &fThreadNotes, &size);
1626 if (fThreadNotes)
1627 ShowNote();
1628 size = sizeof(BOOL);
1629 PrfQueryProfileData(fmprof, FM3Str, "DontAskBzip", &fDontAskBzip, &size);
1630 size = sizeof(BOOL);
1631 PrfQueryProfileData(fmprof, FM3Str, "DontAskGzip", &fDontAskGzip, &size);
1632
1633 LoadDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault, FALSE);
1634
1635 // load pointers and icons we use
1636 hptrArrow = WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, FALSE);
1637 hptrBusy = WinQuerySysPointer(HWND_DESKTOP, SPTR_WAIT, FALSE);
1638 hptrNS = WinQuerySysPointer(HWND_DESKTOP, SPTR_SIZENS, FALSE);
1639 hptrEW = WinQuerySysPointer(HWND_DESKTOP, SPTR_SIZEWE, FALSE);
1640 hptrFloppy = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FLOPPY_ICON);
1641 hptrDrive = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DRIVE_ICON);
1642 hptrRemovable = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, REMOVABLE_ICON);
1643 hptrCDROM = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, CDROM_ICON);
1644 hptrFile = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_ICON);
1645 hptrDir = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DIR_FRAME);
1646 hptrArc = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ARC_FRAME);
1647 hptrArt = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ART_ICON);
1648 hptrSystem = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_SYSTEM_ICON);
1649 hptrHidden = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_HIDDEN_ICON);
1650 hptrReadonly = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_READONLY_ICON);
1651 hptrLast = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, LASTITEM_ICON);
1652 hptrRemote = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, REMOTE_ICON);
1653 hptrVirtual = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, VIRTUAL_ICON);
1654 hptrRamdisk = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, RAMDISK_ICON);
1655 if (!fNoDead)
1656 hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER_ICON);
1657 else
1658 hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER2_ICON);
1659 hptrApp = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, APP_ICON);
1660 hptrDunno = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DUNNO_ICON);
1661 hptrEnv = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ENV_ICON);
1662 hptrZipstrm = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ZIPSTREAM_ICON);
1663
1664 // set up color array used by seeall.c and newview.c color dialog
1665
1666 standardcolors[0] = CLR_WHITE;
1667 standardcolors[1] = CLR_BLACK;
1668 standardcolors[2] = CLR_BLUE;
1669 standardcolors[3] = CLR_RED;
1670 standardcolors[4] = CLR_PINK;
1671 standardcolors[5] = CLR_GREEN;
1672 standardcolors[6] = CLR_CYAN;
1673 standardcolors[7] = CLR_YELLOW;
1674 standardcolors[8] = CLR_DARKGRAY;
1675 standardcolors[9] = CLR_DARKBLUE;
1676 standardcolors[10] = CLR_DARKRED;
1677 standardcolors[11] = CLR_DARKPINK;
1678 standardcolors[12] = CLR_DARKGREEN;
1679 standardcolors[13] = CLR_DARKCYAN;
1680 standardcolors[14] = CLR_BROWN;
1681 standardcolors[15] = CLR_PALEGRAY;
1682
1683 return TRUE;
1684}
1685
1686HWND StartFM3(HAB hab, INT argc, CHAR ** argv)
1687{
1688 HWND hwndFrame;
1689 HWND hwndClient;
1690 UINT x;
1691 ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
1692 FCF_SIZEBORDER | FCF_MINMAX |
1693 FCF_ACCELTABLE | FCF_MENU | FCF_ICON | FCF_TASKLIST | FCF_NOBYTEALIGN;
1694
1695 for (x = 1; x < argc; x++) {
1696 if (*argv[x] == '~' && !argv[x][1])
1697 fReminimize = TRUE;
1698 if (*argv[x] == '+' && !argv[x][1])
1699 fLogFile = TRUE;
1700 if (*argv[x] == '-') {
1701 if (!argv[x][1])
1702 fNoSaveState = TRUE;
1703 else
1704 strcpy(profile, &argv[x][1]);
1705 }
1706 if (*argv[x] == '#' && !argv[x][1])
1707 fUseShellEnv = TRUE;
1708 }
1709
1710 hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
1711 WS_VISIBLE,
1712 &FrameFlags,
1713 (CHAR *) WC_MAINWND,
1714 NULL,
1715 WS_VISIBLE | WS_ANIMATE,
1716 FM3ModHandle, MAIN_FRAME, &hwndClient);
1717 if (hwndFrame) {
1718 WinSetWindowUShort(hwndFrame, QWS_ID, MAIN_FRAME);
1719 hwndMainMenu = WinWindowFromID(hwndFrame, FID_MENU);
1720 if (!WinRestoreWindowPos((CHAR *) FM2Str, "MainWindowPos", hwndFrame)) {
1721
1722 ULONG fl = SWP_MOVE | SWP_SIZE;
1723 RECTL rcl;
1724 ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 3L;
1725 ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
1726
1727 WinQueryWindowRect(HWND_DESKTOP, &rcl);
1728 rcl.yBottom += icz;
1729 rcl.yTop -= bsz;
1730 rcl.xLeft += bsz;
1731 rcl.xRight -= bsz;
1732 WinSetWindowPos(hwndFrame,
1733 HWND_TOP,
1734 rcl.xLeft,
1735 rcl.yBottom,
1736 rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, fl);
1737 }
1738 if (fLogFile) {
1739 CHAR *modea = "a+";
1740
1741 LogFileHandle = xfsopen("FM2.LOG", modea, SH_DENYWR, pszSrcFile, __LINE__, TRUE);
1742 }
1743 if (hwndHelp)
1744 WinAssociateHelpInstance(hwndHelp, hwndFrame);
1745 PostMsg(hwndClient, UM_SETUP, MPFROMLONG(argc), MPFROMP(argv));
1746 }
1747 return hwndFrame;
1748}
1749
1750BOOL CheckFileHeader(CHAR *filespec, CHAR *signature, LONG offset)
1751{
1752 HFILE handle;
1753 ULONG action;
1754 ULONG len = strlen(signature);
1755 ULONG l;
1756 CHAR buffer[4096]; // 06 Oct 07 SHL Protect against NTFS defect
1757 BOOL ret = FALSE;
1758
1759 DosError(FERR_DISABLEHARDERR);
1760 if (DosOpen(filespec,
1761 &handle,
1762 &action,
1763 0,
1764 0,
1765 OPEN_ACTION_FAIL_IF_NEW |
1766 OPEN_ACTION_OPEN_IF_EXISTS,
1767 OPEN_FLAGS_FAIL_ON_ERROR |
1768 OPEN_FLAGS_NOINHERIT |
1769 OPEN_FLAGS_RANDOMSEQUENTIAL |
1770 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0))
1771 ret = FALSE;
1772 else {
1773 // Try signature match
1774 l = len;
1775 l = min(l, 79);
1776 if (!DosChgFilePtr(handle,
1777 abs(offset),
1778 (offset >= 0) ?
1779 FILE_BEGIN : FILE_END, &len)) {
1780 if (!DosRead(handle, buffer, l, &len) && len == l) {
1781 if (!memcmp(signature, buffer, l))
1782 ret = TRUE; // Matched
1783 }
1784 }
1785 }
1786 DosClose(handle); // Either way, we're done for now
1787 return ret; // Return TRUE if matched
1788}
1789
1790int CheckVersion(int vermajor, int verminor)
1791{
1792 int ok = 0;
1793
1794 // fixme to do useful check - was missing in base source
1795
1796#if 0
1797 if (vermajor && verminor) {
1798 *vermajor = VERMAJOR;
1799 *verminor = VERMINOR;
1800 ok = 1;
1801 }
1802#endif
1803
1804 ok = 1;
1805
1806 return ok;
1807}
1808
1809#ifdef __WATCOMC__
1810#pragma alloc_text(INIT,LibMain,InitFM3DLL,DeInitFM3DLL)
1811#pragma alloc_text(INIT1,StartFM3,FindSwapperDat)
1812#endif
Note: See TracBrowser for help on using the repository browser.