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