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