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