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