source: trunk/dll/init.c@ 1830

Last change on this file since 1830 was 1830, checked in by Gregg Young, 10 years ago

PMPrintf support #if 0-ed

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