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