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