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