1 |
|
---|
2 | /***********************************************************************
|
---|
3 |
|
---|
4 | $Id: autoview.c 1204 2008-09-13 06:46:54Z jbs $
|
---|
5 |
|
---|
6 | Auto view
|
---|
7 |
|
---|
8 | Copyright (c) 1993-98 M. Kimes
|
---|
9 | Copyright (c) 2001, 2008 Steven H.Levine
|
---|
10 |
|
---|
11 | 12 Sep 02 SHL AutoObjProc: catch buff2 overflows
|
---|
12 | 25 Oct 02 SHL CreateHexDump: catch buffer overflow
|
---|
13 | 12 Feb 03 SHL AutoObjProc: standardize EA math
|
---|
14 | 23 May 05 SHL Use QWL_USER
|
---|
15 | 29 May 06 SHL Sync with archiver.bb2 mods
|
---|
16 | 22 Jul 06 SHL Check more run time errors
|
---|
17 | 15 Aug 06 SHL Use Runtime_Error more
|
---|
18 | 03 Nov 06 SHL Renames
|
---|
19 | 30 Mar 07 GKY Remove GetPString for window class names
|
---|
20 | 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
|
---|
21 | 01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry
|
---|
22 | 27 Sep 07 SHL Correct ULONGLONG size formatting
|
---|
23 | 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
|
---|
24 | 30 Dec 07 GKY Use CommaFmtULL
|
---|
25 | 29 Feb 08 GKY Use xfree where appropriate
|
---|
26 |
|
---|
27 | ***********************************************************************/
|
---|
28 |
|
---|
29 | #include <stdlib.h>
|
---|
30 | #include <string.h>
|
---|
31 | #include <ctype.h>
|
---|
32 | #include <process.h> // _beginthread
|
---|
33 |
|
---|
34 | #define INCL_DOS
|
---|
35 | #define INCL_WIN
|
---|
36 | #define INCL_GPI
|
---|
37 | #define INCL_LONGLONG
|
---|
38 |
|
---|
39 | #include "fm3dll.h"
|
---|
40 | #include "killproc.h" // Data declaration(s)
|
---|
41 | #include "notebook.h" // Data declaration(s)
|
---|
42 | #include "avl.h" // Data declaration(s)
|
---|
43 | #include "inis.h" // Data declaration(s)
|
---|
44 | #include "init.h" // Data declaration(s)
|
---|
45 | #include "mainwnd.h" // Data declaration(s)
|
---|
46 | #include "fm3dlg.h"
|
---|
47 | #include "fm3str.h"
|
---|
48 | #include "mle.h"
|
---|
49 | #include "pathutil.h" // BldFullPathName
|
---|
50 | #include "errutil.h" // Dos_Error...
|
---|
51 | #include "strutil.h" // GetPString
|
---|
52 | #include "autoview.h"
|
---|
53 | #include "defview.h" // DefaultView
|
---|
54 | #include "valid.h" // IsBinary
|
---|
55 | #include "misc.h" // CheckMenu
|
---|
56 | #include "common.h" // CommonTextButton
|
---|
57 | #include "presparm.h" // CopyPresParams
|
---|
58 | #include "eas.h" // DisplayEAsProc
|
---|
59 | #include "chklist.h" // PopupMenu
|
---|
60 | #include "wrappers.h" // xDosSetPathInfo
|
---|
61 | #include "commafmt.h" // CommaFmtULL
|
---|
62 | #include "fortify.h"
|
---|
63 |
|
---|
64 | static BOOL PutComments(HWND hwnd, CHAR * filename, CHAR * comments);
|
---|
65 | static BOOL WriteEA(HWND hwnd, CHAR * filename, CHAR * eaname, USHORT type,
|
---|
66 | CHAR * data);
|
---|
67 |
|
---|
68 | // Data definitions
|
---|
69 | #pragma data_seg(GLOBAL1)
|
---|
70 | HWND hwndAutoMLE;
|
---|
71 |
|
---|
72 | #pragma data_seg(GLOBAL2)
|
---|
73 | ULONG AutoviewHeight;
|
---|
74 |
|
---|
75 | #pragma data_seg(DATA1)
|
---|
76 | static PSZ pszSrcFile = __FILE__;
|
---|
77 |
|
---|
78 | static HWND AutoMenu;
|
---|
79 | static HWND hwndAutoObj;
|
---|
80 | static CHAR stopflag;
|
---|
81 | static CHAR currfile[CCHMAXPATH];
|
---|
82 |
|
---|
83 | BOOL WriteEA(HWND hwnd, CHAR * filename, CHAR * eaname, USHORT type,
|
---|
84 | CHAR * data)
|
---|
85 | {
|
---|
86 | /* save an ea to disk */
|
---|
87 |
|
---|
88 | FEA2LIST *pfealist = NULL;
|
---|
89 | EAOP2 eaop;
|
---|
90 | APIRET rc;
|
---|
91 | ULONG ealen;
|
---|
92 | USHORT len, *num, *plen, usCodepage;
|
---|
93 | CHAR *p, *eaval;
|
---|
94 | BOOL ret = FALSE;
|
---|
95 |
|
---|
96 | if (!filename || !eaname)
|
---|
97 | return ret;
|
---|
98 | usCodepage = (USHORT) WinQueryCp(WinQueryWindowULong(hwnd, QWL_HMQ));
|
---|
99 | len = (data) ? strlen(data) : 0;
|
---|
100 | ealen = sizeof(FEA2LIST) + 24L + strlen(eaname) + 1L + (ULONG) len + 4L;
|
---|
101 | switch (type) {
|
---|
102 | case EAT_EA:
|
---|
103 | case EAT_ASCII:
|
---|
104 | break;
|
---|
105 | case EAT_MVST:
|
---|
106 | if (data) {
|
---|
107 | ealen += sizeof(USHORT) * 5;
|
---|
108 | p = data;
|
---|
109 | while (*p) {
|
---|
110 | if (*p == '\n' && *(p + 1))
|
---|
111 | ealen += sizeof(USHORT);
|
---|
112 | p++;
|
---|
113 | }
|
---|
114 | }
|
---|
115 | break;
|
---|
116 | case EAT_MVMT:
|
---|
117 | if (data) {
|
---|
118 | ealen += sizeof(USHORT) * 5;
|
---|
119 | p = data;
|
---|
120 | while (*p) {
|
---|
121 | if (*p == '\n' && *(p + 1))
|
---|
122 | ealen += (sizeof(USHORT) * 2);
|
---|
123 | p++;
|
---|
124 | }
|
---|
125 | }
|
---|
126 | break;
|
---|
127 | default:
|
---|
128 | return ret;
|
---|
129 | }
|
---|
130 |
|
---|
131 | rc = DosAllocMem((PPVOID) & pfealist, ealen, PAG_COMMIT | PAG_READ |
|
---|
132 | PAG_WRITE | OBJ_TILE);
|
---|
133 | if (rc || !pfealist)
|
---|
134 | Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__,
|
---|
135 | GetPString(IDS_OUTOFMEMORY));
|
---|
136 | else {
|
---|
137 | memset(pfealist, 0, ealen);
|
---|
138 | pfealist->list[0].cbName = strlen(eaname);
|
---|
139 | memcpy(pfealist->list[0].szName, eaname, pfealist->list[0].cbName + 1);
|
---|
140 | eaval = pfealist->list[0].szName + pfealist->list[0].cbName + 1;
|
---|
141 | switch (type) {
|
---|
142 | case EAT_EA:
|
---|
143 | case EAT_ASCII:
|
---|
144 | if (data) {
|
---|
145 | *(USHORT *) eaval = (USHORT) type;
|
---|
146 | eaval += sizeof(USHORT);
|
---|
147 | *(USHORT *) eaval = (USHORT) len;
|
---|
148 | eaval += sizeof(USHORT);
|
---|
149 | memcpy(eaval, data, len);
|
---|
150 | eaval += len;
|
---|
151 | }
|
---|
152 | break;
|
---|
153 | case EAT_MVST:
|
---|
154 | if (data) {
|
---|
155 | *(USHORT *) eaval = (USHORT) EAT_MVST;
|
---|
156 | eaval += sizeof(USHORT);
|
---|
157 | *(USHORT *) eaval = usCodepage;
|
---|
158 | eaval += sizeof(USHORT);
|
---|
159 | num = (USHORT *) eaval;
|
---|
160 | *num = 0;
|
---|
161 | eaval += sizeof(USHORT);
|
---|
162 | *(USHORT *) eaval = (USHORT) EAT_ASCII;
|
---|
163 | eaval += sizeof(USHORT);
|
---|
164 | plen = (USHORT *) eaval;
|
---|
165 | *plen = 0;
|
---|
166 | eaval += sizeof(USHORT);
|
---|
167 | p = data;
|
---|
168 | while (*p) {
|
---|
169 | while (*p) {
|
---|
170 | if (*p == '\n') {
|
---|
171 | p++;
|
---|
172 | break;
|
---|
173 | }
|
---|
174 | *eaval++ = *p++;
|
---|
175 | (*plen)++;
|
---|
176 | }
|
---|
177 | if (*p || *plen)
|
---|
178 | (*num)++;
|
---|
179 | if (*p) {
|
---|
180 | plen = (USHORT *) eaval;
|
---|
181 | *plen = 0;
|
---|
182 | eaval += sizeof(USHORT);
|
---|
183 | }
|
---|
184 | }
|
---|
185 | }
|
---|
186 | break;
|
---|
187 | case EAT_MVMT:
|
---|
188 | if (data) {
|
---|
189 | *(USHORT *) eaval = (USHORT) EAT_MVMT;
|
---|
190 | eaval += sizeof(USHORT);
|
---|
191 | *(USHORT *) eaval = usCodepage;
|
---|
192 | eaval += sizeof(USHORT);
|
---|
193 | num = (USHORT *) eaval;
|
---|
194 | *num = 0;
|
---|
195 | eaval += sizeof(USHORT);
|
---|
196 | *(USHORT *) eaval = (USHORT) EAT_ASCII;
|
---|
197 | eaval += sizeof(USHORT);
|
---|
198 | plen = (USHORT *) eaval;
|
---|
199 | *plen = 0;
|
---|
200 | eaval += sizeof(USHORT);
|
---|
201 | p = data;
|
---|
202 | while (*p) {
|
---|
203 | while (*p) {
|
---|
204 | if (*p == '\n') {
|
---|
205 | p++;
|
---|
206 | break;
|
---|
207 | }
|
---|
208 | *eaval++ = *p++;
|
---|
209 | (*plen)++;
|
---|
210 | }
|
---|
211 | if (*p || *plen)
|
---|
212 | (*num)++;
|
---|
213 | if (*p) {
|
---|
214 | *(USHORT *) eaval = (USHORT) EAT_ASCII;
|
---|
215 | eaval += sizeof(USHORT);
|
---|
216 | plen = (USHORT *) eaval;
|
---|
217 | *plen = 0;
|
---|
218 | eaval += sizeof(USHORT);
|
---|
219 | }
|
---|
220 | }
|
---|
221 | }
|
---|
222 | break;
|
---|
223 | }
|
---|
224 | pfealist->list[0].cbValue = /*(ULONG)*/ (eaval -
|
---|
225 | (pfealist->list[0].szName +
|
---|
226 | pfealist->list[0].cbName + 1));
|
---|
227 | memset(&eaop, 0, sizeof(eaop));
|
---|
228 | eaop.fpFEA2List = pfealist;
|
---|
229 | pfealist->cbList = 13 + (ULONG) pfealist->list[0].cbName +
|
---|
230 | (ULONG) pfealist->list[0].cbValue;
|
---|
231 | rc = xDosSetPathInfo(filename, FIL_QUERYEASIZE,
|
---|
232 | &eaop, sizeof(eaop), DSPI_WRTTHRU);
|
---|
233 | DosFreeMem(pfealist);
|
---|
234 | if (!rc)
|
---|
235 | ret = TRUE;
|
---|
236 | }
|
---|
237 | return ret;
|
---|
238 | }
|
---|
239 |
|
---|
240 | BOOL PutComments(HWND hwnd, CHAR * filename, CHAR * comments)
|
---|
241 | {
|
---|
242 | register CHAR *p;
|
---|
243 |
|
---|
244 | if (comments) { /* check -- is it empty? */
|
---|
245 | p = comments;
|
---|
246 | while (*p && isspace(*p))
|
---|
247 | p++;
|
---|
248 | if (!*p)
|
---|
249 | comments = NULL;
|
---|
250 | }
|
---|
251 | return WriteEA(hwnd, filename, ".COMMENTS", EAT_MVMT, comments);
|
---|
252 | }
|
---|
253 |
|
---|
254 | static PSZ pszBufOvfMsg = "Buffer overflow";
|
---|
255 |
|
---|
256 | ULONG CreateHexDump(CHAR * pchInBuf, ULONG cbInBuf,
|
---|
257 | CHAR * pchOutBuf, ULONG cbOutBuf,
|
---|
258 | ULONG cOffset, BOOL fLongAddr)
|
---|
259 | {
|
---|
260 | register CHAR *pchIn, *pchReset, *pchOut;
|
---|
261 | register ULONG ibIn = 0, ibIn2, ibInFill;
|
---|
262 | ULONG cbOutLine = 6 + (fLongAddr ? 4 : 0) + 16 * 3 + 1 + 16 + 1;
|
---|
263 |
|
---|
264 | if (pchInBuf && cbInBuf && pchOutBuf && cbOutBuf) {
|
---|
265 | pchIn = pchInBuf;
|
---|
266 | pchOut = pchOutBuf;
|
---|
267 | if (cOffset)
|
---|
268 | *pchOut++ = '\n';
|
---|
269 | while (ibIn < cbInBuf) {
|
---|
270 | if (pchOut - pchOutBuf + cbOutLine >= cbOutBuf) {
|
---|
271 | Runtime_Error(pszSrcFile, __LINE__, pszBufOvfMsg);
|
---|
272 | break;
|
---|
273 | }
|
---|
274 | pchReset = pchIn;
|
---|
275 | ibIn2 = ibIn;
|
---|
276 | if (fLongAddr)
|
---|
277 | sprintf(pchOut, "%08lx ", ibIn + cOffset);
|
---|
278 | else
|
---|
279 | sprintf(pchOut, "%04lx ", ibIn + cOffset);
|
---|
280 | pchOut += 6 + (fLongAddr ? 4 : 0);
|
---|
281 | do {
|
---|
282 | sprintf(pchOut, "%02x ", (UCHAR)*pchIn);
|
---|
283 | pchOut += 3;
|
---|
284 | pchIn++;
|
---|
285 | ibIn++;
|
---|
286 | } while (ibIn < cbInBuf && (ibIn % 16));
|
---|
287 | if (ibIn % 16) {
|
---|
288 | ibInFill = ibIn;
|
---|
289 | while (ibInFill % 16) {
|
---|
290 | *pchOut++ = ' ';
|
---|
291 | *pchOut++ = ' ';
|
---|
292 | *pchOut++ = ' ';
|
---|
293 | ibInFill++;
|
---|
294 | }
|
---|
295 | }
|
---|
296 | *pchOut++ = ' ';
|
---|
297 | pchIn = pchReset;
|
---|
298 | do {
|
---|
299 | if (*pchIn && *pchIn != '\n' && *pchIn != '\r' && *pchIn != '\t'
|
---|
300 | && *pchIn != '\x1a')
|
---|
301 | *pchOut++ = *pchIn++;
|
---|
302 | else {
|
---|
303 | *pchOut++ = '.';
|
---|
304 | pchIn++;
|
---|
305 | }
|
---|
306 | ibIn2++;
|
---|
307 | } while (ibIn2 < ibIn);
|
---|
308 | if (ibIn < cbInBuf)
|
---|
309 | *pchOut++ = '\n';
|
---|
310 | } // while ibIn
|
---|
311 | *pchOut = 0;
|
---|
312 | return (ULONG) (pchOut - pchOutBuf);
|
---|
313 | }
|
---|
314 | return 0L;
|
---|
315 | }
|
---|
316 |
|
---|
317 | MRESULT EXPENTRY AutoObjProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
318 | {
|
---|
319 | switch (msg) {
|
---|
320 | case UM_LOADFILE:
|
---|
321 | *currfile = 0;
|
---|
322 | stopflag--;
|
---|
323 | if (fAutoView) {
|
---|
324 | WinSetWindowText((fComments) ? hwndAutoMLE : hwndAutoview, "");
|
---|
325 | MLEsetreadonly(hwndAutoMLE, TRUE);
|
---|
326 | MLEsetchanged(hwndAutoMLE, FALSE);
|
---|
327 | }
|
---|
328 | if (mp1) {
|
---|
329 | if (fAutoView) {
|
---|
330 | strcpy(currfile, (CHAR *)mp1);
|
---|
331 | if (!fComments) {
|
---|
332 | if (IsFile((CHAR *)mp1) == 1) {
|
---|
333 |
|
---|
334 | HFILE handle;
|
---|
335 | ULONG olen, ibufflen, action, obufflen, l;
|
---|
336 | CHAR *ibuff, *obuff, *p;
|
---|
337 | // 06 Oct 07 SHL Protect against NTFS driver small buffer defect
|
---|
338 | // CHAR buffer[80];
|
---|
339 | CHAR buffer[4096];
|
---|
340 | ARC_TYPE *info;
|
---|
341 |
|
---|
342 | if (!DosOpen((CHAR *)mp1,
|
---|
343 | &handle,
|
---|
344 | &action,
|
---|
345 | 0,
|
---|
346 | 0,
|
---|
347 | OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
|
---|
348 | OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NOINHERIT |
|
---|
349 | OPEN_FLAGS_RANDOMSEQUENTIAL | OPEN_SHARE_DENYNONE |
|
---|
350 | OPEN_ACCESS_READONLY, 0)) {
|
---|
351 | ibufflen = AutoviewHeight < 96 ? 512 : 3072;
|
---|
352 | // 06 Oct 07 SHL protect against NTFS driver small buffer defect
|
---|
353 | // ibuff = xmalloc(ibufflen + 2, pszSrcFile, __LINE__); // 05 Nov 07 SHL
|
---|
354 | ibuff = xmalloc(max(ibufflen + 2, 4096), pszSrcFile, __LINE__);
|
---|
355 | if (ibuff) {
|
---|
356 | // Depends on CreateHexDump line width
|
---|
357 | obufflen = (ibufflen / 16) * (6 + 3 * 16 + 1 + 16 + 1) + 80;
|
---|
358 | obuff = xmalloc(obufflen + 1, pszSrcFile, __LINE__);
|
---|
359 | if (obuff) {
|
---|
360 | *obuff = 0;
|
---|
361 | if (!DosRead(handle, ibuff, ibufflen, &ibufflen) &&
|
---|
362 | ibufflen)
|
---|
363 | {
|
---|
364 | ibuff[ibufflen] = 0;
|
---|
365 | p = obuff;
|
---|
366 | if (IsBinary(ibuff, ibufflen)) {
|
---|
367 | olen = ibufflen;
|
---|
368 | // Check archive
|
---|
369 | if (!arcsigsloaded)
|
---|
370 | load_archivers();
|
---|
371 | info = arcsighead;
|
---|
372 | while (info) {
|
---|
373 | if (info->signature && *info->signature) {
|
---|
374 | l = strlen(info->signature);
|
---|
375 | l = min(l, 79);
|
---|
376 | if (!DosChgFilePtr(handle, abs(info->file_offset),
|
---|
377 | (info->file_offset >= 0L) ?
|
---|
378 | FILE_BEGIN :
|
---|
379 | FILE_END, &ibufflen)) {
|
---|
380 | if (!DosRead(handle,
|
---|
381 | buffer,
|
---|
382 | l, &ibufflen) && ibufflen == l) {
|
---|
383 | if (!memcmp(info->signature, buffer, l))
|
---|
384 | break;
|
---|
385 | }
|
---|
386 | }
|
---|
387 | }
|
---|
388 | info = info->next;
|
---|
389 | }
|
---|
390 | if (info) {
|
---|
391 | sprintf(p, "**%s%s%s\n",
|
---|
392 | info->id ? info->id : "",
|
---|
393 | info->id ? " " : "",
|
---|
394 | GetPString(IDS_ARCHIVETEXT));
|
---|
395 | p += strlen(p);
|
---|
396 | }
|
---|
397 | CreateHexDump(ibuff, // Input buffer
|
---|
398 | olen, // Input buffer size
|
---|
399 | p, // Output buffer
|
---|
400 | obufflen - (p - obuff), // Output buffer size
|
---|
401 | 0, // Address offest
|
---|
402 | FALSE); // Short addresses
|
---|
403 | }
|
---|
404 | else {
|
---|
405 | // Text file
|
---|
406 | register CHAR *src, *dest;
|
---|
407 | CHAR *endsrc;
|
---|
408 |
|
---|
409 | src = ibuff;
|
---|
410 | dest = obuff;
|
---|
411 | endsrc = ibuff + ibufflen;
|
---|
412 | while (src < endsrc) {
|
---|
413 | if (dest == obuff && (*src == '\t' || *src == ' ' ||
|
---|
414 | *src == '\r' || *src == '\n')) {
|
---|
415 | src++;
|
---|
416 | }
|
---|
417 | else if (*src == '\t' || !*src) {
|
---|
418 | *dest = ' ';
|
---|
419 | dest++;
|
---|
420 | src++;
|
---|
421 | }
|
---|
422 | else if (*src == '\r' || *src == '\n') {
|
---|
423 | *dest = *src;
|
---|
424 | while (*(src + 1) == '\r' || *(src + 1) == '\n' ||
|
---|
425 | *(src + 1) == ' ' || *(src + 1) == '\t')
|
---|
426 | src++;
|
---|
427 | dest++;
|
---|
428 | src++;
|
---|
429 | }
|
---|
430 | else {
|
---|
431 | *dest = *src;
|
---|
432 | src++;
|
---|
433 | dest++;
|
---|
434 | }
|
---|
435 | } // while
|
---|
436 | *dest = 0;
|
---|
437 | if (dest - obuff >= obufflen)
|
---|
438 | Runtime_Error(pszSrcFile, __LINE__, pszBufOvfMsg);
|
---|
439 | }
|
---|
440 | if (*obuff)
|
---|
441 | WinSetWindowText(hwndAutoview, obuff);
|
---|
442 | }
|
---|
443 | free(obuff);
|
---|
444 | }
|
---|
445 | free(ibuff);
|
---|
446 | }
|
---|
447 | DosClose(handle);
|
---|
448 | }
|
---|
449 | }
|
---|
450 | else if (!IsFile(currfile)) {
|
---|
451 |
|
---|
452 | static FILEFINDBUF4L ffb[130];
|
---|
453 | CHAR fullname[CCHMAXPATH + 4], szCmmaFmtFileSize[81];
|
---|
454 | HDIR hdir = HDIR_CREATE;
|
---|
455 | ULONG x, nm, ml, mc, bufflen;
|
---|
456 | PBYTE fb;
|
---|
457 | PFILEFINDBUF4L pffbFile;
|
---|
458 | PSZ pszBuf;
|
---|
459 | PSZ p;
|
---|
460 | APIRET rc;
|
---|
461 |
|
---|
462 | BldFullPathName(fullname, currfile, "*");
|
---|
463 | //sprintf(fullname,
|
---|
464 | // "%s%s*",
|
---|
465 | // currfile,
|
---|
466 | // (currfile[strlen(currfile) - 1] == '\\') ? "" : "\\");
|
---|
467 | DosError(FERR_DISABLEHARDERR);
|
---|
468 | nm = sizeof(ffb) / sizeof(FILEFINDBUF4L);
|
---|
469 | if (AutoviewHeight < 96)
|
---|
470 | nm /= 2;
|
---|
471 | rc = xDosFindFirst(fullname,
|
---|
472 | &hdir,
|
---|
473 | FILE_NORMAL | FILE_DIRECTORY |
|
---|
474 | FILE_READONLY | FILE_ARCHIVED |
|
---|
475 | FILE_SYSTEM | FILE_HIDDEN,
|
---|
476 | &ffb, sizeof(ffb), &nm, FIL_QUERYEASIZEL);
|
---|
477 | if (!rc && nm) {
|
---|
478 | fb = (PBYTE) & ffb;
|
---|
479 | x = ml = 0;
|
---|
480 | while (x < nm) {
|
---|
481 | pffbFile = (PFILEFINDBUF4L) fb;
|
---|
482 | mc = (ULONG) pffbFile->cchName +
|
---|
483 | ((pffbFile->attrFile & FILE_DIRECTORY) != 0);
|
---|
484 | ml = max(ml, mc);
|
---|
485 | if (!pffbFile->oNextEntryOffset)
|
---|
486 | break;
|
---|
487 | fb += pffbFile->oNextEntryOffset;
|
---|
488 | x++;
|
---|
489 | }
|
---|
490 | bufflen = (CCHMAXPATHCOMP + 42) * nm;
|
---|
491 | pszBuf = xmalloc(bufflen, pszSrcFile, __LINE__);
|
---|
492 | if (pszBuf) {
|
---|
493 | p = pszBuf;
|
---|
494 | *p = 0;
|
---|
495 | fb = (PBYTE) & ffb;
|
---|
496 | x = 0;
|
---|
497 | while (x < nm) {
|
---|
498 | pffbFile = (PFILEFINDBUF4L) fb;
|
---|
499 | if (!(!*pffbFile->achName ||
|
---|
500 | (((pffbFile->attrFile & FILE_DIRECTORY) &&
|
---|
501 | pffbFile->achName[0] == '.') &&
|
---|
502 | (!pffbFile->achName[1] ||
|
---|
503 | (pffbFile->achName[1] == '.' &&
|
---|
504 | !pffbFile->achName[2]))))) {
|
---|
505 | CommaFmtULL(szCmmaFmtFileSize,
|
---|
506 | sizeof(szCmmaFmtFileSize),
|
---|
507 | pffbFile->cbFile + CBLIST_TO_EASIZE(pffbFile->cbList),
|
---|
508 | ' ');
|
---|
509 | sprintf(p,
|
---|
510 | "%s%-*.*s %-8s [%s%s%s%s] %04lu/%02lu/%02lu "
|
---|
511 | "%02lu:%02lu:%02lu\r",
|
---|
512 | pffbFile->attrFile & FILE_DIRECTORY ? "\\" : " ",
|
---|
513 | ml,
|
---|
514 | ml,
|
---|
515 | pffbFile->achName,
|
---|
516 | szCmmaFmtFileSize,
|
---|
517 | pffbFile->attrFile & FILE_READONLY ? "R" : "-",
|
---|
518 | pffbFile->attrFile & FILE_ARCHIVED ? "A" : "-",
|
---|
519 | pffbFile->attrFile & FILE_HIDDEN ? "H" : "-",
|
---|
520 | pffbFile->attrFile & FILE_SYSTEM ? "S" : "-",
|
---|
521 | pffbFile->fdateLastWrite.year + 1980,
|
---|
522 | pffbFile->fdateLastWrite.month,
|
---|
523 | pffbFile->fdateLastWrite.day,
|
---|
524 | pffbFile->ftimeLastWrite.hours,
|
---|
525 | pffbFile->ftimeLastWrite.minutes,
|
---|
526 | pffbFile->ftimeLastWrite.twosecs * 2);
|
---|
527 | p += strlen(p);
|
---|
528 | }
|
---|
529 | if (!pffbFile->oNextEntryOffset)
|
---|
530 | break;
|
---|
531 | fb += pffbFile->oNextEntryOffset;
|
---|
532 | x++;
|
---|
533 | } // while
|
---|
534 | if (p - pszBuf >= bufflen)
|
---|
535 | Runtime_Error(pszSrcFile, __LINE__, pszBufOvfMsg);
|
---|
536 | if (*pszBuf)
|
---|
537 | WinSetWindowText(hwndAutoview, pszBuf);
|
---|
538 | free(pszBuf);
|
---|
539 | }
|
---|
540 | }
|
---|
541 | if (!rc)
|
---|
542 | DosFindClose(hdir);
|
---|
543 | }
|
---|
544 | }
|
---|
545 | else {
|
---|
546 |
|
---|
547 | APIRET rc;
|
---|
548 | EAOP2 eaop;
|
---|
549 | PGEA2LIST pgealist;
|
---|
550 | PFEA2LIST pfealist;
|
---|
551 | PGEA2 pgea;
|
---|
552 | PFEA2 pfea;
|
---|
553 | CHAR *value, *pszBuf, *p, *data;
|
---|
554 | USHORT len, type, plen, dlen;
|
---|
555 | BOOL readonly = FALSE;
|
---|
556 |
|
---|
557 | pgealist = xmallocz(sizeof(GEA2LIST) + 64, pszSrcFile, __LINE__);
|
---|
558 | if (pgealist) {
|
---|
559 | pgea = &pgealist->list[0];
|
---|
560 | strcpy(pgea->szName, ".COMMENTS");
|
---|
561 | pgea->cbName = strlen(pgea->szName);
|
---|
562 | pgea->oNextEntryOffset = 0L;
|
---|
563 | pgealist->cbList = (sizeof(GEA2LIST) + pgea->cbName);
|
---|
564 | pfealist = xmallocz(65536, pszSrcFile, __LINE__);
|
---|
565 | if (pfealist) {
|
---|
566 | pfealist->cbList = 65536;
|
---|
567 | eaop.fpGEA2List = pgealist;
|
---|
568 | eaop.fpFEA2List = pfealist;
|
---|
569 | eaop.oError = 0L;
|
---|
570 | rc = DosQueryPathInfo((CHAR *)mp1, FIL_QUERYEASFROMLIST,
|
---|
571 | (PVOID) & eaop, (ULONG) sizeof(EAOP2));
|
---|
572 | free(pgealist);
|
---|
573 | if (!rc) {
|
---|
574 | pfea = &eaop.fpFEA2List->list[0];
|
---|
575 | if (pfea->cbName && pfea->cbValue) {
|
---|
576 | value = pfea->szName + pfea->cbName + 1;
|
---|
577 | value[pfea->cbValue] = 0;
|
---|
578 | if (*(USHORT *) value == EAT_MVMT) {
|
---|
579 | pszBuf = xmalloc(65536, pszSrcFile, __LINE__);
|
---|
580 | if (pszBuf) {
|
---|
581 | p = pszBuf;
|
---|
582 | *pszBuf = 0;
|
---|
583 | data = value + (sizeof(USHORT) * 3);
|
---|
584 | type = *(USHORT *) data;
|
---|
585 | data += sizeof(USHORT);
|
---|
586 | len = *(USHORT *) data;
|
---|
587 | data += sizeof(USHORT);
|
---|
588 | while ((data - value) - len < pfea->cbValue) {
|
---|
589 | if (type == EAT_ASCII) {
|
---|
590 | dlen = plen = 0;
|
---|
591 | while (dlen < len) {
|
---|
592 | if (data[dlen] == '\r') {
|
---|
593 | dlen++;
|
---|
594 | if (dlen < len && data[dlen] != '\n')
|
---|
595 | p[plen++] = '\n';
|
---|
596 | }
|
---|
597 | else
|
---|
598 | p[plen++] = data[dlen++];
|
---|
599 | }
|
---|
600 | if ((!len || !plen || p[plen - 1] != '\n') &&
|
---|
601 | (data - value) + len < pfea->cbValue)
|
---|
602 | p[plen++] = '\n';
|
---|
603 | p += plen;
|
---|
604 | *p = 0;
|
---|
605 | }
|
---|
606 | else
|
---|
607 | readonly = TRUE;
|
---|
608 | data += len;
|
---|
609 | if (data - value >= pfea->cbValue)
|
---|
610 | break;
|
---|
611 | type = *(USHORT *) data;
|
---|
612 | data += sizeof(USHORT);
|
---|
613 | len = *(USHORT *) data;
|
---|
614 | data += sizeof(USHORT);
|
---|
615 | } // while
|
---|
616 | if (p - pszBuf >= 65536) {
|
---|
617 | Runtime_Error(pszSrcFile, __LINE__, pszBufOvfMsg);
|
---|
618 | pszBuf[65535] = 0; // Try to stay alive
|
---|
619 | break;
|
---|
620 | }
|
---|
621 | WinSetWindowText(hwndAutoMLE, pszBuf);
|
---|
622 | free(pszBuf);
|
---|
623 | }
|
---|
624 | }
|
---|
625 | else
|
---|
626 | readonly = TRUE;
|
---|
627 | }
|
---|
628 | /* else EA not present */
|
---|
629 | MLEsetchanged(hwndAutoMLE, FALSE);
|
---|
630 | MLEsetreadonly(hwndAutoMLE, readonly);
|
---|
631 | }
|
---|
632 | else {
|
---|
633 | MLEsetchanged(hwndAutoMLE, FALSE);
|
---|
634 | MLEsetreadonly(hwndAutoMLE, FALSE);
|
---|
635 | }
|
---|
636 | free(pfealist);
|
---|
637 | }
|
---|
638 | }
|
---|
639 | }
|
---|
640 | }
|
---|
641 | free((CHAR *)mp1);
|
---|
642 | # ifdef FORTIFY
|
---|
643 | Fortify_LeaveScope();
|
---|
644 | # endif
|
---|
645 | }
|
---|
646 | return 0;
|
---|
647 |
|
---|
648 | case UM_CLOSE:
|
---|
649 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
650 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
---|
651 | WinDestroyWindow(hwnd);
|
---|
652 | return 0;
|
---|
653 | }
|
---|
654 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
655 | }
|
---|
656 |
|
---|
657 | static VOID MakeAutoWinThread(VOID * args)
|
---|
658 | {
|
---|
659 | HAB hab2;
|
---|
660 | HMQ hmq2;
|
---|
661 | HWND hwndParent = (HWND) args;
|
---|
662 | QMSG qmsg2;
|
---|
663 |
|
---|
664 | hab2 = WinInitialize(0);
|
---|
665 | if (hab2) {
|
---|
666 | # ifdef FORTIFY
|
---|
667 | Fortify_EnterScope();
|
---|
668 | # endif
|
---|
669 | hmq2 = WinCreateMsgQueue(hab2, 128);
|
---|
670 | if (hmq2) {
|
---|
671 | DosError(FERR_DISABLEHARDERR);
|
---|
672 | WinRegisterClass(hab2,
|
---|
673 | WC_OBJECTWINDOW,
|
---|
674 | AutoObjProc, 0, sizeof(PVOID));
|
---|
675 | hwndAutoObj = WinCreateWindow(HWND_OBJECT,
|
---|
676 | WC_OBJECTWINDOW,
|
---|
677 | (PSZ) NULL,
|
---|
678 | 0,
|
---|
679 | 0L,
|
---|
680 | 0L,
|
---|
681 | 0L,
|
---|
682 | 0L, 0L, HWND_TOP, OBJ_FRAME, NULL, NULL);
|
---|
683 | if (!hwndAutoObj) {
|
---|
684 | Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
685 | IDS_WINCREATEWINDOW);
|
---|
686 | if (!PostMsg(hwndParent, UM_CLOSE, MPVOID, MPVOID))
|
---|
687 | WinSendMsg(hwndParent, UM_CLOSE, MPVOID, MPVOID);
|
---|
688 | }
|
---|
689 | else {
|
---|
690 | WinSetWindowULong(hwndAutoObj, QWL_USER, hwndParent);
|
---|
691 | priority_normal();
|
---|
692 | while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0))
|
---|
693 | WinDispatchMsg(hab2, &qmsg2);
|
---|
694 | WinDestroyWindow(hwndAutoObj);
|
---|
695 | hwndAutoObj = (HWND) 0;
|
---|
696 | }
|
---|
697 | WinDestroyMsgQueue(hmq2);
|
---|
698 | }
|
---|
699 | // else
|
---|
700 | WinTerminate(hab2);
|
---|
701 | # ifdef FORTIFY
|
---|
702 | Fortify_LeaveScope();
|
---|
703 | # endif
|
---|
704 | }
|
---|
705 | }
|
---|
706 |
|
---|
707 | MRESULT EXPENTRY AutoViewProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
708 | {
|
---|
709 | USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
710 |
|
---|
711 | switch (msg) {
|
---|
712 | case WM_CREATE:
|
---|
713 | {
|
---|
714 | MRESULT mr;
|
---|
715 |
|
---|
716 | if (!hwndAutoObj) {
|
---|
717 | if (_beginthread(MakeAutoWinThread, NULL, 65536, (PVOID) hwnd) == -1) {
|
---|
718 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
719 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
720 | PostMsg(hwnd, UM_CLOSE, MPVOID, MPVOID);
|
---|
721 | }
|
---|
722 | }
|
---|
723 | mr = PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
724 | SetPresParams(hwnd,
|
---|
725 | &RGBGREY,
|
---|
726 | &RGBBLACK, &RGBGREY, GetPString(IDS_4SYSTEMVIOTEXT));
|
---|
727 | stopflag = 0;
|
---|
728 | return mr;
|
---|
729 | }
|
---|
730 |
|
---|
731 | case UM_SETUP:
|
---|
732 | MLEsetlimit(hwnd, 32768);
|
---|
733 | MLEsetformat(hwnd, MLFIE_NOTRANS);
|
---|
734 | MLEsetchanged(hwnd, FALSE);
|
---|
735 | return 0;
|
---|
736 |
|
---|
737 | case WM_BUTTON1DOWN:
|
---|
738 | {
|
---|
739 | SWP swp;
|
---|
740 |
|
---|
741 | WinQueryWindowPos(hwnd, &swp);
|
---|
742 | if (SHORT2FROMMP(mp1) > swp.cy - 4) {
|
---|
743 |
|
---|
744 | HPS hps = WinGetPS(WinQueryWindow(hwnd, QW_PARENT));
|
---|
745 | SWP swpC;
|
---|
746 | TRACKINFO track;
|
---|
747 |
|
---|
748 | if (hps) {
|
---|
749 | WinQueryWindowPos(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
750 | FID_CLIENT), &swpC);
|
---|
751 | track.cxBorder = 4;
|
---|
752 | track.cyBorder = 4;
|
---|
753 | track.cxGrid = 1;
|
---|
754 | track.cyGrid = 8;
|
---|
755 | track.cxKeyboard = 8;
|
---|
756 | track.rclTrack.yBottom = swp.y;
|
---|
757 | track.rclTrack.yTop = swp.y + swp.cy;
|
---|
758 | track.rclTrack.xLeft = swp.x;
|
---|
759 | track.rclTrack.xRight = swp.x + swp.cx;
|
---|
760 | track.rclBoundary = track.rclTrack;
|
---|
761 | track.rclBoundary.yTop = (swpC.cy + swp.y + swp.cy) - 116;
|
---|
762 | track.ptlMinTrackSize.x = swp.x + swp.cx;
|
---|
763 | track.ptlMinTrackSize.y = 36;
|
---|
764 | track.ptlMaxTrackSize.x = swp.x + swp.cx;
|
---|
765 | track.ptlMaxTrackSize.y = (swpC.cy + swp.cy) - 116;
|
---|
766 | track.fs = TF_TOP;
|
---|
767 | if (WinTrackRect(hwnd, hps, &track)) {
|
---|
768 | AutoviewHeight = track.rclTrack.yTop - track.rclTrack.yBottom;
|
---|
769 | PrfWriteProfileData(fmprof,
|
---|
770 | FM3Str,
|
---|
771 | "AutoviewHeight",
|
---|
772 | &AutoviewHeight, sizeof(ULONG));
|
---|
773 | WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
774 | WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
|
---|
775 | }
|
---|
776 | WinReleasePS(hps);
|
---|
777 | }
|
---|
778 | return (MRESULT) TRUE;
|
---|
779 | }
|
---|
780 | else if (id != MAIN_AUTOVIEWMLE)
|
---|
781 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
782 | }
|
---|
783 | break;
|
---|
784 |
|
---|
785 | case WM_BUTTON3DOWN:
|
---|
786 | case WM_BUTTON1UP:
|
---|
787 | case WM_BUTTON3UP:
|
---|
788 | if (id != MAIN_AUTOVIEWMLE)
|
---|
789 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
790 | break;
|
---|
791 |
|
---|
792 | case WM_MOUSEMOVE:
|
---|
793 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
794 | {
|
---|
795 | SWP swp;
|
---|
796 |
|
---|
797 | WinQueryWindowPos(hwnd, &swp);
|
---|
798 | if (SHORT2FROMMP(mp1) > swp.cy - 4) {
|
---|
799 | WinSetPointer(HWND_DESKTOP, hptrNS);
|
---|
800 | return (MRESULT) TRUE;
|
---|
801 | }
|
---|
802 | }
|
---|
803 | break;
|
---|
804 |
|
---|
805 | case WM_PAINT:
|
---|
806 | PostMsg(hwnd, UM_PAINT, MPVOID, MPVOID);
|
---|
807 | break;
|
---|
808 |
|
---|
809 | case UM_PAINT:
|
---|
810 | PaintRecessedWindow(hwnd, (HPS) 0, TRUE, TRUE);
|
---|
811 | return 0;
|
---|
812 |
|
---|
813 | case WM_SETFOCUS:
|
---|
814 | switch (id) {
|
---|
815 | case MAIN_AUTOVIEWMLE:
|
---|
816 | if (!mp2 && !AutoMenu) {
|
---|
817 | if (*currfile) {
|
---|
818 | if (MLEgetchanged(hwnd)) {
|
---|
819 | CHAR *ea = xmalloc(32768, pszSrcFile, __LINE__);
|
---|
820 |
|
---|
821 | if (ea) {
|
---|
822 | *ea = 0;
|
---|
823 | WinQueryWindowText(hwnd, 32767, ea);
|
---|
824 | PutComments(hwnd, currfile, ea);
|
---|
825 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
|
---|
826 | free(ea);
|
---|
827 | # ifdef FORTIFY
|
---|
828 | Fortify_LeaveScope();
|
---|
829 | # endif
|
---|
830 | }
|
---|
831 | }
|
---|
832 | }
|
---|
833 | }
|
---|
834 | break;
|
---|
835 | default:
|
---|
836 | if (mp2)
|
---|
837 | PostMsg(hwnd, UM_FOCUSME, mp1, mp2);
|
---|
838 | break;
|
---|
839 | }
|
---|
840 | break;
|
---|
841 |
|
---|
842 | case UM_FOCUSME:
|
---|
843 | if (mp2) {
|
---|
844 |
|
---|
845 | PID pid;
|
---|
846 | TID tid;
|
---|
847 |
|
---|
848 | if (WinQueryWindowProcess((HWND) mp1, &pid, &tid) && pid == mypid)
|
---|
849 | WinSetFocus(HWND_DESKTOP, (HWND) mp1);
|
---|
850 | else
|
---|
851 | WinSetFocus(HWND_DESKTOP, hwndTree);
|
---|
852 | }
|
---|
853 | return 0;
|
---|
854 |
|
---|
855 | case UM_CLICKED:
|
---|
856 | case UM_CLICKED3:
|
---|
857 | if (id != MAIN_AUTOVIEWMLE) {
|
---|
858 | PostMsg(hwnd,
|
---|
859 | WM_COMMAND,
|
---|
860 | MPFROM2SHORT(((msg == UM_CLICKED3) ?
|
---|
861 | IDM_EAS : IDM_VIEWORARC), 0), MPVOID);
|
---|
862 | }
|
---|
863 | return 0;
|
---|
864 |
|
---|
865 | case WM_COMMAND:
|
---|
866 | PostMsg(hwnd, UM_COMMAND, mp1, mp2);
|
---|
867 | return 0;
|
---|
868 |
|
---|
869 | case UM_COMMAND:
|
---|
870 | switch (SHORT1FROMMP(mp1)) {
|
---|
871 | case IDM_RESCAN:
|
---|
872 | if (*currfile) {
|
---|
873 |
|
---|
874 | CHAR *cf = xstrdup(currfile, pszSrcFile, __LINE__);
|
---|
875 |
|
---|
876 | if (cf) {
|
---|
877 | stopflag++;
|
---|
878 | if (!PostMsg(hwndAutoObj, UM_LOADFILE, MPFROMP(cf), MPVOID))
|
---|
879 | free(cf);
|
---|
880 | # ifdef FORTIFY
|
---|
881 | Fortify_LeaveScope();
|
---|
882 | # endif
|
---|
883 | }
|
---|
884 | }
|
---|
885 | break;
|
---|
886 |
|
---|
887 | case IDM_INFO:
|
---|
888 | DefaultView(hwnd, (HWND) 0, hwndMain, NULL, 16, currfile);
|
---|
889 | break;
|
---|
890 |
|
---|
891 | case IDM_VIEW:
|
---|
892 | DefaultView(hwnd, (HWND) 0, hwndMain, NULL, 0, currfile);
|
---|
893 | break;
|
---|
894 |
|
---|
895 | case IDM_EDIT:
|
---|
896 | DefaultView(hwnd, (HWND) 0, hwndMain, NULL, 8, currfile);
|
---|
897 | break;
|
---|
898 |
|
---|
899 | case IDM_EAS:
|
---|
900 | {
|
---|
901 | char *list[2];
|
---|
902 |
|
---|
903 | list[0] = currfile;
|
---|
904 | list[1] = NULL;
|
---|
905 |
|
---|
906 | WinDlgBox(HWND_DESKTOP,
|
---|
907 | hwndMain,
|
---|
908 | DisplayEAsProc, FM3ModHandle, EA_FRAME, (PVOID) list);
|
---|
909 | }
|
---|
910 | break;
|
---|
911 |
|
---|
912 | default:
|
---|
913 | PostMsg(hwndMain, msg, mp1, mp2);
|
---|
914 | }
|
---|
915 | return 0;
|
---|
916 |
|
---|
917 | case WM_MENUEND:
|
---|
918 | if ((HWND) mp2 == AutoMenu) {
|
---|
919 | WinDestroyWindow(AutoMenu);
|
---|
920 | AutoMenu = (HWND) 0;
|
---|
921 | }
|
---|
922 | break;
|
---|
923 |
|
---|
924 | case WM_CONTEXTMENU:
|
---|
925 | CheckMenu(hwnd, &AutoMenu, (id == MAIN_AUTOVIEWMLE) ?
|
---|
926 | IDM_AUTOVIEWMLE : IDM_AUTOVIEW);
|
---|
927 | WinCheckMenuItem(AutoMenu, IDM_AUTOVIEWFILE, !fComments);
|
---|
928 | WinCheckMenuItem(AutoMenu, IDM_AUTOVIEWCOMMENTS, fComments);
|
---|
929 | WinEnableMenuItem(AutoMenu, IDM_VIEW, (IsFile(currfile) == 1));
|
---|
930 | WinEnableMenuItem(AutoMenu, IDM_EDIT, (IsFile(currfile) == 1));
|
---|
931 | WinEnableMenuItem(AutoMenu, IDM_INFO, (*currfile != 0));
|
---|
932 | PopupMenu(hwnd, hwnd, AutoMenu);
|
---|
933 | break;
|
---|
934 |
|
---|
935 | case UM_LOADFILE:
|
---|
936 | stopflag++;
|
---|
937 | if (!PostMsg(hwndAutoObj, msg, mp1, mp2)) {
|
---|
938 | xfree((CHAR *)mp1, pszSrcFile, __LINE__);
|
---|
939 | # ifdef FORTIFY
|
---|
940 | Fortify_LeaveScope();
|
---|
941 | # endif
|
---|
942 | }
|
---|
943 | return 0;
|
---|
944 |
|
---|
945 | case UM_CLOSE:
|
---|
946 | if (AutoMenu) {
|
---|
947 | WinDestroyWindow(AutoMenu);
|
---|
948 | AutoMenu = (HWND) 0;
|
---|
949 | }
|
---|
950 | WinDestroyWindow(hwnd);
|
---|
951 | return 0;
|
---|
952 |
|
---|
953 | case WM_CLOSE:
|
---|
954 | WinSendMsg(hwnd, UM_CLOSE, MPVOID, MPVOID);
|
---|
955 | return 0;
|
---|
956 |
|
---|
957 | case WM_DESTROY:
|
---|
958 | if (id != MAIN_AUTOVIEWMLE) {
|
---|
959 | if (hwndAutoObj)
|
---|
960 | if (!PostMsg(hwndAutoObj, WM_CLOSE, MPVOID, MPVOID))
|
---|
961 | WinSendMsg(hwndAutoObj, WM_CLOSE, MPVOID, MPVOID);
|
---|
962 | break;
|
---|
963 | }
|
---|
964 | break;
|
---|
965 | }
|
---|
966 |
|
---|
967 | if (id == MAIN_AUTOVIEWMLE)
|
---|
968 | return PFNWPMLE(hwnd, msg, mp1, mp2);
|
---|
969 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
970 | }
|
---|
971 |
|
---|
972 | #pragma alloc_text(AUTOVIEW,AutoViewProc,CreateHexDump,AutoObjProc)
|
---|
973 | #pragma alloc_text(AUTOVIEW2,MakeAutoWinThread,WriteEA,PutComments)
|
---|