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