| 1 |
|
|---|
| 2 | /***********************************************************************
|
|---|
| 3 |
|
|---|
| 4 | $Id: init.c 555 2007-03-04 05:01:14Z gyoung $
|
|---|
| 5 |
|
|---|
| 6 | Initialization
|
|---|
| 7 |
|
|---|
| 8 | Copyright (c) 1993-98 M. Kimes
|
|---|
| 9 | Copyright (c) 2001, 2006 Steven H. Levine
|
|---|
| 10 |
|
|---|
| 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
|
|---|
| 15 | 26 May 05 SHL Comments
|
|---|
| 16 | 06 Jun 05 SHL indent -i2
|
|---|
| 17 | 06 Jun 05 SHL Rework FindSwapperDat for VAC3.65 compat
|
|---|
| 18 | 13 Jul 06 SHL Use Runtime_Error
|
|---|
| 19 | 13 Jul 06 SHL Sync with current style
|
|---|
| 20 | 29 Jul 06 SHL Use xfgets
|
|---|
| 21 | 22 Oct 06 GKY Add NDFS32 support
|
|---|
| 22 | 18 Feb 07 GKY Add ISOFS, RAMFS support
|
|---|
| 23 |
|
|---|
| 24 | ***********************************************************************/
|
|---|
| 25 |
|
|---|
| 26 | #define DEFINE_GLOBALS 1
|
|---|
| 27 |
|
|---|
| 28 | #define INCL_DOS
|
|---|
| 29 | #define INCL_WIN
|
|---|
| 30 | #define INCL_MMIOOS2
|
|---|
| 31 | #define INCL_GPI
|
|---|
| 32 |
|
|---|
| 33 | #include <os2.h>
|
|---|
| 34 | #include <os2me.h>
|
|---|
| 35 | #include <stdlib.h>
|
|---|
| 36 | #include <stdio.h>
|
|---|
| 37 | #include <string.h>
|
|---|
| 38 | #include <ctype.h>
|
|---|
| 39 | #include <share.h>
|
|---|
| 40 | #include <time.h>
|
|---|
| 41 | #include <process.h>
|
|---|
| 42 |
|
|---|
| 43 | #include "fm3dll.h"
|
|---|
| 44 | #include "fm3dlg.h"
|
|---|
| 45 | #include "datamin.h"
|
|---|
| 46 | #include "tools.h"
|
|---|
| 47 | #include "fm3str.h"
|
|---|
| 48 | #include "version.h"
|
|---|
| 49 |
|
|---|
| 50 | #pragma alloc_text(INIT,_DLL_InitTerm,InitFM3DLL,DeInitFM3DLL)
|
|---|
| 51 | #pragma alloc_text(INIT1,StartFM3,FindSwapperDat)
|
|---|
| 52 |
|
|---|
| 53 | extern int _CRT_init(void);
|
|---|
| 54 | extern void _CRT_term(void);
|
|---|
| 55 |
|
|---|
| 56 | static PSZ pszSrcFile = __FILE__;
|
|---|
| 57 |
|
|---|
| 58 | VOID FindSwapperDat(VOID)
|
|---|
| 59 | {
|
|---|
| 60 | CHAR filename[] = "C:\\CONFIG.SYS";
|
|---|
| 61 | CHAR input[8192];
|
|---|
| 62 | CHAR *p;
|
|---|
| 63 | CHAR *pp;
|
|---|
| 64 | FILE *fp;
|
|---|
| 65 | FILEFINDBUF3 ffb;
|
|---|
| 66 | ULONG nm;
|
|---|
| 67 | ULONG size = sizeof(SwapperDat);
|
|---|
| 68 | HDIR hdir = HDIR_CREATE;
|
|---|
| 69 | APIRET rc = 1;
|
|---|
| 70 |
|
|---|
| 71 | *SwapperDat = 0;
|
|---|
| 72 | // Check already known
|
|---|
| 73 | PrfQueryProfileData(fmprof,
|
|---|
| 74 | FM3Str, "SwapperDat", (PVOID) SwapperDat, &size);
|
|---|
| 75 | if (*SwapperDat) {
|
|---|
| 76 | nm = 1;
|
|---|
| 77 | rc = DosFindFirst(SwapperDat,
|
|---|
| 78 | &hdir,
|
|---|
| 79 | FILE_NORMAL | FILE_ARCHIVED |
|
|---|
| 80 | FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,
|
|---|
| 81 | &ffb, sizeof(ffb), &nm, FIL_STANDARD);
|
|---|
| 82 | if (!rc) {
|
|---|
| 83 | DosFindClose(hdir);
|
|---|
| 84 | fp = fopen(SwapperDat, "r");
|
|---|
| 85 | if (fp) {
|
|---|
| 86 | fclose(fp);
|
|---|
| 87 | *SwapperDat = 0;
|
|---|
| 88 | rc = 1; // Force config.sys scan
|
|---|
| 89 | }
|
|---|
| 90 | }
|
|---|
| 91 | else
|
|---|
| 92 | *SwapperDat = 0;
|
|---|
| 93 | }
|
|---|
| 94 | // If not defined in INI or INI wrong, scan config.sys for SWAPPATH statement
|
|---|
| 95 | if (rc) {
|
|---|
| 96 | if (DosQuerySysInfo(QSV_BOOT_DRIVE,
|
|---|
| 97 | QSV_BOOT_DRIVE,
|
|---|
| 98 | (PVOID) & nm, (ULONG) sizeof(ULONG))) {
|
|---|
| 99 | nm = 3; // Assume drive C:
|
|---|
| 100 | }
|
|---|
| 101 | *filename = (CHAR) nm + '@';
|
|---|
| 102 | fp = xfsopen(filename, "r", SH_DENYNO, pszSrcFile, __LINE__);
|
|---|
| 103 | if (fp) {
|
|---|
| 104 | while (!feof(fp)) {
|
|---|
| 105 | if (!xfgets(input, sizeof(input), fp, pszSrcFile, __LINE__))
|
|---|
| 106 | break;
|
|---|
| 107 | lstrip(input);
|
|---|
| 108 | if (!strnicmp(input, "SWAPPATH", 8)) {
|
|---|
| 109 | p = input + 8;
|
|---|
| 110 | while (*p == ' ')
|
|---|
| 111 | p++;
|
|---|
| 112 | if (*p == '=') {
|
|---|
| 113 | p++;
|
|---|
| 114 | stripcr(p);
|
|---|
| 115 | rstrip(p);
|
|---|
| 116 | while (*p == ' ')
|
|---|
| 117 | p++;
|
|---|
| 118 | if (*p == '\"') {
|
|---|
| 119 | p++;
|
|---|
| 120 | pp = p;
|
|---|
| 121 | while (*pp && *pp != '\"')
|
|---|
| 122 | *pp++;
|
|---|
| 123 | if (*pp)
|
|---|
| 124 | *pp = 0;
|
|---|
| 125 | }
|
|---|
| 126 | else {
|
|---|
| 127 | pp = strchr(p, ' ');
|
|---|
| 128 | if (pp)
|
|---|
| 129 | *pp = 0;
|
|---|
| 130 | }
|
|---|
| 131 | if (*p) {
|
|---|
| 132 | strncpy(SwapperDat, p, CCHMAXPATH);
|
|---|
| 133 | SwapperDat[CCHMAXPATH - 1] = 0;
|
|---|
| 134 | if (SwapperDat[strlen(SwapperDat) - 1] != '\\')
|
|---|
| 135 | strcat(SwapperDat, "\\");
|
|---|
| 136 | strcat(SwapperDat, "SWAPPER.DAT");
|
|---|
| 137 | hdir = HDIR_CREATE;
|
|---|
| 138 | nm = 1;
|
|---|
| 139 | if (!DosFindFirst(SwapperDat,
|
|---|
| 140 | &hdir,
|
|---|
| 141 | FILE_NORMAL | FILE_ARCHIVED |
|
|---|
| 142 | FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,
|
|---|
| 143 | &ffb, sizeof(ffb), &nm, FIL_STANDARD)) {
|
|---|
| 144 | DosFindClose(hdir);
|
|---|
| 145 | PrfWriteProfileString(fmprof,
|
|---|
| 146 | FM3Str, "SwapperDat", SwapperDat);
|
|---|
| 147 | }
|
|---|
| 148 | else
|
|---|
| 149 | *SwapperDat = 0;
|
|---|
| 150 | break;
|
|---|
| 151 | }
|
|---|
| 152 | }
|
|---|
| 153 | } // if SWAPPATH
|
|---|
| 154 | } // while
|
|---|
| 155 | fclose(fp);
|
|---|
| 156 | }
|
|---|
| 157 | }
|
|---|
| 158 | }
|
|---|
| 159 |
|
|---|
| 160 | unsigned long _System _DLL_InitTerm(unsigned long hModule,
|
|---|
| 161 | unsigned long ulFlag)
|
|---|
| 162 | {
|
|---|
| 163 | CHAR *env;
|
|---|
| 164 | CHAR stringfile[CCHMAXPATH];
|
|---|
| 165 | FILESTATUS3 fsa;
|
|---|
| 166 | APIRET rc;
|
|---|
| 167 |
|
|---|
| 168 | switch (ulFlag) {
|
|---|
| 169 | case 0:
|
|---|
| 170 | if (_CRT_init() == -1)
|
|---|
| 171 | return 0UL;
|
|---|
| 172 | FM3DllHandle = hModule;
|
|---|
| 173 | strcpy(stringfile, "FM3RES.STR");
|
|---|
| 174 | env = getenv("FM3INI");
|
|---|
| 175 | if (env) {
|
|---|
| 176 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 177 | rc = DosQueryPathInfo(env, FIL_STANDARD, &fsa, (ULONG) sizeof(fsa));
|
|---|
| 178 | if (!rc) {
|
|---|
| 179 | if (fsa.attrFile & FILE_DIRECTORY) {
|
|---|
| 180 | strcpy(stringfile, env);
|
|---|
| 181 | if (stringfile[strlen(stringfile) - 1] != '\\')
|
|---|
| 182 | strcat(stringfile, "\\");
|
|---|
| 183 | strcat(stringfile, "FM3RES.STR");
|
|---|
| 184 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 185 | if (DosQueryPathInfo(stringfile, FIL_STANDARD, &fsa, sizeof(fsa)))
|
|---|
| 186 | strcpy(stringfile, "FM3RES.STR");
|
|---|
| 187 | }
|
|---|
| 188 | }
|
|---|
| 189 | }
|
|---|
| 190 | LoadStrings(stringfile);
|
|---|
| 191 |
|
|---|
| 192 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 193 | /* strings here to prevent multiple occurences in DLL */
|
|---|
| 194 | FM2Str = "FM/2";
|
|---|
| 195 | FM3Str = "FM/3";
|
|---|
| 196 | NullStr = "";
|
|---|
| 197 | Default = "DEFAULT";
|
|---|
| 198 | Settings = "SETTINGS";
|
|---|
| 199 | WPProgram = "WPProgram";
|
|---|
| 200 | FM3Folder = "<FM3_Folder>";
|
|---|
| 201 | FM3Tools = "<FM3_Tools>";
|
|---|
| 202 | DRM_OS2FILE = "DRM_OS2FILE";
|
|---|
| 203 | DRM_FM2ARCMEMBER = "DRM_FM2ARCMEMBER";
|
|---|
| 204 | DRF_FM2ARCHIVE = "DRF_FM2ARCHIVE";
|
|---|
| 205 | DRMDRFLIST = "<DRM_OS2FILE,DRF_UNKNOWN>,"
|
|---|
| 206 | "<DRM_DISCARD,DRF_UNKNOWN>," "<DRM_PRINT,DRF_UNKNOWN>";
|
|---|
| 207 | DRMDRFOS2FILE = "<DRM_OS2FILE,DRF_UNKNOWN>";
|
|---|
| 208 | DRMDRFFM2ARC = "<DRM_FM2ARCMEMBER,DRF_FM2ARCHIVE>";
|
|---|
| 209 | DRM_FM2INIRECORD = "DRM_FM2INIRECORD";
|
|---|
| 210 | DRF_FM2INI = "DRF_FM2INI";
|
|---|
| 211 | SUBJECT = ".SUBJECT";
|
|---|
| 212 | LONGNAME = ".LONGNAME";
|
|---|
| 213 | HPFS = "HPFS";
|
|---|
| 214 | JFS = "JFS";
|
|---|
| 215 | CDFS = "CDFS";
|
|---|
| 216 | ISOFS = "ISOFS";
|
|---|
| 217 | FAT32 = "FAT32";
|
|---|
| 218 | HPFS386 = "HPFS386";
|
|---|
| 219 | CBSIFS = "CBSIFS";
|
|---|
| 220 | NDFS32 = "NDFS32";
|
|---|
| 221 | RAMFS = "RAMFS";
|
|---|
| 222 | NTFS = "NTFS";
|
|---|
| 223 | /* end of strings */
|
|---|
| 224 | memset(&RGBBLACK, 0, sizeof(RGB2));
|
|---|
| 225 | RGBGREY.bRed = RGBGREY.bGreen = RGBGREY.bBlue = 204;
|
|---|
| 226 | RGBGREY.fcOptions = 0;
|
|---|
| 227 | FM3UL = *(ULONG *) FM3Str;
|
|---|
| 228 | DEBUG_STRING = "Debug -- please report to author";
|
|---|
| 229 | break;
|
|---|
| 230 | case 1:
|
|---|
| 231 | StopPrinting = 1;
|
|---|
| 232 | if (fmprof)
|
|---|
| 233 | PrfCloseProfile(fmprof);
|
|---|
| 234 | DosError(FERR_ENABLEHARDERR);
|
|---|
| 235 | _CRT_term();
|
|---|
| 236 | break;
|
|---|
| 237 | default:
|
|---|
| 238 | return 0UL;
|
|---|
| 239 | }
|
|---|
| 240 | return 1UL;
|
|---|
| 241 | }
|
|---|
| 242 |
|
|---|
| 243 | VOID APIENTRY DeInitFM3DLL(ULONG why)
|
|---|
| 244 | {
|
|---|
| 245 | /* cleanup */
|
|---|
| 246 | static CHAR s[CCHMAXPATH];
|
|---|
| 247 | CHAR *enddir;
|
|---|
| 248 | HDIR search_handle;
|
|---|
| 249 | ULONG num_matches;
|
|---|
| 250 | static FILEFINDBUF3 f;
|
|---|
| 251 |
|
|---|
| 252 | StopTimer();
|
|---|
| 253 | StopPrinting = 1;
|
|---|
| 254 |
|
|---|
| 255 | if (LogFileHandle)
|
|---|
| 256 | fclose(LogFileHandle);
|
|---|
| 257 |
|
|---|
| 258 | if (fmprof) {
|
|---|
| 259 | PrfCloseProfile(fmprof);
|
|---|
| 260 | fmprof = (HINI) 0;
|
|---|
| 261 | if (fIniExisted) {
|
|---|
| 262 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 263 | DosCopy("FM3.INI", "FM3INI.BAK", DCPY_EXISTING);
|
|---|
| 264 | }
|
|---|
| 265 | }
|
|---|
| 266 |
|
|---|
| 267 | if (fToolsChanged)
|
|---|
| 268 | save_tools(NULL);
|
|---|
| 269 |
|
|---|
| 270 | _fcloseall();
|
|---|
| 271 |
|
|---|
| 272 | save_dir(s);
|
|---|
| 273 | if (s[strlen(s) - 1] != '\\')
|
|---|
| 274 | strcat(s, "\\");
|
|---|
| 275 | enddir = &s[strlen(s)];
|
|---|
| 276 | if (*ArcTempRoot) {
|
|---|
| 277 | strcat(s, ArcTempRoot);
|
|---|
| 278 | strcat(s, "*");
|
|---|
| 279 | search_handle = HDIR_CREATE;
|
|---|
| 280 | num_matches = 1L;
|
|---|
| 281 | if (!DosFindFirst(s,
|
|---|
| 282 | &search_handle,
|
|---|
| 283 | FILE_NORMAL | FILE_DIRECTORY |
|
|---|
| 284 | FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN |
|
|---|
| 285 | FILE_ARCHIVED,
|
|---|
| 286 | &f, sizeof(FILEFINDBUF3), &num_matches, FIL_STANDARD)) {
|
|---|
| 287 | do {
|
|---|
| 288 | strcpy(enddir, f.achName);
|
|---|
| 289 | if (f.attrFile & FILE_DIRECTORY) {
|
|---|
| 290 | wipeallf("%s\\*", s);
|
|---|
| 291 | DosDeleteDir(s);
|
|---|
| 292 | }
|
|---|
| 293 | else
|
|---|
| 294 | unlinkf("%s", s);
|
|---|
| 295 | }
|
|---|
| 296 | while (!DosFindNext(search_handle,
|
|---|
| 297 | &f, sizeof(FILEFINDBUF3), &num_matches));
|
|---|
| 298 | DosFindClose(search_handle);
|
|---|
| 299 | }
|
|---|
| 300 | }
|
|---|
| 301 |
|
|---|
| 302 | save_dir(s);
|
|---|
| 303 | if (s[strlen(s) - 1] != '\\')
|
|---|
| 304 | strcat(s, "\\");
|
|---|
| 305 | enddir = &s[strlen(s)];
|
|---|
| 306 | strcat(s, LISTTEMPROOT);
|
|---|
| 307 | strcat(s, "???");
|
|---|
| 308 | search_handle = HDIR_CREATE;
|
|---|
| 309 | num_matches = 1L;
|
|---|
| 310 | if (!DosFindFirst(s,
|
|---|
| 311 | &search_handle,
|
|---|
| 312 | FILE_NORMAL | FILE_DIRECTORY |
|
|---|
| 313 | FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN |
|
|---|
| 314 | FILE_ARCHIVED,
|
|---|
| 315 | &f, sizeof(FILEFINDBUF3), &num_matches, FIL_STANDARD)) {
|
|---|
| 316 | do {
|
|---|
| 317 | if (!(f.attrFile & FILE_DIRECTORY)) {
|
|---|
| 318 | strcpy(enddir, f.achName);
|
|---|
| 319 | unlinkf("%s", s);
|
|---|
| 320 | }
|
|---|
| 321 | }
|
|---|
| 322 | while (!DosFindNext(search_handle,
|
|---|
| 323 | &f, sizeof(FILEFINDBUF3), &num_matches));
|
|---|
| 324 | DosFindClose(search_handle);
|
|---|
| 325 | }
|
|---|
| 326 |
|
|---|
| 327 | DosForceDelete("$FM2PLAY.$$$");
|
|---|
| 328 |
|
|---|
| 329 | EndNote();
|
|---|
| 330 |
|
|---|
| 331 | if (FM3ModHandle)
|
|---|
| 332 | DosFreeModule(FM3ModHandle);
|
|---|
| 333 |
|
|---|
| 334 | DosExitList(EXLST_REMOVE, DeInitFM3DLL);
|
|---|
| 335 | }
|
|---|
| 336 |
|
|---|
| 337 | BOOL InitFM3DLL(HAB hab, int argc, char **argv)
|
|---|
| 338 | {
|
|---|
| 339 | /*
|
|---|
| 340 | * this function should be called by any application using this DLL right
|
|---|
| 341 | * after setting up a message queue
|
|---|
| 342 | */
|
|---|
| 343 |
|
|---|
| 344 | CLASSINFO clinfo;
|
|---|
| 345 | APIRET rc;
|
|---|
| 346 | APIRET rcl = 1;
|
|---|
| 347 | APIRET rcq = 1;
|
|---|
| 348 | PFN pfnResVersion = (PFN) NULL;
|
|---|
| 349 | ULONG RVMajor = 0;
|
|---|
| 350 | ULONG RVMinor = 0;
|
|---|
| 351 | ULONG ret = 0;
|
|---|
| 352 | FILESTATUS3 fsa;
|
|---|
| 353 | CHAR *env;
|
|---|
| 354 | CHAR dllfile[CCHMAXPATH];
|
|---|
| 355 | ULONG size;
|
|---|
| 356 |
|
|---|
| 357 | if (!StringsLoaded()) {
|
|---|
| 358 | saymsg(MB_ENTER,
|
|---|
| 359 | HWND_DESKTOP,
|
|---|
| 360 | "Error",
|
|---|
| 361 | "FM3RES.STR isn't in right format, at least "
|
|---|
| 362 | "for this version of FM/2.");
|
|---|
| 363 | return FALSE;
|
|---|
| 364 | }
|
|---|
| 365 |
|
|---|
| 366 | strcpy(dllfile, "FM3RES");
|
|---|
| 367 | env = getenv("FM3INI");
|
|---|
| 368 | if (env) {
|
|---|
| 369 | FILESTATUS3 fsa;
|
|---|
| 370 | APIRET rc;
|
|---|
| 371 |
|
|---|
| 372 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 373 | rc = DosQueryPathInfo(env, FIL_STANDARD, &fsa, (ULONG) sizeof(fsa));
|
|---|
| 374 | if (!rc) {
|
|---|
| 375 | if (fsa.attrFile & FILE_DIRECTORY) {
|
|---|
| 376 | strcpy(dllfile, env);
|
|---|
| 377 | if (dllfile[strlen(dllfile) - 1] != '\\')
|
|---|
| 378 | strcat(dllfile, "\\");
|
|---|
| 379 | strcat(dllfile, "FM3RES");
|
|---|
| 380 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 381 | if (DosQueryPathInfo(dllfile, FIL_STANDARD, &fsa, sizeof(fsa)))
|
|---|
| 382 | strcpy(dllfile, "FM3RES");
|
|---|
| 383 | }
|
|---|
| 384 | }
|
|---|
| 385 | }
|
|---|
| 386 | rcl = DosLoadModule(NULL, 0, dllfile, &FM3ModHandle);
|
|---|
| 387 | if (rcl) {
|
|---|
| 388 | saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
|
|---|
| 389 | HWND_DESKTOP,
|
|---|
| 390 | GetPString(IDS_ERRORTEXT), GetPString(IDS_FM3RESERROR1TEXT));
|
|---|
| 391 | return FALSE;
|
|---|
| 392 | }
|
|---|
| 393 | else {
|
|---|
| 394 | rc = DosExitList(EXLST_ADD, DeInitFM3DLL);
|
|---|
| 395 | if (rc) {
|
|---|
| 396 | Dos_Error(MB_ENTER,
|
|---|
| 397 | rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosExitList failed");
|
|---|
| 398 | }
|
|---|
| 399 | rcq = DosQueryProcAddr(FM3ModHandle, 1, "ResVersion", &pfnResVersion);
|
|---|
| 400 | if (!rcq)
|
|---|
| 401 | ret = pfnResVersion(&RVMajor, &RVMinor);
|
|---|
| 402 | }
|
|---|
| 403 |
|
|---|
| 404 | if (RVMajor < VERMAJOR || (RVMajor == VERMAJOR && RVMinor < VERMINOR)) {
|
|---|
| 405 | saymsg(MB_ENTER,
|
|---|
| 406 | HWND_DESKTOP,
|
|---|
| 407 | GetPString(IDS_ERRORTEXT),
|
|---|
| 408 | GetPString(IDS_FM3RESERROR2TEXT),
|
|---|
| 409 | !rcq ?
|
|---|
| 410 | GetPString(IDS_FM3RESERROR3TEXT) :
|
|---|
| 411 | !rcl ?
|
|---|
| 412 | GetPString(IDS_FM3RESERROR4TEXT) :
|
|---|
| 413 | GetPString(IDS_FM3RESERROR5TEXT), RVMajor, RVMinor, rcl, rcq, ret);
|
|---|
| 414 | return FALSE;
|
|---|
| 415 | }
|
|---|
| 416 |
|
|---|
| 417 | ArgDriveFlags(argc, argv);
|
|---|
| 418 | FillInDriveFlags(NULL);
|
|---|
| 419 |
|
|---|
| 420 | {
|
|---|
| 421 | /* try to ensure that FM/2 Utilities are available */
|
|---|
| 422 | CHAR curpath[CCHMAXPATH + 8], *env;
|
|---|
| 423 | FILESTATUS3 fs3;
|
|---|
| 424 |
|
|---|
| 425 | save_dir2(curpath);
|
|---|
| 426 | strcat(curpath, "\\UTILS");
|
|---|
| 427 | if (!DosQueryPathInfo(curpath,
|
|---|
| 428 | FIL_STANDARD,
|
|---|
| 429 | &fs3,
|
|---|
| 430 | sizeof(fs3)) && (fs3.attrFile & FILE_DIRECTORY)) {
|
|---|
| 431 | env = getenv("PATH");
|
|---|
| 432 | if (env) {
|
|---|
| 433 | if (!stristr(curpath, env))
|
|---|
| 434 | fAddUtils = TRUE;
|
|---|
| 435 | }
|
|---|
| 436 | }
|
|---|
| 437 | }
|
|---|
| 438 | if (!*profile)
|
|---|
| 439 | strcpy(profile, "FM3.INI");
|
|---|
| 440 | mypid = getpid();
|
|---|
| 441 | /* give default appname if none set by caller */
|
|---|
| 442 | if (!*appname)
|
|---|
| 443 | strcpy(appname, FM3Str);
|
|---|
| 444 | /* save appname; may be reset below */
|
|---|
| 445 | strcpy(realappname, appname);
|
|---|
| 446 | if (!strcmp(appname, FM3Str))
|
|---|
| 447 | DosSetMaxFH(100L);
|
|---|
| 448 | else if (!strcmp(appname, "VDir") ||
|
|---|
| 449 | !strcmp(appname, "VTree") ||
|
|---|
| 450 | !strcmp(appname, "VCollect") ||
|
|---|
| 451 | !strcmp(appname, "SEEALL") || !strcmp(appname, "FM/4"))
|
|---|
| 452 | DosSetMaxFH(60L);
|
|---|
| 453 | else
|
|---|
| 454 | DosSetMaxFH(40L);
|
|---|
| 455 |
|
|---|
| 456 | if (DosQuerySysInfo(QSV_VERSION_MAJOR,
|
|---|
| 457 | QSV_VERSION_MINOR,
|
|---|
| 458 | (PVOID) OS2ver, (ULONG) sizeof(OS2ver))) {
|
|---|
| 459 | OS2ver[0] = 2;
|
|---|
| 460 | OS2ver[1] = 1;
|
|---|
| 461 | }
|
|---|
| 462 |
|
|---|
| 463 | /* set up default root names for temp archive goodies */
|
|---|
| 464 | if (!fAmAV2)
|
|---|
| 465 | strcpy(ArcTempRoot, "$FM$ARC$");
|
|---|
| 466 | else
|
|---|
| 467 | strcpy(ArcTempRoot, "$AV$ARC$");
|
|---|
| 468 |
|
|---|
| 469 | /* initialize random number generator */
|
|---|
| 470 | srand(time(NULL) + clock());
|
|---|
| 471 |
|
|---|
| 472 | priority_bumped();
|
|---|
| 473 |
|
|---|
| 474 | /* _heapmin() is done in a separate thread -- start it */
|
|---|
| 475 | if (_beginthread(HeapThread, NULL, 32768, NULL) == -1) {
|
|---|
| 476 | Runtime_Error(pszSrcFile, __LINE__,
|
|---|
| 477 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
|---|
| 478 | return FALSE;
|
|---|
| 479 | }
|
|---|
| 480 | /* timer messages are sent from a separate thread -- start it */
|
|---|
| 481 | if (!StartTimer())
|
|---|
| 482 | return FALSE;
|
|---|
| 483 |
|
|---|
| 484 | /* are we the workplace shell? */
|
|---|
| 485 | env = getenv("WORKPLACE__PROCESS");
|
|---|
| 486 | if (!env || stricmp(env, "NO"))
|
|---|
| 487 | fWorkPlace = TRUE;
|
|---|
| 488 |
|
|---|
| 489 | if ((!strchr(profile, '\\') && !strchr(profile, ':')) ||
|
|---|
| 490 | !(fmprof = PrfOpenProfile((HAB) 0, profile))) {
|
|---|
| 491 | /* figure out where to put INI file... */
|
|---|
| 492 | CHAR *env, inipath[CCHMAXPATH];
|
|---|
| 493 |
|
|---|
| 494 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 495 | save_dir2(HomePath);
|
|---|
| 496 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 497 | memset(driveserial, -1, sizeof(driveserial));
|
|---|
| 498 | *inipath = 0;
|
|---|
| 499 | env = getenv("FM3INI");
|
|---|
| 500 | if (env) {
|
|---|
| 501 | strcpy(inipath, env);
|
|---|
| 502 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 503 | rc = DosQueryPathInfo(inipath, FIL_STANDARD, &fsa, (ULONG) sizeof(fsa));
|
|---|
| 504 | if (!rc) {
|
|---|
| 505 | if (fsa.attrFile & FILE_DIRECTORY) {
|
|---|
| 506 | if (inipath[strlen(inipath) - 1] != '\\')
|
|---|
| 507 | strcat(inipath, "\\");
|
|---|
| 508 | strcat(inipath, profile);
|
|---|
| 509 | }
|
|---|
| 510 | }
|
|---|
| 511 | }
|
|---|
| 512 | if (!env) {
|
|---|
| 513 | env = searchpath(profile);
|
|---|
| 514 | if (!env)
|
|---|
| 515 | env = profile;
|
|---|
| 516 | strcpy(inipath, env);
|
|---|
| 517 | }
|
|---|
| 518 |
|
|---|
| 519 | /* in some odd cases the INI file can get set to readonly status */
|
|---|
| 520 | /* here we test it and reset the readonly bit if necessary */
|
|---|
| 521 | if (!*inipath)
|
|---|
| 522 | strcpy(inipath, profile);
|
|---|
| 523 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 524 | if (!DosQueryPathInfo(inipath, FIL_STANDARD, &fsa, (ULONG) sizeof(fsa))) {
|
|---|
| 525 | fIniExisted = TRUE;
|
|---|
| 526 | if (fsa.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) {
|
|---|
| 527 | fsa.attrFile &= (~(FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM));
|
|---|
| 528 | if (DosSetPathInfo(inipath, FIL_STANDARD, (PVOID) & fsa,
|
|---|
| 529 | (ULONG) sizeof(fsa), 0L))
|
|---|
| 530 | saymsg(MB_ENTER,
|
|---|
| 531 | HWND_DESKTOP,
|
|---|
| 532 | GetPString(IDS_ERRORTEXT),
|
|---|
| 533 | GetPString(IDS_INIREADONLYTEXT), inipath);
|
|---|
| 534 | }
|
|---|
| 535 | }
|
|---|
| 536 |
|
|---|
| 537 | fmprof = PrfOpenProfile((HAB) 0, inipath);
|
|---|
| 538 | if (!fmprof) {
|
|---|
| 539 | strcpy(inipath, "FM3.INI");
|
|---|
| 540 | fmprof = PrfOpenProfile((HAB) 0, inipath);
|
|---|
| 541 | }
|
|---|
| 542 |
|
|---|
| 543 | if (!fmprof) {
|
|---|
| 544 | Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__,
|
|---|
| 545 | "PrfOpenProfile failed");
|
|---|
| 546 | return FALSE;
|
|---|
| 547 | }
|
|---|
| 548 | }
|
|---|
| 549 |
|
|---|
| 550 | FindSwapperDat();
|
|---|
| 551 |
|
|---|
| 552 | size = sizeof(BOOL);
|
|---|
| 553 | PrfQueryProfileData(fmprof,
|
|---|
| 554 | FM3Str,
|
|---|
| 555 | "SeparateParms", (PVOID) & fSeparateParms, &size);
|
|---|
| 556 | if (!fSeparateParms)
|
|---|
| 557 | strcpy(appname, FM3Str);
|
|---|
| 558 |
|
|---|
| 559 | /* start help */
|
|---|
| 560 | memset(&hini, 0, sizeof(HELPINIT));
|
|---|
| 561 | hini.cb = sizeof(HELPINIT);
|
|---|
| 562 | hini.ulReturnCode = 0L;
|
|---|
| 563 | hini.pszTutorialName = NULL;
|
|---|
| 564 | hini.phtHelpTable = (PHELPTABLE) MAKELONG(ID_HELPTABLE, 0xffff);
|
|---|
| 565 | hini.hmodAccelActionBarModule = (HMODULE) 0;
|
|---|
| 566 | hini.idAccelTable = 0;
|
|---|
| 567 | hini.idActionBar = 0;
|
|---|
| 568 | hini.pszHelpWindowTitle = GetPString(IDS_FM2HELPTITLETEXT);
|
|---|
| 569 | hini.fShowPanelId = CMIC_HIDE_PANEL_ID;
|
|---|
| 570 | hini.pszHelpLibraryName = "FM3.HLP";
|
|---|
| 571 | hwndHelp = WinCreateHelpInstance(hab, &hini);
|
|---|
| 572 | if (!hwndHelp) {
|
|---|
| 573 | static CHAR helppath[CCHMAXPATH]; // fixme to be local?
|
|---|
| 574 |
|
|---|
| 575 | env = getenv("FM3INI");
|
|---|
| 576 | if (env) {
|
|---|
| 577 | FILESTATUS3 fsa;
|
|---|
| 578 | APIRET rc;
|
|---|
| 579 |
|
|---|
| 580 | strcpy(helppath, env);
|
|---|
| 581 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 582 | rc =
|
|---|
| 583 | DosQueryPathInfo(helppath, FIL_STANDARD, &fsa, (ULONG) sizeof(fsa));
|
|---|
| 584 | if (!rc) {
|
|---|
| 585 | if (fsa.attrFile & FILE_DIRECTORY) {
|
|---|
| 586 | if (helppath[strlen(helppath) - 1] != '\\')
|
|---|
| 587 | strcat(helppath, "\\");
|
|---|
| 588 | strcat(helppath, "FM3.HLP");
|
|---|
| 589 | hini.pszHelpLibraryName = helppath;
|
|---|
| 590 | hwndHelp = WinCreateHelpInstance(hab, &hini);
|
|---|
| 591 | }
|
|---|
| 592 | }
|
|---|
| 593 | }
|
|---|
| 594 | }
|
|---|
| 595 | if (!hwndHelp) {
|
|---|
| 596 | saymsg(MB_ENTER | MB_ICONEXCLAMATION,
|
|---|
| 597 | HWND_DESKTOP,
|
|---|
| 598 | GetPString(IDS_FM2TROUBLETEXT),
|
|---|
| 599 | GetPString(IDS_CANTLOADHELPTEXT),
|
|---|
| 600 | GetPString(IDS_NOHELPACCEPTTEXT));
|
|---|
| 601 | }
|
|---|
| 602 |
|
|---|
| 603 | /* a couple of default window procs so we don't have to look them up later */
|
|---|
| 604 | if (WinQueryClassInfo(hab, WC_CONTAINER, &clinfo))
|
|---|
| 605 | PFNWPCnr = clinfo.pfnWindowProc;
|
|---|
| 606 | // saymsg(MB_ENTER,HWND_DESKTOP,"Container flags:","%08lx",clinfo.flClassStyle);
|
|---|
| 607 | if (WinQueryClassInfo(hab, WC_FRAME, &clinfo))
|
|---|
| 608 | PFNWPFrame = clinfo.pfnWindowProc;
|
|---|
| 609 | // saymsg(MB_ENTER,HWND_DESKTOP,"Frame flags:","%08lx",clinfo.flClassStyle);
|
|---|
| 610 | if (WinQueryClassInfo(hab, WC_BUTTON, &clinfo))
|
|---|
| 611 | PFNWPButton = clinfo.pfnWindowProc;
|
|---|
| 612 | // saymsg(MB_ENTER,HWND_DESKTOP,"Button flags:","%08lx",clinfo.flClassStyle);
|
|---|
| 613 | if (WinQueryClassInfo(hab, WC_STATIC, &clinfo))
|
|---|
| 614 | PFNWPStatic = clinfo.pfnWindowProc;
|
|---|
| 615 | // saymsg(MB_ENTER,HWND_DESKTOP,"Static flags:","%08lx",clinfo.flClassStyle);
|
|---|
| 616 | if (WinQueryClassInfo(hab, WC_MLE, &clinfo))
|
|---|
| 617 | PFNWPMLE = clinfo.pfnWindowProc;
|
|---|
| 618 | // saymsg(MB_ENTER,HWND_DESKTOP,"MLE flags:","%08lx",clinfo.flClassStyle);
|
|---|
| 619 | if (!PFNWPCnr || !PFNWPFrame || !PFNWPButton || !PFNWPStatic || !PFNWPMLE) {
|
|---|
| 620 | Runtime_Error(pszSrcFile, __LINE__, "WinQueryClassInfo");
|
|---|
| 621 | return FALSE;
|
|---|
| 622 | }
|
|---|
| 623 |
|
|---|
| 624 | /* register window classes we use */
|
|---|
| 625 | WinRegisterClass(hab,
|
|---|
| 626 | GetPString(IDS_WCMAINWND),
|
|---|
| 627 | MainWndProc,
|
|---|
| 628 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 8);
|
|---|
| 629 | WinRegisterClass(hab,
|
|---|
| 630 | GetPString(IDS_WCMAINWND2),
|
|---|
| 631 | MainWndProc2,
|
|---|
| 632 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 4);
|
|---|
| 633 | WinRegisterClass(hab,
|
|---|
| 634 | GetPString(IDS_WCTREECONTAINER),
|
|---|
| 635 | TreeClientWndProc,
|
|---|
| 636 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
|
|---|
| 637 | WinRegisterClass(hab,
|
|---|
| 638 | GetPString(IDS_WCDIRCONTAINER),
|
|---|
| 639 | DirClientWndProc,
|
|---|
| 640 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
|
|---|
| 641 | WinRegisterClass(hab,
|
|---|
| 642 | GetPString(IDS_WCCOLLECTOR),
|
|---|
| 643 | CollectorClientWndProc,
|
|---|
| 644 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
|
|---|
| 645 | WinRegisterClass(hab,
|
|---|
| 646 | GetPString(IDS_WCARCCONTAINER),
|
|---|
| 647 | ArcClientWndProc,
|
|---|
| 648 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
|
|---|
| 649 | WinRegisterClass(hab,
|
|---|
| 650 | GetPString(IDS_WCMLEEDITOR),
|
|---|
| 651 | MLEEditorProc,
|
|---|
| 652 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
|
|---|
| 653 | WinRegisterClass(hab,
|
|---|
| 654 | GetPString(IDS_WCINIEDITOR),
|
|---|
| 655 | IniProc,
|
|---|
| 656 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2);
|
|---|
| 657 | WinRegisterClass(hab,
|
|---|
| 658 | GetPString(IDS_WCTOOLBACK),
|
|---|
| 659 | ToolBackProc, CS_SIZEREDRAW, sizeof(PVOID));
|
|---|
| 660 | WinRegisterClass(hab,
|
|---|
| 661 | GetPString(IDS_WCDRIVEBACK),
|
|---|
| 662 | DriveBackProc,
|
|---|
| 663 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 664 | sizeof(PVOID));
|
|---|
| 665 | WinRegisterClass(hab,
|
|---|
| 666 | GetPString(IDS_WCSEEALL),
|
|---|
| 667 | SeeAllWndProc,
|
|---|
| 668 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID));
|
|---|
| 669 | WinRegisterClass(hab,
|
|---|
| 670 | GetPString(IDS_WCNEWVIEW),
|
|---|
| 671 | ViewWndProc,
|
|---|
| 672 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID));
|
|---|
| 673 | WinRegisterClass(hab,
|
|---|
| 674 | GetPString(IDS_WCTOOLBUTTONS),
|
|---|
| 675 | ChildButtonProc,
|
|---|
| 676 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 677 | sizeof(PVOID));
|
|---|
| 678 | WinRegisterClass(hab,
|
|---|
| 679 | GetPString(IDS_WCDRIVEBUTTONS),
|
|---|
| 680 | DriveProc,
|
|---|
| 681 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 682 | sizeof(PVOID));
|
|---|
| 683 | WinRegisterClass(hab,
|
|---|
| 684 | GetPString(IDS_WCBUBBLE),
|
|---|
| 685 | BubbleProc,
|
|---|
| 686 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 687 | sizeof(ULONG) * 2);
|
|---|
| 688 | WinRegisterClass(hab,
|
|---|
| 689 | GetPString(IDS_WCSTATUS),
|
|---|
| 690 | StatusProc,
|
|---|
| 691 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 692 | sizeof(ULONG));
|
|---|
| 693 | WinRegisterClass(hab,
|
|---|
| 694 | GetPString(IDS_WCDIRSTATUS),
|
|---|
| 695 | DirTextProc,
|
|---|
| 696 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 697 | sizeof(ULONG));
|
|---|
| 698 | WinRegisterClass(hab,
|
|---|
| 699 | GetPString(IDS_WCTREESTATUS),
|
|---|
| 700 | TreeStatProc,
|
|---|
| 701 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 702 | sizeof(ULONG));
|
|---|
| 703 | WinRegisterClass(hab,
|
|---|
| 704 | GetPString(IDS_WCARCSTATUS),
|
|---|
| 705 | ArcTextProc,
|
|---|
| 706 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 707 | sizeof(ULONG));
|
|---|
| 708 | WinRegisterClass(hab,
|
|---|
| 709 | GetPString(IDS_WCCOLSTATUS),
|
|---|
| 710 | CollectorTextProc,
|
|---|
| 711 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 712 | sizeof(ULONG));
|
|---|
| 713 | WinRegisterClass(hab,
|
|---|
| 714 | GetPString(IDS_WCSEESTATUS),
|
|---|
| 715 | SeeStatusProc,
|
|---|
| 716 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 717 | sizeof(ULONG));
|
|---|
| 718 | WinRegisterClass(hab,
|
|---|
| 719 | GetPString(IDS_WCVIEWSTATUS),
|
|---|
| 720 | ViewStatusProc,
|
|---|
| 721 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 722 | sizeof(ULONG));
|
|---|
| 723 | WinRegisterClass(hab,
|
|---|
| 724 | GetPString(IDS_WCERRORWND),
|
|---|
| 725 | NotifyWndProc,
|
|---|
| 726 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 727 | sizeof(PVOID));
|
|---|
| 728 | WinRegisterClass(hab,
|
|---|
| 729 | GetPString(IDS_WCMINITIME),
|
|---|
| 730 | MiniTimeProc,
|
|---|
| 731 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 732 | sizeof(PVOID) * 2);
|
|---|
| 733 | WinRegisterClass(hab,
|
|---|
| 734 | GetPString(IDS_WCDATABAR),
|
|---|
| 735 | DataProc, CS_SIZEREDRAW, sizeof(PVOID));
|
|---|
| 736 | WinRegisterClass(hab,
|
|---|
| 737 | GetPString(IDS_WCTREEOPENBUTTON),
|
|---|
| 738 | OpenButtonProc,
|
|---|
| 739 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 740 | sizeof(PVOID));
|
|---|
| 741 | WinRegisterClass(hab,
|
|---|
| 742 | GetPString(IDS_WCAUTOVIEW),
|
|---|
| 743 | AutoViewProc,
|
|---|
| 744 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 745 | sizeof(PVOID));
|
|---|
| 746 | WinRegisterClass(hab,
|
|---|
| 747 | GetPString(IDS_WCLED),
|
|---|
| 748 | LEDProc,
|
|---|
| 749 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP,
|
|---|
| 750 | sizeof(PVOID));
|
|---|
| 751 |
|
|---|
| 752 | /*
|
|---|
| 753 | * set some defaults (note: everything else automatically initialized
|
|---|
| 754 | * to 0)
|
|---|
| 755 | */
|
|---|
| 756 | detailssize = detailsea = detailslwdate = detailslwtime = detailsattr =
|
|---|
| 757 | detailsicon = fAutoTile = fConfirmDelete = fLoadSubject = fUnHilite =
|
|---|
| 758 | fLoadLongnames = fToolbar = fSaveState = fGuessType = fToolbarHelp =
|
|---|
| 759 | fAutoAddDirs = fUseNewViewer = fDataToFore = fDataShowDrives =
|
|---|
| 760 | fSplitStatus = fDragndropDlg = fQuickArcFind = fKeepCmdLine =
|
|---|
| 761 | fMoreButtons = fDrivebar = fCollapseFirst = fSwitchTree =
|
|---|
| 762 | fSwitchTreeExpand = fNoSearch = fCustomFileDlg = fOtherHelp =
|
|---|
| 763 | fSaveMiniCmds = fUserComboBox = fFM2Deletes = fConfirmTarget =
|
|---|
| 764 | fShowTarget = fDrivebarHelp = fCheckMM = TRUE;
|
|---|
| 765 | ulCnrType = CCS_EXTENDSEL;
|
|---|
| 766 | FilesToGet = 128L;
|
|---|
| 767 | AutoviewHeight = 48L;
|
|---|
| 768 | strcpy(printer, "PRN");
|
|---|
| 769 | prnwidth = 80;
|
|---|
| 770 | prnlength = 66;
|
|---|
| 771 | prntmargin = 6;
|
|---|
| 772 | prnbmargin = 6;
|
|---|
| 773 | prnlmargin = 6;
|
|---|
| 774 | prnrmargin = 3;
|
|---|
| 775 | prnspacing = 1;
|
|---|
| 776 | prntabspaces = 8;
|
|---|
| 777 | CollectorsortFlags = sortFlags = SORT_DIRSFIRST;
|
|---|
| 778 |
|
|---|
| 779 | // load preferences from profile (INI) file
|
|---|
| 780 | size = sizeof(BOOL);
|
|---|
| 781 | PrfQueryProfileData(fmprof,
|
|---|
| 782 | appname, "ShowTarget", (PVOID) & fShowTarget, &size);
|
|---|
| 783 | size = sizeof(BOOL);
|
|---|
| 784 | PrfQueryProfileData(fmprof, appname, "CheckMM", (PVOID) & fCheckMM, &size);
|
|---|
| 785 | size = sizeof(BOOL);
|
|---|
| 786 | PrfQueryProfileData(fmprof,
|
|---|
| 787 | appname,
|
|---|
| 788 | "ChangeTarget", (PVOID) & fChangeTarget, &size);
|
|---|
| 789 | size = sizeof(BOOL);
|
|---|
| 790 | PrfQueryProfileData(fmprof,
|
|---|
| 791 | appname,
|
|---|
| 792 | "ConfirmTarget", (PVOID) & fConfirmTarget, &size);
|
|---|
| 793 | size = sizeof(BOOL);
|
|---|
| 794 | PrfQueryProfileData(fmprof,
|
|---|
| 795 | FM3Str,
|
|---|
| 796 | "CustomFileDlg", (PVOID) & fCustomFileDlg, &size);
|
|---|
| 797 | size = sizeof(BOOL);
|
|---|
| 798 | PrfQueryProfileData(fmprof,
|
|---|
| 799 | FM3Str, "SaveMiniCmds", (PVOID) & fSaveMiniCmds, &size);
|
|---|
| 800 | size = sizeof(BOOL);
|
|---|
| 801 | PrfQueryProfileData(fmprof,
|
|---|
| 802 | appname, "SaveBigCmds", (PVOID) & fSaveBigCmds, &size);
|
|---|
| 803 | size = sizeof(BOOL);
|
|---|
| 804 | PrfQueryProfileData(fmprof,
|
|---|
| 805 | appname, "NoFoldMenu", (PVOID) & fNoFoldMenu, &size);
|
|---|
| 806 | size = sizeof(BOOL);
|
|---|
| 807 | PrfQueryProfileData(fmprof,
|
|---|
| 808 | FM3Str, "ThreadNotes", (PVOID) & fThreadNotes, &size);
|
|---|
| 809 | size = sizeof(BOOL);
|
|---|
| 810 | PrfQueryProfileData(fmprof, FM3Str, "Prnpagenums", (PVOID) & prnpagenums,
|
|---|
| 811 | &size);
|
|---|
| 812 | size = sizeof(BOOL);
|
|---|
| 813 | PrfQueryProfileData(fmprof, FM3Str, "Prnalt", (PVOID) & prnalt, &size);
|
|---|
| 814 | size = sizeof(BOOL);
|
|---|
| 815 | PrfQueryProfileData(fmprof, FM3Str, "Prnformat", (PVOID) & prnformat,
|
|---|
| 816 | &size);
|
|---|
| 817 | size = sizeof(BOOL);
|
|---|
| 818 | PrfQueryProfileData(fmprof, FM3Str, "Prnformfeedbefore",
|
|---|
| 819 | (PVOID) & prnformfeedbefore, &size);
|
|---|
| 820 | size = sizeof(BOOL);
|
|---|
| 821 | PrfQueryProfileData(fmprof,
|
|---|
| 822 | FM3Str,
|
|---|
| 823 | "Prnformfeedafter", (PVOID) & prnformfeedafter, &size);
|
|---|
| 824 | size = sizeof(ULONG);
|
|---|
| 825 | PrfQueryProfileData(fmprof, FM3Str, "Prntabspaces",
|
|---|
| 826 | (PVOID) & prntabspaces, &size);
|
|---|
| 827 | size = sizeof(ULONG);
|
|---|
| 828 | PrfQueryProfileData(fmprof, FM3Str, "Prnwidth", (PVOID) & prnwidth, &size);
|
|---|
| 829 | size = sizeof(ULONG);
|
|---|
| 830 | PrfQueryProfileData(fmprof, FM3Str, "Prnlength", (PVOID) & prnlength,
|
|---|
| 831 | &size);
|
|---|
| 832 | size = sizeof(ULONG);
|
|---|
| 833 | PrfQueryProfileData(fmprof, FM3Str, "Prntmargin", (PVOID) & prntmargin,
|
|---|
| 834 | &size);
|
|---|
| 835 | size = sizeof(ULONG);
|
|---|
| 836 | PrfQueryProfileData(fmprof, FM3Str, "Prnbmargin", (PVOID) & prnbmargin,
|
|---|
| 837 | &size);
|
|---|
| 838 | size = sizeof(ULONG);
|
|---|
| 839 | PrfQueryProfileData(fmprof, FM3Str, "Prnlmargin", (PVOID) & prnlmargin,
|
|---|
| 840 | &size);
|
|---|
| 841 | size = sizeof(ULONG);
|
|---|
| 842 | PrfQueryProfileData(fmprof, FM3Str, "Prnrmargin", (PVOID) & prnrmargin,
|
|---|
| 843 | &size);
|
|---|
| 844 | size = sizeof(ULONG);
|
|---|
| 845 | PrfQueryProfileData(fmprof, FM3Str, "Prnspacing", (PVOID) & prnspacing,
|
|---|
| 846 | &size);
|
|---|
| 847 | size = sizeof(BOOL);
|
|---|
| 848 | PrfQueryProfileData(fmprof, FM3Str, "NoDead", (PVOID) & fNoDead, &size);
|
|---|
| 849 | size = sizeof(BOOL);
|
|---|
| 850 | PrfQueryProfileData(fmprof, FM3Str, "NoFinger", (PVOID) & fNoFinger, &size);
|
|---|
| 851 | size = sizeof(BOOL);
|
|---|
| 852 | PrfQueryProfileData(fmprof, appname, "SwitchTree", (PVOID) & fSwitchTree,
|
|---|
| 853 | &size);
|
|---|
| 854 | size = sizeof(BOOL);
|
|---|
| 855 | PrfQueryProfileData(fmprof, appname, "SwitchTreeExpand",
|
|---|
| 856 | (PVOID) & fSwitchTreeExpand, &size);
|
|---|
| 857 | size = sizeof(BOOL);
|
|---|
| 858 | PrfQueryProfileData(fmprof, appname, "SwitchTreeOnFocus",
|
|---|
| 859 | (PVOID) & fSwitchTreeOnFocus, &size);
|
|---|
| 860 | size = sizeof(BOOL);
|
|---|
| 861 | PrfQueryProfileData(fmprof, appname, "CollapseFirst",
|
|---|
| 862 | (PVOID) & fCollapseFirst, &size);
|
|---|
| 863 | size = sizeof(BOOL);
|
|---|
| 864 | PrfQueryProfileData(fmprof, appname, "FilesInTree",
|
|---|
| 865 | (PVOID) & fFilesInTree, &size);
|
|---|
| 866 | size = sizeof(BOOL);
|
|---|
| 867 | PrfQueryProfileData(fmprof, FM3Str, "TopDir", (PVOID) & fTopDir, &size);
|
|---|
| 868 | size = sizeof(BOOL);
|
|---|
| 869 | PrfQueryProfileData(fmprof, FM3Str, "LookInDir", (PVOID) & fLookInDir,
|
|---|
| 870 | &size);
|
|---|
| 871 | PrfQueryProfileString(fmprof, appname, "DefArc", NULL, szDefArc,
|
|---|
| 872 | sizeof(szDefArc));
|
|---|
| 873 | size = sizeof(ULONG);
|
|---|
| 874 | PrfQueryProfileData(fmprof, FM3Str, "AutoviewHeight",
|
|---|
| 875 | (PVOID) & AutoviewHeight, &size);
|
|---|
| 876 | size = sizeof(BOOL);
|
|---|
| 877 | PrfQueryProfileData(fmprof, FM3Str, "KeepCmdLine", (PVOID) & fKeepCmdLine,
|
|---|
| 878 | &size);
|
|---|
| 879 | if (strcmp(realappname, "FM/4")) {
|
|---|
| 880 | size = sizeof(BOOL);
|
|---|
| 881 | PrfQueryProfileData(fmprof,
|
|---|
| 882 | FM3Str, "MoreButtons", (PVOID) & fMoreButtons, &size);
|
|---|
| 883 | size = sizeof(BOOL);
|
|---|
| 884 | PrfQueryProfileData(fmprof,
|
|---|
| 885 | FM3Str, "Drivebar", (PVOID) & fDrivebar, &size);
|
|---|
| 886 | }
|
|---|
| 887 | else
|
|---|
| 888 | fDrivebar = fMoreButtons = TRUE;
|
|---|
| 889 | size = sizeof(BOOL);
|
|---|
| 890 | PrfQueryProfileData(fmprof,
|
|---|
| 891 | appname, "NoSearch", (PVOID) & fNoSearch, &size);
|
|---|
| 892 | size = sizeof(BOOL);
|
|---|
| 893 | PrfQueryProfileData(fmprof,
|
|---|
| 894 | appname, "GuessType", (PVOID) & fGuessType, &size);
|
|---|
| 895 | size = sizeof(BOOL);
|
|---|
| 896 | PrfQueryProfileData(fmprof,
|
|---|
| 897 | appname, "ViewChild", (PVOID) & fViewChild, &size);
|
|---|
| 898 | size = sizeof(BOOL);
|
|---|
| 899 | PrfQueryProfileData(fmprof, appname, "ShowEnv", (PVOID) & fShowEnv, &size);
|
|---|
| 900 | size = sizeof(BOOL);
|
|---|
| 901 | PrfQueryProfileData(fmprof,
|
|---|
| 902 | appname, "LeaveTree", (PVOID) & fLeaveTree, &size);
|
|---|
| 903 | size = sizeof(BOOL);
|
|---|
| 904 | PrfQueryProfileData(fmprof, FM3Str, "Comments", (PVOID) & fComments, &size);
|
|---|
| 905 | size = sizeof(ULONG);
|
|---|
| 906 | PrfQueryProfileData(fmprof, appname, "WS_ANIMATE", (PVOID) & fwsAnimate,
|
|---|
| 907 | &size);
|
|---|
| 908 | if (fwsAnimate)
|
|---|
| 909 | fwsAnimate = WS_ANIMATE;
|
|---|
| 910 | size = sizeof(ULONG);
|
|---|
| 911 | size = sizeof(BOOL);
|
|---|
| 912 | PrfQueryProfileData(fmprof, appname, "SelectedAlways",
|
|---|
| 913 | (PVOID) & fSelectedAlways, &size);
|
|---|
| 914 | size = sizeof(BOOL);
|
|---|
| 915 | PrfQueryProfileData(fmprof, FM3Str, "ToolbarHelp", (PVOID) & fToolbarHelp,
|
|---|
| 916 | &size);
|
|---|
| 917 | size = sizeof(BOOL);
|
|---|
| 918 | PrfQueryProfileData(fmprof, FM3Str, "OtherHelp", (PVOID) & fOtherHelp,
|
|---|
| 919 | &size);
|
|---|
| 920 | size = sizeof(BOOL);
|
|---|
| 921 | PrfQueryProfileData(fmprof, FM3Str, "DrivebarHelp", (PVOID) & fDrivebarHelp,
|
|---|
| 922 | &size);
|
|---|
| 923 | size = sizeof(BOOL);
|
|---|
| 924 | PrfQueryProfileData(fmprof,
|
|---|
| 925 | appname, "AutoAddDirs", (PVOID) & fAutoAddDirs, &size);
|
|---|
| 926 | size = sizeof(BOOL);
|
|---|
| 927 | PrfQueryProfileData(fmprof,
|
|---|
| 928 | appname,
|
|---|
| 929 | "AutoAddAllDirs", (PVOID) & fAutoAddAllDirs, &size);
|
|---|
| 930 | size = sizeof(BOOL);
|
|---|
| 931 | PrfQueryProfileData(fmprof, FM3Str, "UserListSwitches",
|
|---|
| 932 | (PVOID) & fUserListSwitches, &size);
|
|---|
| 933 | size = sizeof(BOOL);
|
|---|
| 934 | PrfQueryProfileData(fmprof, appname, "UseNewViewer",
|
|---|
| 935 | (PVOID) & fUseNewViewer, &size);
|
|---|
| 936 | size = sizeof(BOOL);
|
|---|
| 937 | PrfQueryProfileData(fmprof, appname, "DefaultDeletePerm",
|
|---|
| 938 | (PVOID) & fDefaultDeletePerm, &size);
|
|---|
| 939 | size = sizeof(BOOL);
|
|---|
| 940 | PrfQueryProfileData(fmprof, FM3Str, "ExternalINIs",
|
|---|
| 941 | (PVOID) & fExternalINIs, &size);
|
|---|
| 942 | size = sizeof(BOOL);
|
|---|
| 943 | PrfQueryProfileData(fmprof, FM3Str, "ExternalCollector",
|
|---|
| 944 | (PVOID) & fExternalCollector, &size);
|
|---|
| 945 | size = sizeof(BOOL);
|
|---|
| 946 | PrfQueryProfileData(fmprof, FM3Str, "ExternalArcboxes",
|
|---|
| 947 | (PVOID) & fExternalArcboxes, &size);
|
|---|
| 948 | size = sizeof(BOOL);
|
|---|
| 949 | PrfQueryProfileData(fmprof, FM3Str, "ExternalViewer",
|
|---|
| 950 | (PVOID) & fExternalViewer, &size);
|
|---|
| 951 | size = sizeof(BOOL);
|
|---|
| 952 | PrfQueryProfileData(fmprof, FM3Str, "UseQProcStat",
|
|---|
| 953 | (PVOID) & fUseQProcStat, &size);
|
|---|
| 954 | size = sizeof(BOOL);
|
|---|
| 955 | PrfQueryProfileData(fmprof, FM3Str, "DataMin", (PVOID) & fDataMin, &size);
|
|---|
| 956 | size = sizeof(BOOL);
|
|---|
| 957 | PrfQueryProfileData(fmprof, appname, "DataToFore", (PVOID) & fDataToFore,
|
|---|
| 958 | &size);
|
|---|
| 959 | size = sizeof(BOOL);
|
|---|
| 960 | PrfQueryProfileData(fmprof, appname, "DataShowDrives",
|
|---|
| 961 | (PVOID) & fDataShowDrives, &size);
|
|---|
| 962 | size = sizeof(BOOL);
|
|---|
| 963 | PrfQueryProfileData(fmprof, appname, "DataInclRemote",
|
|---|
| 964 | (PVOID) & fDataInclRemote, &size);
|
|---|
| 965 | size = sizeof(BOOL);
|
|---|
| 966 | PrfQueryProfileData(fmprof, FM3Str, "SplitStatus", (PVOID) & fSplitStatus,
|
|---|
| 967 | &size);
|
|---|
| 968 | size = sizeof(BOOL);
|
|---|
| 969 | PrfQueryProfileData(fmprof, appname, "FolderAfterExtract",
|
|---|
| 970 | (PVOID) & fFolderAfterExtract, &size);
|
|---|
| 971 | size = sizeof(BOOL);
|
|---|
| 972 | PrfQueryProfileData(fmprof, FM3Str, "DullDatabar", (PVOID) & fDullMin,
|
|---|
| 973 | &size);
|
|---|
| 974 | size = sizeof(BOOL);
|
|---|
| 975 | PrfQueryProfileData(fmprof, appname, "BlueLED", (PVOID) & fBlueLED, &size);
|
|---|
| 976 | size = sizeof(BOOL);
|
|---|
| 977 | PrfQueryProfileData(fmprof, appname, "ConfirmDelete",
|
|---|
| 978 | (PVOID) & fConfirmDelete, &size);
|
|---|
| 979 | size = sizeof(BOOL);
|
|---|
| 980 | PrfQueryProfileData(fmprof, FM3Str, "SaveState", (PVOID) & fSaveState,
|
|---|
| 981 | &size);
|
|---|
| 982 | size = sizeof(BOOL);
|
|---|
| 983 | PrfQueryProfileData(fmprof, appname, "SyncUpdates", (PVOID) & fSyncUpdates,
|
|---|
| 984 | &size);
|
|---|
| 985 | size = sizeof(BOOL);
|
|---|
| 986 | PrfQueryProfileData(fmprof, appname, "LoadSubject", (PVOID) & fLoadSubject,
|
|---|
| 987 | &size);
|
|---|
| 988 | size = sizeof(BOOL);
|
|---|
| 989 | PrfQueryProfileData(fmprof, appname, "UnHilite", (PVOID) & fUnHilite,
|
|---|
| 990 | &size);
|
|---|
| 991 | size = sizeof(BOOL);
|
|---|
| 992 | PrfQueryProfileData(fmprof, FM3Str, "TileBackwards",
|
|---|
| 993 | (PVOID) & fTileBackwards, &size);
|
|---|
| 994 | size = sizeof(BOOL);
|
|---|
| 995 | PrfQueryProfileData(fmprof, appname, "LoadLongname",
|
|---|
| 996 | (PVOID) & fLoadLongnames, &size);
|
|---|
| 997 | size = sizeof(BOOL);
|
|---|
| 998 | PrfQueryProfileData(fmprof, appname, "VerifyWrites", (PVOID) & fVerify,
|
|---|
| 999 | &size);
|
|---|
| 1000 | DosSetVerify(fVerify);
|
|---|
| 1001 | size = sizeof(BOOL);
|
|---|
| 1002 | PrfQueryProfileData(fmprof, appname, "DontMoveMouse",
|
|---|
| 1003 | (PVOID) & fDontMoveMouse, &size);
|
|---|
| 1004 | size = sizeof(BOOL);
|
|---|
| 1005 | PrfQueryProfileData(fmprof, appname, "NoIconsFiles",
|
|---|
| 1006 | (PVOID) & fNoIconsFiles, &size);
|
|---|
| 1007 | size = sizeof(BOOL);
|
|---|
| 1008 | PrfQueryProfileData(fmprof, appname, "NoIconsDirs", (PVOID) & fNoIconsDirs,
|
|---|
| 1009 | &size);
|
|---|
| 1010 | size = sizeof(BOOL);
|
|---|
| 1011 | PrfQueryProfileData(fmprof, appname, "ForceUpper", (PVOID) & fForceUpper,
|
|---|
| 1012 | &size);
|
|---|
| 1013 | size = sizeof(BOOL);
|
|---|
| 1014 | PrfQueryProfileData(fmprof, appname, "ForceLower", (PVOID) & fForceLower,
|
|---|
| 1015 | &size);
|
|---|
| 1016 | size = sizeof(BOOL);
|
|---|
| 1017 | PrfQueryProfileData(fmprof, FM3Str, "TextTools", (PVOID) & fTextTools,
|
|---|
| 1018 | &size);
|
|---|
| 1019 | size = sizeof(BOOL);
|
|---|
| 1020 | PrfQueryProfileData(fmprof, FM3Str, "ToolTitles", (PVOID) & fToolTitles,
|
|---|
| 1021 | &size);
|
|---|
| 1022 | size = sizeof(BOOL);
|
|---|
| 1023 | PrfQueryProfileData(fmprof, appname, "DoubleClickOpens", (PVOID) & fDCOpens,
|
|---|
| 1024 | &size);
|
|---|
| 1025 | size = sizeof(BOOL);
|
|---|
| 1026 | PrfQueryProfileData(fmprof, appname, "LinkSetsIcon",
|
|---|
| 1027 | (PVOID) & fLinkSetsIcon, &size);
|
|---|
| 1028 | size = sizeof(INT);
|
|---|
| 1029 | PrfQueryProfileData(fmprof, appname, "Sort", (PVOID) & sortFlags, &size);
|
|---|
| 1030 | size = sizeof(INT);
|
|---|
| 1031 | PrfQueryProfileData(fmprof, appname, "TreeSort", (PVOID) & TreesortFlags,
|
|---|
| 1032 | &size);
|
|---|
| 1033 | size = sizeof(INT);
|
|---|
| 1034 | PrfQueryProfileData(fmprof,
|
|---|
| 1035 | appname,
|
|---|
| 1036 | "CollectorSort", (PVOID) & CollectorsortFlags, &size);
|
|---|
| 1037 | size = sizeof(targetdir);
|
|---|
| 1038 | PrfQueryProfileData(fmprof, appname, "Targetdir", (PVOID) targetdir, &size);
|
|---|
| 1039 | if (!IsValidDir(targetdir))
|
|---|
| 1040 | *targetdir = 0;
|
|---|
| 1041 | size = sizeof(extractpath);
|
|---|
| 1042 | PrfQueryProfileData(fmprof,
|
|---|
| 1043 | appname, "ExtractPath", (PVOID) extractpath, &size);
|
|---|
| 1044 | if (!IsValidDir(extractpath))
|
|---|
| 1045 | *extractpath = 0;
|
|---|
| 1046 | size = sizeof(printer);
|
|---|
| 1047 | PrfQueryProfileData(fmprof, appname, "Printer", (PVOID) printer, &size);
|
|---|
| 1048 | size = sizeof(dircompare);
|
|---|
| 1049 | PrfQueryProfileData(fmprof, appname, "DirCompare", (PVOID) dircompare,
|
|---|
| 1050 | &size);
|
|---|
| 1051 | size = sizeof(viewer);
|
|---|
| 1052 | PrfQueryProfileData(fmprof, appname, "Viewer", (PVOID) viewer, &size);
|
|---|
| 1053 | size = sizeof(editor);
|
|---|
| 1054 | PrfQueryProfileData(fmprof, appname, "Editor", (PVOID) editor, &size);
|
|---|
| 1055 | size = sizeof(binview);
|
|---|
| 1056 | PrfQueryProfileData(fmprof, appname, "BinView", (PVOID) binview, &size);
|
|---|
| 1057 | size = sizeof(bined);
|
|---|
| 1058 | PrfQueryProfileData(fmprof, appname, "BinEd", (PVOID) bined, &size);
|
|---|
| 1059 | size = sizeof(compare);
|
|---|
| 1060 | PrfQueryProfileData(fmprof, appname, "Compare", (PVOID) compare, &size);
|
|---|
| 1061 | size = sizeof(virus);
|
|---|
| 1062 | PrfQueryProfileData(fmprof, appname, "Virus", (PVOID) virus, &size);
|
|---|
| 1063 | size = sizeof(ftprun);
|
|---|
| 1064 | PrfQueryProfileData(fmprof, appname, "FTPRun", (PVOID) ftprun, &size);
|
|---|
| 1065 | if (!*ftprun && !size)
|
|---|
| 1066 | strcpy(ftprun, "ftppm.exe");
|
|---|
| 1067 | size = sizeof(httprun);
|
|---|
| 1068 | PrfQueryProfileData(fmprof, appname, "HTTPRun", (PVOID) httprun, &size);
|
|---|
| 1069 | if (!*httprun && !size)
|
|---|
| 1070 | strcpy(httprun, "explore.exe -q");
|
|---|
| 1071 | size = sizeof(lasttoolbox);
|
|---|
| 1072 | PrfQueryProfileData(fmprof, FM3Str, "LastToolBox", (PVOID) lasttoolbox,
|
|---|
| 1073 | &size);
|
|---|
| 1074 | size = sizeof(BOOL);
|
|---|
| 1075 | PrfQueryProfileData(fmprof, appname, "FollowTree", (PVOID) & fFollowTree,
|
|---|
| 1076 | &size);
|
|---|
| 1077 | size = sizeof(BOOL);
|
|---|
| 1078 | PrfQueryProfileData(fmprof, appname, "StartMaximized",
|
|---|
| 1079 | (PVOID) & fStartMaximized, &size);
|
|---|
| 1080 | if (!fStartMaximized) {
|
|---|
| 1081 | size = sizeof(BOOL);
|
|---|
| 1082 | PrfQueryProfileData(fmprof, appname, "StartMinimized",
|
|---|
| 1083 | (PVOID) & fStartMinimized, &size);
|
|---|
| 1084 | }
|
|---|
| 1085 | size = sizeof(BOOL);
|
|---|
| 1086 | PrfQueryProfileData(fmprof, appname, "DefaultCopy", (PVOID) & fCopyDefault,
|
|---|
| 1087 | &size);
|
|---|
| 1088 | size = sizeof(BOOL);
|
|---|
| 1089 | PrfQueryProfileData(fmprof, appname, "IdleCopy", (PVOID) & fRealIdle,
|
|---|
| 1090 | &size);
|
|---|
| 1091 | size = sizeof(BOOL);
|
|---|
| 1092 | PrfQueryProfileData(fmprof, appname, "ArcStuffVisible",
|
|---|
| 1093 | (PVOID) & fArcStuffVisible, &size);
|
|---|
| 1094 | size = sizeof(BOOL);
|
|---|
| 1095 | PrfQueryProfileData(fmprof, FM3Str, "NoTreeGap", (PVOID) & fNoTreeGap,
|
|---|
| 1096 | &size);
|
|---|
| 1097 | size = sizeof(BOOL);
|
|---|
| 1098 | PrfQueryProfileData(fmprof, FM3Str, "VTreeOpensWPS",
|
|---|
| 1099 | (PVOID) & fVTreeOpensWPS, &size);
|
|---|
| 1100 | size = sizeof(BOOL);
|
|---|
| 1101 | PrfQueryProfileData(fmprof, appname, "RemoteBug", (PVOID) & fRemoteBug,
|
|---|
| 1102 | &size);
|
|---|
| 1103 | size = sizeof(BOOL);
|
|---|
| 1104 | PrfQueryProfileData(fmprof, appname, "Drag&DropDlg",
|
|---|
| 1105 | (PVOID) & fDragndropDlg, &size);
|
|---|
| 1106 | size = sizeof(BOOL);
|
|---|
| 1107 | PrfQueryProfileData(fmprof, FM3Str, "UserComboBox", (PVOID) & fUserComboBox,
|
|---|
| 1108 | &size);
|
|---|
| 1109 | size = sizeof(BOOL);
|
|---|
| 1110 | PrfQueryProfileData(fmprof, FM3Str, "MinDirOnOpen", (PVOID) & fMinOnOpen,
|
|---|
| 1111 | &size);
|
|---|
| 1112 | size = sizeof(BOOL);
|
|---|
| 1113 | PrfQueryProfileData(fmprof, appname, "QuickArcFind",
|
|---|
| 1114 | (PVOID) & fQuickArcFind, &size);
|
|---|
| 1115 | size = sizeof(BOOL);
|
|---|
| 1116 | PrfQueryProfileData(fmprof, FM3Str, "NoRemovableScan",
|
|---|
| 1117 | (PVOID) & fNoRemovableScan, &size);
|
|---|
| 1118 | size = sizeof(ULONG);
|
|---|
| 1119 | PrfQueryProfileData(fmprof, FM3Str, "NoBrokenNotify",
|
|---|
| 1120 | (PVOID) & NoBrokenNotify, &size);
|
|---|
| 1121 | size = sizeof(ULONG);
|
|---|
| 1122 | PrfQueryProfileData(fmprof, appname, "ContainerType", (PVOID) & ulCnrType,
|
|---|
| 1123 | &size);
|
|---|
| 1124 | size = sizeof(ULONG);
|
|---|
| 1125 | PrfQueryProfileData(fmprof, appname, "FilesToGet", (PVOID) & FilesToGet,
|
|---|
| 1126 | &size);
|
|---|
| 1127 | size = sizeof(BOOL);
|
|---|
| 1128 | PrfQueryProfileData(fmprof, FM3Str, "AutoView", (PVOID) & fAutoView, &size);
|
|---|
| 1129 | size = sizeof(BOOL);
|
|---|
| 1130 | PrfQueryProfileData(fmprof, FM3Str, "FM2Deletes", (PVOID) & fFM2Deletes,
|
|---|
| 1131 | &size);
|
|---|
| 1132 |
|
|---|
| 1133 | /* load pointers and icons we use */
|
|---|
| 1134 | hptrArrow = WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, FALSE);
|
|---|
| 1135 | hptrBusy = WinQuerySysPointer(HWND_DESKTOP, SPTR_WAIT, FALSE);
|
|---|
| 1136 | hptrNS = WinQuerySysPointer(HWND_DESKTOP, SPTR_SIZENS, FALSE);
|
|---|
| 1137 | hptrEW = WinQuerySysPointer(HWND_DESKTOP, SPTR_SIZEWE, FALSE);
|
|---|
| 1138 | hptrFloppy = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FLOPPY_ICON);
|
|---|
| 1139 | hptrDrive = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DRIVE_ICON);
|
|---|
| 1140 | hptrRemovable = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, REMOVABLE_ICON);
|
|---|
| 1141 | hptrCDROM = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, CDROM_ICON);
|
|---|
| 1142 | hptrFile = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_ICON);
|
|---|
| 1143 | hptrDir = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DIR_FRAME);
|
|---|
| 1144 | hptrArc = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ARC_FRAME);
|
|---|
| 1145 | hptrArt = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ART_ICON);
|
|---|
| 1146 | hptrSystem = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_SYSTEM_ICON);
|
|---|
| 1147 | hptrHidden = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_HIDDEN_ICON);
|
|---|
| 1148 | hptrReadonly = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_READONLY_ICON);
|
|---|
| 1149 | hptrLast = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, LASTITEM_ICON);
|
|---|
| 1150 | hptrRemote = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, REMOTE_ICON);
|
|---|
| 1151 | hptrVirtual = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, VIRTUAL_ICON);
|
|---|
| 1152 | hptrRamdisk = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, RAMDISK_ICON);
|
|---|
| 1153 | if (!fNoDead)
|
|---|
| 1154 | hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER_ICON);
|
|---|
| 1155 | else
|
|---|
| 1156 | hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER2_ICON);
|
|---|
| 1157 | hptrApp = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, APP_ICON);
|
|---|
| 1158 | hptrDunno = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DUNNO_ICON);
|
|---|
| 1159 | hptrEnv = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ENV_ICON);
|
|---|
| 1160 | hptrZipstrm = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ZIPSTREAM_ICON);
|
|---|
| 1161 |
|
|---|
| 1162 | // set up color array used by seeall.c and newview.c color dialog
|
|---|
| 1163 |
|
|---|
| 1164 | standardcolors[0] = CLR_WHITE;
|
|---|
| 1165 | standardcolors[1] = CLR_BLACK;
|
|---|
| 1166 | standardcolors[2] = CLR_BLUE;
|
|---|
| 1167 | standardcolors[3] = CLR_RED;
|
|---|
| 1168 | standardcolors[4] = CLR_PINK;
|
|---|
| 1169 | standardcolors[5] = CLR_GREEN;
|
|---|
| 1170 | standardcolors[6] = CLR_CYAN;
|
|---|
| 1171 | standardcolors[7] = CLR_YELLOW;
|
|---|
| 1172 | standardcolors[8] = CLR_DARKGRAY;
|
|---|
| 1173 | standardcolors[9] = CLR_DARKBLUE;
|
|---|
| 1174 | standardcolors[10] = CLR_DARKRED;
|
|---|
| 1175 | standardcolors[11] = CLR_DARKPINK;
|
|---|
| 1176 | standardcolors[12] = CLR_DARKGREEN;
|
|---|
| 1177 | standardcolors[13] = CLR_DARKCYAN;
|
|---|
| 1178 | standardcolors[14] = CLR_BROWN;
|
|---|
| 1179 | standardcolors[15] = CLR_PALEGRAY;
|
|---|
| 1180 |
|
|---|
| 1181 | return TRUE;
|
|---|
| 1182 | }
|
|---|
| 1183 |
|
|---|
| 1184 | HWND StartFM3(HAB hab, INT argc, CHAR ** argv)
|
|---|
| 1185 | {
|
|---|
| 1186 | HWND hwndFrame;
|
|---|
| 1187 | HWND hwndClient;
|
|---|
| 1188 | UINT x;
|
|---|
| 1189 | ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
|
|---|
| 1190 | FCF_SIZEBORDER | FCF_MINMAX |
|
|---|
| 1191 | FCF_ACCELTABLE | FCF_MENU | FCF_ICON | FCF_TASKLIST | FCF_NOBYTEALIGN;
|
|---|
| 1192 |
|
|---|
| 1193 | for (x = 1; x < argc; x++) {
|
|---|
| 1194 | if (*argv[x] == '~' && !argv[x][1])
|
|---|
| 1195 | fReminimize = TRUE;
|
|---|
| 1196 | if (*argv[x] == '+' && !argv[x][1])
|
|---|
| 1197 | fLogFile = TRUE;
|
|---|
| 1198 | if (*argv[x] == '-') {
|
|---|
| 1199 | if (!argv[x][1])
|
|---|
| 1200 | fNoSaveState = TRUE;
|
|---|
| 1201 | else
|
|---|
| 1202 | strcpy(profile, &argv[x][1]);
|
|---|
| 1203 | }
|
|---|
| 1204 | }
|
|---|
| 1205 |
|
|---|
| 1206 | hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
|
|---|
| 1207 | WS_VISIBLE,
|
|---|
| 1208 | &FrameFlags,
|
|---|
| 1209 | GetPString(IDS_WCMAINWND),
|
|---|
| 1210 | NULL,
|
|---|
| 1211 | WS_VISIBLE | WS_ANIMATE,
|
|---|
| 1212 | FM3ModHandle, MAIN_FRAME, &hwndClient);
|
|---|
| 1213 | if (hwndFrame) {
|
|---|
| 1214 | WinSetWindowUShort(hwndFrame, QWS_ID, MAIN_FRAME);
|
|---|
| 1215 | if (!WinRestoreWindowPos(FM2Str, "MainWindowPos", hwndFrame)) {
|
|---|
| 1216 |
|
|---|
| 1217 | ULONG fl = SWP_MOVE | SWP_SIZE;
|
|---|
| 1218 | RECTL rcl;
|
|---|
| 1219 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 3L;
|
|---|
| 1220 | ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
|
|---|
| 1221 |
|
|---|
| 1222 | WinQueryWindowRect(HWND_DESKTOP, &rcl);
|
|---|
| 1223 | rcl.yBottom += icz;
|
|---|
| 1224 | rcl.yTop -= bsz;
|
|---|
| 1225 | rcl.xLeft += bsz;
|
|---|
| 1226 | rcl.xRight -= bsz;
|
|---|
| 1227 | WinSetWindowPos(hwndFrame,
|
|---|
| 1228 | HWND_TOP,
|
|---|
| 1229 | rcl.xLeft,
|
|---|
| 1230 | rcl.yBottom,
|
|---|
| 1231 | rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, fl);
|
|---|
| 1232 | }
|
|---|
| 1233 | if (fLogFile)
|
|---|
| 1234 | LogFileHandle = _fsopen("FM2.LOG", "a+", SH_DENYWR);
|
|---|
| 1235 | if (hwndHelp)
|
|---|
| 1236 | WinAssociateHelpInstance(hwndHelp, hwndFrame);
|
|---|
| 1237 | PostMsg(hwndClient, UM_SETUP, MPFROMLONG(argc), MPFROMP(argv));
|
|---|
| 1238 | }
|
|---|
| 1239 | return hwndFrame;
|
|---|
| 1240 | }
|
|---|
| 1241 |
|
|---|
| 1242 | int CheckVersion(int vermajor, int verminor)
|
|---|
| 1243 | {
|
|---|
| 1244 | int ok = 0;
|
|---|
| 1245 |
|
|---|
| 1246 | // fixme to do useful check - was missing in base source
|
|---|
| 1247 |
|
|---|
| 1248 | #if 0
|
|---|
| 1249 | if (vermajor && verminor) {
|
|---|
| 1250 | *vermajor = VERMAJOR;
|
|---|
| 1251 | *verminor = VERMINOR;
|
|---|
| 1252 | ok = 1;
|
|---|
| 1253 | }
|
|---|
| 1254 | #endif
|
|---|
| 1255 |
|
|---|
| 1256 | ok = 1;
|
|---|
| 1257 |
|
|---|
| 1258 | return ok;
|
|---|
| 1259 | }
|
|---|