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