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