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