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