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