source: trunk/dll/arccnrs.c@ 1752

Last change on this file since 1752 was 1752, checked in by Gregg Young, 11 years ago

Fixed error checking in FillArcCnr only to report missing archivers after all entries have been tried. Added a check b/gzip exes for TAR.B/GZ archives. Use the test archive string from the first working archive description. Enhance the error message. Ticket 502 Fix a trap caused by selecting "print" from the arccontainer menu. Ticket 525 Fix the problem with copying text from the test archive window by launching it in a command shell (i.e. comspec /k archiver -t archive) Ticket 503

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 111.0 KB
Line 
1
2/***********************************************************************
3
4 $Id: arccnrs.c 1752 2014-03-02 01:39:13Z gyoung $
5
6 Archive containers
7
8 Copyright (c) 1993-98 M. Kimes
9 Copyright (c) 2001, 2013 Steven H. Levine
10
11 11 Jun 02 SHL Ensure archive name not garbage
12 22 May 03 SHL ArcObjWndProc: fix UM_RESCAN now that we understand it
13 01 Aug 04 SHL Rework lstrip/rstrip usage
14 23 May 05 SHL Use QWL_USER
15 25 May 05 SHL Rename comnam to szCommonName and fix typo
16 25 May 05 SHL Use ULONGLONG and CommaFmtULL
17 05 Jun 05 SHL Drop obsolete, localize
18 05 Jun 05 SHL Correct last sort logic
19 05 Jun 05 SHL Use QWL_USER
20 22 Jun 05 SHL ArcSort: correct typo in last sort fix
21 13 Aug 05 SHL FillArcCnr: optimize
22 08 Dec 05 SHL FillArcCnr: allow list start and end markers to be empty (i.e. tar)
23 08 Dec 05 SHL ArcCnrWndProc: suppress IDM_EXTRACT if no simple extract (i.e. tar)
24 30 Dec 05 SHL ArcCnrWndProc: correct date/time column display setup
25 29 May 06 SHL Comments
26 14 Jul 06 SHL Use Runtime_Error
27 26 Jul 06 SHL Correct SelectAll usage
28 29 Jul 06 SHL Use xfgets_bstripcr
29 31 Jul 06 SHL Lower priority for archives with more than 1000 entries
30 02 Aug 06 SHL Add logic to stop processing large archives
31 23 Aug 06 SHL Integrate John Small's switch list title logic
32 03 Nov 06 SHL Renames
33 14 Mar 07 SHL ArcObjWndProc/UM_ENTER: delay before starting viewer
34 30 Mar 07 GKY Remove GetPString for window class names
35 06 Apr 07 GKY Work around PM DragInfo and DrgFreeISH limit
36 06 Apr 07 GKY Add some error checking in drag/drop
37 20 Apr 07 SHL Sync with NumItemsToUnhilite mods
38 21 Apr 07 GKY Find FM2Utils by path or utils directory
39 12 May 07 SHL Use dcd->ulItemsToUnHilite; sync with UnHilite arg mods
40 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit
41 16 Jun 07 SHL Use DosQueryAppType not DosQAppType
42 02 Aug 07 SHL Sync with ARCITEM mods
43 06 Aug 07 SHL Use BldFullPathName and BldQuotedFileName
44 06 Aug 07 SHL Move BldQuotedFileName and BldQuotedFullPathNamehere
45 to be near primary caller
46 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
47 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
48 26 Aug 07 GKY DosSleep(1) in loops changed to (0)
49 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
50 30 Dec 07 GKY Use TestCDates for sort by date
51 10 Jan 08 SHL Sync with CfgDlgProc mods
52 10 Feb 08 GKY Implement bubble help for bitmap menu items
53 15 Feb 08 SHL Sync with settings menu rework
54 29 Feb 08 GKY Use xfree where appropriate
55 14 Jul 08 JBS Ticket 126: Add support for WPS open default & open settings in arccnrs
56 16 Jul 08 GKY Fix trap on viewing multiple files from an archive (misplaced free)
57 16 Jul 08 GKY Use TMP directory for temp files if present. Use MakeTempName
58 19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory
59 25 Aug 08 GKY Check TMP directory space warn if lee than 5 MiB prevent archiver from opening if
60 less than 10 KiB (It hangs and can't be closed)
61 08 Nov 08 GKY Add WaitChildThread to fix hang caused by viewer trying to open a file before
62 the archiver process closes. (Ticket 58)
63 23 Nov 08 JBS Ticket 284: Support archivers with no Start or End of list strings
64 29 Nov 08 GKY Add flag to tell CheckListProc file is in an archive so it won't try to open it.
65 29 Nov 08 GKY Remove or replace with a mutex semaphore DosEnterCriSec where appropriate.
66 30 Nov 08 GKY Add the option of creating a subdirectory from the arcname
67 for the extract path to arc container.
68 02 Dec 08 JBS Ticket 284: Changed string indicating no Start/End of list strings.
69 03 Dec 08 GKY Subdirectory from the arcname for the extract path only created if an "extract"
70 menu option is selected.
71 10 Dec 08 SHL Integrate exception handler support
72 07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error
73 07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook.
74 08 Mar 09 GKY Renamed commafmt.h i18nutil.h
75 08 Mar 09 GKY Additional strings move to PCSZs in init.c
76 08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used)
77 12 Mar 09 SHL Use common SearchContainer
78 13 Dec 09 GKY Fixed separate paramenters. Please note that appname should be used in
79 profile calls for user settings that work and are setable in more than one
80 miniapp; FM3Str should be used for setting only relavent to FM/2 or that
81 aren't user settable; realappname should be used for setting applicable to
82 one or more miniapp but not to FM/2
83 17 Jan 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
84 15 Apr 10 JBS Ticket 422: Stop hang when open archive gets deleted or moved
85 23 Oct 10 GKY Add ForwardslashToBackslash function to streamline code
86 20 Nov 10 GKY Check that pTmpDir IsValid and recreate if not found; Fixes hangs caused
87 by temp file creation failures.
88 13 Aug 11 GKY Change to Doxygen comment format
89 30 Jul 13 GKY Changes to allow 7z archiver to work with AV.
90 05 Aug 13 GKY Changes to allow Lzip to work with AV
91 11 Aug 13 GKY Removed code that attempted to use the archive name as the extract directory
92 It was never fully implemented and doesn't make sense for the container.
93 09 Feb 14 GKY Fix trap on opening a file without an extention
94 22 Feb 14 GKY Fix warn readonly yes don't ask to work when recursing directories.
95 28 Apr 14 JBS Ticket #522: Ensure use of wrapper functions where needed
96 01 Mar 14 GKY Fixed error checking in FillArcCnr only to report missing archivers after
97 all entries have been tried. Added a check b/gzip exes for TAR.B/GZ archives.
98 Use the test archive string from the first working archive description.
99 Enhance the error message. Ticket 502
100 01 Mar 14 GKY Fix a trap caused by selecting "print" from the arccontainer menu. Ticket 525
101 01 Mar 14 GKY Fix the problem with copying text from the test archive window by launching
102 it in a command shell (i.e. comspec /k archiver -t archive) Ticket 503
103
104***********************************************************************/
105
106#include <stdlib.h> // free..
107#include <string.h>
108#include <ctype.h>
109#include <direct.h> // rmdir
110#include <share.h> // SH_DENYWR
111#include <limits.h> // ULONG_MAX
112
113#if 0
114#include <malloc.h> // _heapchk
115#endif
116
117#define INCL_DOS
118#define INCL_DOSERRORS
119#define INCL_WIN
120#define INCL_LONGLONG
121
122#include "fm3dll.h"
123#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
124#include "arccnrs.h"
125#include "makelist.h" // Typedef
126#include "colors.h" // Typedef
127#include "mainwnd2.h" // Data declaration(s)
128#include "grep.h" // Data declaration(s)
129#include "dircnrs.h" // Data declaration(s)
130#include "info.h" // Data declaration(s)
131#include "init.h" // Data declaration(s)
132#include "fm3dlg.h"
133#include "fm3str.h"
134#include "mle.h"
135#include "pathutil.h" // BldFullPathName
136#include "filldir.h" // EmptyCnr...
137#include "errutil.h" // Dos_Error...
138#include "strutil.h" // GetPString
139#include "notebook.h" // CfgDlgProc
140#include "worker.h" // Action, MassAction
141#include "avv.h" // ArcReviewDlgProc, rewrite_archiverbb2
142#include "chklist.h" // CenterOverWindow, CheckListProc
143#include "common.h" // CommonCreateTextChildren, CommonFrameWndProc, CommonTextPaint
144 // CommonTextButton
145#include "draglist.h" // DoFileDrag, DragOne
146#include "valid.h" // GetDesktopName, TestCDates
147#include "mainwnd.h" // GetNextWindowPos, MakeBubble, TopWindowName
148#include "objwin.h" // MakeObjWin
149#include "shadow.h" // MakeShadows
150#include "objcnr.h" // ObjCnrDlgProc
151#include "printer.h" // PrintListThread
152#include "srchpath.h" // RunFM2Util
153#include "misc.h" // Broadcast, CheckMenu, CurrentRecord, SayFilter, SaySort
154 // DrawTargetEmphasis, IsFm2Window
155#include "select.h" // SelectAll, SelectList
156#include "findrec.h" // ShowCnrRecord
157#include "walkem.h" // WalkExtractDlgProc
158#include "droplist.h" // AcceptOneDrop, CheckPmDrgLimit, DropHelp, GetOneDrop
159#include "archive.h" // ArchiveDlgProc
160#include "common.h" // CommonTextProc
161#include "presparm.h" // CopyPresParams
162#include "defview.h" // DefaultViewKeys
163#include "systemf.h" // ExecOnList
164#include "filter.h" // PickMaskDlgProc
165#include "avl.h" // SBoxDlgProc
166#include "mkdir.h" // SetDir
167#include "collect.h" // StartCollector
168#include "viewer.h" // StartMLEEditor
169#include "newview.h" // StartViewer
170#include "i18nutil.h" // commafmt
171#include "copyf.h" // unlinkf
172#include "literal.h" // wildcard
173#include "wrappers.h" // xrealloc
174#include "misc.h" // AdjustCnrColVis, QuickPopup, SetSortChecks, SwitchCommand
175#include "select.h" // DeselectAll, InvertAll
176#include "strips.h" // bstrip
177#include "dirs.h" // save_dir2
178#include "fortify.h"
179#include "excputil.h" // 06 May 08 SHL added
180
181#define ARCFLAGS_REALDIR 0x00000001
182#define ARCFLAGS_PSEUDODIR 0x00000002
183#define CON_COLS 6
184#define EXTRA_ARCRECORD_BYTES (sizeof(ARCITEM) - sizeof(MINIRECORDCORE))
185#define NO_START_OF_ARCHIVER_LIST_STRING "None"
186#define NO_END_OF_ARCHIVER_LIST_STRING NO_START_OF_ARCHIVER_LIST_STRING
187
188#pragma data_seg(DATA1)
189static INT DefArcSortFlags;
190
191// Data definitions
192static PSZ pszSrcFile = __FILE__;
193#pragma data_seg(GLOBAL1)
194HWND ArcCnrMenu;
195HWND ArcMenu;
196CHAR ArcTempRoot[CCHMAXPATH];
197BOOL fArcStuffVisible;
198BOOL fFileNameCnrPath;
199
200#pragma data_seg(GLOBAL2)
201CHAR lastextractpath[CCHMAXPATH];
202ULONGLONG ullDATFileSpaceNeeded = 10000;
203
204typedef struct {
205
206 HWND hwndCnr; //hwnd you want the message posted to
207 HWND hwndClient; //hwnd calling this thread; NULL will work
208 ULONG RunFlags; //runemf2 flags see systemf.h
209 ULONG msg; //Message to post
210 UINT uiLineNumber;
211 PCSZ pszSrcFile;
212 CHAR filename[CCHMAXPATH]; //file passed as MP1 message parameter (file selected)
213 CHAR *pszDirectory; //Execution directory
214 CHAR *pszEnvironment; //Enviroment -- NULL passes current
215 CHAR *pszCmdLine; //Use sprintf to format multipart command line into single string
216 CHAR formatstring[40]; //Usally "%s"
217}
218WAITCHILD;
219
220/** Creates a thread to wait for a child process to complete then posts a message and closes
221 * This function should only be used for runemf2 calls that include the WAIT flag
222 */
223VOID WaitChildThread(VOID * arg) /*FOLD00*/
224{
225 WAITCHILD *WaitChild;
226 HAB thab;
227 CHAR *filename;
228 INT ret;
229
230 DosError(FERR_DISABLEHARDERR);
231
232# ifdef FORTIFY
233 Fortify_EnterScope();
234# endif
235
236 WaitChild = (WAITCHILD *) arg;
237 if (WaitChild) {
238 filename = xstrdup(WaitChild->filename, pszSrcFile, __LINE__);
239 thab = WinInitialize(0);
240 if (thab) {
241 IncrThreadUsage();
242 priority_normal();
243 ret = runemf2(WaitChild->RunFlags, WaitChild->hwndClient,
244 WaitChild->pszSrcFile, WaitChild->uiLineNumber,
245 WaitChild->pszDirectory, WaitChild->pszEnvironment,
246 WaitChild->formatstring, WaitChild->pszCmdLine);
247 if (ret != -1) {
248 if (IsFile(WaitChild->filename) == 1)
249 PostMsg(WaitChild->hwndCnr, WaitChild->msg, MPFROMP(filename), MPVOID);
250 }
251 DecrThreadUsage();
252 WinTerminate(thab);
253 }
254 xfree(WaitChild->pszDirectory, pszSrcFile, __LINE__);
255 xfree(WaitChild->pszEnvironment, pszSrcFile, __LINE__);
256 xfree(WaitChild->pszCmdLine, pszSrcFile, __LINE__);
257 free(WaitChild);
258 } // if WaitChild
259# ifdef FORTIFY
260 Fortify_LeaveScope();
261# endif
262}
263
264static MRESULT EXPENTRY ArcErrProc(HWND hwnd, ULONG msg, MPARAM mp1, /*FOLD00*/
265 MPARAM mp2)
266{
267 ARCDUMP *ad;
268 CHAR szQuotedArcName[CCHMAXPATH];
269
270 switch (msg) {
271 case WM_INITDLG:
272 if (!mp2)
273 WinDismissDlg(hwnd, 0);
274 else {
275 ad = (ARCDUMP *) mp2;
276 WinSetWindowPtr(hwnd, QWL_USER, ad);
277 if (ad->errmsg)
278 WinSetDlgItemText(hwnd, ARCERR_TEXT, ad->errmsg);
279 if (!ad->info->test)
280 WinEnableWindow(WinWindowFromID(hwnd, ARCERR_TEST), FALSE);
281 if (ad->listname) {
282 MLEsetlimit(WinWindowFromID(hwnd, ARCERR_MLE), -1L);
283 MLEsetformat(WinWindowFromID(hwnd, ARCERR_MLE), MLFIE_NOTRANS);
284 MLEsetcurpos(WinWindowFromID(hwnd, ARCERR_MLE),
285 MLEgetlen(WinWindowFromID(hwnd, ARCERR_MLE)));
286 MLEinsert(WinWindowFromID(hwnd, ARCERR_MLE),
287 GetPString(IDS_ARCHIVERREPORTTEXT));
288 MLEinsertfile(WinWindowFromID(hwnd, ARCERR_MLE), ad->listname);
289 }
290 }
291 break;
292
293 case WM_COMMAND:
294 switch (SHORT1FROMMP(mp1)) {
295 case DID_CANCEL:
296 WinDismissDlg(hwnd, 0);
297 break;
298
299 case IDM_HELP:
300 if (hwndHelp) {
301 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
302 MPFROM2SHORT(HELP_ARCERR, 0), MPFROMSHORT(HM_RESOURCEID));
303 }
304 break;
305
306 case DID_OK:
307 ad = WinQueryWindowPtr(hwnd, QWL_USER);
308 WinDlgBox(HWND_DESKTOP, hwnd, ArcReviewDlgProc, FM3ModHandle,
309 AD_FRAME, MPFROMP(ad));
310 WinDismissDlg(hwnd, 0);
311 break;
312
313 case ARCERR_VIEW:
314 ad = WinQueryWindowPtr(hwnd, QWL_USER);
315 {
316 CHAR *list[2];
317
318 list[0] = ad->arcname;
319 list[1] = NULL;
320 if (TestBinary(ad->arcname)) {
321 if (*binview)
322 ExecOnList((HWND) 0, binview, WINDOWED | SEPARATE, NULL, NULL, list,
323 NULL, pszSrcFile, __LINE__);
324 else
325 StartMLEEditor(HWND_DESKTOP, 16 + 4 + 1, ad->arcname, hwnd);
326 }
327 else {
328 if (*viewer) {
329 ExecOnList((HWND) 0, viewer, WINDOWED | SEPARATE |
330 (fViewChild ? CHILD : 0), NULL,
331 NULL, list, NULL, pszSrcFile, __LINE__);
332 }
333 else
334 StartMLEEditor(HWND_DESKTOP, 8 + 4 + 1, ad->arcname, hwnd);
335 }
336 }
337 break;
338
339 case ARCERR_TEST: {
340 CHAR *comspec;
341
342 ad = WinQueryWindowPtr(hwnd, QWL_USER);
343 comspec = getenv( "COMSPEC" );
344 runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED,
345 hwnd, pszSrcFile, __LINE__, NULL, NULL,
346 "%s /k %s %s",
347 comspec, ad->info->test,
348 BldQuotedFileName(szQuotedArcName, ad->arcname));
349 break;
350 }
351 }
352 return 0;
353 }
354 return WinDefDlgProc(hwnd, msg, mp1, mp2);
355}
356
357static SHORT APIENTRY ArcSort(PMINIRECORDCORE pmrc1, PMINIRECORDCORE pmrc2, /*FOLD00*/
358 PVOID pStorage)
359{
360 PARCITEM pai1 = (PARCITEM) pmrc1;
361 PARCITEM pai2 = (PARCITEM) pmrc2;
362 DIRCNRDATA *pdcd = (DIRCNRDATA *) pStorage;
363 SHORT ret = 0;
364 CHAR *pext, *ppext;
365 INT sortFlags;
366
367 if (!pdcd) {
368 HWND hwndCnr = pai1->hwndCnr;
369
370 pdcd = WinQueryWindowPtr(hwndCnr, QWL_USER);
371 if (!pdcd) {
372 Runtime_Error(pszSrcFile, __LINE__, NULL);
373 return ret;
374 }
375 }
376
377 sortFlags = pdcd->sortFlags; // Optimize
378
379 if (sortFlags) {
380 switch (sortFlags & (~SORT_REVERSE)) {
381 case SORT_FIRSTEXTENSION:
382 pext = strchr(pai1->pszFileName, '.');
383 ppext = strchr(pai2->pszFileName, '.');
384 if (!pext)
385 pext = NullStr;
386 if (!ppext)
387 ppext = NullStr;
388 ret = stricmp(pext, ppext);
389 break;
390
391 case SORT_LASTEXTENSION:
392 pext = strrchr(pai1->pszFileName, '.');
393 ppext = strrchr(pai2->pszFileName, '.');
394 if (!pext)
395 pext = NullStr;
396 if (!ppext)
397 ppext = NullStr;
398 ret = stricmp(pext, ppext);
399 break;
400
401 case SORT_LWDATE:
402 ret = TestCDates(&pai1->date, &pai1->time,
403 &pai2->date, &pai2->time);
404 break;
405
406 case SORT_SIZE:
407 ret =
408 (pai1->cbFile < pai2->cbFile) ? 1 : (pai1->cbFile ==
409 pai2->cbFile) ? 0 : -1;
410 if (!ret)
411 ret =
412 (pai1->cbComp < pai2->cbComp) ? 1 : (pai1->cbComp ==
413 pai2->cbComp) ? 0 : -1;
414 break;
415
416 case SORT_EASIZE:
417 ret =
418 (pai1->cbComp < pai2->cbComp) ? 1 : (pai1->cbComp ==
419 pai2->cbComp) ? 0 : -1;
420 if (!ret)
421 ret =
422 (pai1->cbFile < pai2->cbFile) ? 1 : (pai1->cbFile ==
423 pai2->cbFile) ? 0 : -1;
424 break;
425 }
426 if (!ret)
427 ret = (SHORT) stricmp(pai1->pszFileName, pai2->pszFileName);
428 if (ret && (sortFlags & SORT_REVERSE))
429 ret = ret > 0 ? -1 : 1;
430 return ret;
431 }
432 return (SHORT) stricmp(pai1->pszFileName, pai2->pszFileName);
433}
434
435static INT APIENTRY ArcFilter(PMINIRECORDCORE rmini, PVOID arg) /*FOLD00*/
436{
437 DIRCNRDATA *dcd = (DIRCNRDATA *) arg;
438 PARCITEM r;
439 register INT x;
440 INT ret = FALSE;
441
442 if (dcd && *dcd->mask.szMask) {
443 r = (PARCITEM) rmini;
444 if (dcd->mask.pszMasks[1]) {
445 for (x = 0; dcd->mask.pszMasks[x]; x++) {
446 if (*dcd->mask.pszMasks[x]) {
447 if (*dcd->mask.pszMasks[x] != '/') {
448 if (wildcard(r->pszFileName, dcd->mask.pszMasks[x], TRUE))
449 ret = TRUE;
450 }
451 else {
452 if (wildcard(r->pszFileName, dcd->mask.pszMasks[x] + 1, TRUE)) {
453 ret = FALSE;
454 break;
455 }
456 }
457 }
458 }
459 }
460 else {
461 if (wildcard(r->pszFileName, dcd->mask.szMask, TRUE))
462 ret = TRUE;
463 }
464 }
465 else
466 ret = TRUE;
467 return ret;
468}
469
470static MRESULT EXPENTRY ArcFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, /*FOLD00*/
471 MPARAM mp2)
472{
473 return CommonFrameWndProc(ARC_CNR, hwnd, msg, mp1, mp2);
474}
475
476static BOOL IsArcThere(HWND hwnd, CHAR * arcname) /*FOLD00*/
477{
478 if (arcname) {
479 if (IsFile(arcname) != 1) {
480 saymsg(MB_CANCEL, hwnd,
481 GetPString(IDS_SAYWHATTEXT),
482 GetPString(IDS_ARCNOTTHERETEXT), arcname);
483 return FALSE;
484 }
485 return TRUE;
486 }
487 return FALSE;
488}
489
490/**
491 * Free storage associated with archive container item
492 * Caller is responsible for correcting pointers
493 */
494
495static VOID FreeArcItemData(PARCITEM pai) /*FOLD00*/
496{
497 // DbgMsg(pszSrcFile, __LINE__, "FreeArcItemData %p", pai);
498 PSZ psz;
499
500 if (pai->pszFileName && pai->pszFileName != NullStr) {
501 psz = pai->pszFileName;
502 pai->pszFileName = NULL; // 08 Jul 08 SHL was NulStr
503 free(psz);
504 }
505}
506
507/**
508 * Remove item(s) from archive container and free associated storage if requested
509 * @param paiFirst points to first item to remove or NULL to remove all
510 * @param usCnt is remove count or 0 to remove all
511 */
512
513static VOID RemoveArcItems(HWND hwnd, PARCITEM paiFirst, USHORT usCnt, USHORT usFlags) /*FOLD00*/
514{
515 INT remaining = usCnt;
516 PARCITEM pai;
517
518 if ((usCnt && !paiFirst) || (!usCnt && paiFirst))
519 Runtime_Error(pszSrcFile, __LINE__, "paiFirst %p usCnt %u mismatch", paiFirst, usCnt);
520 else {
521 // Free our buffers if free requested
522 if (usFlags & CMA_FREE) {
523 if (paiFirst)
524 pai = paiFirst;
525 else {
526 pai = (PARCITEM)WinSendMsg(hwnd, CM_QUERYRECORD, MPVOID,
527 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
528 if ((INT)pai == -1) {
529 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_QUERYRECORD");
530 remaining = -1;
531 pai = NULL;
532 }
533 }
534 while (pai) {
535 FreeArcItemData(pai);
536 pai = (PARCITEM)pai->rc.preccNextRecord;
537 if (remaining && --remaining == 0)
538 break;
539 }
540 }
541 }
542
543 // DbgMsg(pszSrcFile, __LINE__, "RemoveArcItems %p %u %s", pai, usCnt, pai->pszFileName);
544
545 if (remaining != - 1) {
546 remaining = (INT)WinSendMsg(hwnd, CM_REMOVERECORD, MPFROMP(&paiFirst), MPFROM2SHORT(usCnt, usFlags));
547 if (remaining == -1) {
548 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_REMOVERECORD hwnd %x pai %p cnt %u",
549 hwnd, paiFirst, usCnt);
550 }
551 }
552}
553
554/**
555 * Empty all records from an archive container and
556 * free associated storage and free up field infos
557 */
558
559static VOID EmptyArcCnr(HWND hwnd) /*FOLD00*/
560{
561#if 0 // fixme to be gone or to be configurable
562 {
563 int state = _heapchk();
564 if (state != _HEAPOK)
565 Runtime_Error(pszSrcFile, __LINE__, "heap corrupted %d", state);
566 else
567 DbgMsg(pszSrcFile, __LINE__, "_memavl %u", _memavl());
568 }
569#endif
570
571 // Remove all ARCITEM records
572 RemoveArcItems(hwnd, NULL, 0, CMA_FREE);
573
574 // Use common code to remove rest
575 EmptyCnr(hwnd);
576}
577
578//== FillArcCnr() generate archive content list and fill container window ==
579
580static INT FillArcCnr(HWND hwndCnr, CHAR * arcname, ARC_TYPE ** arcinfo, /*FOLD00*/
581 ULONGLONG * pullTotalBytes, volatile PCHAR pStopFlag)
582{
583 FILE *fp;
584 HFILE oldstdout;
585 HFILE newstdout;
586 CHAR lonename[CCHMAXPATH + 2],
587 *nsize, *osize, *fdate, *fname, *p, *pp, *arctemp;
588 CHAR TestStr[CCHMAXPATH * 2];
589 CHAR s[CCHMAXPATH * 2];
590 BOOL gotstart;
591 BOOL gotend;
592 BOOL wasquote;
593 BOOL nomove = FALSE; // fixme to be gone?
594 BOOL notest;
595 BOOL nobzip, ftarbz, nogzip, ftargz;
596 INT highest = 0, fieldnum, counter = 0, numarcfiles = 0;
597 PARCITEM lastpai;
598 ARC_TYPE *info;
599 ARC_TYPE *tinfo;
600 ULONG apptype;
601 APIRET rc;
602 CHAR *mode;
603 ULONG cnter = 0;
604
605 if (!arcname || !arcinfo)
606 return 0;
607
608 info = *arcinfo;
609 if (!info)
610 info = find_type(arcname, NULL);
611 arctemp = xmallocz(CCHMAXPATH, pszSrcFile, __LINE__);
612 if (CheckDriveSpaceAvail(ArcTempRoot, ullDATFileSpaceNeeded, ullTmpSpaceNeeded) == 1)
613 saymsg(MB_OK,
614 HWND_DESKTOP,
615 NullStr,
616 GetPString(IDS_ARCTMPDRIVESPACELIMITED),
617 ArcTempRoot);
618 MakeTempName(arctemp, ArcTempRoot, 2);
619 p = strrchr(arcname, '.');
620 if (p) {
621 APIRET temp;
622
623 p = p - 3;
624 nobzip = stricmp(p, "TAR.BZ");
625 nogzip = stricmp(p, "TAR.GZ");
626 if (!nobzip) {
627 ftarbz = TRUE;
628 if (DosQueryAppType("bzip.exe" , &apptype)) {
629 nobzip = TRUE;
630 temp = saymsg(MB_YESNO, HWND_DESKTOP, NullStr, GetPString(IDS_ARCNOBZIP));
631 if (temp != MBID_NO)
632 return 0;
633 }
634 }
635 else if (!nogzip) {
636 ftargz = TRUE;
637 if (DosQueryAppType("gzip.exe" , &apptype)) {
638 nogzip = TRUE;
639 temp = saymsg(MB_YESNO, HWND_DESKTOP, NullStr, GetPString(IDS_ARCNOGZIP));
640 if (temp != MBID_NO)
641 return 0;
642 }
643 }
644 }
645
646ReTry:
647
648 tinfo = NULL;
649 numarcfiles = counter = highest = 0;
650 gotstart = gotend = FALSE;
651 lastpai = NULL;
652 *pullTotalBytes = 0;
653 if (!info || !info->list)
654 Runtime_Error(pszSrcFile, __LINE__, NULL);
655 else {
656 RemoveArcItems(hwndCnr, NULL, 0, CMA_FREE | CMA_INVALIDATE | CMA_ERASE);
657 *arcinfo = info;
658 highest = info->osizepos;
659 if (info->nsizepos > highest)
660 highest = info->nsizepos;
661 if (info->fdpos > highest)
662 highest = info->fdpos;
663 if (info->fnpos > highest)
664 highest = info->fnpos;
665 if (highest > 50) {
666 saymsg(MB_ENTER | MB_ICONEXCLAMATION, HWND_DESKTOP,
667 GetPString(IDS_SHAMETEXT), GetPString(IDS_BUNGEDUPTEXT));
668 }
669 if (info->fnpos == -1)
670 highest = 32767;
671
672 DosError(FERR_DISABLEHARDERR);
673 DosForceDelete(arctemp);
674 DosError(FERR_DISABLEHARDERR);
675
676 strcpy(s, info->list);
677 p = strchr(s, ' ');
678 if (p)
679 *p = 0;
680 DosError(FERR_DISABLEHARDERR);
681 if (!DosQueryAppType(s, &apptype) &&
682 (apptype & FAPPTYP_DOS ||
683 apptype & FAPPTYP_WINDOWSREAL ||
684 apptype & FAPPTYP_WINDOWSPROT ||
685 apptype & FAPPTYP_WINDOWSPROT31)) {
686 p = GetCmdSpec(TRUE);
687 runemf2(SEPARATE | INVISIBLE | MINIMIZED | BACKGROUND | WAIT,
688 hwndCnr, pszSrcFile, __LINE__, NULL, "DOS_BACKGROUND_EXECUTION=1",
689 "%s /C %s %s >%s",
690 p, // shell
691 info->list, // list command
692 BldQuotedFileName(s, arcname),
693 arctemp);
694 }
695 else {
696 mode = "w";
697 fp = xfopen(arctemp, mode, pszSrcFile, __LINE__, FALSE);
698 if (!fp) {
699 xfree(arctemp, pszSrcFile, __LINE__);
700 return 0;
701 }
702 else {
703 newstdout = -1;
704 DosError(FERR_DISABLEHARDERR);
705 rc = DosDupHandle(fileno(stdout), &newstdout);
706 if (rc) {
707 Dos_Error(MB_CANCEL, rc, hwndCnr, pszSrcFile, __LINE__,
708 PCSZ_DOSDUPHANDLE);
709 xfree(arctemp, pszSrcFile, __LINE__);
710 return 0;
711 }
712 else {
713 oldstdout = fileno(stdout);
714 DosError(FERR_DISABLEHARDERR);
715 rc = DosDupHandle(fileno(fp), &oldstdout);
716 if (rc) {
717 Dos_Error(MB_CANCEL, rc, hwndCnr, pszSrcFile, __LINE__,
718 PCSZ_DOSDUPHANDLE);
719 xfree(arctemp, pszSrcFile, __LINE__);
720 return 0;
721 }
722 else {
723 rc = 0;
724 //DbgMsg(pszSrcFile, __LINE__, "Number of tries %i", cnter);
725 rc = DosQueryAppType(s, &apptype);
726 if (!rc) {
727 cnter ++;
728 runemf2(SEPARATE | INVISIBLE | MINIMIZED | BACKGROUND | WAIT,
729 hwndCnr, pszSrcFile, __LINE__, NULL, NULL,
730 "%s %s",
731 info->list,
732 BldQuotedFileName(s, arcname));
733 if (cnter == 1) {
734 if (info->test)
735 strcpy(TestStr, info->test);
736 else
737 notest = TRUE;
738 }
739 else if (notest && info->test) {
740 strcpy(TestStr, info->test);
741 notest = FALSE;
742 }
743 }
744 oldstdout = fileno(stdout);
745 DosError(FERR_DISABLEHARDERR);
746 DosDupHandle(newstdout, &oldstdout);
747 DosClose(newstdout);
748 fclose(fp);
749 }
750 }
751 }
752 }
753
754 DosError(FERR_DISABLEHARDERR);
755 mode = "r";
756 fp = xfsopen(arctemp, mode, SH_DENYWR, pszSrcFile, __LINE__, TRUE);
757
758 if (fp) {
759 gotstart = !info->startlist || // If list has no start marker
760 !*info->startlist ||
761 (stricmp(info->startlist, NO_START_OF_ARCHIVER_LIST_STRING) == 0);
762
763 while (!feof(fp) && !gotend && !*pStopFlag) {
764 if (!xfgets_bstripcr(s, sizeof(s), fp, pszSrcFile, __LINE__))
765 break;
766 if (!gotstart) {
767 if (!strcmp(s, info->startlist))
768 gotstart = TRUE;
769 }
770 else if (info->endlist && !strcmp(s, info->endlist))
771 gotend = TRUE;
772 else {
773 // add to container
774 fname = NULL;
775 bstrip(s);
776 if (info->nameisfirst) {
777 strncpy(lonename, s, CCHMAXPATH + 2);
778 lonename[CCHMAXPATH + 1] = 0;
779 fname = lonename;
780 if (!xfgets_bstripcr(s, sizeof(s), fp, pszSrcFile, __LINE__))
781 break;
782 if (*fname == '\"') {
783 memmove(fname, fname + 1, strlen(fname) + 1);
784 p = strchr(fname, '\"');
785 if (p)
786 *p = 0;
787 }
788 }
789 nsize = NULL;
790 osize = fdate = NullStr;
791 p = s;
792 for (fieldnum = 0; fieldnum <= highest; fieldnum++) {
793 pp = p;
794 while (*pp && (*pp == ' ' || *pp == '\t')) // skip leading
795 pp++;
796 if (!*pp) {
797 if (fieldnum == info->fnpos && (!strcmp(strupr(info->ext), "7Z") ||
798 !strcmp(strupr(info->signature), "7Z")))
799 fname = nsize;// GKY 7-30-13 Work around for missing nsize field for some members of archive
800 break;
801 }
802 wasquote = FALSE;
803 p = pp;
804 while (*p && (wasquote ||
805 ((fieldnum != info->fnpos || !info->nameislast) ?
806 (*p != ' ' && *p != '\t') : TRUE))) {
807 if (*p == '\"') {
808 if (!wasquote) {
809 wasquote = TRUE;
810 memmove(p, p + 1, strlen(p));
811 while (*p == ' ' || *p == '\t')
812 p++;
813 }
814 else {
815 memmove(p, p + 1, strlen(p));
816 break;
817 }
818 }
819 else if (*p)
820 p++;
821 }
822 if (*p) {
823 *p = 0;
824 p++;
825 }
826 if (fieldnum == info->nsizepos)
827 nsize = pp;
828 else if (fieldnum == info->osizepos)
829 osize = pp;
830 else if (fieldnum == info->fdpos) {
831 fdate = pp;
832 if (info->fdflds > 1 && info->fdflds < 24) {
833 INT y;
834
835 if (*p) {
836 p--;
837 *p = ' ';
838 for (y = 0; y < info->fdflds - 1; y++) {
839 while (*p && (*p == ' ' || *p == '\t'))
840 p++;
841 while (*p && (*p != ' ' && *p != '\t'))
842 p++;
843 fieldnum++;
844 }
845 if (*p) {
846 *p = 0;
847 p++;
848 }
849 }
850 }
851 }
852 else if (fieldnum == info->fnpos) {
853 fname = pp;
854 if (pp && *pp == '*' && !*(pp + 1)) // workaround for LH.EXE
855 fname = NULL;
856 if (info->nameislast)
857 break;
858 }
859 else if ((!p || !*p) && info->fnpos == -1) {
860 fname = pp;
861 break;
862 }
863 } // for fldnum
864 if (info->nameisnext) {
865 if (!xfgets_bstripcr
866 (lonename, sizeof(lonename), fp, pszSrcFile, __LINE__))
867 break;
868 fname = lonename;
869 }
870 // fixme to complain?
871 if (fname && *fname) {
872
873 RECORDINSERT ri;
874 PARCITEM pai;
875
876 pai = WinSendMsg(hwndCnr,
877 CM_ALLOCRECORD,
878 MPFROMLONG(EXTRA_ARCRECORD_BYTES),
879 MPFROMLONG(1L));
880 if (!pai) {
881 Runtime_Error(pszSrcFile, __LINE__, PCSZ_CM_ALLOCRECORD);
882 break;
883 }
884 else {
885 memset(pai, 0, sizeof(ARCITEM));
886 pai->hwndCnr = hwndCnr;
887 if (*fname == '*') {
888 fname++;
889 pai->flags = ARCFLAGS_REALDIR;
890 }
891 if (fname[strlen(fname) - 1] == '\\' ||
892 fname[strlen(fname) - 1] == '/')
893 pai->flags = ARCFLAGS_REALDIR;
894 pai->pszFileName = xstrdup(fname,pszSrcFile, __LINE__);
895# ifdef FORTIFY
896 // Will be freed by WM_DESTROY
897 Fortify_SetOwner(pai->pszFileName, 1);
898 // Fortify_ChangeScope(pai->pszFileName, -1);
899# endif
900
901 pai->pszDisplayName = pai->pszFileName;
902 pai->rc.pszIcon = pai->pszDisplayName;
903 if (fdate)
904 strcpy(pai->szDate, fdate);
905 // pai->pszFileName = pai->pszFileName;
906 pai->rc.pszIcon = pai->pszFileName;
907 pai->rc.hptrIcon = (pai->flags & ARCFLAGS_REALDIR) != 0 ?
908 hptrDir : hptrFile;
909 pai->pszDate = pai->szDate;
910 if (osize)
911 pai->cbFile = atol(osize);
912 if (nsize)
913 pai->cbComp = atol(nsize);
914 if (info->datetype && fdate && *fdate)
915 ArcDateTime(fdate, info->datetype, &pai->date, &pai->time);
916 memset(&ri, 0, sizeof(RECORDINSERT));
917 ri.cb = sizeof(RECORDINSERT);
918 ri.pRecordOrder = (PRECORDCORE) CMA_END;
919 ri.pRecordParent = (PRECORDCORE) NULL;
920 ri.zOrder = (USHORT) CMA_TOP;
921 ri.cRecordsInsert = 1L;
922 ri.fInvalidateRecord = FALSE;
923 if (WinSendMsg(hwndCnr,
924 CM_INSERTRECORD, MPFROMP(pai), MPFROMP(&ri))) {
925 *pullTotalBytes += pai->cbFile;
926 }
927 numarcfiles++;
928 if (!(++counter % 50)) {
929 if (!lastpai)
930 lastpai = pai;
931 WinSendMsg(hwndCnr,
932 CM_INVALIDATERECORD,
933 lastpai,
934 MPFROM2SHORT(10, CMA_ERASE | CMA_REPOSITION));
935 lastpai = pai;
936 }
937 // Avoid hogging system for large archive
938 if (numarcfiles == 100)
939 priority_idle();
940 }
941 }
942 }
943 } // while !eof
944
945 fclose(fp);
946 //DbgMsg(pszSrcFile, __LINE__, "Archive check counter %i numarcfiles %i gotstart %i %c",
947 // cnter, numarcfiles, gotstart, pStopFlag);
948 if (*pStopFlag)
949 numarcfiles = 0; // Request close
950 else if (!numarcfiles || !gotstart
951 || (!gotend && info->endlist && *info->endlist &&
952 (stricmp(info->endlist, NO_END_OF_ARCHIVER_LIST_STRING)))) {
953 // Oops
954 ARCDUMP ad;
955 CHAR errstr[CCHMAXPATH + 256];
956
957 // Try for alternate archiver
958 tinfo = info;
959 do {
960 tinfo = tinfo->next;
961 if (tinfo)
962 tinfo = find_type(arcname, tinfo);
963 if (tinfo) {
964 DosError(FERR_DISABLEHARDERR);
965 DosForceDelete(arctemp);
966 info = tinfo;
967 goto ReTry;
968 }
969 } while (tinfo);
970 if (!fAlertBeepOff)
971 DosBeep(750, 50); // wake up user
972 if (cnter > 0) {
973 CHAR Temp[CCHMAXPATH + 2];
974
975 sprintf(errstr, GetPString(IDS_ARCERRORINFOTEXT),
976 arcname,
977 !gotstart ? GetPString(IDS_NOGOTSTARTTEXT) : NullStr,
978 !numarcfiles ? GetPString(IDS_NOARCFILESFOUNDTEXT) : NullStr,
979 !gotend ? GetPString(IDS_NOENDOFLISTTEXT) : NullStr,
980 !notest ? NullStr : GetPString(IDS_ARCNOTEST),
981 ftarbz && !nobzip ? GetPString(IDS_ARCBZIPTESTTARBZ) : NullStr,
982 ftargz && !nogzip ? GetPString(IDS_ARCGZIPTESTTARGZ) : NullStr);
983 memset(&ad, 0, sizeof(ARCDUMP));
984 ad.info = info;
985 strcpy(ad.listname, arctemp);
986 strcpy(ad.arcname, arcname);
987 if (!notest) {
988 strcpy(Temp, info->test);
989 info->test = xstrdup(TestStr, pszSrcFile, __LINE__);
990 }
991 else if ((ftarbz && !nobzip) || (ftargz && !nogzip))
992 info->test = xstrdup(ftarbz ? "bzip.exe -t" : "gzip.exe - t",
993 pszSrcFile, __LINE__);
994 ad.errmsg = errstr;
995 WinDlgBox(HWND_DESKTOP,
996 hwndCnr,
997 ArcErrProc, FM3ModHandle, ARCERR_FRAME, MPFROMP(&ad));
998 if (!notest)
999 info->test = xstrdup(Temp, pszSrcFile, __LINE__);
1000 else if ((ftarbz && !nobzip) || (ftargz && !nogzip))
1001 info->test = xstrdup("", pszSrcFile, __LINE__);
1002 }
1003 else
1004 saymsg(MB_OK, HWND_DESKTOP, GetPString(IDS_ARCMISSINGEXE),
1005 GetPString(IDS_ARCMISSINGEXEVERBOSE));
1006 }
1007 else if (!nomove && tinfo) {
1008 // if we got a false hit, move working hit to top
1009 tinfo = info->next;
1010 info->next = arcsighead;
1011 arcsighead->prev = info;
1012 if (tinfo)
1013 tinfo->next->prev = info->prev;
1014 info->prev->next = tinfo;
1015 info->prev = NULL;
1016 arcsighead = info;
1017 rewrite_archiverbb2(NULL); // Rewrite with warning
1018 }
1019 } // if opened
1020
1021 DosError(FERR_DISABLEHARDERR);
1022 DosForceDelete(arctemp);
1023 xfree(arctemp, pszSrcFile, __LINE__);
1024 }
1025
1026 if (numarcfiles)
1027 priority_normal();
1028
1029 return numarcfiles;
1030}
1031
1032MRESULT EXPENTRY ArcTextProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) /*FOLD00*/
1033{
1034 static BOOL emphasized = FALSE;
1035 static HWND hwndButtonPopup = (HWND) 0;
1036 static ULONG timestamp = ULONG_MAX;
1037 static USHORT lastid = 0;
1038
1039 switch (msg) {
1040 case WM_CREATE:
1041 return CommonTextProc(hwnd, msg, mp1, mp2);
1042
1043 case WM_COMMAND:
1044 return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1045 ARC_CNR), msg, mp1, mp2);
1046
1047 case UM_CONTEXTMENU:
1048 case WM_CONTEXTMENU:
1049 {
1050 USHORT id;
1051
1052 id = WinQueryWindowUShort(hwnd, QWS_ID);
1053 switch (id) {
1054 case DIR_SELECTED:
1055 case DIR_VIEW:
1056 case DIR_SORT:
1057 {
1058 POINTL ptl = { 0, 0 };
1059 SWP swp;
1060 DIRCNRDATA *dcd;
1061
1062 if (hwndButtonPopup)
1063 WinDestroyWindow(hwndButtonPopup);
1064 if (id == DIR_SELECTED)
1065 id = DIR_RESTORE;
1066 if (id == lastid) {
1067
1068 ULONG check;
1069
1070 DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &check,
1071 sizeof(check));
1072 if (check < timestamp + 500) {
1073 lastid = 0;
1074 goto MenuAbort;
1075 }
1076 }
1077 hwndButtonPopup = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
1078 if (hwndButtonPopup) {
1079 WinSetWindowUShort(hwndButtonPopup, QWS_ID, id);
1080 dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
1081 QW_PARENT),
1082 ARC_CNR), QWL_USER);
1083 if (id == DIR_SORT) {
1084 if (dcd)
1085 SetSortChecks(hwndButtonPopup, dcd->sortFlags);
1086 WinSendMsg(hwndButtonPopup,
1087 MM_DELETEITEM,
1088 MPFROM2SHORT(IDM_SORTNONE, FALSE), MPVOID);
1089 WinSendMsg(hwndButtonPopup,
1090 MM_DELETEITEM,
1091 MPFROM2SHORT(IDM_SORTNAME, FALSE), MPVOID);
1092 WinSendMsg(hwndButtonPopup,
1093 MM_DELETEITEM,
1094 MPFROM2SHORT(IDM_SORTLADATE, FALSE), MPVOID);
1095 WinSendMsg(hwndButtonPopup,
1096 MM_DELETEITEM,
1097 MPFROM2SHORT(IDM_SORTCRDATE, FALSE), MPVOID);
1098 WinSendMsg(hwndButtonPopup,
1099 MM_DELETEITEM,
1100 MPFROM2SHORT(IDM_SORTDIRSFIRST, FALSE), MPVOID);
1101 WinSendMsg(hwndButtonPopup,
1102 MM_DELETEITEM,
1103 MPFROM2SHORT(IDM_SORTDIRSLAST, FALSE), MPVOID);
1104 WinSendMsg(hwndButtonPopup,
1105 MM_DELETEITEM,
1106 MPFROM2SHORT(IDM_SORTSUBJECT, FALSE), MPVOID);
1107 WinSendMsg(hwndButtonPopup,
1108 MM_SETITEMTEXT,
1109 MPFROM2SHORT(IDM_SORTEASIZE, 0),
1110 MPFROMP(GetPString(IDS_COMPRESSEDSIZEMENUTEXT)));
1111 WinSendMsg(hwndButtonPopup,
1112 MM_SETITEMTEXT,
1113 MPFROM2SHORT(IDM_SORTLWDATE, 0),
1114 MPFROMP(GetPString(IDS_DATEMENUTEXT)));
1115 }
1116 ptl.x = 0;
1117 if (WinPopupMenu(HWND_OBJECT,
1118 HWND_OBJECT,
1119 hwndButtonPopup, -32767, -32767, 0, 0)) {
1120 WinQueryWindowPos(hwndButtonPopup, &swp);
1121 ptl.y = -(swp.cy + 2);
1122 }
1123 else {
1124 WinQueryWindowPos(hwnd, &swp);
1125 ptl.y = swp.cy + 2;
1126 }
1127 if (WinPopupMenu(hwnd,
1128 hwnd,
1129 hwndButtonPopup,
1130 ptl.x,
1131 ptl.y,
1132 0,
1133 PU_HCONSTRAIN | PU_VCONSTRAIN |
1134 PU_KEYBOARD | PU_MOUSEBUTTON1)) {
1135 CenterOverWindow(hwndButtonPopup);
1136 PaintRecessedWindow(hwnd, (HPS) 0, FALSE, FALSE);
1137 }
1138 }
1139 }
1140 break;
1141 default:
1142 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1143 ARC_CNR),
1144 WM_CONTROL, MPFROM2SHORT(ARC_CNR, CN_CONTEXTMENU), MPVOID);
1145 break;
1146 }
1147 }
1148 MenuAbort:
1149 if (msg == UM_CONTEXTMENU)
1150 return 0;
1151 break;
1152
1153 case WM_MENUEND:
1154 if (hwndButtonPopup == (HWND) mp2) {
1155 lastid = WinQueryWindowUShort((HWND) mp2, QWS_ID);
1156 WinDestroyWindow(hwndButtonPopup);
1157 hwndButtonPopup = (HWND) 0;
1158 DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &timestamp,
1159 sizeof(timestamp));
1160 switch (lastid) {
1161 case DIR_VIEW:
1162 case DIR_SORT:
1163 case DIR_RESTORE:
1164 case DIR_SELECTED:
1165 PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
1166 break;
1167 }
1168 }
1169 break;
1170
1171 case WM_MOUSEMOVE:
1172 {
1173 USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
1174 PCSZ s = NULL;
1175
1176 if (fOtherHelp) {
1177 if ((!hwndBubble ||
1178 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
1179 !WinQueryCapture(HWND_DESKTOP)) {
1180 switch (id) {
1181 case DIR_TOTALS:
1182 s = GetPString(IDS_ARCCNRTOTALSHELPTEXT);
1183 break;
1184 case DIR_SELECTED:
1185 s = GetPString(IDS_ARCCNRSELECTEDHELPTEXT);
1186 break;
1187 case DIR_VIEW:
1188 s = GetPString(IDS_ARCCNRVIEWHELPTEXT);
1189 break;
1190 case DIR_SORT:
1191 s = GetPString(IDS_DIRCNRSORTHELP);
1192 break;
1193 case DIR_FILTER:
1194 s = GetPString(IDS_DIRCNRFILTERHELP);
1195 break;
1196 case DIR_FOLDERICON:
1197 s = GetPString(IDS_ARCCNRFOLDERHELPTEXT);
1198 break;
1199 default:
1200 break;
1201 }
1202 if (s)
1203 MakeBubble(hwnd, TRUE, s);
1204 else if (hwndBubble)
1205 WinDestroyWindow(hwndBubble);
1206 }
1207 }
1208 switch (id) {
1209 case DIR_FILTER:
1210 case DIR_SORT:
1211 case DIR_VIEW:
1212 case DIR_SELECTED:
1213 case DIR_FOLDERICON:
1214 return CommonTextButton(hwnd, msg, mp1, mp2);
1215 }
1216 }
1217 break;
1218
1219 case WM_BUTTON3UP:
1220 case WM_BUTTON1UP:
1221 case WM_BUTTON1DOWN:
1222 case WM_BUTTON3DOWN:
1223 {
1224 USHORT id;
1225
1226 id = WinQueryWindowUShort(hwnd, QWS_ID);
1227 switch (id) {
1228 case DIR_FILTER:
1229 case DIR_SORT:
1230 case DIR_VIEW:
1231 case DIR_SELECTED:
1232 case DIR_FOLDERICON:
1233 return CommonTextButton(hwnd, msg, mp1, mp2);
1234 }
1235 }
1236 break;
1237
1238 case UM_CLICKED:
1239 case UM_CLICKED3:
1240 {
1241 USHORT id, cmd = 0;
1242
1243 id = WinQueryWindowUShort(hwnd, QWS_ID);
1244 switch (id) {
1245 case DIR_FOLDERICON:
1246 switch (msg) {
1247 case WM_BUTTON3CLICK:
1248 case WM_CHORD:
1249 cmd = IDM_RESCAN;
1250 break;
1251 default:
1252 if ((SHORT2FROMMP(mp2) & KC_ALT) != 0)
1253 cmd = IDM_WINDOWDLG;
1254 else
1255 cmd = IDM_WALKDIR;
1256 break;
1257 }
1258 break;
1259 case DIR_VIEW:
1260 case DIR_SORT:
1261 case DIR_SELECTED:
1262 PostMsg(hwnd, UM_CONTEXTMENU, MPVOID, MPVOID);
1263 break;
1264 case DIR_FILTER:
1265 cmd = IDM_FILTER;
1266 break;
1267 default:
1268 break;
1269 }
1270 if (cmd)
1271 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1272 ARC_CNR),
1273 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
1274 }
1275 return 0;
1276
1277 case WM_BEGINDRAG:
1278 case DM_DROP:
1279 case DM_DRAGOVER:
1280 case DM_DRAGLEAVE:
1281 case DM_DROPHELP:
1282 if (msg == DM_DRAGOVER) {
1283 if (!emphasized) {
1284 emphasized = TRUE;
1285 DrawTargetEmphasis(hwnd, emphasized);
1286 }
1287 }
1288 else if (msg != WM_BEGINDRAG) {
1289 if (emphasized) {
1290 emphasized = FALSE;
1291 DrawTargetEmphasis(hwnd, emphasized);
1292 }
1293 }
1294 switch (WinQueryWindowUShort(hwnd, QWS_ID)) {
1295 case DIR_FOLDERICON:
1296 switch (msg) {
1297 case DM_DRAGOVER:
1298 if (AcceptOneDrop(hwnd, mp1, mp2))
1299 return MRFROM2SHORT(DOR_DROP, DO_MOVE);
1300 return MRFROM2SHORT(DOR_NODROP, 0); // Drop not valid
1301 case DM_DROPHELP:
1302 DropHelp(mp1, mp2, hwnd, GetPString(IDS_ARCCNRFOLDERDROPHELPTEXT));
1303 return 0;
1304 case DM_DROP:
1305 {
1306 char szFrom[CCHMAXPATH + 2];
1307
1308 if (emphasized) {
1309 emphasized = FALSE;
1310 DrawTargetEmphasis(hwnd, emphasized);
1311 }
1312 if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom)))
1313 WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1314 ARC_CNR),
1315 WM_COMMAND,
1316 MPFROM2SHORT(IDM_SWITCH, 0), MPFROMP(szFrom));
1317 }
1318 return 0;
1319 default:
1320 return PFNWPStatic(hwnd, msg, mp1, mp2);
1321 }
1322 default:
1323 {
1324 CNRDRAGINFO cnd;
1325 USHORT dcmd;
1326
1327 switch (msg) {
1328 case DM_DROP:
1329 dcmd = CN_DROP;
1330 break;
1331 case DM_DRAGOVER:
1332 dcmd = CN_DRAGOVER;
1333 break;
1334 case DM_DRAGLEAVE:
1335 dcmd = CN_DRAGLEAVE;
1336 break;
1337 case DM_DROPHELP:
1338 dcmd = CN_DROPHELP;
1339 break;
1340 case WM_BEGINDRAG:
1341 dcmd = CN_INITDRAG;
1342 break;
1343 }
1344 cnd.pDragInfo = (PDRAGINFO) mp1;
1345 cnd.pRecord = NULL;
1346 return WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
1347 WM_CONTROL,
1348 MPFROM2SHORT(ARC_CNR, dcmd), MPFROMP(&cnd));
1349 }
1350 }
1351 }
1352 return PFNWPStatic(hwnd, msg, mp1, mp2);
1353}
1354
1355MRESULT EXPENTRY ArcClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1, /*FOLD00*/
1356 MPARAM mp2)
1357{
1358
1359 switch (msg) {
1360 case UM_CONTAINERHWND:
1361 return MRFROMLONG(WinWindowFromID(hwnd, ARC_CNR));
1362
1363 case UM_VIEWSMENU:
1364 // fixme to disble menu items as needed
1365 return MRFROMLONG(CheckMenu(hwnd, &ArcCnrMenu, ARCCNR_POPUP));
1366
1367 case UM_FILESMENU:
1368 // fixme to disble menu items as needed
1369 return MRFROMLONG(CheckMenu(hwnd, &ArcMenu, ARC_POPUP));
1370
1371 case MM_PORTHOLEINIT:
1372 case WM_INITMENU:
1373 case UM_INITMENU:
1374 case UM_COMMAND:
1375 case UM_LOADFILE:
1376 case UM_UPDATERECORD:
1377 case UM_UPDATERECORDLIST:
1378 case WM_COMMAND:
1379 case WM_CONTROL:
1380 case WM_CLOSE:
1381 return WinSendMsg(WinWindowFromID(hwnd, ARC_CNR), msg, mp1, mp2);
1382
1383 case WM_PSETFOCUS:
1384 case WM_SETFOCUS:
1385 if (mp2)
1386 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
1387 break;
1388
1389 case UM_FOCUSME:
1390 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, ARC_CNR));
1391 break;
1392
1393 case WM_PAINT:
1394 {
1395 HPS hps;
1396 RECTL rcl;
1397
1398 hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
1399 if (hps) {
1400 WinQueryWindowRect(hwnd, &rcl);
1401 WinFillRect(hps, &rcl, CLR_PALEGRAY);
1402 CommonTextPaint(hwnd, hps);
1403 WinEndPaint(hps);
1404 }
1405 }
1406 break;
1407
1408 case UM_SIZE:
1409 case WM_SIZE:
1410 if (msg == UM_SIZE) {
1411
1412 SWP swp;
1413
1414 WinQueryWindowPos(hwnd, &swp);
1415 mp1 = MPFROM2SHORT(swp.cx, swp.cy);
1416 mp2 = MPFROM2SHORT(swp.cx, swp.cy);
1417 }
1418 {
1419 USHORT cx, cy, bx;
1420
1421 cx = SHORT1FROMMP(mp2);
1422 cy = SHORT2FROMMP(mp2);
1423 WinSetWindowPos(WinWindowFromID(hwnd, ARC_CNR), HWND_TOP,
1424 0,
1425 22, cx, cy - (24 + 22), SWP_SHOW | SWP_MOVE | SWP_SIZE);
1426 WinSetWindowPos(WinWindowFromID(hwnd, ARC_EXTRACTDIR), HWND_TOP,
1427 0, 0, cx, 22, SWP_SHOW | SWP_MOVE | SWP_SIZE);
1428 WinSetWindowPos(WinWindowFromID(hwnd, DIR_FOLDERICON), HWND_TOP,
1429 2, cy - 22, 24, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
1430 WinSetWindowPos(WinWindowFromID(hwnd, DIR_TOTALS), HWND_TOP,
1431 29,
1432 cy - 22,
1433 (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
1434 WinSetWindowPos(WinWindowFromID(hwnd, DIR_SELECTED), HWND_TOP,
1435 29 + (cx / 3) + 2,
1436 cy - 22,
1437 (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
1438 bx = (cx - (29 + (((cx / 3) + 2) * 2))) / 3;
1439 WinSetWindowPos(WinWindowFromID(hwnd, DIR_VIEW), HWND_TOP,
1440 29 + (((cx / 3) + 2) * 2),
1441 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
1442 WinSetWindowPos(WinWindowFromID(hwnd, DIR_SORT), HWND_TOP,
1443 29 + (((cx / 3) + 2) * 2) + bx,
1444 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
1445 WinSetWindowPos(WinWindowFromID(hwnd, DIR_FILTER), HWND_TOP,
1446 29 + (((cx / 3) + 2) * 2) + (bx * 2),
1447 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
1448 }
1449 CommonTextPaint(hwnd, (HPS) 0);
1450 if (msg == UM_SIZE) {
1451 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
1452 SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE);
1453 return 0;
1454 }
1455 break;
1456 }
1457 return WinDefWindowProc(hwnd, msg, mp1, mp2);
1458}
1459
1460MRESULT EXPENTRY ArcObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) /*FOLD00*/
1461{
1462 DIRCNRDATA *dcd;
1463 PSZ psz;
1464 CHAR szQuotedArcName[CCHMAXPATH];
1465 CHAR szQuotedMemberName[CCHMAXPATH];
1466
1467 switch (msg) {
1468 case WM_CREATE:
1469 DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2); // 18 Jul 08 SHL fixme
1470 break;
1471
1472 case DM_PRINTOBJECT:
1473 case DM_DISCARDOBJECT:
1474 dcd = INSTDATA(hwnd);
1475 if (dcd) {
1476
1477 LISTINFO *li;
1478 CNRDRAGINFO cni;
1479
1480 cni.pRecord = NULL;
1481 cni.pDragInfo = (PDRAGINFO) mp1;
1482 li = DoFileDrop(dcd->hwndCnr,
1483 dcd->directory, FALSE, MPVOID, MPFROMP(&cni));
1484 CheckPmDrgLimit(cni.pDragInfo);
1485 if (li) {
1486 li->type = (msg == DM_DISCARDOBJECT) ? IDM_DELETE : IDM_PRINT;
1487 if (!li->list ||
1488 !li->list[0] || !PostMsg(hwnd, UM_ACTION, MPFROMP(li), MPVOID))
1489 FreeListInfo(li);
1490 else
1491 return MRFROMLONG(DRR_SOURCE);
1492 }
1493 }
1494 return MRFROMLONG(DRR_TARGET);
1495
1496 case DM_RENDERPREPARE:
1497 return (MRESULT) TRUE;
1498
1499 case DM_RENDER:
1500 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
1501 if (dcd && dcd->info && dcd->info->extract && dcd->arcname) {
1502
1503 PDRAGTRANSFER pdt = (PDRAGTRANSFER) mp1;
1504 CHAR filename[CCHMAXPATH];
1505 ULONG len;
1506
1507 if (pdt->hwndClient && pdt->pditem && pdt->hstrSelectedRMF &&
1508 pdt->hstrRenderToName) {
1509 if (pdt->usOperation == DO_COPY || pdt->usOperation == DO_MOVE) {
1510 *filename = 0;
1511 len = DrgQueryStrName(pdt->hstrSelectedRMF, CCHMAXPATH, filename);
1512 filename[len] = 0;
1513 if (strnicmp(filename, "OS2FILE,", 8)) {
1514 *filename = 0;
1515 len = DrgQueryStrName(pdt->hstrRenderToName, CCHMAXPATH, filename);
1516 filename[len] = 0;
1517 if (len && *filename) {
1518 psz = xstrdup(filename, pszSrcFile, __LINE__);
1519 if (psz) {
1520 PostMsg(hwnd, UM_RENDER, MPFROMP(pdt), MPFROMP(psz));
1521 return (MRESULT) TRUE;
1522 }
1523 }
1524 }
1525 }
1526 pdt->fsReply = DMFL_RENDERRETRY;
1527 }
1528 }
1529 return (MRESULT) FALSE;
1530
1531 case UM_RENDER:
1532 {
1533 PDRAGTRANSFER pdt = (PDRAGTRANSFER) mp1;
1534 USHORT usRes = DMFL_RENDERFAIL;
1535
1536 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
1537 if (dcd && dcd->info && dcd->info->extract && dcd->arcname) {
1538
1539 CHAR *filename = (CHAR *) mp2, *p;
1540 ULONG len;
1541 CHAR membername[CCHMAXPATH], construct[CCHMAXPATH * 2];
1542
1543 *membername = 0;
1544 len = DrgQueryStrName(pdt->pditem->hstrSourceName,
1545 CCHMAXPATH, membername);
1546 membername[len] = 0;
1547 if (*membername && len && filename) {
1548 unlinkf(filename);
1549 strcpy(construct, filename);
1550 p = strrchr(filename, '\\');
1551 if (!p)
1552 *construct = 0;
1553 else {
1554 if (p == filename || *(p - 1) == ':')
1555 p++;
1556 *p = 0;
1557 }
1558 runemf2(SEPARATE | WINDOWED | ASYNCHRONOUS | WAIT |
1559 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
1560 dcd->hwndClient, pszSrcFile, __LINE__, construct, NULL,
1561 "%s %s %s",
1562 dcd->info->extract,
1563 BldQuotedFileName(szQuotedArcName, dcd->arcname),
1564 BldQuotedFileName(szQuotedMemberName, membername));
1565 BldFullPathName(construct, construct, membername);
1566 if (IsFile(construct) != -1) {
1567 rename(construct, filename);
1568 unlinkf(construct);
1569 if (IsFile(filename) != -1)
1570 usRes = DMFL_RENDEROK;
1571 }
1572 }
1573 }
1574 xfree((CHAR *)mp2, pszSrcFile, __LINE__);
1575 PostMsg(pdt->hwndClient, DM_RENDERCOMPLETE, MPFROMP(pdt),
1576 MPFROM2SHORT(usRes, 0));
1577 }
1578 return 0;
1579
1580 case UM_SETUP:
1581# ifdef FORTIFY
1582 Fortify_EnterScope();
1583# endif
1584 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
1585 if (!dcd) {
1586 Runtime_Error(pszSrcFile, __LINE__, NULL);
1587 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
1588 }
1589 else {
1590# ifdef FORTIFY
1591 Fortify_BecomeOwner(dcd);
1592# endif
1593 // set unique id
1594 WinSetWindowUShort(hwnd, QWS_ID, ARCOBJ_FRAME + (ARC_FRAME - dcd->id));
1595 dcd->hwndObject = hwnd; // pass back hwnd
1596 if (ParentIsDesktop(hwnd, dcd->hwndParent))
1597 DosSleep(100); //05 Aug 07 GKY 250 // Avoid race?
1598 }
1599 return 0;
1600
1601 case UM_RESCAN:
1602 /**
1603 * populate container
1604 */
1605 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
1606 if (dcd) {
1607 if (mp1)
1608 strcpy(dcd->arcname, (CHAR *) mp1); // Update name on request
1609 dcd->ullTotalBytes = dcd->totalfiles =
1610 dcd->selectedfiles = dcd->selectedbytes = 0;
1611 WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, "0");
1612 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, "0 / 0k");
1613 dcd->totalfiles = FillArcCnr(dcd->hwndCnr,
1614 dcd->arcname,
1615 &dcd->info,
1616 &dcd->ullTotalBytes, &dcd->stopflag);
1617 if (!dcd->totalfiles)
1618 PostMsg(dcd->hwndCnr, WM_CLOSE, MPVOID, MPVOID);
1619 else {
1620 dcd->arcfilled = TRUE;
1621 if (!PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID))
1622 WinSendMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
1623 PostMsg(dcd->hwndCnr, UM_SETUP2, MPVOID, MPVOID);
1624 WinSendMsg(dcd->hwndCnr,
1625 CM_INVALIDATERECORD,
1626 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
1627 }
1628 }
1629 return 0;
1630
1631 case UM_SELECT:
1632 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
1633 if (dcd) {
1634 switch (SHORT1FROMMP(mp1)) {
1635 case IDM_SELECTALL:
1636 case IDM_SELECTALLFILES:
1637 SelectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, TRUE);
1638 break;
1639 case IDM_DESELECTALL:
1640 case IDM_DESELECTALLFILES:
1641 DeselectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, TRUE);
1642 break;
1643 case IDM_DESELECTMASK:
1644 case IDM_SELECTMASK:
1645 {
1646 MASK mask;
1647 PARCITEM pci = (PARCITEM) mp2;
1648
1649 memset(&mask, 0, sizeof(MASK));
1650 mask.fNoAttribs = TRUE;
1651 mask.fNoDirs = TRUE;
1652 mask.fText = TRUE;
1653 strcpy(mask.prompt,
1654 GetPString((SHORT1FROMMP(mp1) == IDM_SELECTMASK) ?
1655 IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT));
1656 if (pci && (INT) pci != -1)
1657 strcpy(mask.szMask, pci->pszFileName);
1658 if (WinDlgBox(HWND_DESKTOP, dcd->hwndCnr, PickMaskDlgProc,
1659 FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
1660 if (SHORT1FROMMP(mp1) == IDM_SELECTMASK)
1661 SelectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, NULL, FALSE);
1662 else
1663 DeselectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, NULL, FALSE);
1664 }
1665 }
1666 break;
1667
1668 case IDM_INVERT:
1669 InvertAll(dcd->hwndCnr);
1670 break;
1671 }
1672 }
1673 return 0;
1674
1675 case UM_ENTER:
1676 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
1677 if (dcd) {
1678
1679 CHAR *s = (CHAR *) mp1, *p, *pp; // filename[CCHMAXPATH];
1680 WAITCHILD *WaitChild;
1681
1682 WaitChild = xmallocz(sizeof(WAITCHILD), pszSrcFile, __LINE__);
1683 WaitChild->pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1684 if (!WaitChild)
1685 return 0;
1686 if (s) {
1687 if (!dcd->info->extract) {
1688 Runtime_Error(pszSrcFile, __LINE__, "no extract");
1689 free(s);
1690 return 0;
1691 }
1692 sprintf(WaitChild->pszCmdLine, "%s %s %s",
1693 dcd->info->exwdirs ? dcd->info->exwdirs :
1694 dcd->info->extract,
1695 BldQuotedFileName(szQuotedArcName, dcd->arcname),
1696 BldQuotedFileName(szQuotedMemberName, s));
1697 if (!dcd->info->exwdirs) {
1698 p = s;
1699 p = strrchr(s, '\\');
1700 pp = strrchr(s, '/');
1701 if (p && pp)
1702 p = max(p, pp);
1703 else if (!p)
1704 p = pp;
1705 if (p)
1706 memmove(s, p + 1, strlen(p + 1));
1707 }
1708 sprintf(WaitChild->filename, "%s\\%s", dcd->workdir, s);
1709 ForwardslashToBackslash(WaitChild->filename);
1710 free(s);
1711 WaitChild->RunFlags = SEPARATE | ASYNCHRONOUS | WAIT |
1712 (fArcStuffVisible ? 0 : BACKGROUND);
1713 WaitChild->hwndClient = dcd->hwndClient;
1714 WaitChild->msg = UM_ENTER;
1715 WaitChild->uiLineNumber = __LINE__;
1716 WaitChild->pszSrcFile = pszSrcFile;
1717 WaitChild->pszDirectory = xstrdup(dcd->workdir, pszSrcFile, __LINE__);
1718 WaitChild->pszEnvironment = NULL;
1719 strcpy(WaitChild->formatstring, "%s");
1720 WaitChild->hwndCnr = dcd->hwndCnr;
1721 xbeginthread(WaitChildThread,
1722 65536,
1723 WaitChild,
1724 pszSrcFile,
1725 __LINE__);
1726 }
1727 }
1728 return 0;
1729
1730 case UM_COMMAND:
1731 if (mp1) {
1732 if (PostMsg(hwnd, UM_ACTION, mp1, mp2))
1733 return (MRESULT) TRUE;
1734 }
1735 return 0;
1736
1737 case UM_ACTION:
1738 DosError(FERR_DISABLEHARDERR);
1739 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
1740 if (dcd) {
1741
1742 LISTINFO *li = (LISTINFO *) mp1;
1743 register INT x;
1744
1745 if (li && li->list && li->list[0]) {
1746 // printf("%x/r", li->type); fflush(stdout); // 24 Sep 08 SHL
1747 switch (li->type) {
1748 case IDM_ARCHIVE:
1749 case IDM_ARCHIVEM:
1750 {
1751 DIRCNRDATA ad;
1752 CHAR szBuffer[1025], *p;
1753
1754 if (!li->list[1] && !stricmp(li->list[0], dcd->arcname)) {
1755 Runtime_Error(pszSrcFile, __LINE__, "arc to self");
1756 break;
1757 }
1758 ad = *dcd;
1759 ad.namecanchange = 0;
1760 ad.fmoving = (li->type == IDM_ARCHIVEM);
1761 if (!WinDlgBox(HWND_DESKTOP, dcd->hwndClient, ArchiveDlgProc,
1762 FM3ModHandle, ARCH_FRAME, (PVOID) & ad) || !*ad.arcname ||
1763 !*ad.command) // we blew it
1764 break;
1765 // build the sucker
1766 strcpy(szBuffer, ad.command);
1767 strcat(szBuffer, " ");
1768
1769 BldQuotedFileName(szBuffer + strlen(szBuffer), ad.arcname);
1770
1771 p = &szBuffer[strlen(szBuffer)]; // Remeber where archiver name ends
1772
1773 if (ad.mask.szMask) {
1774 strcat(szBuffer, " ");
1775
1776 BldQuotedFileName(szBuffer + strlen(szBuffer), ad.mask.szMask);
1777 }
1778 strcat(szBuffer, " ");
1779 x = 0;
1780
1781 // Run commands avoiding command line overflow
1782 while (li->list[x]) {
1783
1784 if (IsFile(li->list[x]))
1785 BldQuotedFileName(szBuffer + strlen(szBuffer), li->list[x]);
1786 else
1787 BldQuotedFullPathName(szBuffer + strlen(szBuffer), li->list[x], "*");
1788
1789 x++;
1790 if (!li->list[x] || strlen(szBuffer) +
1791 strlen(li->list[x]) + 5 > MaxComLineStrg) {
1792 runemf2(SEPARATE | WINDOWED | ASYNCHRONOUS |
1793 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
1794 hwnd, pszSrcFile, __LINE__,
1795 NULL, NULL, "%s", szBuffer);
1796 *p = 0;
1797 }
1798 strcat(szBuffer, " ");
1799 } // while
1800
1801 PostMsg(dcd->hwndCnr, UM_RESCAN, MPFROMSHORT(1), MPVOID);
1802 Broadcast(WinQueryAnchorBlock(hwnd),
1803 hwndMain, UM_UPDATERECORD, MPFROMP(ad.arcname), MPVOID);
1804 Broadcast(WinQueryAnchorBlock(hwnd),
1805 hwndMain,
1806 UM_UPDATERECORDLIST, MPFROMP(li->list), MPVOID);
1807 }
1808 break;
1809
1810 case IDM_REFRESH:
1811 case IDM_DELETE:
1812 {
1813 CHAR *endofit;
1814 PSZ pszCmdLine;
1815 INT z;
1816 CHECKLIST ck;
1817 CHAR prompt[CCHMAXPATH + 257];
1818
1819 if (!dcd->info->delete)
1820 break;
1821 memset(&ck, 0, sizeof(ck));
1822 ck.size = sizeof(ck);
1823 ck.list = li->list;
1824 ck.cmd = li->type;
1825 ck.prompt = prompt;
1826 ck.flags = CHECK_ARCHIVE;
1827 sprintf(prompt, GetPString(IDS_ARCCNRDELREFTEXT),
1828 (li->type == IDM_DELETE) ?
1829 GetPString(IDS_DELETELOWERTEXT) :
1830 GetPString(IDS_REFRESHLOWERTEXT),
1831 &"s"[li->list[1] == NULL],
1832 dcd->arcname,
1833 (li->type == IDM_DELETE) ?
1834 GetPString(IDS_DELETELOWERTEXT) :
1835 GetPString(IDS_REFRESHLOWERTEXT));
1836 if (!WinDlgBox(HWND_DESKTOP, hwnd, CheckListProc,
1837 FM3ModHandle, CHECK_FRAME, MPFROMP(&ck)))
1838 break;
1839 li->list = ck.list;
1840 if (!li->list || !li->list[0])
1841 break;
1842 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1843 if (!pszCmdLine)
1844 break;
1845 strcpy(pszCmdLine, li->type == IDM_DELETE ?
1846 dcd->info->delete :
1847 dcd->info->create);
1848 strcat(pszCmdLine, " ");
1849 BldQuotedFileName(pszCmdLine + strlen(pszCmdLine), dcd->arcname);
1850 endofit = &pszCmdLine[strlen(pszCmdLine)];
1851 z = 0;
1852 do {
1853 for (x = z; li->list[x] &&
1854 strlen(pszCmdLine) + strlen(li->list[x]) < 999; x++) {
1855 strcat(pszCmdLine, " ");
1856 BldQuotedFileName(pszCmdLine + strlen(pszCmdLine), li->list[x]);
1857 }
1858 z = x;
1859 runemf2(SEPARATE | WINDOWED | ASYNCHRONOUS | WAIT |
1860 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
1861 hwnd, pszSrcFile, __LINE__, NullStr, NULL, "%s", pszCmdLine);
1862 *endofit = 0;
1863 free(pszCmdLine);
1864 } while (li->list[x]);
1865 PostMsg(dcd->hwndCnr, UM_RESCAN, MPFROMSHORT(1), MPVOID);
1866 Broadcast(WinQueryAnchorBlock(hwnd),
1867 hwndMain,
1868 UM_UPDATERECORD, MPFROMP(dcd->arcname), MPVOID);
1869 }
1870 break;
1871
1872 case IDM_PRINT:
1873 case IDM_VIRUSSCAN:
1874 case IDM_VIEW:
1875 case IDM_MCIPLAY:
1876 case IDM_VIEWARCHIVE:
1877 case IDM_VIEWTEXT:
1878 case IDM_VIEWBINARY:
1879 case IDM_EDIT:
1880 case IDM_EDITTEXT:
1881 case IDM_EDITBINARY:
1882 case IDM_EXEC:
1883 case IDM_EXTRACTWDIRS:
1884 case IDM_EXTRACT:
1885 case IDM_OPENDEFAULT:
1886 case IDM_OPENSETTINGS:
1887 {
1888 CHAR *endofit, *ptr;
1889 PSZ pszCmdLine;
1890 INT z;
1891 if ((li->type == IDM_EXTRACT && !li->info->extract) ||
1892 ((li->type == IDM_VIEW || li->type == IDM_VIEWTEXT ||
1893 li->type == IDM_VIEWBINARY || li->type == IDM_EDIT ||
1894 li->type == IDM_VIEWARCHIVE || li->type == IDM_EDITTEXT ||
1895 li->type == IDM_EDITBINARY || li->type == IDM_MCIPLAY) &&
1896 (!li->info->extract && !li->info->exwdirs)) ||
1897 (li->type != IDM_EXTRACT && li->type != IDM_EDIT &&
1898 li->type != IDM_VIEW && li->type != IDM_VIEWTEXT &&
1899 li->type != IDM_VIEWBINARY &&
1900 li->type != IDM_VIEWARCHIVE &&
1901 li->type != IDM_EDITTEXT &&
1902 li->type != IDM_EDITBINARY &&
1903 li->type != IDM_MCIPLAY && !li->info->exwdirs)) {
1904 Runtime_Error(pszSrcFile, __LINE__, "no cmd for request");
1905 break;
1906 }
1907 if (li->type == IDM_EXTRACT || li->type == IDM_EXTRACTWDIRS) {
1908
1909 CHAR fullname[CCHMAXPATH * 2];
1910 CHAR **exfiles = NULL;
1911 UINT numfiles = 0, numalloc = 0;
1912
1913 if (li->targetpath && fFileNameCnrPath &&
1914 stricmp(lastextractpath, li->targetpath)) {
1915 strcpy(lastextractpath, li->targetpath);
1916 SetDir(dcd->hwndParent, hwnd, li->targetpath, 1);
1917 }
1918 for (x = 0; li->list[x]; x++) {
1919 BldFullPathName(fullname, li->targetpath, li->list[x]);
1920 //Check if file already exists on disk warn if it does.
1921 if (IsFile(fullname) != -1) {
1922 AddToList(li->list[x], &exfiles, &numfiles, &numalloc);
1923 li->list = RemoveFromList(li->list, li->list[x]);
1924 if (!li->list)
1925 break;
1926 x--;
1927 }
1928 }
1929 if (exfiles && numfiles) {
1930
1931 CHECKLIST ckl;
1932 CHAR prompt[(CCHMAXPATH * 2) + 256];
1933
1934 memset(&ckl, 0, sizeof(ckl));
1935 ckl.size = sizeof(ckl);
1936 ckl.list = exfiles;
1937 ckl.prompt = prompt;
1938 ckl.cmd = li->type;
1939 ckl.flags = CHECK_ARCHIVE;
1940 sprintf(prompt,
1941 GetPString(IDS_REPLACEWARNTEXT),
1942 &"s"[numfiles == 1],
1943 li->arcname, &"s"[numfiles != 1], li->targetpath);
1944 if (!WinDlgBox(HWND_DESKTOP, hwnd, CheckListProc,
1945 FM3ModHandle, CHECK_FRAME, MPFROMP(&ckl))) {
1946 if (ckl.list)
1947 FreeList(ckl.list);
1948 break;
1949 }
1950 else if (ckl.list)
1951 li->list = CombineLists(li->list, ckl.list);
1952 } // end check and warn
1953 }
1954 if (!li->list || !li->list[0])
1955 break;
1956 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1957 if (!pszCmdLine)
1958 break;
1959 strcpy(pszCmdLine,
1960 (li->type == IDM_EXTRACT ||
1961 ((li->type == IDM_VIEW ||
1962 li->type == IDM_VIEWTEXT ||
1963 li->type == IDM_VIEWBINARY ||
1964 li->type == IDM_VIEWARCHIVE ||
1965 li->type == IDM_PRINT ||
1966 li->type == IDM_EDIT ||
1967 li->type == IDM_EDITTEXT ||
1968 li->type == IDM_OPENDEFAULT ||
1969 li->type == IDM_OPENSETTINGS ||
1970 (li->type == IDM_EDITBINARY || // JBS No way for this () to be true??
1971 li->type == IDM_MCIPLAY)) ||
1972 !li->info->exwdirs)) ?
1973 li->info->extract :
1974 li->info->exwdirs);
1975 strcat(pszCmdLine, " ");
1976 BldQuotedFileName(pszCmdLine + strlen(pszCmdLine), li->arcname);
1977 endofit = &pszCmdLine[strlen(pszCmdLine)];
1978 z = 0;
1979 do {
1980 for (x = z; li->list[x] &&
1981 strlen(pszCmdLine) + strlen(li->list[x]) < MaxComLineStrg - 1 ; x++) {
1982 strcat(pszCmdLine, " ");
1983 BldQuotedFileName(pszCmdLine + strlen(pszCmdLine), li->list[x]);
1984 ptr = li->list[x];
1985 while (*ptr) {
1986 if (*ptr == '/')
1987 *ptr = '\\';
1988 ptr++;
1989 }
1990 }
1991 z = x;
1992 runemf2(SEPARATE | WINDOWED | WAIT |
1993 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
1994 hwnd, pszSrcFile, __LINE__,
1995 li->targetpath, NULL, "%s", pszCmdLine);
1996 *endofit = 0;
1997 } while (li->list[x]);
1998 if (li->type == IDM_EXTRACT || li->type == IDM_EXTRACTWDIRS) {
1999 // update windows
2000 for (x = 0; li->list[x]; x++) {
2001
2002 CHAR *temp, *p;
2003
2004 temp = li->list[x];
2005 ForwardslashToBackslash(temp);
2006 p = xmalloc(strlen(temp) + strlen(li->targetpath) + 2,
2007 pszSrcFile, __LINE__);
2008 if (p) {
2009 BldFullPathName(p, li->targetpath, temp);
2010 li->list[x] = p;
2011 free(temp);
2012 }
2013 }
2014 if (fFolderAfterExtract) {
2015
2016 CHAR objectpath[CCHMAXPATH], *p;
2017 APIRET rc;
2018
2019 GetDesktopName(objectpath, sizeof(objectpath));
2020 rc = WinDlgBox(HWND_DESKTOP, dcd->hwndParent, ObjCnrDlgProc,
2021 FM3ModHandle, OBJCNR_FRAME,
2022 MPFROMP(objectpath));
2023 if (rc) {
2024 if (rc > 1)
2025 strcpy(objectpath, "<WP_DESKTOP>");
2026 p = NULL;
2027 if (li->arcname) {
2028 p = strrchr(li->arcname, '\\');
2029 if (p)
2030 p++;
2031 }
2032 MakeShadows(dcd->hwndParent, li->list, 2, objectpath, p);
2033 }
2034 }
2035 Broadcast(WinQueryAnchorBlock(hwnd),
2036 hwndMain,
2037 UM_UPDATERECORDLIST, MPFROMP(li->list), MPVOID);
2038 }
2039 else if (li->type == IDM_EXEC)
2040 ExecOnList(hwnd,
2041 li->runfile,
2042 WINDOWED | SEPARATEKEEP | PROMPT,
2043 li->targetpath, NULL, NULL, GetPString(IDS_EXECARCFILETITLETEXT),
2044 pszSrcFile, __LINE__);
2045 else if (li->type == IDM_VIRUSSCAN)
2046 ExecOnList(hwnd, virus, PROMPT | WINDOWED | SEPARATEKEEP,
2047 li->targetpath, NULL, NULL,
2048 GetPString(IDS_VIRUSSCANARCHIVETITLETEXT),
2049 pszSrcFile, __LINE__);
2050 else if (li->type == IDM_VIEW || li->type == IDM_VIEWTEXT ||
2051 li->type == IDM_VIEWBINARY || li->type == IDM_EDIT ||
2052 li->type == IDM_EDITTEXT ||
2053 li->type == IDM_VIEWARCHIVE ||
2054 li->type == IDM_EDITBINARY ||
2055 li->type == IDM_OPENDEFAULT ||
2056 li->type == IDM_OPENSETTINGS ||
2057 li->type == IDM_MCIPLAY || li->type == IDM_PRINT) {
2058
2059 CHAR *temp, *p;
2060 for (x = 0; li->list[x]; x++) {
2061 if (!li->info->exwdirs) {
2062 temp = li->list[x];
2063 p = strrchr(li->list[x], '\\');
2064 if (p) {
2065 p++;
2066 li->list[x] = xstrdup(p, pszSrcFile, __LINE__);
2067 if (!li->list[x])
2068 li->list[x] = temp;
2069 else {
2070 xfree(temp, pszSrcFile, __LINE__);
2071 }
2072 }
2073 }
2074 BldFullPathName(pszCmdLine, li->targetpath, li->list[x]);
2075 temp = li->list[x];
2076 li->list[x] = xstrdup(pszCmdLine, pszSrcFile, __LINE__);
2077 if (!li->list[x])
2078 li->list[x] = temp;
2079 else
2080 xfree(temp, pszSrcFile, __LINE__);
2081 }
2082 free(pszCmdLine);
2083 if (li->type == IDM_VIEW || li->type == IDM_EDIT) {
2084
2085 BOOL isit = TestBinary(li->list[0]);
2086
2087 if (isit) {
2088 if (li->type == IDM_VIEW)
2089 li->type = IDM_VIEWBINARY;
2090 else
2091 li->type = IDM_EDITBINARY;
2092 }
2093 else {
2094 if (li->type == IDM_VIEW)
2095 li->type = IDM_VIEWTEXT;
2096 else
2097 li->type = IDM_EDITTEXT;
2098 }
2099 }
2100 if (li->type == IDM_MCIPLAY) {
2101
2102 FILE *fp;
2103 CHAR szTempFile[CCHMAXPATH];
2104 CHAR *modew = "w";
2105
2106 if (pTmpDir && !IsValidDir(pTmpDir))
2107 DosCreateDir(pTmpDir, 0);
2108 BldFullPathName(szTempFile, pTmpDir, PCSZ_FM2PLAYTEMP);
2109 fp = xfopen(szTempFile, modew, pszSrcFile, __LINE__, FALSE);
2110 if (fp) {
2111 fprintf(fp, "%s", ";AV/2-built FM2Play listfile\n");
2112 for (x = 0; li->list[x]; x++)
2113 fprintf(fp, "%s\n", li->list[x]);
2114 fprintf(fp, ";end\n");
2115 fclose(fp);
2116 strrev(szTempFile);
2117 strcat(szTempFile, "@/");
2118 strrev(szTempFile);
2119 RunFM2Util(PCSZ_FM2PLAYEXE, szTempFile);
2120 }
2121 }
2122 else if (li->type == IDM_PRINT) {
2123 strcpy(li->targetpath, printer);
2124 // 10 Dec 08 SHL correct error handling - looked backward
2125 if (xbeginthread(PrintListThread,
2126 65536,
2127 li,
2128 pszSrcFile,
2129 __LINE__) != -1)
2130 {
2131 li = NULL; // Ensure not freed here
2132 }
2133
2134 }
2135 else if (li->type == IDM_VIEWARCHIVE) {
2136
2137 ARC_TYPE *info;
2138
2139 for (x = 0; li->list[x]; x++) {
2140 if (IsFile(li->list[x]) == 1) {
2141 info = NULL; // Do not hide dups - fixme to know why?
2142 if (WinDlgBox(HWND_DESKTOP, HWND_DESKTOP,
2143 SBoxDlgProc, FM3ModHandle, ASEL_FRAME,
2144 (PVOID) & info) && info) {
2145 StartArcCnr(HWND_DESKTOP,
2146 HWND_DESKTOP, li->list[x], 4, info);
2147 }
2148 }
2149 }
2150 }
2151 else if ((li->type == IDM_VIEWTEXT && *viewer) ||
2152 (li->type == IDM_VIEWBINARY && *binview) ||
2153 (li->type == IDM_EDITTEXT && *editor) ||
2154 (li->type == IDM_EDITBINARY && *bined)) {
2155 //DosSleep(32); // Added WAIT to runemf2 12-12-08 GKY
2156 ExecOnList(hwnd, ((li->type == IDM_VIEWTEXT) ? viewer :
2157 (li->type == IDM_VIEWBINARY) ? binview :
2158 (li->type == IDM_EDITTEXT) ? editor :
2159 bined),
2160 WINDOWED | SEPARATE, NULL, NULL, // li->targetpath,
2161 li->list,
2162 NULL, pszSrcFile, __LINE__);
2163 }
2164 else if (li->type == IDM_OPENDEFAULT ||
2165 li->type == IDM_OPENSETTINGS) {
2166 WORKER *wk;
2167# ifdef FORTIFY
2168 Fortify_EnterScope();
2169# endif
2170 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
2171 if (!wk)
2172 FreeListInfo(li);
2173 else {
2174 wk->size = sizeof(WORKER);
2175 wk->hwndCnr = dcd->hwndCnr;
2176 wk->hwndParent = dcd->hwndParent;
2177 wk->hwndFrame = dcd->hwndFrame;
2178 wk->hwndClient = dcd->hwndClient;
2179 wk->li = li;
2180 strcpy(wk->directory, dcd->directory);
2181 if (xbeginthread(Action,
2182 122880,
2183 wk,
2184 pszSrcFile,
2185 __LINE__) == -1)
2186 {
2187 free(wk);
2188 FreeListInfo((LISTINFO *) mp1);
2189 }
2190 }
2191# ifdef FORTIFY
2192 Fortify_LeaveScope();
2193# endif
2194 }
2195 else {
2196 if (li->hwnd) {
2197
2198 ULONG viewtype;
2199
2200 for (x = 0; li->list[x]; x++) {
2201 if (x == 0) {
2202 if (li->type == IDM_VIEWBINARY ||
2203 li->type == IDM_EDITBINARY)
2204 viewtype = 16;
2205 else
2206 viewtype = 8;
2207 }
2208 else
2209 viewtype = 0;
2210# ifdef FORTIFY
2211 Fortify_EnterScope();
2212# endif
2213 temp = xstrdup(li->list[x], pszSrcFile, __LINE__);
2214 if (temp) {
2215 if (!PostMsg(WinQueryWindow(li->hwnd, QW_PARENT),
2216 UM_LOADFILE,
2217 MPFROMLONG(4L +
2218 (li->type == IDM_VIEWTEXT ||
2219 li->type == IDM_VIEWBINARY) +
2220 viewtype), MPFROMP(temp)))
2221 free(temp);
2222 }
2223# ifdef FORTIFY
2224 DosSleep(1); // Allow MassAction to take ownership
2225 Fortify_LeaveScope();
2226# endif
2227 }
2228 }
2229 }
2230 }
2231 }
2232 break;
2233
2234 case IDM_FIND:
2235 {
2236 UINT numfiles = 0, numalloced = 0;
2237 CHAR **list2 = NULL, fullname[CCHMAXPATH * 2], *p;
2238
2239 for (x = 0; li->list[x]; x++) {
2240 ForwardslashToBackslash(li->list[x]);
2241 BldFullPathName(fullname, dcd->directory, li->list[x]);
2242 if (IsFile(fullname) != -1)
2243 if (AddToList(fullname, &list2, &numfiles, &numalloced))
2244 break;
2245 if (strchr(li->list[x], '\\')) {
2246 p = strrchr(li->list[x], '\\');
2247 if (p) {
2248 p++;
2249 if (*p) {
2250 BldFullPathName(fullname, dcd->directory, p);
2251 if (IsFile(fullname) != -1)
2252 if (AddToList(fullname, &list2, &numfiles, &numalloced))
2253 break;
2254 }
2255 }
2256 }
2257 }
2258 if (!numfiles || !list2)
2259 Runtime_Error(pszSrcFile, __LINE__, "no files or list");
2260 else {
2261 WinSendMsg(dcd->hwndCnr, WM_COMMAND,
2262 MPFROM2SHORT(IDM_COLLECTOR, 0), MPVOID);
2263 DosSleep(10); //05 Aug 07 GKY 128
2264 if (Collector) {
2265 if (!PostMsg(Collector, WM_COMMAND,
2266 MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(list2)))
2267 FreeList(list2);
2268 }
2269 else
2270 FreeList(list2);
2271 }
2272 }
2273 break;
2274 } // switch
2275 }
2276 if (li && li->type != IDM_OPENDEFAULT && li->type != IDM_OPENSETTINGS)
2277 {
2278 FreeListInfo(li);
2279 }
2280 }
2281 return 0;
2282
2283 case WM_CLOSE:
2284 WinDestroyWindow(hwnd);
2285 break;
2286
2287 case WM_DESTROY:
2288 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
2289 if (dcd) {
2290 if (*dcd->workdir) {
2291 DosSleep(16); //05 Aug 07 GKY 33
2292 wipeallf(TRUE, "%s\\*", dcd->workdir);
2293 if (rmdir(dcd->workdir)) {
2294 DosSleep(100); //05 Aug 07 GKY 256
2295 wipeallf(TRUE, "%s\\*", dcd->workdir);
2296 rmdir(dcd->workdir);
2297 }
2298 }
2299 FreeList(dcd->lastselection);
2300 WinSendMsg(dcd->hwndCnr, UM_CLOSE, MPVOID, MPVOID);
2301 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, NULL); // 13 Apr 10 SHL Set NULL before freeing dcd
2302 free(dcd);
2303# ifdef FORTIFY
2304 Fortify_LeaveScope();
2305# endif
2306 }
2307 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
2308 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
2309 break;
2310 } // switch
2311 return WinDefWindowProc(hwnd, msg, mp1, mp2);
2312}
2313
2314static MRESULT EXPENTRY ArcCnrWndProc(HWND hwnd, ULONG msg, MPARAM mp1, /*FOLD00*/
2315 MPARAM mp2)
2316{
2317 DIRCNRDATA *dcd = INSTDATA(hwnd);
2318 CHAR szQuotedArcName[CCHMAXPATH];
2319
2320 switch (msg) {
2321 case DM_PRINTOBJECT:
2322 case DM_DISCARDOBJECT:
2323 if (dcd)
2324 return WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
2325 else
2326 return MRFROMLONG(DRR_TARGET);
2327
2328 case WM_CHAR:
2329 shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
2330 if (SHORT1FROMMP(mp1) & KC_KEYUP)
2331 return (MRESULT)TRUE;
2332 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
2333 switch (SHORT2FROMMP(mp2)) {
2334 case VK_DELETE:
2335 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID);
2336 break;
2337 }
2338 }
2339
2340 if (SearchContainer(hwnd, msg, mp1, mp2))
2341 return (MRESULT)TRUE; // Avoid default handler
2342 break; // Let default handler see key too
2343
2344 case WM_MOUSEMOVE:
2345 case WM_BUTTON1UP:
2346 case WM_BUTTON2UP:
2347 case WM_BUTTON3UP:
2348 case WM_CHORD:
2349 shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
2350 break;
2351
2352 case WM_BUTTON1MOTIONEND:
2353 {
2354 CNRINFO cnri;
2355
2356 memset(&cnri, 0, sizeof(CNRINFO));
2357 cnri.cb = sizeof(CNRINFO);
2358 if (WinSendMsg(hwnd,
2359 CM_QUERYCNRINFO,
2360 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)))) {
2361 if (cnri.flWindowAttr & CV_DETAIL)
2362 PrfWriteProfileData(fmprof,
2363 appname,
2364 "ArcCnrSplitBar",
2365 (PVOID) & cnri.xVertSplitbar, sizeof(LONG));
2366 }
2367 }
2368 break;
2369
2370 case WM_PRESPARAMCHANGED:
2371 PresParamChanged(hwnd, PCSZ_ARCCNR, mp1, mp2);
2372 break;
2373
2374 case UM_UPDATERECORD:
2375 case UM_UPDATERECORDLIST:
2376 if (dcd && !IsArcThere(hwnd, dcd->arcname))
2377 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
2378 return 0;
2379
2380 case WM_SETFOCUS:
2381 /**
2382 * put name of our window (archive name) on status line
2383 */
2384 if (dcd && hwndStatus && mp2)
2385 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2386 break;
2387
2388 case UM_SETUP2:
2389 if (dcd && dcd->info) {
2390 if (dcd->info->fdpos == -1 || !dcd->info->datetype)
2391 dcd->sortFlags &= (~SORT_LWDATE);
2392 if (dcd->info->nsizepos == -1)
2393 dcd->sortFlags &= (~SORT_EASIZE);
2394 if (dcd->info->osizepos == -1)
2395 dcd->sortFlags &= (~SORT_SIZE);
2396 AdjustCnrColVis(hwnd,
2397 GetPString(IDS_OLDSIZECOLTEXT),
2398 dcd->info->osizepos != -1, FALSE);
2399 AdjustCnrColVis(hwnd,
2400 GetPString(IDS_NEWSIZECOLTEXT),
2401 dcd->info->nsizepos != -1, FALSE);
2402 // Display unsullied date/time string if type 0
2403 AdjustCnrColVis(hwnd,
2404 GetPString(IDS_DATETIMECOLTEXT),
2405 dcd->info->fdpos != -1 && !dcd->info->datetype, FALSE);
2406 // Display parsed date/time columns if type specified
2407 AdjustCnrColVis(hwnd,
2408 GetPString(IDS_TIMECOLTEXT),
2409 dcd->info->fdpos != -1 && dcd->info->datetype, FALSE);
2410 AdjustCnrColVis(hwnd,
2411 GetPString(IDS_DATECOLTEXT),
2412 dcd->info->fdpos != -1 && dcd->info->datetype, FALSE);
2413 WinSendMsg(hwnd, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID);
2414 }
2415 return 0;
2416
2417 case UM_RESCAN:
2418 if (dcd) {
2419 CNRINFO cnri;
2420 CHAR s[CCHMAXPATH * 2], tb[81], tf[81];
2421 PARCITEM pci;
2422
2423 if (mp1) {
2424 PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPVOID);
2425 return 0;
2426 }
2427 memset(&cnri, 0, sizeof(CNRINFO));
2428 cnri.cb = sizeof(CNRINFO);
2429 WinSendMsg(hwnd,
2430 CM_QUERYCNRINFO,
2431 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
2432 dcd->totalfiles = cnri.cRecords;
2433 commafmt(tf, sizeof(tf), dcd->selectedfiles);
2434 if (dcd->ullTotalBytes)
2435 CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, 'K');
2436 else
2437 *tb = 0;
2438 sprintf(s, "%s%s%s", tf, *tb ? " / " : NullStr, tb);
2439 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
2440 commafmt(tf, sizeof(tf), dcd->totalfiles);
2441 if (dcd->ullTotalBytes)
2442 CommaFmtULL(tb, sizeof(tb), dcd->ullTotalBytes, 'K');
2443 else
2444 *tb = 0;
2445 sprintf(s, "%s%s%s", tf, *tb ? " / " : NullStr, tb);
2446 WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, s);
2447 if (hwndStatus &&
2448 dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
2449 sprintf(s, " [%s%s%s]%s%s%s %s",
2450 tf,
2451 *tb ? " / " : NullStr,
2452 tb,
2453 *dcd->mask.szMask ? " (" : NullStr,
2454 *dcd->mask.szMask ? dcd->mask.szMask : NullStr,
2455 *dcd->mask.szMask ? ")" : NullStr, dcd->arcname);
2456 WinSetWindowText(hwndStatus, s);
2457 if (!ParentIsDesktop(hwnd, dcd->hwndParent)) {
2458 pci = WinSendMsg(hwnd,
2459 CM_QUERYRECORDEMPHASIS,
2460 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
2461 if (pci && (INT) pci != -1) {
2462 if (fSplitStatus && hwndStatus2) {
2463 if (dcd->ullTotalBytes)
2464 CommaFmtULL(tb, sizeof(tb), pci->cbFile, ' ');
2465 else
2466 *tb = 0;
2467 sprintf(s, "%s%s%s%s",
2468 *tb ? " " : NullStr,
2469 tb, *tb ? " " : NullStr, pci->pszFileName);
2470 WinSetWindowText(hwndStatus2, s);
2471 }
2472 if (fMoreButtons)
2473 WinSetWindowText(hwndName, pci->pszFileName);
2474 }
2475 else {
2476 WinSetWindowText(hwndStatus2, NullStr);
2477 WinSetWindowText(hwndName, NullStr);
2478 }
2479 WinSetWindowText(hwndDate, NullStr);
2480 WinSetWindowText(hwndAttr, NullStr);
2481 }
2482 }
2483 if ((dcd->arcfilled && !dcd->totalfiles) ||
2484 !IsArcThere(hwnd, dcd->arcname))
2485 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
2486 }
2487 return 0;
2488
2489 case UM_SETUP:
2490 if (!dcd) {
2491 Runtime_Error(pszSrcFile, __LINE__, NULL);
2492 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
2493 return 0;
2494 }
2495 else {
2496 if (!dcd->hwndObject) {
2497 /**
2498 * first time through -- set things up
2499 */
2500 {
2501 CHAR *p;
2502 ULONG z, was;
2503 APIRET rc;
2504
2505 rc = DosCreateDir(dcd->workdir, 0);
2506 if (rc) {
2507 if (rc == ERROR_ACCESS_DENIED) {
2508 p = strrchr(dcd->workdir, '.');
2509 if (p) { /* jbs: What if there is no "."? Give up? */
2510 p++;
2511 was = strtoul(p, NULL, 16);
2512 for (z = 0; z < 99; z++) {
2513 was++;
2514 sprintf(p, "%03x");
2515 rc = DosCreateDir(dcd->workdir, 0);
2516 if (!rc || rc != ERROR_ACCESS_DENIED)
2517 break;
2518 }
2519 }
2520 }
2521 if (rc)
2522 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
2523 return 0;
2524 }
2525 }
2526 RestorePresParams(hwnd, PCSZ_ARCCNR);
2527 dcd->mask.fNoAttribs = TRUE;
2528 dcd->mask.fNoDirs = TRUE;
2529 *dcd->mask.prompt = 0;
2530 {
2531 PFIELDINFO pfi, pfiLastLeftCol;
2532 ULONG numcols = CON_COLS;
2533 CNRINFO cnri;
2534 ULONG size;
2535
2536 pfi = WinSendMsg(hwnd,
2537 CM_ALLOCDETAILFIELDINFO,
2538 MPFROMLONG(numcols), NULL);
2539 if (pfi) {
2540
2541 PFIELDINFO pfiFirst;
2542 FIELDINFOINSERT fii;
2543
2544 pfiFirst = pfi;
2545 pfi->flData = CFA_STRING | CFA_LEFT | CFA_FIREADONLY;
2546 pfi->flTitle = CFA_CENTER;
2547 pfi->pTitleData = (PSZ)GetPString(IDS_FILENAMECOLTEXT);
2548 pfi->offStruct = FIELDOFFSET(ARCITEM, pszDisplayName);
2549 pfiLastLeftCol = pfi;
2550 pfi = pfi->pNextFieldInfo;
2551 pfi->flData =
2552 CFA_ULONG | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
2553 pfi->flTitle = CFA_CENTER;
2554 pfi->pTitleData = (PSZ)GetPString(IDS_OLDSIZECOLTEXT);
2555 pfi->offStruct = FIELDOFFSET(ARCITEM, cbFile);
2556 pfi = pfi->pNextFieldInfo;
2557 pfi->flData =
2558 CFA_ULONG | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
2559 pfi->flTitle = CFA_CENTER;
2560 pfi->pTitleData = (PSZ)GetPString(IDS_NEWSIZECOLTEXT);
2561 pfi->offStruct = FIELDOFFSET(ARCITEM, cbComp);
2562 pfi = pfi->pNextFieldInfo;
2563 pfi->flData =
2564 CFA_STRING | CFA_CENTER | CFA_SEPARATOR | CFA_FIREADONLY;
2565 pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
2566 pfi->pTitleData = (PSZ)GetPString(IDS_DATETIMECOLTEXT);
2567 pfi->offStruct = FIELDOFFSET(ARCITEM, pszDate);
2568 pfi = pfi->pNextFieldInfo;
2569 pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY;
2570 pfi->flTitle = CFA_CENTER;
2571 pfi->pTitleData = (PSZ)GetPString(IDS_DATECOLTEXT);
2572 pfi->offStruct = FIELDOFFSET(ARCITEM, date);
2573 pfi = pfi->pNextFieldInfo;
2574 pfi->flData = CFA_TIME | CFA_RIGHT | CFA_FIREADONLY;
2575 pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
2576 pfi->pTitleData = (PSZ)GetPString(IDS_TIMECOLTEXT);
2577 pfi->offStruct = FIELDOFFSET(ARCITEM, time);
2578 memset(&fii, 0, sizeof(FIELDINFOINSERT));
2579 fii.cb = sizeof(FIELDINFOINSERT);
2580 fii.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST;
2581 fii.cFieldInfoInsert = (SHORT) numcols;
2582 fii.fInvalidateFieldInfo = TRUE;
2583 WinSendMsg(hwnd,
2584 CM_INSERTDETAILFIELDINFO,
2585 MPFROMP(pfiFirst), MPFROMP(&fii));
2586 PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
2587
2588 memset(&cnri, 0, sizeof(cnri));
2589 cnri.cb = sizeof(CNRINFO);
2590 cnri.pFieldInfoLast = pfiLastLeftCol;
2591 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET + 32;
2592
2593 size = sizeof(LONG);
2594 PrfQueryProfileData(fmprof, appname, "ArcCnrSplitBar",
2595 &cnri.xVertSplitbar, &size);
2596 if (cnri.xVertSplitbar <= 0)
2597 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET + 32;
2598
2599 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT | CV_NAME));
2600 cnri.flWindowAttr |= (CV_DETAIL | CA_DETAILSVIEWTITLES | CV_FLOW);
2601 cnri.flWindowAttr &= (~(CA_ORDEREDTARGETEMPH |
2602 CA_MIXEDTARGETEMPH));
2603 cnri.pSortRecord = (PVOID) ArcSort;
2604 WinSendMsg(hwnd,
2605 CM_SETCNRINFO,
2606 MPFROMP(&cnri),
2607 MPFROMLONG(CMA_PFIELDINFOLAST |
2608 CMA_XVERTSPLITBAR |
2609 CMA_PSORTRECORD | CMA_FLWINDOWATTR));
2610 }
2611 }
2612 WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(ArcSort), MPFROMP(dcd));
2613 if (xbeginthread(MakeObjWin,
2614 245760,
2615 dcd,
2616 pszSrcFile,
2617 __LINE__) == -1)
2618 {
2619 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
2620 return 0;
2621 }
2622 else
2623 DosSleep(1);
2624 SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
2625 DIR_FILTER), &dcd->mask, TRUE);
2626 SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
2627 DIR_SORT), dcd->sortFlags, TRUE);
2628 DefArcSortFlags = dcd->sortFlags; // Remember for new windows
2629 }
2630 }
2631 return 0;
2632
2633 case UM_SETDIR:
2634 if (dcd) {
2635
2636 CHAR s[CCHMAXPATH], *p;
2637 ULONG ret = 0;
2638
2639 WinQueryDlgItemText(dcd->hwndClient, ARC_EXTRACTDIR, CCHMAXPATH, s);
2640 bstrip(s);
2641 MakeFullName(s);
2642 if (*s) {
2643 while ((p = strchr(s, '/')) != NULL)
2644 *p = '\\';
2645 while (strlen(s) > 3 && s[strlen(s) - 1] == '\\')
2646 s[strlen(s) - 1] = 0;
2647 if (stricmp(s, dcd->directory)) {
2648 if (IsFullName(s)) {
2649 if (driveflags[toupper(*s) - 'A'] &
2650 (DRIVE_NOTWRITEABLE | DRIVE_IGNORE | DRIVE_INVALID)) {
2651 Runtime_Error(pszSrcFile, __LINE__, "drive %s bad", s);
2652 WinSetDlgItemText(dcd->hwndClient,
2653 ARC_EXTRACTDIR, dcd->directory);
2654 return 0;
2655 }
2656 }
2657 if (!SetDir(dcd->hwndParent, hwnd, s, 0)) {
2658 if (stricmp(dcd->directory, s)) {
2659 //DosEnterCritSec(); //GKY 11-29-08
2660 DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
2661 strcpy(lastextractpath, s);
2662 DosReleaseMutexSem(hmtxFM2Globals);
2663 //DosExitCritSec();
2664 }
2665 strcpy(dcd->directory, s);
2666 if ((!isalpha(*s) || s[1] != ':') && *s != '.')
2667 saymsg(MB_ENTER | MB_ICONASTERISK,
2668 hwnd,
2669 GetPString(IDS_WARNINGTEXT),
2670 GetPString(IDS_SPECIFYDRIVETEXT));
2671 }
2672 else
2673 ret = 1;
2674 }
2675 }
2676 WinSetDlgItemText(dcd->hwndClient, ARC_EXTRACTDIR, dcd->directory);
2677 return (MRESULT) ret;
2678 }
2679 return 0;
2680
2681 case UM_ENTER:
2682 if (WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID)) {
2683 free(mp1);
2684 return 0;
2685 }
2686 SetShiftState();
2687 if (dcd && (CHAR *) mp1) {
2688
2689 SWP swp;
2690 CHAR *filename = mp1;
2691 //printf("%s %d UM_ENTER %s\n",__FILE__, __LINE__, filename); fflush(stdout);
2692 if (IsFile(filename) != 1) {
2693 free(mp1);
2694 return 0;
2695 }
2696 WinQueryWindowPos(dcd->hwndFrame, &swp);
2697 DefaultViewKeys(hwnd, dcd->hwndFrame, dcd->hwndParent, &swp, filename);
2698 if (fUnHilite)
2699 UnHilite(hwnd, FALSE, &dcd->lastselection, 0);
2700 }
2701 free(mp1);
2702 return 0;
2703
2704 case WM_MENUEND:
2705 if (dcd) {
2706
2707 HWND hwndMenu = (HWND) mp2;
2708
2709 if (hwndMenu == ArcCnrMenu || hwndMenu == ArcMenu) {
2710 MarkAll(hwnd, TRUE, FALSE, TRUE);
2711 if (dcd->cnremphasized) {
2712 WinSendMsg(hwnd,
2713 CM_SETRECORDEMPHASIS,
2714 MPVOID, MPFROM2SHORT(FALSE, CRA_SOURCE));
2715 dcd->cnremphasized = FALSE;
2716 }
2717 }
2718 }
2719 break;
2720
2721 case MM_PORTHOLEINIT:
2722 if (dcd) {
2723 switch (SHORT1FROMMP(mp1)) {
2724 case 0:
2725 case 1:
2726 {
2727 ULONG wmsg;
2728
2729 wmsg = SHORT1FROMMP(mp1) == 0 ? UM_FILESMENU : UM_VIEWSMENU;
2730 PortholeInit((HWND) WinSendMsg(dcd->hwndClient,
2731 wmsg, MPVOID, MPVOID), mp1, mp2);
2732 }
2733 break;
2734 }
2735 }
2736 break;
2737
2738 case UM_INITMENU:
2739 case WM_INITMENU:
2740 if (dcd) {
2741 switch (SHORT1FROMMP(mp1)) {
2742 case IDM_FILESMENU:
2743 if (dcd->info) {
2744 WinEnableMenuItem((HWND) mp2,
2745 IDM_DELETE, dcd->info->delete != NULL);
2746 WinEnableMenuItem((HWND) mp2, IDM_TEST, dcd->info->test != NULL);
2747 WinEnableMenuItem((HWND) mp2, IDM_EXTRACT,
2748 dcd->info->extract != NULL && !strstr(dcd->info->ext, "TAR"));
2749 WinEnableMenuItem((HWND) mp2, IDM_ARCEXTRACT,
2750 dcd->info->extract != NULL && !strstr(dcd->info->ext, "TAR"));
2751 WinEnableMenuItem((HWND) mp2,
2752 IDM_EXTRACTWDIRS, dcd->info->exwdirs != NULL);
2753 WinEnableMenuItem((HWND) mp2,
2754 IDM_ARCEXTRACTWDIRS, dcd->info->exwdirs != NULL);
2755 WinEnableMenuItem((HWND) mp2,
2756 IDM_ARCEXTRACTWDIRSEXIT,
2757 dcd->info->exwdirs != NULL);
2758 }
2759 break;
2760
2761 case IDM_VIEWSMENU:
2762 WinEnableMenuItem((HWND) mp2, IDM_TEST, dcd->info->test != NULL);
2763 WinEnableMenuItem((HWND) mp2, IDM_ARCEXTRACT,
2764 dcd->info->extract != NULL && !strstr(dcd->info->ext, "TAR"));
2765 WinCheckMenuItem((HWND) mp2,
2766 IDM_MINIICONS, (dcd->flWindowAttr & CV_MINI) != 0);
2767 WinEnableMenuItem((HWND) mp2,
2768 IDM_RESELECT, (dcd->lastselection != NULL));
2769 break;
2770
2771 case IDM_COMMANDSMENU:
2772 SetupCommandMenu((HWND) mp2, hwnd);
2773 break;
2774
2775 case IDM_SORTSUBMENU:
2776 SetSortChecks((HWND) mp2, dcd->sortFlags);
2777 break;
2778
2779 case IDM_WINDOWSMENU:
2780 /**
2781 * add switchlist entries to end of pulldown menu
2782 */
2783 SetupWinList((HWND)mp2,
2784 hwndMain ? hwndMain : (HWND)0, dcd->hwndFrame);
2785 break;
2786 }
2787 dcd->hwndLastMenu = (HWND) mp2;
2788 }
2789 if (msg == WM_INITMENU)
2790 break;
2791 return 0;
2792
2793 case UM_LOADFILE:
2794 if (dcd && mp2) {
2795
2796 HWND hwnd;
2797
2798 if ((INT)mp1 == 5 || (INT)mp1 == 13 || (INT)mp1 == 21)
2799 hwnd = StartViewer(HWND_DESKTOP, (INT)mp1,
2800 (CHAR *)mp2, dcd->hwndFrame);
2801 else
2802 hwnd = StartMLEEditor(dcd->hwndParent,
2803 (INT)mp1, (CHAR *)mp2, dcd->hwndFrame);
2804 free((CHAR *)mp2);
2805 return MRFROMLONG(hwnd);
2806 }
2807 return 0;
2808
2809 case UM_COMMAND:
2810 if (mp1) {
2811 if (dcd) {
2812 if (!PostMsg(dcd->hwndObject, UM_COMMAND, mp1, mp2)) {
2813 Runtime_Error(pszSrcFile, __LINE__, "post");
2814 FreeListInfo((LISTINFO *) mp1);
2815 }
2816 else
2817 return (MRESULT) TRUE;
2818 }
2819 else
2820 FreeListInfo((LISTINFO *) mp1);
2821 }
2822 return 0;
2823
2824 case UM_OPENWINDOWFORME:
2825 if (dcd) {
2826 if (mp1 && !IsFile((CHAR *) mp1)) {
2827 OpenDirCnr((HWND) 0, hwndMain, dcd->hwndFrame, FALSE, (char *)mp1);
2828 }
2829 else if (mp1 && IsFile(mp1) == 1 &&
2830 CheckDriveSpaceAvail(ArcTempRoot, ullDATFileSpaceNeeded, ullTmpSpaceNeeded) != 2) {
2831 StartArcCnr(HWND_DESKTOP,
2832 dcd->hwndFrame, (CHAR *) mp1, 4, (ARC_TYPE *) mp2);
2833 }
2834 }
2835 return 0;
2836
2837 case WM_COMMAND:
2838 DosError(FERR_DISABLEHARDERR);
2839 if (dcd) {
2840 if (SwitchCommand(dcd->hwndLastMenu, SHORT1FROMMP(mp1)))
2841 return 0;
2842 if (WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID))
2843 return 0;
2844 if (!IsArcThere(hwnd, dcd->arcname)) {
2845 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
2846 return 0;
2847 }
2848 switch (SHORT1FROMMP(mp1)) {
2849 case IDM_TREEVIEW:
2850
2851 break;
2852
2853 case IDM_CONTEXTMENU:
2854 {
2855 PCNRITEM pci;
2856
2857 pci = (PCNRITEM) CurrentRecord(hwnd);
2858 PostMsg(hwnd,
2859 WM_CONTROL,
2860 MPFROM2SHORT(ARC_CNR, CN_CONTEXTMENU), MPFROMP(pci));
2861 }
2862 break;
2863
2864 case IDM_NEXTWINDOW:
2865 case IDM_PREVWINDOW:
2866 {
2867 HWND hwndActive;
2868
2869 hwndActive = WinQueryFocus(HWND_DESKTOP);
2870 WinSetFocus(HWND_DESKTOP,
2871 hwndActive == hwnd ?
2872 WinWindowFromID(dcd->hwndClient, ARC_EXTRACTDIR) :
2873 hwnd);
2874 }
2875 break;
2876
2877 case IDM_FOLDERAFTEREXTRACT:
2878 fFolderAfterExtract = fFolderAfterExtract ? FALSE : TRUE;
2879 PrfWriteProfileData(fmprof, appname, "FolderAfterExtract",
2880 &fFolderAfterExtract, sizeof(BOOL));
2881 break;
2882
2883 case IDM_SHOWSELECT:
2884 QuickPopup(hwnd, dcd, CheckMenu(hwnd, &ArcCnrMenu, ARCCNR_POPUP),
2885 IDM_SELECTSUBMENU);
2886 break;
2887
2888 case IDM_SHOWSORT:
2889 QuickPopup(hwnd, dcd, CheckMenu(hwnd, &ArcCnrMenu, ARCCNR_POPUP),
2890 IDM_SORTSUBMENU);
2891 break;
2892
2893 case IDM_ARCHIVERSETTINGS:
2894 if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndParent))
2895 PostMsg(dcd->hwndParent, msg, MPFROMLONG(IDM_ARCHIVERSETTINGS), mp2);
2896 else {
2897 WinDlgBox(HWND_DESKTOP,
2898 hwnd,
2899 CfgDlgProc,
2900 FM3ModHandle,
2901 CFG_FRAME,
2902 MPFROMLONG(IDM_ARCHIVERSETTINGS));
2903 }
2904 break;
2905
2906 case IDM_RESCAN:
2907 dcd->ullTotalBytes = dcd->totalfiles =
2908 dcd->selectedfiles = dcd->selectedbytes = 0;
2909 WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, "0");
2910 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, "0 / 0k");
2911 dcd->totalfiles = FillArcCnr(dcd->hwndCnr,
2912 dcd->arcname,
2913 &dcd->info,
2914 &dcd->ullTotalBytes, &dcd->stopflag);
2915 PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
2916 PostMsg(dcd->hwndCnr, UM_SETUP2, MPVOID, MPVOID);
2917 WinSendMsg(dcd->hwndCnr,
2918 CM_INVALIDATERECORD,
2919 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
2920 break;
2921
2922 case IDM_RESELECT:
2923 SelectList(hwnd, TRUE, FALSE, FALSE, NULL, NULL, dcd->lastselection);
2924 break;
2925
2926 case IDM_HELP:
2927 if (hwndHelp)
2928 WinSendMsg(hwndHelp,
2929 HM_DISPLAY_HELP,
2930 MPFROM2SHORT(HELP_ARCLIST, 0),
2931 MPFROMSHORT(HM_RESOURCEID));
2932 break;
2933
2934 case IDM_WINDOWDLG:
2935 if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndFrame))
2936 PostMsg(dcd->hwndParent,
2937 UM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
2938 break;
2939
2940 case IDM_SELECTALL:
2941 case IDM_SELECTALLFILES:
2942 case IDM_DESELECTALL:
2943 case IDM_DESELECTALLFILES:
2944 case IDM_SELECTMASK:
2945 case IDM_DESELECTMASK:
2946 case IDM_INVERT:
2947 {
2948 PARCITEM pci;
2949
2950 pci = (PARCITEM) WinSendMsg(hwnd,
2951 CM_QUERYRECORDEMPHASIS,
2952 MPFROMLONG(CMA_FIRST),
2953 MPFROMSHORT(CRA_CURSORED));
2954 if ((INT) pci == -1)
2955 pci = NULL;
2956 if (SHORT1FROMMP(mp1) == IDM_HIDEALL) {
2957 if (pci) {
2958 if (!(pci->rc.flRecordAttr & CRA_SELECTED))
2959 pci->rc.flRecordAttr |= CRA_FILTERED;
2960 WinSendMsg(hwnd,
2961 CM_INVALIDATERECORD,
2962 MPFROMP(&pci),
2963 MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
2964 break;
2965 }
2966 }
2967 PostMsg(dcd->hwndObject, UM_SELECT, mp1, MPFROMP(pci));
2968 }
2969 break;
2970
2971 case IDM_SORTSMARTNAME:
2972 case IDM_SORTNAME:
2973 case IDM_SORTFILENAME:
2974 case IDM_SORTSIZE:
2975 case IDM_SORTEASIZE:
2976 case IDM_SORTFIRST:
2977 case IDM_SORTLAST:
2978 case IDM_SORTLWDATE:
2979 dcd->sortFlags &= SORT_REVERSE;
2980 // intentional fallthru
2981 case IDM_SORTREVERSE:
2982 switch (SHORT1FROMMP(mp1)) {
2983 case IDM_SORTSMARTNAME:
2984 case IDM_SORTFILENAME:
2985 dcd->sortFlags |= SORT_FILENAME;
2986 break;
2987 case IDM_SORTSIZE:
2988 dcd->sortFlags |= SORT_SIZE;
2989 break;
2990 case IDM_SORTEASIZE:
2991 dcd->sortFlags |= SORT_EASIZE;
2992 break;
2993 case IDM_SORTFIRST:
2994 dcd->sortFlags |= SORT_FIRSTEXTENSION;
2995 break;
2996 case IDM_SORTLAST:
2997 dcd->sortFlags |= SORT_LASTEXTENSION;
2998 break;
2999 case IDM_SORTLWDATE:
3000 dcd->sortFlags |= SORT_LWDATE;
3001 break;
3002 case IDM_SORTREVERSE:
3003 if (dcd->sortFlags & SORT_REVERSE)
3004 dcd->sortFlags &= (~SORT_REVERSE);
3005 else
3006 dcd->sortFlags |= SORT_REVERSE;
3007 break;
3008 }
3009 WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(ArcSort), MPFROMP(dcd));
3010 SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
3011 DIR_SORT), dcd->sortFlags, TRUE);
3012 DefArcSortFlags = dcd->sortFlags; // Remember for new windows
3013 break;
3014
3015 case IDM_COLLECTOR:
3016 if (!Collector) {
3017 HWND hwndC;
3018 SWP swp;
3019
3020 if (ParentIsDesktop(hwnd, dcd->hwndParent) && !fAutoTile &&
3021 (!fExternalCollector && !strcmp(realappname, FM3Str)))
3022 GetNextWindowPos(dcd->hwndParent, &swp, NULL, NULL);
3023 hwndC = StartCollector(fExternalCollector ||
3024 strcmp(realappname, FM3Str) ?
3025 HWND_DESKTOP : dcd->hwndParent, 4);
3026 if (hwndC) {
3027 if (!ParentIsDesktop(hwnd, dcd->hwndParent) && !fAutoTile &&
3028 (!fExternalCollector && !strcmp(realappname, FM3Str)))
3029 WinSetWindowPos(hwndC,
3030 HWND_TOP,
3031 swp.x,
3032 swp.y,
3033 swp.cx,
3034 swp.cy,
3035 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
3036 else if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
3037 fAutoTile && !strcmp(realappname, FM3Str)) {
3038 TileChildren(dcd->hwndParent, TRUE);
3039 }
3040 WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
3041 DosSleep(100); //05 Aug 07 GKY 128
3042 }
3043 }
3044 else
3045 StartCollector(dcd->hwndParent, 4);
3046 break;
3047
3048 case IDM_ARCEXTRACTEXIT:
3049 case IDM_ARCEXTRACT:
3050 if (dcd->directory && fFileNameCnrPath &&
3051 stricmp(lastextractpath, dcd->directory)) {
3052 strcpy(lastextractpath, dcd->directory);
3053 //DbgMsg(pszSrcFile, __LINE__, "Extract dir %s", dcd->directory);
3054 SetDir(dcd->hwndParent, hwnd, dcd->directory, 1);
3055 }
3056 if (dcd->info->extract)
3057 runemf2(SEPARATE | WINDOWED | ASYNCHRONOUS |
3058 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
3059 hwnd, pszSrcFile, __LINE__,
3060 dcd->directory, NULL, "%s %s", dcd->info->extract,
3061 BldQuotedFileName(szQuotedArcName, dcd->arcname));
3062 if (SHORT1FROMMP(mp1) == IDM_ARCEXTRACTEXIT)
3063 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
3064 break;
3065
3066 case IDM_ARCEXTRACTWDIRSEXIT:
3067 case IDM_ARCEXTRACTWDIRS:
3068 if (dcd->directory && fFileNameCnrPath &&
3069 stricmp(lastextractpath, dcd->directory)) {
3070 strcpy(lastextractpath, dcd->directory);
3071 SetDir(dcd->hwndParent, hwnd, dcd->directory, 1);
3072 }
3073 if (dcd->info->exwdirs)
3074 runemf2(SEPARATE | WINDOWED | ASYNCHRONOUS |
3075 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
3076 hwnd, pszSrcFile, __LINE__,
3077 dcd->directory, NULL, "%s %s",
3078 dcd->info->exwdirs,
3079 BldQuotedFileName(szQuotedArcName, dcd->arcname));
3080 if (SHORT1FROMMP(mp1) == IDM_ARCEXTRACTWDIRSEXIT)
3081 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
3082 break;
3083
3084 case IDM_RESORT:
3085 WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(ArcSort), MPFROMP(dcd));
3086 break;
3087
3088 case IDM_FILTER:
3089 {
3090 BOOL empty = FALSE;
3091 PARCITEM pci;
3092
3093 if (!*dcd->mask.szMask) {
3094 empty = TRUE;
3095 pci = (PARCITEM) CurrentRecord(hwnd);
3096 if (pci && strchr(pci->pszFileName, '.'))
3097 strcpy(dcd->mask.szMask, pci->pszFileName);
3098 }
3099
3100 if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
3101 FM3ModHandle, MSK_FRAME, MPFROMP(&dcd->mask))) {
3102 WinSendMsg(hwnd, CM_FILTER, MPFROMP(ArcFilter), MPFROMP(dcd));
3103 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
3104 }
3105 else if (empty)
3106 *dcd->mask.szMask = 0;
3107 SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
3108 DIR_FILTER), &dcd->mask, TRUE);
3109 }
3110 break;
3111
3112 case IDM_SWITCH:
3113 if (mp2) {
3114 if (stricmp(dcd->directory, (CHAR *) mp2)) {
3115 //DosEnterCritSec(); //GKY 11-29-08
3116 DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
3117 strcpy(lastextractpath, (CHAR *) mp2);
3118 MakeValidDir(lastextractpath);
3119 DosReleaseMutexSem(hmtxFM2Globals);
3120 //DosExitCritSec();
3121 }
3122 strcpy(dcd->directory, (CHAR *) mp2);
3123 MakeValidDir(dcd->directory);
3124 WinSetWindowText(dcd->hwndExtract, dcd->directory);
3125 }
3126 break;
3127
3128 case IDM_WALKDIR:
3129 {
3130 CHAR newdir[CCHMAXPATH];
3131
3132 strcpy(newdir, dcd->directory);
3133 if (!WinDlgBox(HWND_DESKTOP, dcd->hwndParent, WalkExtractDlgProc,
3134 FM3ModHandle, WALK_FRAME,
3135 MPFROMP(newdir)) || !*newdir)
3136 break;
3137 if (stricmp(newdir, dcd->directory)) {
3138 strcpy(dcd->directory, newdir);
3139 if (stricmp(lastextractpath, newdir))
3140 strcpy(lastextractpath, newdir);
3141 WinSetWindowText(dcd->hwndExtract, dcd->directory);
3142 }
3143 }
3144 break;
3145
3146 case IDM_TEST:
3147 if (dcd->info->test)
3148 runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED,
3149 hwnd, pszSrcFile, __LINE__, NULL, NULL,
3150 "%s %s",dcd->info->test,
3151 BldQuotedFileName(szQuotedArcName, dcd->arcname));
3152 break;
3153
3154 case IDM_REFRESH:
3155 case IDM_DELETE:
3156 case IDM_PRINT:
3157 case IDM_VIEW:
3158 case IDM_VIEWTEXT:
3159 case IDM_VIEWBINARY:
3160 case IDM_VIEWARCHIVE:
3161 case IDM_EDIT:
3162 case IDM_EDITTEXT:
3163 case IDM_EDITBINARY:
3164 case IDM_EXTRACT:
3165 case IDM_EXTRACTWDIRS:
3166 case IDM_FIND:
3167 case IDM_EXEC:
3168 case IDM_VIRUSSCAN:
3169 case IDM_OPENDEFAULT:
3170 case IDM_OPENSETTINGS:
3171 case IDM_MCIPLAY:
3172 {
3173 LISTINFO *li;
3174# ifdef FORTIFY
3175 Fortify_EnterScope();
3176# endif
3177 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
3178 if (li) {
3179 li->type = SHORT1FROMMP(mp1);
3180 li->hwnd = hwnd;
3181 li->list = BuildArcList(hwnd);
3182 if (li->type == IDM_DELETE)
3183 ignorereadonly = FALSE;
3184 if (li->type == IDM_REFRESH) {
3185
3186 CHAR s[CCHMAXPATH], *p;
3187 INT x, y;
3188
3189 for (x = 0; li->list && li->list[x]; x++) {
3190 BldFullPathName(s, dcd->workdir, li->list[x]);
3191 if (IsFile(s) != 1) {
3192 free(li->list[x]);
3193 li->list[x] = NULL;
3194 for (y = x; li->list[y]; y++)
3195 li->list[y] = li->list[y + 1];
3196 li->list =
3197 xrealloc(li->list, y * sizeof(CHAR *), pszSrcFile,
3198 __LINE__);
3199 x--;
3200 }
3201 else {
3202 p = xstrdup(s, pszSrcFile, __LINE__);
3203 if (p) {
3204 free(li->list[x]);
3205 li->list[x] = p;
3206 }
3207 }
3208 } // for
3209 }
3210 strcpy(li->arcname, dcd->arcname);
3211 li->info = dcd->info;
3212 {
3213 PARCITEM pai;
3214
3215 if (SHORT1FROMMP(mp1) != IDM_EXEC)
3216 pai = (PARCITEM) CurrentRecord(hwnd);
3217 else
3218 pai = (PARCITEM) WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
3219 MPFROMLONG(CMA_FIRST),
3220 MPFROMSHORT(CRA_CURSORED));
3221 if (pai && (INT) pai != -1)
3222 strcpy(li->runfile, pai->pszFileName);
3223 else
3224 strcpy(li->runfile, li->list[0]);
3225 }
3226 switch (SHORT1FROMMP(mp1)) {
3227 case IDM_VIEW:
3228 case IDM_VIEWTEXT:
3229 case IDM_VIEWBINARY:
3230 case IDM_VIEWARCHIVE:
3231 case IDM_EDIT:
3232 case IDM_EDITTEXT:
3233 case IDM_EDITBINARY:
3234 case IDM_EXEC:
3235 case IDM_PRINT:
3236 case IDM_VIRUSSCAN:
3237 case IDM_OPENDEFAULT:
3238 case IDM_OPENSETTINGS:
3239 case IDM_MCIPLAY:
3240 strcpy(li->targetpath, dcd->workdir);
3241 break;
3242 default:
3243 strcpy(li->targetpath, dcd->directory);
3244 break;
3245 }
3246 if (li->list) {
3247 if (!PostMsg(dcd->hwndObject, UM_ACTION, MPFROMP(li), MPVOID)) {
3248 Runtime_Error(pszSrcFile, __LINE__, "post");
3249 FreeListInfo(li);
3250 }
3251 else if (fUnHilite && SHORT1FROMMP(mp1) != IDM_EDIT)
3252 UnHilite(hwnd, TRUE, &dcd->lastselection, 0);
3253 }
3254 else {
3255 free(li);
3256 }
3257 }
3258# ifdef FORTIFY
3259 Fortify_LeaveScope();
3260# endif
3261 }
3262 break;
3263 }
3264 }
3265 return 0;
3266
3267 case WM_CONTROL:
3268 DosError(FERR_DISABLEHARDERR);
3269 if (dcd) {
3270 switch (SHORT2FROMMP(mp1)) {
3271 case CN_BEGINEDIT:
3272 PostMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
3273 break;
3274
3275 case CN_ENDEDIT:
3276 if (!((PCNREDITDATA) mp2)->pRecord) {
3277
3278 PFIELDINFO pfi = ((PCNREDITDATA) mp2)->pFieldInfo;
3279 USHORT cmd = 0;
3280
3281 if (!pfi || pfi->offStruct == FIELDOFFSET(ARCITEM, pszDisplayName))
3282 cmd = IDM_SORTSMARTNAME;
3283 else if (pfi->offStruct == FIELDOFFSET(ARCITEM, cbFile))
3284 cmd = IDM_SORTSIZE;
3285 else if (pfi->offStruct == FIELDOFFSET(ARCITEM, cbComp))
3286 cmd = IDM_SORTEASIZE;
3287 else if (pfi->offStruct == FIELDOFFSET(ARCITEM, date))
3288 cmd = IDM_SORTLWDATE;
3289 else if (pfi->offStruct == FIELDOFFSET(ARCITEM, time))
3290 cmd = IDM_SORTLWDATE;
3291 if (cmd)
3292 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
3293 }
3294 break;
3295
3296 case CN_DROPHELP:
3297 saymsg(MB_ENTER, hwnd,
3298 GetPString(IDS_DROPHELPHDRTEXT),
3299 GetPString(IDS_ARCCNRDROPHELPTEXT), dcd->arcname);
3300 return 0;
3301
3302 case CN_DRAGLEAVE:
3303 if (mp2) {
3304
3305 PDRAGINFO pDInfo;
3306
3307 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
3308 DrgAccessDraginfo(pDInfo); // Access DRAGINFO
3309 DrgFreeDraginfo(pDInfo); // Free DRAGINFO
3310 }
3311 return 0;
3312
3313 case CN_DRAGAFTER:
3314 case CN_DRAGOVER:
3315 if (mp2) {
3316
3317 PDRAGITEM pDItem; // Pointer to DRAGITEM
3318 PDRAGINFO pDInfo; // Pointer to DRAGINFO
3319 PARCITEM pci;
3320
3321 pci = (PARCITEM) ((PCNRDRAGINFO) mp2)->pRecord;
3322 if (SHORT1FROMMP(mp1) == CN_DRAGAFTER)
3323 pci = NULL;
3324 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
3325 DrgAccessDraginfo(pDInfo); // Access DRAGINFO
3326 if (*dcd->arcname) {
3327 if ((driveflags[toupper(*dcd->arcname) - 'A'] &
3328 DRIVE_NOTWRITEABLE) || !dcd->info || !dcd->info->create) {
3329 DrgFreeDraginfo(pDInfo);
3330 return MRFROM2SHORT(DOR_NEVERDROP, 0);
3331 }
3332 }
3333 if (pci) {
3334 DrgFreeDraginfo(pDInfo);
3335 return MRFROM2SHORT(DOR_NODROP, 0);
3336 }
3337 pDItem = DrgQueryDragitemPtr(pDInfo, // Access DRAGITEM
3338 0); // Index to DRAGITEM
3339 if (DrgVerifyRMF(pDItem, // Check valid rendering
3340 (CHAR *) DRM_OS2FILE, // mechanisms and data
3341 NULL) && !(pDItem->fsControl & DC_PREPARE)) {
3342 DrgFreeDraginfo(pDInfo); // Free DRAGINFO
3343 return MRFROM2SHORT(DOR_DROP, // Return okay to drop
3344 fCopyDefault ? DO_COPY : DO_MOVE);
3345 }
3346 DrgFreeDraginfo(pDInfo); // Free DRAGINFO
3347 }
3348 return (MRFROM2SHORT(DOR_NEVERDROP, 0)); // Drop not valid
3349
3350 case CN_INITDRAG:
3351 if (mp2) {
3352
3353 BOOL wasemphasized = FALSE;
3354 PCNRDRAGINIT pcd = (PCNRDRAGINIT) mp2;
3355 PARCITEM pci;
3356
3357 if (pcd) {
3358 pci = (PARCITEM) pcd->pRecord;
3359 if (pci) {
3360 if (pci->rc.flRecordAttr & CRA_SELECTED)
3361 wasemphasized = TRUE;
3362 if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
3363 fSplitStatus && hwndStatus2)
3364 WinSetWindowText(hwndStatus2, (CHAR *) GetPString(IDS_DRAGARCMEMTEXT));
3365 if (DoFileDrag(hwnd,
3366 dcd->hwndObject,
3367 mp2, dcd->arcname, NULL, TRUE)) {
3368 if ((fUnHilite && wasemphasized) || dcd->ulItemsToUnHilite)
3369 UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
3370 }
3371 if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
3372 fSplitStatus && hwndStatus2) {
3373 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
3374 }
3375 }
3376 else {
3377 if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
3378 fSplitStatus && hwndStatus2)
3379 WinSetWindowText(hwndStatus2,
3380 (CHAR *) GetPString(IDS_DRAGARCFILETEXT));
3381 DragOne(hwnd, dcd->hwndObject, dcd->arcname, FALSE);
3382 if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
3383 fSplitStatus && hwndStatus2)
3384 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
3385 }
3386 }
3387 }
3388 return 0;
3389
3390 case CN_DROP:
3391 if (mp2) {
3392
3393 LISTINFO *li;
3394
3395 //DosBeep(500, 100); // fixme to know why beep?
3396 li = DoFileDrop(hwnd, dcd->arcname, FALSE, mp1, mp2);
3397 //DosBeep(50, 100); // fixme to know why beep?
3398 CheckPmDrgLimit(((PCNRDRAGINFO)mp2)->pDragInfo);
3399 if (li) {
3400 li->type = li->type == DO_MOVE ? IDM_ARCHIVEM : IDM_ARCHIVE;
3401 strcpy(li->targetpath, dcd->arcname);
3402 if (!li->list ||
3403 !li->list[0] ||
3404 !PostMsg(dcd->hwndObject, UM_ACTION, MPFROMP(li), MPVOID))
3405 FreeListInfo(li);
3406 }
3407 }
3408 return 0;
3409
3410 case CN_CONTEXTMENU:
3411 {
3412 PARCITEM pci = (PARCITEM) mp2;
3413
3414 if (pci) {
3415 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
3416 MPFROM2SHORT(TRUE, CRA_CURSORED));
3417 MarkAll(hwnd, FALSE, FALSE, TRUE);
3418 dcd->hwndLastMenu = CheckMenu(hwnd, &ArcMenu, ARC_POPUP);
3419 }
3420 else {
3421 dcd->hwndLastMenu = CheckMenu(hwnd, &ArcCnrMenu, ARCCNR_POPUP);
3422 if (dcd->hwndLastMenu && !dcd->cnremphasized) {
3423 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
3424 MPFROM2SHORT(TRUE, CRA_SOURCE));
3425 dcd->cnremphasized = TRUE;
3426 }
3427 }
3428 if (dcd->hwndLastMenu) {
3429 if (dcd->hwndLastMenu == ArcCnrMenu) {
3430 if (dcd->flWindowAttr & CV_MINI)
3431 WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE);
3432 }
3433 WinCheckMenuItem(dcd->hwndLastMenu, IDM_FOLDERAFTEREXTRACT,
3434 fFolderAfterExtract);
3435 if (!PopupMenu(hwnd, hwnd, dcd->hwndLastMenu)) {
3436 if (dcd->cnremphasized) {
3437 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
3438 MPFROM2SHORT(FALSE, CRA_SOURCE));
3439 dcd->cnremphasized = TRUE;
3440 }
3441 MarkAll(hwnd, TRUE, FALSE, TRUE);
3442 }
3443 }
3444 }
3445 break;
3446
3447 case CN_EMPHASIS:
3448 if (mp2) {
3449
3450 PNOTIFYRECORDEMPHASIS pre = mp2;
3451 PARCITEM pci;
3452 CHAR s[CCHMAXPATHCOMP + 91], tf[81], tb[81];
3453
3454 pci = (PARCITEM)(pre ? pre->pRecord : NULL);
3455 if (!pci) {
3456 if (!ParentIsDesktop(hwnd, dcd->hwndParent)) {
3457 if (hwndStatus2)
3458 WinSetWindowText(hwndStatus2, NullStr);
3459 if (fMoreButtons)
3460 WinSetWindowText(hwndName, NullStr);
3461 }
3462 break;
3463 }
3464 if (pre->fEmphasisMask & CRA_SELECTED) {
3465 if (pci->rc.flRecordAttr & CRA_SELECTED) {
3466 dcd->selectedbytes += pci->cbFile;
3467 dcd->selectedfiles++;
3468 }
3469 else if (dcd->selectedfiles) {
3470 dcd->selectedbytes -= pci->cbFile;
3471 dcd->selectedfiles--;
3472 }
3473 commafmt(tf, sizeof(tf), dcd->selectedfiles);
3474 if (dcd->ullTotalBytes)
3475 CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, ' ');
3476 else
3477 *tb = 0;
3478 sprintf(s, "%s%s%s", tf, *tb ? " / " : NullStr, tb);
3479 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
3480 }
3481 else if (WinQueryActiveWindow(dcd->hwndParent) ==
3482 dcd->hwndFrame &&
3483 !ParentIsDesktop(hwnd, dcd->hwndParent)) {
3484 if (pre->fEmphasisMask & CRA_CURSORED) {
3485 if (pci->rc.flRecordAttr & CRA_CURSORED) {
3486 if (fSplitStatus && hwndStatus2) {
3487 if (dcd->ullTotalBytes)
3488 CommaFmtULL(tb, sizeof(tb), pci->cbFile, ' ');
3489 else
3490 *tb = 0;
3491 sprintf(s, "%s%s%s%s",
3492 *tb ? " " : NullStr,
3493 tb, *tb ? " " : NullStr, pci->pszFileName);
3494 WinSetWindowText(hwndStatus2, s);
3495 }
3496 if (fMoreButtons)
3497 WinSetWindowText(hwndName, pci->pszFileName);
3498 }
3499 }
3500 }
3501 }
3502 break;
3503
3504 case CN_ENTER:
3505 if (mp2) {
3506
3507 PARCITEM pci = (PARCITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
3508
3509 if (pci) {
3510
3511 CHAR *s;
3512
3513 if ((pci->rc.flRecordAttr & CRA_INUSE) ||
3514 (pci->flags & (ARCFLAGS_REALDIR | ARCFLAGS_PSEUDODIR)))
3515 break;
3516 s = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
3517 if (s) {
3518 if (!PostMsg(dcd->hwndObject, UM_ENTER, MPFROMP(s), MPVOID)) {
3519 Runtime_Error(pszSrcFile, __LINE__, "post");
3520 free(s);
3521 }
3522 }
3523 }
3524 }
3525 break;
3526 }
3527 }
3528 return 0;
3529
3530 case UM_FOLDUP:
3531 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
3532 DosExit(EXIT_PROCESS, 1);
3533 return 0;
3534
3535 case UM_CLOSE:
3536 WinDestroyWindow(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
3537 QW_PARENT));
3538 return 0;
3539
3540 case WM_SAVEAPPLICATION:
3541 if (dcd && ParentIsDesktop(hwnd, dcd->hwndParent)) {
3542 SWP swp;
3543
3544 WinQueryWindowPos(dcd->hwndFrame, &swp);
3545 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE | SWP_MAXIMIZE)))
3546 PrfWriteProfileData(fmprof, appname, "AV2SizePos", &swp, sizeof(swp));
3547 }
3548 break;
3549
3550 case WM_CLOSE:
3551 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
3552 if (dcd)
3553 dcd->stopflag++;
3554 if (dcd && dcd->hwndObject) {
3555 if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
3556 WinSendMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID);
3557 }
3558 // In case object window frees dcd
3559 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
3560 if (!dcd ||
3561 (!dcd->dontclose &&
3562 !dcd->amextracted && ParentIsDesktop(hwnd, dcd->hwndParent))) {
3563 if (!PostMsg(hwnd, UM_FOLDUP, MPVOID, MPVOID))
3564 WinSendMsg(hwnd, UM_FOLDUP, MPVOID, MPVOID);
3565 }
3566 return 0;
3567
3568 case WM_DESTROY:
3569 if (ArcMenu)
3570 WinDestroyWindow(ArcMenu);
3571 if (ArcCnrMenu)
3572 WinDestroyWindow(ArcCnrMenu);
3573 ArcMenu = ArcCnrMenu = (HWND) 0;
3574 EmptyArcCnr(hwnd);
3575# ifdef FORTIFY
3576 Fortify_LeaveScope();
3577# endif
3578 break;
3579 }
3580 if (dcd && dcd->oldproc){
3581 return dcd->oldproc(hwnd, msg, mp1, mp2);
3582 }
3583 else
3584 return PFNWPCnr(hwnd, msg, mp1, mp2);
3585}
3586
3587MRESULT EXPENTRY ArcCnrMenuProc(HWND hwnd, ULONG msg, MPARAM mp1, /*FOLD00*/
3588 MPARAM mp2)
3589{
3590 PFNWP oldMenuProc = WinQueryWindowPtr(hwnd, QWL_USER);
3591 static short sLastMenuitem;
3592
3593 switch (msg) {
3594 case WM_MOUSEMOVE: {
3595 if (fOtherHelp) {
3596 RECTL rectl;
3597 SHORT i, sCurrentMenuitem;
3598 SHORT MenuItems = 10;
3599 SHORT asMenuIDs[10] = {IDM_VIEW,
3600 IDM_DELETE,
3601 IDM_EXEC,
3602 IDM_EXTRACT,
3603 IDM_TEST,
3604 IDM_VIRUSSCAN,
3605 IDM_RESCAN,
3606 IDM_WALKDIR,
3607 IDM_FILTER,
3608 0};
3609 PCSZ szHelpString = NULL;
3610
3611
3612 for (i=0; i<MenuItems; i++) {
3613 sCurrentMenuitem = asMenuIDs[i];
3614 oldMenuProc(hwnd,MM_QUERYITEMRECT,
3615 MPFROM2SHORT(asMenuIDs[i], FALSE),
3616 &rectl);
3617
3618 if (MOUSEMSG(&msg)->x > rectl.xLeft &&
3619 MOUSEMSG(&msg)->x < rectl.xRight &&
3620 MOUSEMSG(&msg)->y > rectl.yBottom &&
3621 MOUSEMSG(&msg)->y < rectl.yTop)
3622 break;
3623 } // for
3624
3625
3626 switch (sCurrentMenuitem) {
3627 case 0:
3628 break;
3629 case IDM_VIEW:
3630 szHelpString = GetPString(IDS_ARCCNRVIEWMENUHELP);
3631 break;
3632 case IDM_DELETE:
3633 szHelpString = GetPString(IDS_ARCCNRDELETEMENUHELP);
3634 break;
3635 case IDM_EXEC:
3636 szHelpString = GetPString(IDS_ARCCNREXECMENUHELP);
3637 break;
3638 case IDM_EXTRACT:
3639 szHelpString = GetPString(IDS_ARCCNREXTRACTMENUHELP);
3640 break;
3641 case IDM_TEST:
3642 szHelpString = GetPString(IDS_ARCCNRTESTMENUHELP);
3643 break;
3644 case IDM_VIRUSSCAN:
3645 szHelpString = GetPString(IDS_ARCCNRVIRUSMENUHELP);
3646 break;
3647 case IDM_RESCAN:
3648 szHelpString = GetPString(IDS_ARCCNRRESCANMENUHELP);
3649 break;
3650 case IDM_WALKDIR:
3651 szHelpString = GetPString(IDS_ARCCNRWALKDIRMENUHELP);
3652 break;
3653 case IDM_FILTER:
3654 szHelpString = GetPString(IDS_ARCCNRFILTERMENUHELP);
3655 break;
3656 default:
3657 break;
3658 }
3659
3660 if (sLastMenuitem != sCurrentMenuitem && szHelpString) {
3661 sLastMenuitem = sCurrentMenuitem;
3662 MakeBubble(hwnd, TRUE, szHelpString);
3663 }
3664 else if (hwndBubble && !sCurrentMenuitem){
3665 sLastMenuitem = sCurrentMenuitem;
3666 WinDestroyWindow(hwndBubble);
3667 }
3668 }
3669 }
3670 }
3671 return oldMenuProc(hwnd, msg, mp1, mp2);
3672}
3673
3674HWND StartArcCnr(HWND hwndParent, HWND hwndCaller, CHAR * arcname, INT flags, /*FOLD00*/
3675 ARC_TYPE * sinfo)
3676{
3677 /**
3678 * bitmapped flags:
3679 * 1 = am extracted from another archive
3680 * 4 = don't kill proc on close
3681 */
3682
3683 HWND hwndFrame = (HWND) 0, hwndClient;
3684 ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
3685 FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_NOBYTEALIGN | FCF_ACCELTABLE;
3686 USHORT id;
3687 DIRCNRDATA *dcd;
3688 ARC_TYPE *info = sinfo;
3689 CHAR title[MAXNAMEL + 1] = "AV/2 - ";
3690 CHAR fullname[CCHMAXPATH + 8], *p, temp;
3691 static USHORT idinc = 0;
3692
3693
3694 if (strrchr(arcname, '.')) {
3695 if (!stricmp(strrchr(arcname, '.') + 1, "LZ")) {
3696 saymsg(MB_ENTER | MB_ICONASTERISK, HWND_DESKTOP, GetPString(IDS_LZIPLIMITATION),
3697 GetPString(IDS_LZIPNOLIST));
3698 return -1;
3699 }
3700 }
3701
3702 if (!idinc)
3703 idinc = (rand() % 256);
3704 if (ParentIsDesktop(hwndParent, hwndParent))
3705 FrameFlags |= (FCF_TASKLIST | FCF_MENU);
3706 if (arcname) {
3707 DosError(FERR_DISABLEHARDERR);
3708 if (DosQueryPathInfo(arcname,
3709 FIL_QUERYFULLNAME, fullname, sizeof(fullname)))
3710 strcpy(fullname, arcname);
3711 ForwardslashToBackslash(fullname);
3712 if (!info)
3713 info = find_type(fullname, arcsighead);
3714 if (!info)
3715 return hwndFrame;
3716 if (strlen(title) + strlen(fullname) > MAXNAMEL) {
3717 p = title + strlen(title);
3718 strncpy(p, fullname, MAXNAMEL / 2 - 5);
3719 strcpy(p + MAXNAMEL / 2 - 5, "...");
3720 strcat(title, fullname + strlen(fullname) - (MAXNAMEL / 2 - 5));
3721 }
3722 else {
3723 strcat(title, fullname);
3724 }
3725 hwndFrame = WinCreateStdWindow(hwndParent,
3726 WS_VISIBLE,
3727 &FrameFlags,
3728 (CHAR *) WC_ARCCONTAINER,
3729 title,
3730 WS_VISIBLE | fwsAnimate,
3731 FM3ModHandle, ARC_FRAME, &hwndClient);
3732 if (hwndFrame && hwndClient) {
3733 id = ARC_FRAME + idinc++;
3734 if (idinc > 512)
3735 idinc = 0;
3736 WinSetWindowUShort(hwndFrame, QWS_ID, id);
3737# ifdef FORTIFY
3738 Fortify_EnterScope();
3739# endif
3740 dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__);
3741 if (!dcd) {
3742 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
3743 hwndFrame = (HWND) 0;
3744 }
3745 else {
3746# ifdef FORTIFY
3747 // Will be freed by WM_DESTROY
3748 Fortify_ChangeScope(dcd, -1);
3749# endif
3750 dcd->size = sizeof(DIRCNRDATA);
3751 dcd->id = id;
3752 dcd->type = ARC_FRAME;
3753 if (pTmpDir && !IsValidDir(pTmpDir))
3754 DosCreateDir(pTmpDir, 0);
3755 MakeTempName(dcd->workdir, ArcTempRoot, 2);
3756 strcpy(dcd->arcname, fullname);
3757 if (*extractpath) {
3758 if (!strcmp(extractpath, "*")) {
3759 p = strrchr(fullname, '\\');
3760 if (p) {
3761 if (p < fullname + 3)
3762 p++;
3763 temp = *p;
3764 *p = 0;
3765 strcpy(dcd->directory, fullname);
3766 *p = temp;
3767 }
3768 }
3769 else
3770 strcpy(dcd->directory, extractpath);
3771 }
3772 if (!*dcd->directory && *lastextractpath) {
3773 //DosEnterCritSec(); //GKY 11-29-08
3774 DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
3775 strcpy(dcd->directory, lastextractpath);
3776 DosReleaseMutexSem(hmtxFM2Globals);
3777 //DosExitCritSec();
3778 }
3779 if (!*dcd->directory) {
3780 if (!ParentIsDesktop(hwndParent, hwndParent))
3781 TopWindowName(hwndParent, hwndCaller, dcd->directory);
3782 if (!*dcd->directory) {
3783 p = strrchr(fullname, '\\');
3784 if (p) {
3785 if (p < fullname + 3)
3786 p++;
3787 *p = 0;
3788 strcpy(dcd->directory, fullname);
3789 }
3790 }
3791 }
3792 if (!*dcd->directory ||
3793 (IsFile(dcd->directory) == 1) ||
3794 (isalpha(*dcd->directory) &&
3795 (driveflags[toupper(*dcd->directory) - 'A'] &
3796 DRIVE_NOTWRITEABLE)))
3797 strcpy(dcd->directory, pFM2SaveDirectory);
3798 dcd->hwndParent = hwndParent ? hwndParent : HWND_DESKTOP;
3799 dcd->hwndFrame = hwndFrame;
3800 dcd->hwndClient = hwndClient;
3801 dcd->amextracted = (flags & 1) != 0;
3802 dcd->dontclose = (flags & 4) != 0;
3803 dcd->info = info;
3804 dcd->sortFlags = DefArcSortFlags;
3805 {
3806 PFNWP oldproc;
3807
3808 oldproc = WinSubclassWindow(hwndFrame, (PFNWP) ArcFrameWndProc);
3809 WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
3810 }
3811 dcd->hwndCnr = WinCreateWindow(hwndClient,
3812 WC_CONTAINER,
3813 NULL,
3814 CCS_AUTOPOSITION | CCS_MINIICONS |
3815 CCS_MINIRECORDCORE | ulCnrType |
3816 WS_VISIBLE,
3817 0,
3818 0,
3819 0,
3820 0,
3821 hwndClient,
3822 HWND_TOP, (ULONG) ARC_CNR, NULL, NULL);
3823 if (!dcd->hwndCnr) {
3824 Win_Error(hwndClient, hwndClient, pszSrcFile, __LINE__,
3825 PCSZ_WINCREATEWINDOW);
3826 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
3827 free(dcd);
3828 hwndFrame = (HWND) 0;
3829 }
3830 else {
3831 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
3832 dcd->oldproc = WinSubclassWindow(dcd->hwndCnr,
3833 (PFNWP) ArcCnrWndProc);
3834 {
3835 USHORT ids[] = { DIR_TOTALS, DIR_SELECTED, DIR_VIEW, DIR_SORT,
3836 DIR_FILTER, DIR_FOLDERICON, 0
3837 };
3838
3839 CommonCreateTextChildren(dcd->hwndClient,
3840 WC_ARCSTATUS, ids);
3841 }
3842 WinEnableWindow(WinWindowFromID(dcd->hwndClient, DIR_VIEW), FALSE);
3843 dcd->hwndExtract = WinCreateWindow(dcd->hwndClient,
3844 WC_ENTRYFIELD,
3845 NULL,
3846 ES_AUTOSCROLL,
3847 0,
3848 0,
3849 0,
3850 0,
3851 dcd->hwndClient,
3852 HWND_TOP,
3853 ARC_EXTRACTDIR, NULL, NULL);
3854 WinSendMsg(dcd->hwndExtract,
3855 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
3856 WinSetWindowText(dcd->hwndExtract, dcd->directory);
3857 if (!PostMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID))
3858 WinSendMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID);
3859 if (FrameFlags & FCF_MENU) {
3860 PFNWP oldmenuproc;
3861 HWND hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
3862
3863 oldmenuproc = WinSubclassWindow(hwndMenu, (PFNWP) ArcCnrMenuProc);
3864 WinSetWindowPtr(hwndMenu, QWL_USER, (PVOID) oldmenuproc);
3865 if (!fToolbar) {
3866
3867 if (hwndMenu) {
3868 WinSendMsg(hwndMenu, MM_DELETEITEM,
3869 MPFROM2SHORT(IDM_VIEW, FALSE), MPVOID);
3870 WinSendMsg(hwndMenu, MM_DELETEITEM,
3871 MPFROM2SHORT(IDM_EXEC, FALSE), MPVOID);
3872 WinSendMsg(hwndMenu, MM_DELETEITEM,
3873 MPFROM2SHORT(IDM_RESCAN, FALSE), MPVOID);
3874 WinSendMsg(hwndMenu, MM_DELETEITEM,
3875 MPFROM2SHORT(IDM_DELETE, FALSE), MPVOID);
3876 WinSendMsg(hwndMenu, MM_DELETEITEM,
3877 MPFROM2SHORT(IDM_EXTRACT, FALSE), MPVOID);
3878 WinSendMsg(hwndMenu, MM_DELETEITEM,
3879 MPFROM2SHORT(IDM_TEST, FALSE), MPVOID);
3880 WinSendMsg(hwndMenu, MM_DELETEITEM,
3881 MPFROM2SHORT(IDM_VIRUSSCAN, FALSE), MPVOID);
3882 WinSendMsg(hwndMenu, MM_DELETEITEM,
3883 MPFROM2SHORT(IDM_WALKDIR, FALSE), MPVOID);
3884 WinSendMsg(hwndMenu, MM_DELETEITEM,
3885 MPFROM2SHORT(IDM_FILTER, FALSE), MPVOID);
3886 }
3887 }
3888 }
3889 if (FrameFlags & FCF_TASKLIST) {
3890
3891 SWP swp, swpD;
3892 ULONG size = sizeof(swp);
3893 LONG cxScreen, cyScreen;
3894
3895 WinQueryTaskSizePos(WinQueryAnchorBlock(hwndFrame), 0, &swp);
3896 if (PrfQueryProfileData(fmprof, appname, "AV2SizePos", &swpD, &size)) {
3897 cxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
3898 cyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
3899 if (swp.x + swpD.cx > cxScreen)
3900 swp.x = cxScreen - swpD.cx;
3901 if (swp.y + swpD.cy > cyScreen)
3902 swp.y = cyScreen - swpD.cy;
3903 swp.cx = swpD.cx;
3904 swp.cy = swpD.cy;
3905 }
3906 WinSetWindowPos(hwndFrame,
3907 HWND_TOP,
3908 swp.x,
3909 swp.y,
3910 swp.cx,
3911 swp.cy,
3912 SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER |
3913 SWP_ACTIVATE);
3914 }
3915 }
3916 }
3917# ifdef FORTIFY
3918 Fortify_LeaveScope();
3919# endif
3920 }
3921 }
3922 return hwndFrame;
3923}
3924
3925#pragma alloc_text(ARCCNRS,ArcCnrWndProc,ArcObjWndProc,ArcClientWndProc,BldQuotedFullPathName)
3926#pragma alloc_text(ARCCNRS,ArcTextProc,FillArcCnr,ArcFilter,BldQuotedFileName)
3927#pragma alloc_text(ARCCNRS,ArcSort,ArcFrameWndProc,IsArcThere,ArcErrProc)
3928#pragma alloc_text(STARTUP,StartArcCnr)
Note: See TracBrowser for help on using the repository browser.