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