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