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