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