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