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