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