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