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