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