source: trunk/dll/collect.c@ 1562

Last change on this file since 1562 was 1562, checked in by Gregg Young, 14 years ago

Code clean up for collector trap on find dups

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 86.2 KB
RevLine 
[1335]1
[96]2/***********************************************************************
3
4 $Id: collect.c 1562 2011-05-29 17:45:54Z gyoung $
5
6 Collector
7
8 Copyright (c) 1993-98 M. Kimes
[1498]9 Copyright (c) 2003, 2010 Steven H. Levine
[96]10
[130]11 15 Oct 02 MK Baseline
12 10 Jan 04 SHL Avoid -1L byte counts
13 01 Aug 04 SHL Rework lstrip/rstrip usage
14 23 May 05 SHL Use QWL_USER
[145]15 24 May 05 SHL Rework Win_Error usage
[155]16 25 May 05 SHL Use ULONGLONG and CommaFmtULL
17 25 May 05 SHL Rework for FillInRecordFromFFB
[186]18 05 Jun 05 SHL Use QWL_USER
[194]19 06 Jun 05 SHL Indent -i2
[197]20 06 Jun 05 SHL Make savedSortFlags static to avoid referencing garbage
[280]21 24 Oct 05 SHL Sanitize handle references
22 24 Oct 05 SHL CollectorCnrWndProc: avoid excess writes to Status2 window
23 10 Nov 05 SHL CollectorCnrWndProc: correct missing button window updates
[352]24 14 Jul 06 SHL Use Runtime_Error
[403]25 27 Jul 06 SHL Avoid shutdown hang - pre3 typo
26 29 Jul 06 SHL Use xfgets_bstripcr
[444]27 15 Aug 06 SHL Don't write garbage to CollectorFilter INI entry
28 15 Aug 06 SHL Rework SetMask args
29 18 Aug 06 SHL CollectorCnrWndProc: avoid freeing NULL pointer
[471]30 31 Aug 06 SHL Disable Utilities->Seek and scan menu while busy
31 31 Aug 06 SHL Correct stop scan context menu enable/disable
[593]32 30 Mar 07 GKY Remove GetPString for window class names
[603]33 06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
34 06 Apr 07 GKY Add some error checking in drag/drop
[618]35 19 Apr 07 SHL Use FreeDragInfoData. Add more drag/drop error checks.
[672]36 12 May 07 SHL Use dcd->ulItemsToUnHilite
[688]37 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit
[724]38 05 Jul 07 SHL CollectorCnrWndProc: just warn if busy
[751]39 02 Aug 07 SHL Sync with CNRITEM mods
[775]40 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
[793]41 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
[814]42 26 Aug 07 GKY DosSleep(1) in loops changed to (0)
[872]43 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
[917]44 10 Jan 08 SHL Sync with CfgDlgProc mods
[946]45 10 Feb 08 GKY Implement bubble help for bitmap menu items
[953]46 15 Feb 08 SHL Sync with settings menu rework
[956]47 15 Feb 08 GKY Fix attempt to free container items that were never inserted
48 15 Feb 08 GKY Fix "collect" so it updates recollected files and unhides them if needed
[985]49 29 Feb 08 GKY Use xfree where appropriate
[1041]50 06 Jul 08 GKY Update delete/undelete to include move to and open XWP trashcan
[1065]51 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
[1077]52 all the details view settings (both the global variables and those in the
53 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
[1084]54 20 Jul 08 GKY Add save/append filename to clipboard.
[1335]55 Change menu wording to make these easier to find
[1120]56 25 Aug 08 GKY Check TMP directory space warn if lee than 5 MiB prevent archiver from opening if
[1335]57 less than 10 KiB (It hangs and can't be closed)
58 10 Dec 08 SHL Integrate exception handler support
[1357]59 26 Dec 08 GKY Fixed DROPHELP to check for copy as default is action is DO_DEFAULT
[1375]60 01 Jan 09 GKY Add Seek and Scan to drives & directory context menus pass drive/dir as search root
[1395]61 07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error
62 07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook.
63 07 Feb 09 GKY Add *DateFormat functions to format dates based on locale
64 07 Feb 09 GKY Move repeated strings to PCSZs.
[1400]65 08 Mar 09 GKY Renamed commafmt.h i18nutil.h
66 08 Mar 09 GKY Additional strings move to PCSZs in init.c
[1430]67 06 Jun 09 GKY Add option to show file system type or drive label in tree
[1439]68 12 Jul 09 GKY Add szFSType to FillInRecordFromFSA use to bypass EA scan and size formatting
[1456]69 for tree container
[1442]70 13 Jul 09 GKY Fixed double free of memory buffer in UM_COLLECTFROMFILE
[1456]71 15 Sep 09 SHL Use UM_GREP when passing pathname
[1498]72 17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
[1546]73 23 Oct 10 GKY Add menu items for opening directory cnrs based on path of selected item
74 including the option to use walk directories to select path
[1561]75 28 May 11 GKY Fixed trap caused by passing a nonexistant pci to FillInRecordFromFFB in
76 UM_COLLECT because pci is limited to 65535 files. (nRecord is a USHORT)
[96]77
78***********************************************************************/
79
[2]80#include <stdlib.h>
81#include <string.h>
82#include <ctype.h>
83#include <share.h>
84#include <limits.h>
[1335]85// #include <process.h> // _beginthread
[155]86
[907]87#define INCL_DOS // QSV_MS_COUNT
88#define INCL_WIN
89#define INCL_DOSERRORS
90#define INCL_LONGLONG
91
[1181]92#include "fm3dll.h"
[1221]93#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
[1205]94#include "dircnrs.h" // Data declaration(s)
95#include "info.h" // Data declaration(s)
96#include "init.h" // Data declaration(s)
[2]97#include "fm3dlg.h"
98#include "fm3str.h"
99#include "mle.h"
100#include "grep.h"
[907]101#include "comp.h"
102#include "arccnrs.h" // StartArcCnr
103#include "filldir.h" // EmptyCnr...
104#include "strutil.h" // GetPString
105#include "errutil.h" // Runtime_Error
[942]106#include "tmrsvcs.h" // ITIMER_DESC
[953]107#include "notebook.h" // CfgDlgProc
[1077]108#include "command.h" // RunCommand
[1335]109#include "worker.h" // Action, MassAction
110#include "notify.h" // AddNote
111#include "misc.h" // AdjustCnrColsForPref, AdjustDetailsSwitches, CnrDirectEdit,
[1159]112 // LoadDetailsSwitches, OpenEdit, QuickPopup, SayFilter
113 // SaySort, SayView, SetCnrCols, SetDetailsSwitches
[1181]114 // SetSortChecks, SetViewMenu, disable_menuitem, CheckMenu
115 // CurrentRecord, DrawTargetEmphasis, IsFm2Window
[1159]116#include "chklist.h" // CenterOverWindow, DropListProc
117#include "collect.h"
118#include "common.h" // CommonCnrProc, CommonCreateTextChildren, CommonFrameWndProc
[1335]119 // CommonTextPaint
[1159]120#include "select.h" // DeselectAll, HideAll, RemoveAll, SelectAll, SelectList
121#include "dirsize.h" // DirSizeProc
122#include "grep2.h" // GrepDlgProc
123#include "mainwnd.h" // MakeBubble
124#include "objwin.h" // MakeObjWin
125#include "saveclip.h" // SaveListDlgProc
126#include "findrec.h" // ShowCnrRecord
127#include "sortcnr.h" // SortCollectorCnr
128#include "seeall.h" // StartSeeAll
129#include "update.h" // UpdateCnrList, UpdateCnrRecord
[1181]130#include "droplist.h" // CheckPmDrgLimit
131#include "common.h" // CommonTextButton, CommonTextProc
132#include "presparm.h" // CopyPresParams
133#include "defview.h" // DefaultViewKeys
134#include "draglist.h" // DoFileDrag, FreeDragInfoData
135#include "systemf.h" // ExecOnList
136#include "filter.h" // Filter
137#include "findrec.h" // FindCnrRecord
138#include "shadow.h" // OpenObject
139#include "mkdir.h" // PMMkDir
140#include "valid.h" // ParentIsDesktop
141#include "viewer.h" // StartMLEEditor
142#include "newview.h" // StartViewer
143#include "undel.h" // UndeleteDlgProc
[1400]144#include "i18nutil.h" // commafmt
[1181]145#include "getnames.h" // insert_filename
[1159]146#include "select.h" // InvertAll
[1181]147#include "strips.h" // bstrip
148#include "wrappers.h" // xDosFindFirst
[1017]149#include "fortify.h"
[1335]150#include "excputil.h" // xbeginthread
[1546]151#include "walkem.h" // WalkAllDlgProc
[1017]152
[1205]153// Data definitions
154#pragma data_seg(GLOBAL1)
155HWND CollectorCnrMenu;
156HWND hwndStatus2;
157
158#pragma data_seg(GLOBAL2)
159INT CollectorsortFlags;
160
[2]161#pragma data_seg(DATA1)
[352]162static PSZ pszSrcFile = __FILE__;
163
[194]164MRESULT EXPENTRY CollectorFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
165 MPARAM mp2)
166{
167 return CommonFrameWndProc(COLLECTOR_CNR, hwnd, msg, mp1, mp2);
[2]168}
169
[551]170MRESULT EXPENTRY CollectorTextProc(HWND hwnd, ULONG msg, MPARAM mp1,
171 MPARAM mp2)
[96]172{
[197]173 DIRCNRDATA *dcd;
[155]174
[194]175 static BOOL emphasized = FALSE;
[551]176 static HWND hwndButtonPopup = (HWND) 0;
[194]177 static ULONG timestamp = ULONG_MAX;
178 static USHORT lastid = 0;
[2]179
[444]180 switch (msg) {
[194]181 case WM_CREATE:
182 return CommonTextProc(hwnd, msg, mp1, mp2);
[2]183
[194]184 case UM_CONTEXTMENU:
185 case WM_CONTEXTMENU:
186 {
187 USHORT id;
188
189 id = WinQueryWindowUShort(hwnd, QWS_ID);
[444]190 switch (id) {
[194]191 case DIR_SELECTED:
192 case DIR_VIEW:
193 case DIR_SORT:
194 {
[551]195 POINTL ptl = { 0, 0 };
[194]196 SWP swp;
[2]197
[194]198 if (hwndButtonPopup)
199 WinDestroyWindow(hwndButtonPopup);
[444]200 if (id == lastid) {
[194]201 ULONG check;
[2]202
[194]203 DosQuerySysInfo(QSV_MS_COUNT,
[551]204 QSV_MS_COUNT, &check, sizeof(check));
[444]205 if (check < timestamp + 500) {
[194]206 lastid = 0;
207 goto MenuAbort;
208 }
209 }
[551]210 hwndButtonPopup = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
[444]211 if (hwndButtonPopup) {
[551]212 WinSetWindowUShort(hwndButtonPopup, QWS_ID, id);
[194]213 dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
[352]214 QW_PARENT),
[551]215 COLLECTOR_CNR), QWL_USER);
[444]216 if (id == DIR_VIEW) {
217 if (dcd) {
[551]218 SetViewMenu(hwndButtonPopup, dcd->flWindowAttr);
[1065]219 SetDetailsSwitches(hwndButtonPopup, &dcd->ds);
[907]220 CopyPresParams(hwndButtonPopup, hwnd);
[194]221 }
[2]222
[194]223 /* don't have tree view in collector */
224 WinSendMsg(hwndButtonPopup,
225 MM_DELETEITEM,
[551]226 MPFROM2SHORT(IDM_TREEVIEW, FALSE), MPVOID);
[2]227
[194]228 }
[444]229 else if (id == DIR_SORT) {
[194]230 if (dcd)
[551]231 SetSortChecks(hwndButtonPopup, dcd->sortFlags);
[194]232 }
233 ptl.x = 0;
234 if (WinPopupMenu(HWND_OBJECT,
235 HWND_OBJECT,
[551]236 hwndButtonPopup, -32767, -32767, 0, 0)) {
237 WinQueryWindowPos(hwndButtonPopup, &swp);
[194]238 ptl.y = -(swp.cy + 2);
239 }
[444]240 else {
[551]241 WinQueryWindowPos(hwnd, &swp);
[194]242 ptl.y = swp.cy + 2;
243 }
244 if (WinPopupMenu(hwnd,
245 hwnd,
246 hwndButtonPopup,
247 ptl.x,
248 ptl.y,
249 0,
250 PU_HCONSTRAIN | PU_VCONSTRAIN |
[551]251 PU_KEYBOARD | PU_MOUSEBUTTON1)) {
[194]252 CenterOverWindow(hwndButtonPopup);
[551]253 PaintRecessedWindow(hwnd, NULLHANDLE, FALSE, FALSE);
[194]254 }
255 }
256 }
257 break;
258 default:
259 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
260 COLLECTOR_CNR),
261 WM_CONTROL,
[551]262 MPFROM2SHORT(COLLECTOR_CNR, CN_CONTEXTMENU), MPVOID);
[194]263 break;
[2]264 }
[194]265 }
266 MenuAbort:
267 if (msg == UM_CONTEXTMENU)
268 return 0;
269 break;
[2]270
[194]271 case WM_MENUEND:
[551]272 if (hwndButtonPopup == (HWND) mp2) {
273 lastid = WinQueryWindowUShort((HWND) mp2, QWS_ID);
[194]274 WinDestroyWindow(hwndButtonPopup);
[551]275 hwndButtonPopup = (HWND) 0;
276 DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &timestamp,
277 sizeof(timestamp));
[444]278 switch (lastid) {
[194]279 case DIR_SELECTED:
280 case DIR_VIEW:
281 case DIR_SORT:
[551]282 PaintRecessedWindow(hwnd, NULLHANDLE, TRUE, FALSE);
[194]283 break;
[2]284 }
[194]285 }
286 break;
[2]287
[194]288 case WM_COMMAND:
289 {
290 DIRCNRDATA *dcd;
291 MRESULT mr;
292
293 mr = WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,
294 QW_PARENT),
[551]295 COLLECTOR_CNR), msg, mp1, mp2);
[194]296 if (hwndButtonPopup &&
297 SHORT1FROMMP(mp1) > IDM_DETAILSTITLES &&
[551]298 SHORT1FROMMP(mp1) < IDM_DETAILSSETUP) {
[194]299 dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
300 QW_PARENT),
[551]301 COLLECTOR_CNR), QWL_USER);
[194]302 if (dcd)
[1065]303 SetDetailsSwitches(hwndButtonPopup, &dcd->ds);
[2]304 }
[194]305 return mr;
306 }
[2]307
[194]308 case WM_MOUSEMOVE:
309 {
310 USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
[1394]311 PCSZ s = NULL;
[194]312
[444]313 if (fOtherHelp) {
[194]314 if ((!hwndBubble ||
315 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
[551]316 !WinQueryCapture(HWND_DESKTOP)) {
[444]317 switch (id) {
[194]318 case DIR_SELECTED:
319 s = GetPString(IDS_COLSELECTEDHELP);
320 break;
321 case DIR_TOTALS:
322 s = GetPString(IDS_COLTOTALSHELP);
323 break;
324 case DIR_VIEW:
325 s = GetPString(IDS_DIRCNRVIEWHELP);
326 break;
327 case DIR_SORT:
328 s = GetPString(IDS_DIRCNRSORTHELP);
329 break;
330 case DIR_FILTER:
[948]331 s = GetPString(IDS_DIRCNRFILTERHELP);
332 break;
[194]333 default:
334 break;
335 }
336 if (s)
337 MakeBubble(hwnd, TRUE, s);
338 else if (hwndBubble)
339 WinDestroyWindow(hwndBubble);
340 }
[2]341 }
[444]342 switch (id) {
[194]343 case DIR_FILTER:
344 case DIR_SORT:
345 case DIR_VIEW:
346 case DIR_SELECTED:
347 return CommonTextButton(hwnd, msg, mp1, mp2);
348 }
349 }
350 break;
[2]351
[194]352 case WM_BUTTON3UP:
353 case WM_BUTTON1UP:
354 case WM_BUTTON3DOWN:
355 case WM_BUTTON1DOWN:
356 {
357 USHORT id;
358
[280]359 id = WinQueryWindowUShort(hwnd, QWS_ID);
[444]360 switch (id) {
[194]361 case DIR_FILTER:
362 case DIR_SORT:
363 case DIR_VIEW:
364 case DIR_SELECTED:
365 return CommonTextButton(hwnd, msg, mp1, mp2);
[2]366 }
[194]367 }
368 break;
[2]369
[194]370 case UM_CLICKED:
371 case UM_CLICKED3:
372 {
373 USHORT id, cmd = 0;
374
[280]375 id = WinQueryWindowUShort(hwnd, QWS_ID);
[444]376 switch (id) {
[194]377 case DIR_VIEW:
378 case DIR_SORT:
379 case DIR_SELECTED:
[551]380 PostMsg(hwnd, UM_CONTEXTMENU, MPVOID, MPVOID);
[194]381 break;
382 case DIR_FILTER:
383 cmd = IDM_FILTER;
384 break;
385 default:
386 break;
[2]387 }
[194]388 if (cmd)
[551]389 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
[194]390 COLLECTOR_CNR),
[551]391 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
[194]392 }
393 return 0;
[2]394
[194]395 case DM_DROP:
396 case DM_DRAGOVER:
397 case DM_DRAGLEAVE:
398 case DM_DROPHELP:
[444]399 if (msg == DM_DRAGOVER) {
400 if (!emphasized) {
[194]401 emphasized = TRUE;
402 DrawTargetEmphasis(hwnd, emphasized);
[2]403 }
[194]404 }
[444]405 else {
406 if (emphasized) {
[194]407 emphasized = FALSE;
408 DrawTargetEmphasis(hwnd, emphasized);
[2]409 }
[194]410 }
411 {
412 CNRDRAGINFO cnd;
413 USHORT dcmd;
414
[444]415 switch (msg) {
[194]416 case DM_DROP:
417 dcmd = CN_DROP;
418 break;
419 case DM_DRAGOVER:
420 dcmd = CN_DRAGOVER;
421 break;
422 case DM_DRAGLEAVE:
423 dcmd = CN_DRAGLEAVE;
424 break;
425 case DM_DROPHELP:
426 dcmd = CN_DROPHELP;
427 break;
[2]428 }
[194]429 memset(&cnd, 0, sizeof(cnd));
430 cnd.pDragInfo = (PDRAGINFO) mp1;
431 cnd.pRecord = NULL;
432 return WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_CONTROL,
433 MPFROM2SHORT(COLLECTOR_CNR, dcmd), MPFROMP(&cnd));
434 }
[2]435 }
[194]436 return PFNWPStatic(hwnd, msg, mp1, mp2);
[2]437}
438
[194]439MRESULT EXPENTRY CollectorClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
440 MPARAM mp2)
441{
[444]442 switch (msg) {
[194]443 case UM_CONTAINERHWND:
444 return MRFROMLONG(WinWindowFromID(hwnd, COLLECTOR_CNR));
[2]445
[194]446 case UM_VIEWSMENU:
[872]447 return MRFROMLONG(CheckMenu(hwnd, &CollectorCnrMenu, COLLECTORCNR_POPUP));
[2]448
[194]449 case MM_PORTHOLEINIT:
450 case WM_INITMENU:
451 case UM_INITMENU:
452 case UM_CONTAINER_FILLED:
453 case UM_FILESMENU:
454 case UM_UPDATERECORD:
455 case UM_UPDATERECORDLIST:
456 return WinSendMsg(WinWindowFromID(hwnd, COLLECTOR_CNR), msg, mp1, mp2);
[2]457
[194]458 case WM_PSETFOCUS:
459 case WM_SETFOCUS:
460 if (mp2)
461 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
462 break;
[2]463
[194]464 case UM_FOCUSME:
465 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, COLLECTOR_CNR));
466 break;
[2]467
[194]468 case WM_PAINT:
469 {
470 HPS hps;
471 RECTL rcl;
[2]472
[280]473 hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
[444]474 if (hps) {
[194]475 WinQueryWindowRect(hwnd, &rcl);
476 WinFillRect(hps, &rcl, CLR_PALEGRAY);
477 CommonTextPaint(hwnd, hps);
478 WinEndPaint(hps);
[2]479 }
[194]480 }
481 break;
[2]482
[194]483 case UM_SIZE:
484 case WM_SIZE:
[444]485 if (msg == UM_SIZE) {
[194]486 SWP swp;
[2]487
[194]488 WinQueryWindowPos(hwnd, &swp);
489 mp1 = MPFROM2SHORT(swp.cx, swp.cy);
490 mp2 = MPFROM2SHORT(swp.cx, swp.cy);
491 }
492 {
493 USHORT cx, cy, bx;
[2]494
[194]495 cx = SHORT1FROMMP(mp2);
496 cy = SHORT2FROMMP(mp2);
497 WinSetWindowPos(WinWindowFromID(hwnd, COLLECTOR_CNR), HWND_TOP,
[551]498 0, 0, cx, cy - 24, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]499 WinSetWindowPos(WinWindowFromID(hwnd, DIR_TOTALS), HWND_TOP,
500 2,
501 cy - 22,
[551]502 (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]503 WinSetWindowPos(WinWindowFromID(hwnd, DIR_SELECTED), HWND_TOP,
504 2 + (cx / 3) + 2,
505 cy - 22,
[551]506 (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]507 bx = (cx - (2 + (((cx / 3) + 2) * 2))) / 3;
508 WinSetWindowPos(WinWindowFromID(hwnd, DIR_VIEW), HWND_TOP,
509 2 + (((cx / 3) + 2) * 2),
[551]510 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]511 WinSetWindowPos(WinWindowFromID(hwnd, DIR_SORT), HWND_TOP,
512 2 + (((cx / 3) + 2) * 2) + bx,
[551]513 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]514 WinSetWindowPos(WinWindowFromID(hwnd, DIR_FILTER), HWND_TOP,
515 2 + (((cx / 3) + 2) * 2) + (bx * 2),
[551]516 cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
[194]517 }
[280]518 CommonTextPaint(hwnd, NULLHANDLE);
[444]519 if (msg == UM_SIZE) {
[194]520 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
521 SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE);
522 return 0;
523 }
524 break;
[2]525
[194]526 case UM_COMMAND:
527 case WM_COMMAND:
528 case WM_CONTROL:
529 case WM_CLOSE:
530 return WinSendMsg(WinWindowFromID(hwnd, COLLECTOR_CNR), msg, mp1, mp2);
[2]531 }
[194]532 return WinDefWindowProc(hwnd, msg, mp1, mp2);
[2]533}
534
[942]535MRESULT EXPENTRY CollectorObjWndProc(HWND hwnd, ULONG msg,
536 MPARAM mp1, MPARAM mp2)
[194]537{
[197]538 ULONG size;
[2]539 DIRCNRDATA *dcd;
540
[444]541 switch (msg) {
[194]542 case WM_CREATE:
[1077]543 // 18 Jul 08 SHL fixme to doc why messsage gets lost
544 DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2); // 18 Jul 08 SHL fixme
[194]545 break;
[2]546
[194]547 case DM_PRINTOBJECT:
548 return MRFROMLONG(DRR_TARGET);
[2]549
[194]550 case DM_DISCARDOBJECT:
551 dcd = INSTDATA(hwnd);
[444]552 if (fFM2Deletes && dcd) {
[194]553 LISTINFO *li;
554 CNRDRAGINFO cni;
[2]555
[194]556 cni.pRecord = NULL;
557 cni.pDragInfo = (PDRAGINFO) mp1;
[551]558 li = DoFileDrop(dcd->hwndCnr, NULL, FALSE, MPVOID, MPFROMP(&cni));
[687]559 CheckPmDrgLimit(cni.pDragInfo);
[444]560 if (li) {
[672]561 li->type = fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE;
[194]562 if (!PostMsg(hwnd, UM_MASSACTION, MPFROMP(li), MPVOID))
563 FreeListInfo(li);
564 else
565 return MRFROMLONG(DRR_SOURCE);
[2]566 }
[194]567 }
568 return MRFROMLONG(DRR_TARGET);
[2]569
[194]570 case UM_UPDATERECORDLIST:
571 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]572 if (dcd && mp1) {
[194]573 INT numentries = 0;
574 CHAR **list = (CHAR **) mp1;
[2]575
[194]576 while (list[numentries])
577 numentries++;
578 if (numentries)
[551]579 UpdateCnrList(dcd->hwndCnr, list, numentries, FALSE, dcd);
[194]580 }
581 return 0;
[2]582
[194]583 case UM_SETUP:
[1077]584# ifdef FORTIFY
585 Fortify_EnterScope();
586# endif
[194]587 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]588 if (dcd) {
[1077]589# ifdef FORTIFY
[1078]590 Fortify_BecomeOwner(dcd);
[1077]591# endif
[194]592 /* set unique id */
593 WinSetWindowUShort(hwnd,
594 QWS_ID,
[551]595 COLLECTOROBJ_FRAME + (COLLECTOR_FRAME - dcd->id));
596 dcd->hwndObject = hwnd;
[942]597 // 09 Feb 08 SHL fixme to be sure applet does not really need this
598 // if (ParentIsDesktop(hwnd, dcd->hwndParent))
599 // DosSleep(100); //05 Aug 07 GKY 250
[194]600 }
601 else
602 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
603 return 0;
[2]604
[194]605 case UM_COMMAND:
[444]606 if (mp1) {
[194]607 LISTINFO *li = (LISTINFO *) mp1;
608
[551]609 switch (li->type) {
[194]610 case IDM_DOITYOURSELF:
611 case IDM_APPENDTOCLIP:
[1084]612 case IDM_APPENDTOCLIPFILENAME:
[194]613 case IDM_SAVETOCLIP:
614 case IDM_ARCHIVE:
615 case IDM_ARCHIVEM:
616 case IDM_VIEW:
617 case IDM_VIEWTEXT:
618 case IDM_VIEWBINARY:
619 case IDM_VIEWARCHIVE:
620 case IDM_EDIT:
621 case IDM_EDITTEXT:
622 case IDM_EDITBINARY:
623 case IDM_OBJECT:
624 case IDM_SHADOW:
625 case IDM_SHADOW2:
626 case IDM_PRINT:
627 case IDM_ATTRS:
628 case IDM_DELETE:
629 case IDM_PERMDELETE:
630 case IDM_FAKEEXTRACT:
631 case IDM_FAKEEXTRACTM:
632 case IDM_MCIPLAY:
633 case IDM_UPDATE:
634 if (PostMsg(hwnd, UM_MASSACTION, mp1, mp2))
635 return (MRESULT) TRUE;
636 break;
637 default:
638 if (PostMsg(hwnd, UM_ACTION, mp1, mp2))
639 return (MRESULT) TRUE;
[2]640 }
[194]641 }
642 return 0;
[2]643
[194]644 case UM_COLLECT:
645 DosError(FERR_DISABLEHARDERR);
646 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]647 if (dcd) {
[194]648 LISTINFO *li = (LISTINFO *) mp1;
[1561]649 INT x, y = 0;
[841]650 FILEFINDBUF4L fb4;
[194]651 HDIR hdir;
652 ULONG nm;
653 PCNRITEM pci, pciFirst, pciT, pciP = NULL;
654 RECORDINSERT ri;
655 ULONG ulMaxFiles;
[1562]656 ULONGLONG ullTotalBytes, ullInitialTotalBytes;
[194]657 CHAR fullname[CCHMAXPATH];
[1561]658 INT makeShort = 0;
[2]659
[942]660 if (!hwndStatus) {
661 WinSetWindowText(WinWindowFromID(dcd->hwndClient, DIR_SELECTED),
[1498]662 (CHAR *) GetPString(IDS_COLLECTINGTEXT));
[942]663 }
664 else {
665 if (WinQueryFocus(HWND_DESKTOP) == dcd->hwndCnr)
[1498]666 WinSetWindowText(hwndStatus, (CHAR *) GetPString(IDS_COLLECTINGTEXT));
[942]667 }
[1562]668 ullInitialTotalBytes = dcd->ullTotalBytes;
[1561]669 while (li->list[y]) {
[1562]670 for (ulMaxFiles = 0; li->list[ulMaxFiles + y] && ulMaxFiles < USHRT_MAX; ulMaxFiles++) ; // Count
[942]671
[1561]672 if (ulMaxFiles) {
673
674 pci = WinSendMsg(dcd->hwndCnr, CM_ALLOCRECORD,
675 MPFROMLONG(EXTRA_RECORD_BYTES),
676 MPFROMLONG(ulMaxFiles));
677 if (!pci) {
678 Runtime_Error(pszSrcFile, __LINE__, PCSZ_CM_ALLOCRECORD);
679 break;
680 }
681 else {
682 ITIMER_DESC itdSleep = { 0 }; // 06 Feb 08 SHL
683 InitITimer(&itdSleep, 500); // Sleep every 500 mSec
684 pciFirst = pci;
685 // 04 Jan 08 SHL fixme like comp.c if CM_ALLOCRECORD returns unexpected record count
686 for (x = y ; li->list[x]; x++) {
687 nm = 1;
688 hdir = HDIR_CREATE;
689 DosError(FERR_DISABLEHARDERR);
[1562]690 if (ullInitialTotalBytes && !makeShort &&
[1561]691 FindCnrRecord(dcd->hwndCnr, li->list[x], NULL, FALSE, FALSE, TRUE)) {
692 pci = UpdateCnrRecord(dcd->hwndCnr, li->list[x], FALSE, dcd);
693 if (Filter((PMINIRECORDCORE) pci, (PVOID) & dcd->mask)) {
694 pci->rc.flRecordAttr &= ~CRA_FILTERED;
695 WinSendMsg(dcd->hwndCnr, CM_INVALIDATERECORD, MPVOID,
696 MPFROM2SHORT(0, CMA_REPOSITION | CMA_ERASE));
697 }
698 pci = (PCNRITEM) pci->rc.preccNextRecord;
699 if (pciP)
700 pciP->rc.preccNextRecord = (PMINIRECORDCORE) pci;
701 else
702 pciFirst = pci;
703 }
704 else if (*li->list[x] &&
705 !DosQueryPathInfo(li->list[x], FIL_QUERYFULLNAME,
706 fullname, sizeof(fullname)) &&
707 !IsRoot(fullname) &&
708 !xDosFindFirst(fullname,
709 &hdir,
710 FILE_NORMAL | FILE_DIRECTORY |
711 FILE_ARCHIVED | FILE_SYSTEM |
712 FILE_HIDDEN | FILE_READONLY,
713 &fb4, sizeof(fb4), &nm, FIL_QUERYEASIZEL)) {
714 DosFindClose(hdir);
715 priority_normal();
716 *fb4.achName = 0;
717 //DbgMsg(pszSrcFile, __LINE__, "hwndCnr %x pci %x fullname %s pci->rc.preccNextRecord %x x %x Max %x",
718 // dcd->hwndCnr, pci, fullname, pci->rc.preccNextRecord, x, ulMaxFiles);
719 ullTotalBytes = FillInRecordFromFFB(dcd->hwndCnr,
720 pci,
721 fullname, &fb4, FALSE, dcd);
722 dcd->ullTotalBytes += ullTotalBytes;
723 pciP = pci;
724 pci = (PCNRITEM) pci->rc.preccNextRecord;
725 }
726 else {
727 // Oops - fixme to complain?
728 pciT = pci;
729 pci = (PCNRITEM) pci->rc.preccNextRecord;
730 if (pciP)
731 pciP->rc.preccNextRecord = (PMINIRECORDCORE) pci;
732 else
733 pciFirst = pci;
734 if (pciT)
735 FreeCnrItemData(pciT); // FreeCnrItem(hwnd, pciT);
736 ulMaxFiles--; // Remember gone
737 }
738 SleepIfNeeded(&itdSleep, 1); // 09 Feb 08 SHL
739 // DosSleep(0); //26 Aug 07 GKY 1 // 09 Feb 08 SHL
740 if (pciP->rc.preccNextRecord == 0) {
741 y = x + 1;
742 break;
743 }
744 y = x + 1;
745 } // for
746 if (ulMaxFiles) {
747 //DbgMsg(pszSrcFile, __LINE__, "ri %x pciFirst %x x %x Max %x",
748 // ri, pciFirst, x, ulMaxFiles);
749 // Some files OK
750 memset(&ri, 0, sizeof(RECORDINSERT));
751 ri.cb = sizeof(RECORDINSERT);
752 ri.pRecordOrder = (PRECORDCORE) CMA_END;
753 ri.pRecordParent = (PRECORDCORE) 0;
754 ri.zOrder = (ULONG) CMA_TOP;
755 ri.cRecordsInsert = ulMaxFiles;
756 ri.fInvalidateRecord = TRUE;
757 WinSendMsg(dcd->hwndCnr,
758 CM_INSERTRECORD, MPFROMP(pciFirst), MPFROMP(&ri));
759 PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
760 makeShort++;
761 ulMaxFiles = 0;
762 }
763 }
764 }
[1562]765 if (makeShort > 1000) {
766 Runtime_Error(pszSrcFile, __LINE__,
767 "You have exceeded 650,000,000 files which probably means either a momory alocation or a list creation failure. Either way contact us.");
768 break;
769 }
[1561]770 } //While
[194]771 }
[551]772 if (dcd->flWindowAttr & CV_DETAIL)
[194]773 WinSendDlgItemMsg(hwnd,
774 COLLECTOR_CNR,
775 CM_INVALIDATERECORD,
[1561]776 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
[194]777 return 0;
[2]778
[194]779 case UM_COLLECTFROMFILE:
780 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[1077]781# ifdef FORTIFY
782 Fortify_EnterScope();
783# endif
784
[403]785 if (dcd && mp1) {
[841]786 FILESTATUS4L fs4;
[194]787 PCNRITEM pci;
788 RECORDINSERT ri;
789 CHAR fullname[1024], *p;
790 FILE *fp;
[750]791 ULONG errs = 0;
[444]792 BOOL first = FALSE;
793 size_t c;
[1544]794 CHAR *moder = "r";
[2]795
[1077]796# ifdef FORTIFY
[1078]797 Fortify_BecomeOwner(mp1);
[1077]798# endif
799
[1544]800 fp = xfsopen((CHAR *)mp1, moder, SH_DENYNO, pszSrcFile, __LINE__, TRUE);
[403]801 if (fp) {
802 while (!feof(fp)) {
[444]803 // Avoid too much noise if collecting from binary file - oops
804 if (!fgets(fullname, sizeof(fullname), fp)) {
805 if (ferror(fp))
806 Runtime_Error(pszSrcFile, __LINE__, "fgets");
[194]807 break;
808 }
[444]809
810 c = strlen(fullname);
811 if (c + 1 >= sizeof(fullname))
812 errs++;
[551]813 else if (!c || (fullname[c - 1] != '\n' && fullname[c - 1] != '\r'))
[444]814 errs++;
[403]815 else {
[444]816 bstripcr(fullname);
817
818 if (*fullname == '\"') {
819 memmove(fullname, fullname + 1, strlen(fullname) + 1);
820 lstrip(fullname);
821 p = strchr(fullname, '\"');
822 if (p)
823 *p = 0;
824 rstrip(fullname);
825 }
826 else {
827 p = strchr(fullname, ' ');
828 if (p)
829 *p = 0;
830 }
831 /* fullname now contains name of file to collect */
[1077]832 DosError(FERR_DISABLEHARDERR);
833 if (FindCnrRecord(dcd->hwndCnr,
[956]834 fullname,
835 NULL,
836 FALSE,
837 FALSE,
[1077]838 TRUE)) {
839 pci = UpdateCnrRecord(dcd->hwndCnr, fullname, FALSE, dcd);
840 if (Filter((PMINIRECORDCORE) pci, (PVOID) & dcd->mask)) {
841 pci->rc.flRecordAttr &= ~CRA_FILTERED;
842 WinSendMsg(dcd->hwndCnr, CM_INVALIDATERECORD, MPVOID,
843 MPFROM2SHORT(0, CMA_REPOSITION | CMA_ERASE));
844 }
845 /*pci = (PCNRITEM) pci->rc.preccNextRecord;
[956]846 if (pciP)
847 pciP->rc.preccNextRecord = (PMINIRECORDCORE) pci;
848 else
[1077]849 pciFirst = pci;*/
850 }
[956]851 else if (IsFullName(fullname) &&
[444]852 !IsRoot(fullname) &&
853 !DosQueryPathInfo(fullname,
[841]854 FIL_QUERYEASIZEL,
[444]855 &fs4,
[1077]856 sizeof(fs4))) {
[444]857 /* collect it */
[551]858 pci = WinSendMsg(dcd->hwndCnr,
[444]859 CM_ALLOCRECORD,
860 MPFROMLONG(EXTRA_RECORD_BYTES),
[750]861 MPFROMLONG(1));
[444]862 if (pci) {
[551]863 dcd->ullTotalBytes += FillInRecordFromFSA(dcd->hwndCnr, pci,
864 fullname,
[1456]865 &fs4, FALSE, NULL, dcd);
[444]866 memset(&ri, 0, sizeof(RECORDINSERT));
867 ri.cb = sizeof(RECORDINSERT);
868 ri.pRecordOrder = (PRECORDCORE) CMA_END;
869 ri.pRecordParent = (PRECORDCORE) 0;
870 ri.zOrder = (ULONG) CMA_TOP;
[750]871 ri.cRecordsInsert = 1;
[444]872 ri.fInvalidateRecord = TRUE;
[551]873 WinSendMsg(dcd->hwndCnr, CM_INSERTRECORD,
[444]874 MPFROMP(pci), MPFROMP(&ri));
875 }
[194]876 }
[444]877 else
878 errs++;
[194]879 }
[444]880 if (errs > (first ? 0 : 50)) {
881 /* prevent runaway on bad file */
[551]882 APIRET ret = saymsg(MB_YESNO, dcd->hwndCnr,
[444]883 GetPString(IDS_COLLECTNOLISTHDRTEXT),
884 GetPString(IDS_COLLECTNOLISTTEXT),
[1009]885 (CHAR *)mp1);
[551]886
[444]887 if (ret == MBID_NO)
888 break;
889 if (!first)
890 errs = 0;
891 else
892 first = FALSE;
[194]893 }
[551]894 } // while not eof
[194]895 fclose(fp);
[2]896 }
[1442]897 free(mp1);
[194]898 }
[1063]899# ifdef FORTIFY
900 Fortify_LeaveScope();
[1077]901# endif
[194]902 return 0;
[2]903
[194]904 case UM_SELECT:
905 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]906 if (dcd) {
907 switch (SHORT1FROMMP(mp1)) {
[194]908 case IDM_SELECTLIST:
909 {
910 CHAR filename[CCHMAXPATH], *p, *pp;
[2]911
[1395]912 strcpy(filename, PCSZ_STARDOTLST);
[194]913 size = CCHMAXPATH;
[551]914 PrfQueryProfileData(fmprof, appname, "SaveToListName", filename,
915 &size);
[194]916 pp = strrchr(filename, '\\');
917 if (!pp)
918 pp = filename;
919 p = strrchr(pp, '.');
[444]920 if (p && *(p + 1) && p > pp + 1) {
[194]921 if (pp > filename)
922 pp++;
923 *pp = '*';
924 pp++;
925 if (p > pp)
926 memmove(pp, p, strlen(p) + 1);
927 }
928 if (insert_filename(hwnd, filename, FALSE, FALSE))
[551]929 SelectList(dcd->hwndCnr, TRUE, FALSE, FALSE, NULL, filename,
930 NULL);
[194]931 }
932 break;
933 case IDM_SELECTALL:
[551]934 SelectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
[194]935 break;
936 case IDM_DESELECTALL:
[551]937 DeselectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
[194]938 break;
939 case IDM_SELECTALLFILES:
[551]940 SelectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
[194]941 break;
942 case IDM_DESELECTALLFILES:
[551]943 DeselectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
[194]944 break;
945 case IDM_SELECTALLDIRS:
[551]946 SelectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
[194]947 break;
948 case IDM_DESELECTALLDIRS:
[551]949 DeselectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
[194]950 break;
951 case IDM_DESELECTMASK:
952 case IDM_SELECTMASK:
953 {
954 MASK mask;
955 PCNRITEM pci = (PCNRITEM) mp2;
[2]956
[194]957 memset(&mask, 0, sizeof(MASK));
958 mask.fNoAttribs = TRUE;
959 mask.fNoDirs = TRUE;
960 mask.fText = TRUE;
961 strcpy(mask.prompt,
962 GetPString((SHORT1FROMMP(mp1) == IDM_SELECTMASK) ?
[551]963 IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT));
[194]964 if (pci && (INT) pci != -1)
[730]965 strcpy(mask.szMask, pci->pszFileName);
[551]966 if (WinDlgBox(HWND_DESKTOP, dcd->hwndCnr, PickMaskDlgProc,
967 FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
[194]968 if (SHORT1FROMMP(mp1) == IDM_SELECTMASK)
[551]969 SelectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, mask.szText,
[194]970 FALSE);
971 else
[551]972 DeselectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, mask.szText,
[194]973 FALSE);
974 }
975 }
[2]976
[194]977 case IDM_DESELECTCLIP:
978 case IDM_SELECTCLIP:
979 {
980 CHAR **list;
[2]981
[194]982 list = ListFromClipboard(hwnd);
[444]983 if (list) {
[551]984 SelectList(dcd->hwndCnr, TRUE, FALSE,
[194]985 (SHORT1FROMMP(mp1) == IDM_DESELECTCLIP),
986 NULL, NULL, list);
987 FreeList(list);
988 }
989 }
990 break;
[2]991
[194]992 case IDM_INVERT:
[551]993 InvertAll(dcd->hwndCnr);
[194]994 break;
[2]995 }
[194]996 }
997 return 0;
[2]998
[194]999 case UM_MASSACTION:
[1077]1000# ifdef FORTIFY
1001 Fortify_EnterScope();
1002# endif
[444]1003 if (mp1) {
[1077]1004# ifdef FORTIFY
[1078]1005 Fortify_BecomeOwner(mp1);
[1077]1006# endif
[194]1007 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]1008 if (dcd) {
[194]1009 WORKER *wk;
[551]1010 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
[444]1011 if (!wk)
[352]1012 FreeListInfo((LISTINFO *) mp1);
1013 else {
[551]1014 wk->size = sizeof(WORKER);
1015 wk->hwndCnr = dcd->hwndCnr;
1016 wk->hwndParent = dcd->hwndParent;
1017 wk->hwndFrame = dcd->hwndFrame;
1018 wk->hwndClient = dcd->hwndClient;
1019 wk->li = (LISTINFO *) mp1;
1020 strcpy(wk->directory, dcd->directory);
[1335]1021 if (xbeginthread(MassAction,
1022 122880,
1023 wk,
1024 pszSrcFile,
1025 __LINE__) == -1)
1026 {
[1077]1027 free(wk);
[194]1028 FreeListInfo((LISTINFO *) mp1);
1029 }
1030 }
[2]1031 }
[194]1032 }
[1077]1033# ifdef FORTIFY
1034 DosSleep(1); // Let receiver take ownership
1035 Fortify_LeaveScope();
1036# endif
[194]1037 return 0;
[2]1038
[194]1039 case UM_ACTION:
[1077]1040# ifdef FORTIFY
1041 Fortify_EnterScope();
1042# endif
[444]1043 if (mp1) {
[1077]1044# ifdef FORTIFY
[1078]1045 Fortify_BecomeOwner(mp1);
[1077]1046# endif
[194]1047 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]1048 if (dcd) {
[194]1049 WORKER *wk;
[551]1050 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
[352]1051 if (!wk)
1052 FreeListInfo((LISTINFO *) mp1);
1053 else {
[551]1054 wk->size = sizeof(WORKER);
1055 wk->hwndCnr = dcd->hwndCnr;
1056 wk->hwndParent = dcd->hwndParent;
1057 wk->hwndFrame = dcd->hwndFrame;
1058 wk->hwndClient = dcd->hwndClient;
1059 wk->li = (LISTINFO *) mp1;
1060 strcpy(wk->directory, dcd->directory);
[1335]1061 if (xbeginthread(Action,
1062 122880,
1063 wk,
1064 pszSrcFile,
1065 __LINE__) == -1)
1066 {
[1077]1067 free(wk);
[194]1068 FreeListInfo((LISTINFO *) mp1);
1069 }
1070 }
[2]1071 }
[194]1072 }
[1077]1073# ifdef FORTIFY
1074 DosSleep(1); // Let receiver take ownership
1075 Fortify_LeaveScope();
1076# endif
[194]1077 return 0;
[2]1078
[194]1079 case WM_CLOSE:
1080 WinDestroyWindow(hwnd);
1081 break;
[2]1082
[194]1083 case WM_DESTROY:
1084 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
[444]1085 if (dcd) {
1086 INT x;
[551]1087
1088 dcd->stopflag = 1;
[942]1089 // Allow other threads to honor stop request
1090 for (x = 0; x < 100 && dcd->amextracted; x++)
1091 DosSleep(10);
1092 if (dcd->amextracted)
1093 Runtime_Error(pszSrcFile, __LINE__, "still busy");
[551]1094 WinSendMsg(dcd->hwndCnr, UM_CLOSE, MPVOID, MPVOID);
1095 FreeList(dcd->lastselection);
[1513]1096 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, NULL); // 13 Apr 10 SHL Set NULL before freeing dcd
[1039]1097 free(dcd);
[1063]1098# ifdef FORTIFY
1099 Fortify_LeaveScope();
[1077]1100# endif
[194]1101 }
1102 DosPostEventSem(CompactSem);
[551]1103 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
1104 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
[194]1105 break;
[2]1106 }
[194]1107 return WinDefWindowProc(hwnd, msg, mp1, mp2);
[2]1108}
1109
[551]1110MRESULT EXPENTRY CollectorCnrWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
1111 MPARAM mp2)
[155]1112{
[672]1113 DIRCNRDATA *dcd = INSTDATA(hwnd);
[197]1114 ULONG size;
[2]1115
[197]1116 static INT savedSortFlags;
1117
[444]1118 switch (msg) {
[194]1119 case DM_PRINTOBJECT:
1120 return MRFROMLONG(DRR_TARGET);
1121
1122 case DM_DISCARDOBJECT:
1123 if (dcd)
[551]1124 return WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
[194]1125 else
[2]1126 return MRFROMLONG(DRR_TARGET);
1127
[194]1128 case WM_CHAR:
1129 shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
1130 if (SHORT1FROMMP(mp1) & KC_KEYUP)
1131 return (MRESULT) TRUE;
[444]1132 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
1133 switch (SHORT2FROMMP(mp2)) {
[194]1134 case VK_DELETE:
1135 if ((shiftstate & KC_CTRL) == KC_CTRL)
1136 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PERMDELETE, 0), MPVOID);
1137 else if ((shiftstate & KC_SHIFT) == KC_SHIFT)
1138 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SAVETOCLIP, 0), MPVOID);
1139 else
1140 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID);
1141 break;
[2]1142 }
[194]1143 }
1144 if (shiftstate || fNoSearch)
1145 break;
[444]1146 if (SHORT1FROMMP(mp1) & KC_CHAR) {
[194]1147 ULONG thistime, len;
1148 SEARCHSTRING srch;
1149 PCNRITEM pci;
[2]1150
[194]1151 if (!dcd)
1152 break;
[444]1153 switch (SHORT1FROMMP(mp2)) {
[194]1154 case '\x1b':
1155 case '\r':
1156 case '\n':
[551]1157 dcd->lasttime = 0;
1158 *dcd->szCommonName = 0;
[194]1159 break;
1160 default:
1161 thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd));
[551]1162 if (thistime > dcd->lasttime + 1250)
1163 *dcd->szCommonName = 0;
1164 dcd->lasttime = thistime;
1165 if (SHORT1FROMMP(mp2) == ' ' && !dcd->szCommonName)
[194]1166 break;
1167 KbdRetry:
[551]1168 len = strlen(dcd->szCommonName);
[444]1169 if (len >= CCHMAXPATH - 1) {
[551]1170 *dcd->szCommonName = 0;
[194]1171 len = 0;
1172 }
[551]1173 dcd->szCommonName[len] = toupper(SHORT1FROMMP(mp2));
1174 dcd->szCommonName[len + 1] = 0;
[194]1175 memset(&srch, 0, sizeof(SEARCHSTRING));
[197]1176 srch.cb = sizeof(SEARCHSTRING);
[551]1177 srch.pszSearch = dcd->szCommonName;
[194]1178 srch.fsPrefix = TRUE;
1179 srch.fsCaseSensitive = FALSE;
1180 srch.usView = CV_ICON;
1181 pci = WinSendMsg(hwnd, CM_SEARCHSTRING, MPFROMP(&srch),
1182 MPFROMLONG(CMA_FIRST));
[444]1183 if (pci && (INT) pci != -1) {
[194]1184 USHORT attrib = CRA_CURSORED;
[2]1185
[194]1186 /* make found item current item */
[551]1187 if (!stricmp(pci->pszFileName, dcd->szCommonName))
[194]1188 attrib |= CRA_SELECTED;
1189 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
1190 MPFROM2SHORT(TRUE, attrib));
1191 /* make sure that record shows in viewport */
1192 ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
1193 return (MRESULT) TRUE;
1194 }
[444]1195 else {
1196 if (SHORT1FROMMP(mp2) == ' ') {
[551]1197 dcd->szCommonName[len] = 0;
[194]1198 break;
1199 }
[551]1200 *dcd->szCommonName = 0;
1201 dcd->lasttime = 0;
[194]1202 if (len) // retry as first letter if no match
[2]1203
[194]1204 goto KbdRetry;
1205 }
1206 break;
[2]1207 }
[194]1208 }
1209 break;
[2]1210
[194]1211 case WM_MOUSEMOVE:
1212 case WM_BUTTON1UP:
1213 case WM_BUTTON2UP:
1214 case WM_BUTTON3UP:
1215 case WM_CHORD:
1216 shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
1217 break;
[2]1218
[194]1219 case WM_BUTTON1MOTIONEND:
1220 {
1221 CNRINFO cnri;
1222
1223 memset(&cnri, 0, sizeof(CNRINFO));
1224 cnri.cb = sizeof(CNRINFO);
1225 if (WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
[551]1226 MPFROMLONG(sizeof(CNRINFO)))) {
[194]1227 if (cnri.flWindowAttr & CV_DETAIL)
1228 PrfWriteProfileData(fmprof, appname, "CollectorCnrSplitBar",
1229 (PVOID) & cnri.xVertSplitbar, sizeof(LONG));
[2]1230 }
[194]1231 }
1232 break;
[2]1233
[194]1234 case WM_PRESPARAMCHANGED:
[1400]1235 PresParamChanged(hwnd, PCSZ_COLLECTOR, mp1, mp2);
[194]1236 break;
[2]1237
[194]1238 case UM_COMPARE:
[444]1239 if (dcd && mp1 && mp2) {
[194]1240 COMPARE *cmp;
[1009]1241 CHAR *leftdir = (CHAR *)mp1, *rightdir = (CHAR *)mp2;
[2]1242
[444]1243 if (!IsFile(leftdir) && !IsFile(rightdir)) {
[551]1244 cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
[444]1245 if (cmp) {
[551]1246 cmp->size = sizeof(COMPARE);
1247 strcpy(cmp->leftdir, leftdir);
1248 strcpy(cmp->rightdir, rightdir);
1249 cmp->hwndParent = dcd->hwndParent;
1250 cmp->dcd.hwndParent = dcd->hwndParent;
[194]1251 WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, CompareDlgProc,
1252 FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
1253 }
[2]1254 }
[194]1255 }
1256 return 0;
[2]1257
[194]1258 case UM_UPDATERECORDLIST:
1259 if (dcd && mp1)
[551]1260 WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
[194]1261 return 0;
[2]1262
[194]1263 case UM_UPDATERECORD:
[444]1264 if (dcd && mp1) {
[194]1265 CHAR *filename;
[2]1266
[194]1267 filename = mp1;
1268 if (filename)
1269 UpdateCnrRecord(hwnd, filename, TRUE, dcd);
1270 }
1271 return 0;
[2]1272
[194]1273 case WM_SETFOCUS:
1274 /*
1275 * put name of our window on status line
1276 */
[444]1277 if (dcd && hwndStatus && mp2) {
[194]1278 PCNRITEM pci = NULL;
[2]1279
[444]1280 if (fAutoView && hwndMain) {
[194]1281 pci = WinSendMsg(hwnd,
1282 CM_QUERYRECORDEMPHASIS,
[551]1283 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
[194]1284 if (pci && (INT) pci != -1 &&
[730]1285 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
1286 WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
[194]1287 else
[551]1288 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
[2]1289 }
[551]1290 if (dcd->amextracted)
[1498]1291 WinSetWindowText(hwndStatus2, (CHAR *) GetPString(IDS_INSEEKSCANTEXT)); // Say working
[551]1292 WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
[194]1293 }
1294 break;
[2]1295
[194]1296 case UM_RESCAN:
[444]1297 if (dcd) {
[194]1298 CNRINFO cnri;
[1397]1299 CHAR s[CCHMAXPATH + 69], tb[81], tf[81], szDate[DATE_BUF_BYTES] *p;
[194]1300 PCNRITEM pci = NULL;
[2]1301
[194]1302 memset(&cnri, 0, sizeof(CNRINFO));
1303 cnri.cb = sizeof(CNRINFO);
1304 WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
1305 MPFROMLONG(sizeof(CNRINFO)));
[551]1306 dcd->totalfiles = cnri.cRecords;
1307 commafmt(tf, sizeof(tf), dcd->totalfiles);
1308 CommaFmtULL(tb, sizeof(tb), dcd->ullTotalBytes, ' ');
[194]1309 sprintf(s, "%s / %s", tf, tb);
[551]1310 WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, s);
[2]1311
[551]1312 commafmt(tf, sizeof(tf), dcd->selectedfiles);
1313 CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, ' ');
[194]1314 sprintf(s, "%s / %s", tf, tb);
[551]1315 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
[155]1316
[194]1317 if (hwndStatus &&
[551]1318 dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
[444]1319 if (hwndMain) {
[194]1320 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
[551]1321 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
[194]1322 if (pci && (INT) pci != -1)
[730]1323 PostMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
[194]1324 else
1325 PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
1326 }
[948]1327 if (!dcd->amextracted) {
1328 if (!fMoreButtons) {
1329 sprintf(s, " %s%s%s%s",
[942]1330 GetPString(IDS_COLLECTORTEXT),
[948]1331 *dcd->mask.szMask || dcd->mask.antiattr ||
1332 dcd->mask.attrFile != ALLATTRS ? " (" : NullStr,
1333 *dcd->mask.szMask ?
1334 dcd->mask.szMask :
1335 dcd->mask.antiattr ||
1336 dcd->mask.attrFile != ALLATTRS ?
1337 GetPString(IDS_ATTRTEXT) : NullStr,
1338 *dcd->mask.szMask || dcd->mask.antiattr ||
1339 dcd->mask.attrFile != ALLATTRS ?
1340 ")" : NullStr);
1341 }
1342 else
1343 strcpy(s, GetPString(IDS_COLLECTORTEXT));
1344 WinSetWindowText(hwndStatus, s);
[942]1345 }
[194]1346 if (!pci)
1347 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
[551]1348 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
[444]1349 if (pci && (INT) pci != -1) {
[280]1350 BOOL fStatus2Used = FALSE;
[551]1351
[444]1352 if (fSplitStatus && hwndStatus2) {
[551]1353 if (pci->attrFile & FILE_DIRECTORY)
1354 p = pci->pszFileName;
[444]1355 else {
[730]1356 p = strrchr(pci->pszFileName, '\\');
[444]1357 if (p) {
[194]1358 if (*(p + 1))
1359 p++;
1360 else
[551]1361 p = pci->pszFileName;
[155]1362 }
[194]1363 else
[551]1364 p = pci->pszFileName;
[194]1365 }
[551]1366 CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
[1456]1367 if (!fMoreButtons) {
1368 DateFormat(szDate, pci->date);
[1395]1369 sprintf(s, " %s %s %02u%s%02u%s%02u [%s] %s",
1370 tb, szDate, pci->time.hours, TimeSeparator, pci->time.minutes,
1371 TimeSeparator, pci->time.seconds, pci->pszDispAttr, p);
[194]1372 }
[444]1373 else {
[551]1374 if (pci->cbFile + pci->easize > 1024)
1375 CommaFmtULL(tf, sizeof(tf), pci->cbFile + pci->easize, 'K');
[194]1376 else
1377 *tf = 0;
1378 sprintf(s, GetPString(IDS_STATUSSIZETEXT),
[551]1379 tb, *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
[194]1380 }
1381 WinSetWindowText(hwndStatus2, s);
[280]1382 fStatus2Used = TRUE;
[194]1383 }
[444]1384 if (fMoreButtons) {
[1456]1385 WinSetWindowText(hwndName, pci->pszFileName);
1386 DateFormat(szDate, pci->date);
[1395]1387 sprintf(s, "%s %02u%s%02u%s%02u",
1388 szDate, pci->time.hours, TimeSeparator, pci->time.minutes,
1389 TimeSeparator, pci->time.seconds);
[194]1390 WinSetWindowText(hwndDate, s);
[551]1391 WinSetWindowText(hwndAttr, pci->pszDispAttr);
[194]1392 }
[551]1393 if (dcd->amextracted && hwndStatus2 && !fStatus2Used)
[1498]1394 WinSetWindowText(hwndStatus2, (CHAR *) GetPString(IDS_INSEEKSCANTEXT)); // Say working
[194]1395 }
[444]1396 else {
[948]1397 if (hwndStatus2) {
1398 if (dcd->amextracted)
[1498]1399 WinSetWindowText(hwndStatus2, (CHAR *) GetPString(IDS_INSEEKSCANTEXT)); // Say working
[948]1400 else
1401 WinSetWindowText(hwndStatus2, NullStr);
1402 }
[444]1403 if (fMoreButtons) {
[194]1404 WinSetWindowText(hwndName, NullStr);
1405 WinSetWindowText(hwndDate, NullStr);
1406 WinSetWindowText(hwndAttr, NullStr);
1407 }
1408 }
[2]1409 }
[194]1410 }
1411 return 0;
[2]1412
[194]1413 case UM_CONTAINER_FILLED:
[1395]1414 if (!fAlertBeepOff)
1415 DosBeep(1000, 50); // Wake up user?
[194]1416 WinSendMsg(hwnd,
1417 CM_INVALIDATERECORD,
[551]1418 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
[471]1419 disable_menuitem(WinWindowFromID(WinQueryWindow(hwndMain, QW_PARENT),
[1394]1420 FID_MENU), IDM_GREP, FALSE);
[1366]1421 disable_menuitem(TreeMenu, IDM_GREP, FALSE);
1422 disable_menuitem(DirMenu, IDM_GREP, FALSE);
[551]1423 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
[444]1424 if (dcd) {
[551]1425 dcd->stopflag = 0;
1426 dcd->amextracted = FALSE; // Say not busy
1427 if (dcd->namecanchange) {
1428 if (!PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID))
1429 WinSendMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
[2]1430 }
[194]1431 else
1432 WinSetWindowPos(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
1433 QW_PARENT),
1434 HWND_TOP,
[551]1435 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE | SWP_ZORDER);
[194]1436 }
1437 return 0;
[2]1438
[194]1439 case UM_SETUP:
[444]1440 if (dcd) {
[551]1441 if (!dcd->hwndObject) {
[471]1442 /* first time through -- set things up */
[2]1443
[194]1444 CNRINFO cnri;
[2]1445
[1400]1446 RestorePresParams(hwnd, PCSZ_COLLECTOR);
[1409]1447 LoadDetailsSwitches(PCSZ_COLLECTOR, &dcd->ds, FALSE);
[471]1448
[551]1449 dcd->amextracted = FALSE; // Say not busy
1450 dcd->stopflag = 0;
[194]1451 memset(&cnri, 0, sizeof(CNRINFO));
1452 cnri.cb = sizeof(CNRINFO);
1453 WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
1454 MPFROMLONG(sizeof(CNRINFO)));
1455 cnri.cyLineSpacing = 0;
[750]1456 cnri.cxTreeIndent = 12;
[2]1457
[551]1458 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT | CV_DETAIL));
[194]1459 cnri.flWindowAttr |= (CV_NAME | CA_DETAILSVIEWTITLES |
1460 CV_MINI | CV_FLOW);
1461 cnri.pSortRecord = (PVOID) SortCollectorCnr;
[2]1462
[444]1463 size = sizeof(ULONG);
1464 PrfQueryProfileData(fmprof, appname, "CollectorflWindowAttr",
1465 (PVOID) & cnri.flWindowAttr, &size);
1466 size = sizeof(MASK);
1467 if (PrfQueryProfileSize(fmprof, appname, "CollectorFilter", &size) &&
[551]1468 size) {
1469 PrfQueryProfileData(fmprof, appname, "CollectorFilter", &dcd->mask,
[444]1470 &size);
[551]1471 SetMask(NULL, &dcd->mask);
[194]1472 }
[444]1473 else {
[551]1474 dcd->mask.attrFile = (FILE_NORMAL | FILE_READONLY |
1475 FILE_DIRECTORY | FILE_HIDDEN |
1476 FILE_SYSTEM | FILE_ARCHIVED);
1477 dcd->mask.antiattr = 0;
[444]1478 }
1479
[551]1480 *(dcd->mask.prompt) = 0;
[444]1481
[194]1482 cnri.flWindowAttr |= CV_FLOW;
1483 cnri.flWindowAttr &= (~(CA_MIXEDTARGETEMPH | CA_ORDEREDTARGETEMPH));
[551]1484 dcd->flWindowAttr = cnri.flWindowAttr;
[194]1485 WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
1486 MPFROMLONG(CMA_FLWINDOWATTR | CMA_LINESPACING |
1487 CMA_CXTREEINDENT | CMA_PSORTRECORD));
1488 SetCnrCols(hwnd, FALSE);
[1065]1489 AdjustCnrColsForPref(hwnd, NULL, &dcd->ds, FALSE);
[2]1490
[197]1491 /* fix splitbar for collector container */
1492 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
1493 size = sizeof(LONG);
1494 PrfQueryProfileData(fmprof, appname, "CollectorCnrSplitBar",
1495 &cnri.xVertSplitbar, &size);
1496 if (cnri.xVertSplitbar <= 0)
[194]1497 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
[197]1498 WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
1499 MPFROMLONG(CMA_XVERTSPLITBAR));
1500
[1335]1501 if (xbeginthread(MakeObjWin,
1502 245760,
1503 dcd,
1504 pszSrcFile,
1505 __LINE__) == -1)
1506 {
[551]1507 Runtime_Error(pszSrcFile, __LINE__,
1508 GetPString(IDS_COULDNTSTARTTHREADTEXT));
[194]1509 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
1510 return 0;
1511 }
1512 else
[942]1513 DosSleep(32); // Let object window get started
[2]1514 }
[194]1515 SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
[551]1516 DIR_FILTER), &dcd->mask, FALSE);
[194]1517 SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1518 DIR_SORT), CollectorsortFlags, FALSE);
1519 SayView(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
[551]1520 DIR_VIEW), dcd->flWindowAttr);
[194]1521 }
[444]1522 else {
[194]1523 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
[2]1524 return 0;
[194]1525 }
1526 return 0;
[2]1527
[194]1528 case WM_MENUEND:
[444]1529 if (dcd) {
[551]1530 HWND hwndMenu = (HWND) mp2;
[2]1531
[194]1532 if (hwndMenu == CollectorCnrMenu || hwndMenu == CollectorFileMenu ||
[551]1533 hwndMenu == CollectorDirMenu) {
[194]1534 MarkAll(hwnd, TRUE, FALSE, TRUE);
[551]1535 if (dcd->cnremphasized) {
[194]1536 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
1537 MPFROM2SHORT(FALSE, CRA_SOURCE));
[551]1538 dcd->cnremphasized = FALSE;
[194]1539 }
[2]1540 }
[194]1541 }
1542 break;
[2]1543
[194]1544 case UM_OPENWINDOWFORME:
[444]1545 if (dcd) {
[1009]1546 if (mp1 && !IsFile((CHAR *)mp1))
[551]1547 OpenDirCnr(HWND_DESKTOP, hwndMain, dcd->hwndFrame, FALSE, (PSZ) mp1);
[1120]1548 else if (mp1 && IsFile(mp1) == 1 &&
[1335]1549 CheckDriveSpaceAvail(ArcTempRoot, ullDATFileSpaceNeeded, ullTmpSpaceNeeded) != 2)
[194]1550 StartArcCnr(HWND_DESKTOP,
[1009]1551 dcd->hwndFrame, (CHAR *)mp1, 4, (ARC_TYPE *) mp2);
[194]1552 }
1553 return 0;
[2]1554
[194]1555 case MM_PORTHOLEINIT:
[444]1556 if (dcd) {
1557 switch (SHORT1FROMMP(mp1)) {
[194]1558 case 0:
1559 case 1:
1560 {
1561 ULONG wmsg;
[2]1562
[194]1563 wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
[551]1564 PortholeInit((HWND) WinSendMsg(dcd->hwndClient, wmsg, MPVOID,
[194]1565 MPVOID), mp1, mp2);
1566 }
1567 break;
[2]1568 }
[194]1569 }
1570 break;
[2]1571
[194]1572 case UM_INITMENU:
1573 case WM_INITMENU:
[444]1574 if (dcd) {
1575 switch (SHORT1FROMMP(mp1)) {
[194]1576 case IDM_VIEWSMENU:
[551]1577 SetViewMenu((HWND) mp2, dcd->flWindowAttr);
1578 WinEnableMenuItem((HWND) mp2, IDM_RESELECT,
[907]1579 (dcd->lastselection != NULL));
1580 CopyPresParams((HWND) mp2, hwnd);
[194]1581 break;
[2]1582
[194]1583 case IDM_DETAILSSETUP:
[1065]1584 SetDetailsSwitches((HWND) mp2, &dcd->ds);
[194]1585 break;
[2]1586
[194]1587 case IDM_COMMANDSMENU:
[551]1588 SetupCommandMenu((HWND) mp2, hwnd);
[194]1589 break;
[2]1590
[194]1591 case IDM_SORTSUBMENU:
[551]1592 SetSortChecks((HWND) mp2, CollectorsortFlags);
[194]1593 break;
[2]1594 }
[551]1595 dcd->hwndLastMenu = (HWND) mp2;
[194]1596 }
1597 if (msg == WM_INITMENU)
1598 break;
1599 return 0;
[2]1600
[194]1601 case UM_COLLECTFROMFILE:
[444]1602 if (mp1) {
[1077]1603# ifdef FORTIFY
1604 Fortify_EnterScope();
[1078]1605 Fortify_BecomeOwner(mp1);
[1077]1606# endif
[1442]1607 if (!dcd) {
1608 Runtime_Error(pszSrcFile, __LINE__, NULL);
1609 free(mp1);
1610 }
[444]1611 else {
[551]1612 if (!PostMsg(dcd->hwndObject, UM_COLLECTFROMFILE, mp1, mp2)) {
[1442]1613 Runtime_Error(pszSrcFile, __LINE__, PCSZ_POSTMSG);
1614 free(mp1);
[194]1615 }
[2]1616 }
[1077]1617# ifdef FORTIFY
1618 DosSleep(1); // Let receiver take ownership
1619 Fortify_LeaveScope();
1620# endif
[194]1621 }
1622 return 0;
[2]1623
[194]1624 case UM_COMMAND:
[444]1625 if (mp1) {
1626 if (dcd) {
[551]1627 if (!PostMsg(dcd->hwndObject, UM_COMMAND, mp1, mp2)) {
[1400]1628 Runtime_Error(pszSrcFile, __LINE__, PCSZ_POSTMSG);
[194]1629 FreeListInfo((LISTINFO *) mp1);
1630 }
1631 else
1632 return (MRESULT) TRUE;
[2]1633 }
[194]1634 else
1635 FreeListInfo((LISTINFO *) mp1);
1636 }
1637 return 0;
[2]1638
[194]1639 case UM_NOTIFY:
1640 if (mp2)
[1009]1641 AddNote((CHAR *)mp2);
[194]1642 return 0;
[2]1643
[194]1644 case WM_COMMAND:
1645 DosError(FERR_DISABLEHARDERR);
[444]1646 if (dcd) {
1647 switch (SHORT1FROMMP(mp1)) {
[194]1648 case IDM_SETTARGET:
1649 SetTargetDir(hwnd, FALSE);
1650 break;
[2]1651
[194]1652 case IDM_CONTEXTMENU:
1653 {
1654 PCNRITEM pci;
[2]1655
[194]1656 pci = (PCNRITEM) CurrentRecord(hwnd);
1657 PostMsg(hwnd, WM_CONTROL, MPFROM2SHORT(COLLECTOR_CNR,
[551]1658 CN_CONTEXTMENU),
1659 MPFROMP(pci));
[194]1660 }
1661 break;
[2]1662
[194]1663 case IDM_SHOWALLFILES:
1664 {
1665 PCNRITEM pci;
[2]1666
[471]1667 pci = WinSendMsg(hwnd,
1668 CM_QUERYRECORDEMPHASIS,
[551]1669 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
[444]1670 if (pci && (INT) pci != -1) {
[194]1671 static CHAR dirname[CCHMAXPATH];
[2]1672
[730]1673 strcpy(dirname, pci->pszFileName);
[194]1674 MakeValidDir(dirname);
1675 StartSeeAll(HWND_DESKTOP, FALSE, dirname);
1676 }
1677 }
1678 break;
[2]1679
[194]1680 case IDM_BEGINEDIT:
1681 OpenEdit(hwnd);
1682 break;
[2]1683
[194]1684 case IDM_ENDEDIT:
1685 WinSendMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
1686 break;
[2]1687
[194]1688 case IDM_SHOWSELECT:
[551]1689 QuickPopup(hwnd, dcd,
[872]1690 CheckMenu(hwnd, &CollectorCnrMenu, COLLECTORCNR_POPUP),
[194]1691 IDM_SELECTSUBMENU);
1692 break;
[2]1693
[194]1694 case IDM_SHOWSORT:
[551]1695 QuickPopup(hwnd, dcd,
[872]1696 CheckMenu(hwnd, &CollectorCnrMenu, COLLECTORCNR_POPUP),
[194]1697 IDM_SORTSUBMENU);
1698 break;
[2]1699
[194]1700 case IDM_VIEWORARC:
1701 {
1702 SWP swp;
1703 PCNRITEM pci;
[2]1704
[194]1705 pci = (PCNRITEM) WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
1706 MPFROMLONG(CMA_FIRST),
1707 MPFROMSHORT(CRA_CURSORED));
[444]1708 if (pci && (INT) pci != -1) {
[551]1709 WinQueryWindowPos(dcd->hwndFrame, &swp);
1710 DefaultViewKeys(hwnd, dcd->hwndFrame, dcd->hwndParent, &swp,
[730]1711 pci->pszFileName);
[194]1712 }
1713 }
1714 break;
[2]1715
[194]1716 case IDM_SEEALL:
[551]1717 StartSeeAll(HWND_DESKTOP, FALSE, NULL);
[194]1718 break;
[2]1719
[194]1720 case IDM_COLLECTSELECT:
1721 {
1722 CHAR filename[CCHMAXPATH], *p, *pp;
[2]1723
[1395]1724 strcpy(filename, PCSZ_STARDOTLST);
[194]1725 size = CCHMAXPATH;
1726 PrfQueryProfileData(fmprof, appname, "SaveToListName",
1727 filename, &size);
1728 pp = strrchr(filename, '\\');
1729 if (!pp)
1730 pp = filename;
1731 p = strrchr(pp, '.');
[444]1732 if (p && *(p + 1) && p > pp + 1) {
[194]1733 if (pp > filename)
1734 pp++;
1735 *pp = '*';
1736 pp++;
1737 if (p > pp)
1738 memmove(pp, p, strlen(p) + 1);
1739 }
[444]1740 if (insert_filename(hwnd, filename, FALSE, FALSE)) {
[1077]1741# ifdef FORTIFY
1742 Fortify_EnterScope();
1743# endif
[551]1744 p = xstrdup(filename, pszSrcFile, __LINE__);
[444]1745 if (p) {
[194]1746 if (!PostMsg(hwnd, UM_COLLECTFROMFILE, MPFROMP(p), MPVOID))
[1077]1747 free(p);
[194]1748 }
[1077]1749# ifdef FORTIFY
1750 DosSleep(1); // Let receiver take ownership
1751 Fortify_LeaveScope();
1752# endif
[194]1753 }
1754 }
1755 break;
[2]1756
[953]1757 case IDM_COLLECTORVIEWSETTINGS:
[551]1758 if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndParent))
[953]1759 PostMsg(dcd->hwndParent, msg, MPFROMLONG(IDM_COLLECTORVIEWSETTINGS), mp2);
[917]1760 else {
1761 WinDlgBox(HWND_DESKTOP,
1762 hwnd,
1763 CfgDlgProc,
1764 FM3ModHandle,
1765 CFG_FRAME,
[953]1766 MPFROMLONG(IDM_COLLECTORVIEWSETTINGS));
[917]1767 }
[194]1768 break;
[2]1769
[194]1770 case IDM_RESELECT:
[551]1771 SelectList(hwnd, FALSE, FALSE, FALSE, NULL, NULL, dcd->lastselection);
[1546]1772 break;
1773
1774 case IDM_WALKDIR:
[1547]1775 case IDM_OPENDIRWINDOW:
1776 case IDM_OPENDIRICON:
1777 case IDM_OPENDIRDETAILS:
1778 case IDM_OPENDIRTREE:
[1546]1779 {
1780 CHAR newpath[CCHMAXPATH];
1781 PCNRITEM pci;
1782
1783 pci = (PCNRITEM) CurrentRecord(hwnd);
1784 if (pci && (INT) pci != -1) {
1785 strcpy(newpath, pci->pszFileName);
1786 MakeValidDir(newpath);
1787 }
1788 else
1789 strcpy(newpath, pFM2SaveDirectory);
[1547]1790 if (*newpath) {
1791 switch (SHORT1FROMMP(mp1)) {
1792 case IDM_WALKDIR:
1793 WinDlgBox(HWND_DESKTOP, dcd->hwndParent, WalkAllDlgProc,
1794 FM3ModHandle, WALK_FRAME, MPFROMP(newpath));
1795 break;
1796 case IDM_OPENDIRWINDOW:
1797 WinSendMsg(hwnd, UM_OPENWINDOWFORME, MPFROMP(newpath), MPVOID);
1798 break;
1799 case IDM_OPENDIRICON:
1800 OpenObject(newpath, PCSZ_ICON, hwnd);
1801 break;
1802 case IDM_OPENDIRDETAILS:
1803 OpenObject(newpath, Details, hwnd);
1804 break;
1805 case IDM_OPENDIRTREE:
1806 OpenObject(newpath, PCSZ_TREE, hwnd);
1807 break;
1808 default:
1809 break;
1810 }
1811 }
[1546]1812 }
[194]1813 break;
[2]1814
[194]1815 case IDM_HELP:
1816 if (hwndHelp)
1817 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
1818 MPFROM2SHORT(HELP_COLLECT, 0),
1819 MPFROMSHORT(HM_RESOURCEID));
1820 break;
[2]1821
[194]1822 case IDM_SORTNONE:
1823 case IDM_SORTSMARTNAME:
1824 case IDM_SORTNAME:
1825 case IDM_SORTFILENAME:
1826 case IDM_SORTSIZE:
1827 case IDM_SORTEASIZE:
1828 case IDM_SORTFIRST:
1829 case IDM_SORTLAST:
1830 case IDM_SORTLWDATE:
1831 case IDM_SORTLADATE:
1832 case IDM_SORTCRDATE:
1833 case IDM_SORTSUBJECT:
[197]1834 savedSortFlags = CollectorsortFlags;
[194]1835 CollectorsortFlags &= (SORT_REVERSE | SORT_DIRSFIRST | SORT_DIRSLAST);
1836 case IDM_SORTDIRSFIRST:
1837 case IDM_SORTDIRSLAST:
1838 case IDM_SORTREVERSE:
[444]1839 switch (SHORT1FROMMP(mp1)) {
[194]1840 case IDM_SORTSUBJECT:
1841 CollectorsortFlags |= SORT_SUBJECT;
1842 break;
1843 case IDM_SORTNONE:
1844 CollectorsortFlags |= SORT_NOSORT;
1845 break;
1846 case IDM_SORTSMARTNAME:
[197]1847 if (~savedSortFlags & SORT_FILENAME)
[194]1848 CollectorsortFlags |= SORT_FILENAME;
1849 break;
1850 case IDM_SORTFILENAME:
1851 CollectorsortFlags |= SORT_FILENAME;
1852 break;
1853 case IDM_SORTSIZE:
1854 CollectorsortFlags |= SORT_SIZE;
1855 break;
1856 case IDM_SORTEASIZE:
1857 CollectorsortFlags |= SORT_EASIZE;
1858 break;
1859 case IDM_SORTFIRST:
1860 CollectorsortFlags |= SORT_FIRSTEXTENSION;
1861 break;
1862 case IDM_SORTLAST:
1863 CollectorsortFlags |= SORT_LASTEXTENSION;
1864 break;
1865 case IDM_SORTLWDATE:
1866 CollectorsortFlags |= SORT_LWDATE;
1867 break;
1868 case IDM_SORTLADATE:
1869 CollectorsortFlags |= SORT_LADATE;
1870 break;
1871 case IDM_SORTCRDATE:
1872 CollectorsortFlags |= SORT_CRDATE;
1873 break;
1874 case IDM_SORTDIRSFIRST:
1875 if (CollectorsortFlags & SORT_DIRSFIRST)
1876 CollectorsortFlags &= (~SORT_DIRSFIRST);
[444]1877 else {
[194]1878 CollectorsortFlags |= SORT_DIRSFIRST;
1879 CollectorsortFlags &= (~SORT_DIRSLAST);
1880 }
1881 break;
1882 case IDM_SORTDIRSLAST:
1883 if (CollectorsortFlags & SORT_DIRSLAST)
1884 CollectorsortFlags &= (~SORT_DIRSLAST);
[444]1885 else {
[194]1886 CollectorsortFlags |= SORT_DIRSLAST;
1887 CollectorsortFlags &= (~SORT_DIRSFIRST);
1888 }
1889 break;
1890 case IDM_SORTREVERSE:
1891 if (CollectorsortFlags & SORT_REVERSE)
1892 CollectorsortFlags &= (~SORT_REVERSE);
1893 else
1894 CollectorsortFlags |= SORT_REVERSE;
1895 break;
1896 }
1897 PrfWriteProfileData(fmprof, appname, "CollectorSort",
1898 &CollectorsortFlags, sizeof(INT));
1899 WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortCollectorCnr), MPVOID);
1900 SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
1901 DIR_SORT), CollectorsortFlags, FALSE);
1902 break;
[2]1903
[194]1904 case IDM_COLLECTFROMCLIP:
1905 {
1906 LISTINFO *li;
[1077]1907# ifdef FORTIFY
1908 Fortify_EnterScope();
1909# endif
[551]1910 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
[444]1911 if (li) {
[551]1912 li->list = ListFromClipboard(hwnd);
1913 if (!li->list || !li->list[0])
[194]1914 FreeListInfo(li);
[444]1915 else {
[551]1916 li->type = IDM_COLLECT;
1917 if (!PostMsg(dcd->hwndObject, UM_COLLECT, MPFROMP(li), MPVOID))
[194]1918 FreeListInfo(li);
1919 }
1920 }
[1077]1921# ifdef FORTIFY
1922 DosSleep(1); // Let receiver take ownership
1923 Fortify_LeaveScope();
1924# endif
[194]1925 }
1926 break;
[2]1927
[194]1928 case IDM_REMOVE:
[551]1929 if (fAutoView && hwndMain)
1930 PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
1931 dcd->suspendview = 1;
1932 RemoveAll(hwnd, &dcd->ullTotalBytes, &dcd->totalfiles);
1933 dcd->suspendview = 0;
1934 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
[194]1935 break;
[2]1936
[194]1937 case IDM_CLEARCNR:
1938 {
1939 PCNRITEM pci;
[2]1940
[194]1941 pci = (PCNRITEM) WinSendMsg(hwnd,
1942 CM_QUERYRECORD,
1943 MPVOID,
[551]1944 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
[444]1945 if (pci && (INT) pci != -1) {
[751]1946 RemoveCnrItems(hwnd, NULL, 0, CMA_FREE | CMA_INVALIDATE);
[551]1947 dcd->ullTotalBytes = dcd->selectedbytes = dcd->selectedfiles =
[750]1948 dcd->totalfiles = 0;
[551]1949 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
[194]1950 }
1951 }
1952 break;
[2]1953
[194]1954 case DID_CANCEL:
[551]1955 if (dcd->amextracted)
1956 dcd->stopflag = 1; // Request cancel
[194]1957 break;
[2]1958
[194]1959 case IDM_COLLECTOR:
[444]1960 if (mp2) {
[194]1961 LISTINFO *li;
[1077]1962# ifdef FORTIFY
1963 Fortify_EnterScope();
1964# endif
[551]1965 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
[444]1966 if (li) {
[551]1967 li->list = mp2;
1968 if (!li->list || !li->list[0])
[194]1969 FreeListInfo(li);
[444]1970 else {
[551]1971 li->type = IDM_COLLECT;
1972 if (!PostMsg(dcd->hwndObject, UM_COLLECT, MPFROMP(li), MPVOID))
[194]1973 FreeListInfo(li);
1974 }
1975 }
1976 else
1977 FreeList(mp2);
[1077]1978# ifdef FORTIFY
1979 DosSleep(1); // Let receiver take ownership
1980 Fortify_LeaveScope();
1981# endif
[194]1982 }
1983 break;
[2]1984
[194]1985 case IDM_UNDELETE:
[1077]1986 {
[194]1987 PCNRITEM pci;
[1077]1988 CHAR path[CCHMAXPATH];
1989 HOBJECT hObject;
1990 HWND hwndDesktop;
[2]1991
[1077]1992 hObject = WinQueryObject("<XWP_TRASHCAN>");
1993 if (hObject != NULLHANDLE && fTrashCan) {
1994 hwndDesktop = WinQueryDesktopWindow((HAB) 0, NULLHANDLE);
[1041]1995 WinSetFocus(HWND_DESKTOP, hwndDesktop);
[1077]1996 WinOpenObject(hObject, 0, TRUE);
[194]1997 }
[1077]1998 else {
1999 pci = (PCNRITEM) CurrentRecord(hwnd);
2000 if (pci && (INT) pci != -1) {
2001 strcpy(path, pci->pszFileName);
2002 MakeValidDir(path);
2003 WinDlgBox(HWND_DESKTOP, hwnd, UndeleteDlgProc, FM3ModHandle,
2004 UNDEL_FRAME, MPFROMP(path));
2005 }
2006 }
[194]2007 }
2008 break;
[2]2009
[194]2010 case IDM_GREP:
[1456]2011 case UM_GREP:
[724]2012 if (dcd->amextracted) {
2013 saymsg(MB_OK | MB_ICONASTERISK,
2014 hwnd,
2015 GetPString(IDS_WARNINGTEXT),
2016 "Collector busy - please try again later");
2017 }
[1394]2018 else {
2019 GREPINFO *GrepInfo;
[1366]2020
[1394]2021 GrepInfo = xmallocz(sizeof(GREPINFO), pszSrcFile, __LINE__);
2022 if (GrepInfo) {
2023 GrepInfo->hwnd = &hwnd;
[1456]2024 if (msg == UM_GREP && mp2)
[1394]2025 GrepInfo->szGrepPath = mp2;
2026 if (WinDlgBox(HWND_DESKTOP, hwnd, GrepDlgProc,
2027 FM3ModHandle, GREP_FRAME, (PVOID) GrepInfo)) {
2028 free(GrepInfo);
2029 dcd->amextracted = TRUE; // Say busy scanning
2030 disable_menuitem(WinWindowFromID
2031 (WinQueryWindow(hwndMain, QW_PARENT), FID_MENU),
2032 IDM_GREP, TRUE);
2033 disable_menuitem(TreeMenu, IDM_GREP, TRUE);
2034 disable_menuitem(DirMenu, IDM_GREP, TRUE);
2035 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2036 }
2037 else
2038 free(GrepInfo);
[194]2039 }
2040 }
2041 break;
[2]2042
[194]2043 case IDM_RESORT:
2044 WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortCollectorCnr), MPVOID);
2045 break;
[2]2046
[194]2047 case IDM_FILTER:
2048 {
2049 BOOL empty = FALSE;
2050 PCNRITEM pci;
2051 CHAR *p;
[2]2052
[551]2053 if (!*dcd->mask.szMask) {
[194]2054 empty = TRUE;
2055 pci = (PCNRITEM) CurrentRecord(hwnd);
[551]2056 if (pci && !(pci->attrFile & FILE_DIRECTORY)) {
[730]2057 p = strrchr(pci->pszFileName, '\\');
[444]2058 if (p) {
[194]2059 p++;
[551]2060 strcpy(dcd->mask.szMask, p);
[194]2061 }
2062 }
2063 }
[551]2064 *(dcd->mask.prompt) = 0;
[2]2065
[194]2066 if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
[551]2067 FM3ModHandle, MSK_FRAME, MPFROMP(&dcd->mask))) {
[197]2068 size = sizeof(MASK);
2069 PrfWriteProfileData(fmprof, appname, "CollectorFilter",
[551]2070 &dcd->mask, size);
2071 dcd->suspendview = 1;
2072 WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask));
2073 dcd->suspendview = 0;
[444]2074 if (fAutoView && hwndMain) {
[194]2075 pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
2076 MPFROMLONG(CMA_FIRST),
2077 MPFROMSHORT(CRA_CURSORED));
2078 if (pci && (INT) pci != -1 &&
[730]2079 (!(driveflags[toupper(*pci->pszFileName) - 'A'] &
[551]2080 DRIVE_SLOW)))
[730]2081 WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName),
[194]2082 MPVOID);
2083 else
2084 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
2085 }
2086 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2087 }
2088 else if (empty)
[551]2089 *dcd->mask.szMask = 0;
[194]2090 SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
[551]2091 DIR_FILTER), &dcd->mask, FALSE);
[194]2092 }
[1077]2093 break;
[2]2094
[958]2095 case IDM_UNHIDEALL:
[1077]2096 WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask));
2097 break;
[958]2098
[194]2099 case IDM_HIDEALL:
2100 if (fAutoView && hwndMain)
2101 PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
[551]2102 dcd->suspendview = 1;
[194]2103 HideAll(hwnd);
[551]2104 dcd->suspendview = 0;
[194]2105 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2106 break;
[2]2107
[194]2108 case IDM_SELECTLIST:
2109 case IDM_SELECTALL:
2110 case IDM_DESELECTALL:
2111 case IDM_SELECTALLFILES:
2112 case IDM_DESELECTALLFILES:
2113 case IDM_SELECTALLDIRS:
2114 case IDM_DESELECTALLDIRS:
2115 case IDM_SELECTMASK:
2116 case IDM_DESELECTMASK:
2117 case IDM_INVERT:
2118 case IDM_SELECTCLIP:
2119 case IDM_DESELECTCLIP:
2120 {
2121 PCNRITEM pci;
[2]2122
[194]2123 pci = (PCNRITEM) CurrentRecord(hwnd);
2124 if ((INT) pci == -1)
2125 pci = NULL;
[444]2126 if (SHORT1FROMMP(mp1) == IDM_HIDEALL) {
2127 if (pci) {
[551]2128 if (!(pci->rc.flRecordAttr & CRA_SELECTED))
2129 pci->rc.flRecordAttr |= CRA_FILTERED;
[194]2130 WinSendMsg(hwnd, CM_INVALIDATERECORD, MPFROMP(&pci),
2131 MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
2132 break;
2133 }
2134 }
[551]2135 PostMsg(dcd->hwndObject, UM_SELECT, mp1, MPFROMP(pci));
[194]2136 }
2137 break;
[2]2138
[194]2139 case IDM_RESCAN:
[551]2140 PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPVOID);
[194]2141 break;
[2]2142
[194]2143 case IDM_SHOWLNAMES:
2144 case IDM_SHOWSUBJECT:
2145 case IDM_SHOWEAS:
2146 case IDM_SHOWSIZE:
2147 case IDM_SHOWICON:
2148 case IDM_SHOWLWDATE:
2149 case IDM_SHOWLWTIME:
2150 case IDM_SHOWLADATE:
2151 case IDM_SHOWLATIME:
2152 case IDM_SHOWCRDATE:
2153 case IDM_SHOWCRTIME:
2154 case IDM_SHOWATTR:
[551]2155 AdjustDetailsSwitches(hwnd, dcd->hwndLastMenu,
[194]2156 SHORT1FROMMP(mp1), NULL,
[1400]2157 PCSZ_COLLECTOR, &dcd->ds, FALSE);
[194]2158 break;
[2]2159
[194]2160 case IDM_ICON:
2161 case IDM_TEXT:
2162 case IDM_DETAILS:
2163 case IDM_NAME:
2164 case IDM_MINIICONS:
2165 case IDM_DETAILSTITLES:
2166 {
2167 CNRINFO cnri;
[2]2168
[194]2169 memset(&cnri, 0, sizeof(CNRINFO));
2170 cnri.cb = sizeof(CNRINFO);
2171 WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
2172 MPFROMLONG(sizeof(CNRINFO)));
[444]2173 switch (SHORT1FROMMP(mp1)) {
[194]2174 case IDM_ICON:
2175 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2176 CV_DETAIL | CV_NAME));
2177 cnri.flWindowAttr |= CV_ICON;
2178 break;
2179 case IDM_NAME:
2180 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2181 CV_DETAIL | CV_NAME));
2182 cnri.flWindowAttr |= CV_NAME;
2183 break;
2184 case IDM_TEXT:
2185 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2186 CV_DETAIL | CV_NAME));
2187 cnri.flWindowAttr |= CV_TEXT;
2188 break;
2189 case IDM_DETAILS:
2190 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
2191 CV_DETAIL | CV_NAME));
2192 cnri.flWindowAttr |= CV_DETAIL;
2193 break;
2194 case IDM_MINIICONS:
2195 if (cnri.flWindowAttr & CV_MINI)
2196 cnri.flWindowAttr &= (~CV_MINI);
2197 else
2198 cnri.flWindowAttr |= CV_MINI;
2199 break;
2200 case IDM_DETAILSTITLES:
2201 if (cnri.flWindowAttr & CA_DETAILSVIEWTITLES)
2202 cnri.flWindowAttr &= (~CA_DETAILSVIEWTITLES);
2203 else
2204 cnri.flWindowAttr |= CA_DETAILSVIEWTITLES;
2205 break;
2206 }
[551]2207 cnri.flWindowAttr &= (~(CA_ORDEREDTARGETEMPH | CA_MIXEDTARGETEMPH));
[194]2208 cnri.flWindowAttr |= CV_FLOW;
[551]2209 dcd->flWindowAttr = cnri.flWindowAttr;
[194]2210 PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
2211 &cnri.flWindowAttr, sizeof(ULONG));
2212 WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
2213 MPFROMLONG(CMA_FLWINDOWATTR));
2214 WinSendMsg(hwnd, CM_INVALIDATERECORD, MPVOID,
2215 MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
2216 SayView(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
[551]2217 DIR_VIEW), dcd->flWindowAttr);
[194]2218 }
2219 break;
[2]2220
[194]2221 case IDM_SAVETOLIST:
2222 WinDlgBox(HWND_DESKTOP, hwnd, SaveListDlgProc, FM3ModHandle,
2223 SAV_FRAME, MPFROMP(&hwnd));
2224 break;
[2]2225
[194]2226 case IDM_SIZES:
2227 {
2228 PCNRITEM pci;
[2]2229
[194]2230 pci = (PCNRITEM) CurrentRecord(hwnd);
2231 if (pci && (INT) pci != -1)
2232 WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, DirSizeProc, FM3ModHandle,
[730]2233 DSZ_FRAME, pci->pszFileName);
[194]2234 }
2235 break;
[2]2236
[194]2237 case IDM_MKDIR:
2238 {
2239 PCNRITEM pci;
[2]2240
[194]2241 pci = (PCNRITEM) CurrentRecord(hwnd);
[551]2242 PMMkDir(dcd->hwndParent, (pci && (INT) pci != -1) ?
[730]2243 pci->pszFileName : NULL, FALSE);
[194]2244 }
2245 break;
[2]2246
[194]2247 case IDM_DOITYOURSELF:
2248 case IDM_UPDATE:
2249 case IDM_COLLECTFROMFILE:
[1547]2250 case IDM_OPENWINDOW:
[194]2251 case IDM_OPENSETTINGS:
2252 case IDM_OPENDEFAULT:
2253 case IDM_OPENICON:
2254 case IDM_OPENDETAILS:
2255 case IDM_OPENTREE:
2256 case IDM_OBJECT:
2257 case IDM_SHADOW:
2258 case IDM_SHADOW2:
2259 case IDM_DELETE:
2260 case IDM_PERMDELETE:
2261 case IDM_PRINT:
2262 case IDM_ATTRS:
2263 case IDM_INFO:
2264 case IDM_COPY:
2265 case IDM_MOVE:
2266 case IDM_WPSCOPY:
2267 case IDM_WPSMOVE:
2268 case IDM_COPYPRESERVE:
2269 case IDM_MOVEPRESERVE:
2270 case IDM_WILDCOPY:
2271 case IDM_WILDMOVE:
2272 case IDM_RENAME:
2273 case IDM_COMPARE:
2274 case IDM_EAS:
2275 case IDM_SUBJECT:
2276 case IDM_VIEW:
2277 case IDM_VIEWTEXT:
2278 case IDM_VIEWBINARY:
2279 case IDM_VIEWARCHIVE:
2280 case IDM_EDIT:
2281 case IDM_EDITTEXT:
2282 case IDM_EDITBINARY:
2283 case IDM_SAVETOCLIP:
[1084]2284 case IDM_SAVETOCLIPFILENAME:
[194]2285 case IDM_APPENDTOCLIP:
[1084]2286 case IDM_APPENDTOCLIPFILENAME:
[194]2287 case IDM_ARCHIVE:
2288 case IDM_ARCHIVEM:
2289 case IDM_EXTRACT:
2290 case IDM_MCIPLAY:
2291 case IDM_UUDECODE:
2292 case IDM_MERGE:
2293 {
2294 LISTINFO *li;
2295 ULONG action = UM_ACTION;
[1077]2296# ifdef FORTIFY
2297 Fortify_EnterScope();
2298# endif
[551]2299 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
[444]2300 if (li) {
[551]2301 li->type = SHORT1FROMMP(mp1);
2302 li->hwnd = hwnd;
2303 li->list = BuildList(hwnd);
2304 if (li->list) {
[444]2305 switch (SHORT1FROMMP(mp1)) {
[194]2306 case IDM_DOITYOURSELF:
[1335]2307 case IDM_APPENDTOCLIP:
2308 case IDM_APPENDTOCLIPFILENAME:
[194]2309 case IDM_SAVETOCLIP:
[1335]2310 case IDM_SAVETOCLIPFILENAME:
[194]2311 case IDM_ARCHIVE:
2312 case IDM_ARCHIVEM:
2313 case IDM_DELETE:
2314 case IDM_PERMDELETE:
2315 case IDM_ATTRS:
2316 case IDM_PRINT:
2317 case IDM_SHADOW:
2318 case IDM_SHADOW2:
2319 case IDM_OBJECT:
2320 case IDM_VIEW:
2321 case IDM_VIEWTEXT:
2322 case IDM_VIEWBINARY:
2323 case IDM_EDIT:
2324 case IDM_EDITTEXT:
2325 case IDM_EDITBINARY:
2326 case IDM_MCIPLAY:
2327 case IDM_UPDATE:
2328 case IDM_INFO:
2329 case IDM_EAS:
2330 action = UM_MASSACTION;
2331 break;
2332 }
[551]2333 if (li->type == IDM_SHADOW || li->type == IDM_OBJECT ||
2334 li->type == IDM_SHADOW2)
2335 *li->targetpath = 0;
2336 if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID)) {
[1400]2337 Runtime_Error(pszSrcFile, __LINE__, PCSZ_POSTMSG);
[194]2338 FreeListInfo(li);
2339 }
2340 else if (fUnHilite)
[672]2341 UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
[194]2342 }
[1077]2343 else
2344 free(li);
[194]2345 }
[1077]2346# ifdef FORTIFY
2347 Fortify_LeaveScope();
2348# endif
[194]2349 }
2350 break;
[2]2351
[194]2352 default:
2353 if (!cmdloaded)
2354 load_commands();
2355 if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
[551]2356 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
[194]2357 INT x;
[2]2358
[1486]2359 x = SHORT1FROMMP(mp1);// - IDM_COMMANDSTART;
[444]2360 if (x >= 0) {
[1486]2361 //x++;
[194]2362 RunCommand(hwnd, x);
2363 if (fUnHilite)
[672]2364 UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
[194]2365 }
2366 }
2367 break;
2368 }
2369 }
2370 return 0;
[2]2371
[194]2372 case UM_FIXCNRMLE:
2373 case UM_FIXEDITNAME:
2374 return CommonCnrProc(hwnd, msg, mp1, mp2);
[2]2375
[194]2376 case UM_FILESMENU:
2377 {
2378 PCNRITEM pci;
[551]2379 HWND menuHwnd = (HWND) 0;
[2]2380
[194]2381 pci = (PCNRITEM) CurrentRecord(hwnd);
[444]2382 if (pci && (INT) pci != -1) {
[551]2383 if (pci->attrFile & FILE_DIRECTORY)
[872]2384 menuHwnd = CheckMenu(hwnd, &CollectorDirMenu, COLLECTORDIR_POPUP);
[194]2385 else
[872]2386 menuHwnd = CheckMenu(hwnd, &CollectorFileMenu, COLLECTORFILE_POPUP);
[2]2387 }
[194]2388 return MRFROMLONG(menuHwnd);
2389 }
[2]2390
[194]2391 case WM_CONTROL:
2392 DosError(FERR_DISABLEHARDERR);
[444]2393 if (dcd) {
2394 switch (SHORT2FROMMP(mp1)) {
[194]2395 case CN_CONTEXTMENU:
2396 {
2397 PCNRITEM pci = (PCNRITEM) mp2;
[2]2398
[444]2399 if (pci) {
[194]2400 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
2401 MPFROM2SHORT(TRUE, CRA_CURSORED));
2402 MarkAll(hwnd, FALSE, FALSE, TRUE);
[551]2403 if (pci->attrFile & FILE_DIRECTORY)
[872]2404 dcd->hwndLastMenu = CheckMenu(hwnd, &CollectorDirMenu,
[551]2405 COLLECTORDIR_POPUP);
[194]2406 else
[872]2407 dcd->hwndLastMenu = CheckMenu(hwnd, &CollectorFileMenu,
[551]2408 COLLECTORFILE_POPUP);
[194]2409 }
[444]2410 else {
[872]2411 dcd->hwndLastMenu = CheckMenu(hwnd, &CollectorCnrMenu,
[551]2412 COLLECTORCNR_POPUP);
2413 if (dcd->hwndLastMenu && !dcd->cnremphasized) {
[194]2414 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
2415 MPFROM2SHORT(TRUE, CRA_SOURCE));
[551]2416 dcd->cnremphasized = TRUE;
[194]2417 }
2418 }
[551]2419 if (dcd->hwndLastMenu) {
2420 if (dcd->hwndLastMenu == CollectorCnrMenu) {
2421 SetViewMenu(dcd->hwndLastMenu, dcd->flWindowAttr);
[1065]2422 SetDetailsSwitches(dcd->hwndLastMenu, &dcd->ds);
[907]2423 CopyPresParams(dcd->hwndLastMenu, hwnd);
[551]2424 if (dcd->flWindowAttr & CV_MINI)
2425 WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE);
2426 disable_menuitem(dcd->hwndLastMenu, DID_CANCEL,
2427 !dcd->amextracted);
2428 disable_menuitem(dcd->hwndLastMenu, IDM_GREP, dcd->amextracted);
[194]2429 }
[551]2430 if (!PopupMenu(hwnd, hwnd, dcd->hwndLastMenu)) {
2431 if (dcd->cnremphasized) {
[194]2432 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
2433 MPFROM2SHORT(FALSE, CRA_SOURCE));
[551]2434 dcd->cnremphasized = TRUE;
[194]2435 }
2436 MarkAll(hwnd, TRUE, FALSE, TRUE);
2437 }
2438 }
2439 }
2440 break;
[2]2441
[194]2442 case CN_DROPHELP:
[444]2443 if (mp2) {
[194]2444 PDRAGINFO pDInfo;
2445 PCNRITEM pci;
2446 ULONG numitems;
2447 USHORT usOperation;
[2]2448
[551]2449 pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
2450 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
[444]2451 if (!DrgAccessDraginfo(pDInfo)) {
[352]2452 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
[1402]2453 PCSZ_DRGACCESSDRAGINFO);
[618]2454 return 0;
[194]2455 }
2456 numitems = DrgQueryDragitemCount(pDInfo);
[551]2457 usOperation = pDInfo->usOperation;
[1394]2458 if (usOperation == DO_DEFAULT)
2459 usOperation = fCopyDefault ? DO_COPY : DO_MOVE;
[618]2460 FreeDragInfoData(hwnd, pDInfo);
[194]2461 saymsg(MB_ENTER | MB_ICONASTERISK,
2462 hwnd,
2463 GetPString(IDS_DROPHELPHDRTEXT),
2464 GetPString(IDS_DROPHELPTEXT),
2465 numitems,
[750]2466 &"s"[numitems == 1],
[194]2467 (pci) ? NullStr : GetPString(IDS_NOTEXT),
2468 (pci) ? NullStr : " ",
[730]2469 (pci) ? pci->pszFileName : NullStr,
[194]2470 (pci) ? " " : NullStr,
2471 GetPString((usOperation == DO_COPY) ?
2472 IDS_COPYTEXT :
2473 (usOperation == DO_LINK) ?
2474 IDS_LINKTEXT : IDS_MOVETEXT));
2475 }
2476 return 0;
[2]2477
[194]2478 case CN_DRAGLEAVE:
[444]2479 if (mp2) {
[194]2480 PDRAGINFO pDInfo;
[2]2481
[618]2482 // fixme to know why needed
[551]2483 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
[618]2484 DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
2485 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
[194]2486 }
2487 return 0;
[2]2488
[194]2489 case CN_DRAGAFTER:
2490 case CN_DRAGOVER:
[444]2491 if (mp2) {
[618]2492 PDRAGITEM pDItem; /* Pointer to DRAGITEM */
2493 PDRAGINFO pDInfo; /* Pointer to DRAGINFO */
[194]2494 PCNRITEM pci;
2495 USHORT uso;
[2]2496
[551]2497 pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
[618]2498 // if(SHORT1FROMMP(mp1) == CN_DRAGAFTER)
2499 // pci = NULL;
[551]2500 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
[618]2501 if (!DrgAccessDraginfo(pDInfo)) {
2502 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
[1402]2503 PCSZ_DRGACCESSDRAGINFO);
[618]2504 return (MRFROM2SHORT(DOR_NODROP, 0)); /* Drop not valid */
2505 }
[444]2506 if (pci) {
[551]2507 if (pci->rc.flRecordAttr & CRA_SOURCE) {
[194]2508 DrgFreeDraginfo(pDInfo);
2509 return (MRFROM2SHORT(DOR_NODROP, 0));
2510 }
[551]2511 uso = pDInfo->usOperation;
[194]2512 if (uso == DO_DEFAULT)
2513 uso = (fCopyDefault) ? DO_COPY : DO_MOVE;
[551]2514 if (!(pci->attrFile & FILE_DIRECTORY)) {
2515 if (uso != DO_LINK && uso != DO_MOVE && uso != DO_COPY) {
[194]2516 DrgFreeDraginfo(pDInfo);
2517 return MRFROM2SHORT(DOR_NODROP, 0);
2518 }
2519 if (uso != DO_LINK &&
[730]2520 !(driveflags[toupper(*pci->pszFileName) - 'A'] &
[551]2521 DRIVE_NOTWRITEABLE)) {
[194]2522 ARC_TYPE *info = NULL;
[2]2523
[194]2524 if (!fQuickArcFind &&
[730]2525 !(driveflags[toupper(*pci->pszFileName) - 'A'] &
[194]2526 DRIVE_SLOW))
[730]2527 info = find_type(pci->pszFileName, NULL);
[194]2528 else
[730]2529 info = quick_find_type(pci->pszFileName, NULL);
[551]2530 if (!info || ((uso == DO_MOVE && !info->move) ||
2531 (uso == DO_COPY && !info->create))) {
[194]2532 DrgFreeDraginfo(pDInfo);
2533 return MRFROM2SHORT(DOR_NODROP, 0);
2534 }
2535 }
2536 }
2537 }
[618]2538 pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */
2539 0); /* Index to DRAGITEM */
[194]2540 if (DrgVerifyRMF(pDItem, /* Check valid rendering */
[1498]2541 (CHAR *) DRM_OS2FILE, /* mechanisms and data */
[551]2542 NULL)) {
[618]2543 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
[444]2544 if (pci) {
[730]2545 if (driveflags[toupper(*pci->pszFileName) - 'A'] &
[194]2546 DRIVE_NOTWRITEABLE)
2547 return MRFROM2SHORT(DOR_DROP, DO_LINK);
[730]2548 if (toupper(*pci->pszFileName) < 'C')
[194]2549 return MRFROM2SHORT(DOR_DROP, DO_COPY);
[618]2550 return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
[551]2551 ((fCopyDefault) ? DO_COPY : DO_MOVE));
[194]2552 }
2553 else
[618]2554 return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
[194]2555 DO_COPY);
2556 }
[618]2557 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
[194]2558 }
[618]2559 return (MRFROM2SHORT(DOR_NODROP, 0)); /* Drop not valid */
[2]2560
[194]2561 case CN_INITDRAG:
[444]2562 if (mp2) {
[194]2563 BOOL wasemphasized = FALSE;
2564 PCNRDRAGINIT pcd = (PCNRDRAGINIT) mp2;
2565 PCNRITEM pci;
[2]2566
[444]2567 if (pcd) {
[551]2568 pci = (PCNRITEM) pcd->pRecord;
[444]2569 if (pci) {
[551]2570 if (pci->rc.flRecordAttr & CRA_SELECTED)
[194]2571 wasemphasized = TRUE;
[730]2572 if (IsRoot(pci->pszFileName))
[194]2573 break;
2574 if (hwndStatus2)
[551]2575 WinSetWindowText(hwndStatus2,
[1498]2576 (CHAR *) GetPString(IDS_DRAGFILEOBJTEXT));
[551]2577 if (DoFileDrag(hwnd, dcd->hwndObject, mp2, NULL, NULL, TRUE)) {
[672]2578 if ((fUnHilite && wasemphasized) || dcd->ulItemsToUnHilite)
2579 UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
[194]2580 }
2581 if (hwndStatus2)
2582 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2583 }
2584 }
2585 }
2586 return 0;
[2]2587
[194]2588 case CN_DROP:
[444]2589 if (mp2) {
[194]2590 LISTINFO *li;
2591 ULONG action = UM_ACTION;
[2]2592
[724]2593 li = DoFileDrop(hwnd, NULL, TRUE, mp1, mp2);
2594 CheckPmDrgLimit(((PCNRDRAGINFO)mp2)->pDragInfo);
[444]2595 if (li) {
[551]2596 if (!*li->targetpath) {
2597 li->type = IDM_COLLECT;
[194]2598 action = UM_COLLECT;
2599 }
[444]2600 else {
[551]2601 if (li->list && li->list[0] && IsRoot(li->list[0]))
2602 li->type = DO_LINK;
2603 else if (fDragndropDlg && (!*li->arcname || !li->info)) {
[194]2604 CHECKLIST cl;
[2]2605
[194]2606 memset(&cl, 0, sizeof(cl));
2607 cl.size = sizeof(cl);
[551]2608 cl.flags = li->type;
2609 cl.list = li->list;
2610 cl.cmd = li->type;
2611 cl.prompt = li->targetpath;
2612 li->type = WinDlgBox(HWND_DESKTOP, dcd->hwndParent,
2613 DropListProc, FM3ModHandle,
[618]2614 DND_FRAME, MPFROMP(&cl));
2615 if (li->type == DID_ERROR)
2616 Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
[1402]2617 GetPString(IDS_DRAGDROPDIALOGTEXT));
[618]2618 if (!li->type) {
[194]2619 FreeListInfo(li);
2620 return 0;
2621 }
[551]2622 li->list = cl.list;
[618]2623 if (!li->list || !li->list[0]) {
[194]2624 FreeListInfo(li);
2625 return 0;
2626 }
2627 }
[551]2628 switch (li->type) {
[194]2629 case DND_LAUNCH:
[551]2630 strcat(li->targetpath, " %a");
2631 ExecOnList(dcd->hwndParent, li->targetpath,
[1497]2632 PROMPT | WINDOWED, NULL, NULL, li->list, NULL,
[907]2633 pszSrcFile, __LINE__);
[551]2634 FreeList(li->list);
2635 li->list = NULL;
[194]2636 break;
2637 case DO_LINK:
[444]2638 if (fLinkSetsIcon) {
[551]2639 li->type = IDM_SETICON;
[194]2640 action = UM_MASSACTION;
2641 }
2642 else
[551]2643 li->type = IDM_COMPARE;
[194]2644 break;
2645 case DND_EXTRACT:
[551]2646 if (*li->targetpath && !IsFile(li->targetpath))
2647 li->type = IDM_EXTRACT;
[194]2648 break;
2649 case DND_MOVE:
[551]2650 li->type = IDM_MOVE;
2651 if (*li->targetpath && IsFile(li->targetpath) == 1) {
[194]2652 action = UM_MASSACTION;
[551]2653 li->type = IDM_ARCHIVEM;
[194]2654 }
2655 break;
2656 case DND_WILDMOVE:
[551]2657 li->type = IDM_WILDMOVE;
2658 if (*li->targetpath && IsFile(li->targetpath) == 1) {
[194]2659 action = UM_MASSACTION;
[551]2660 li->type = IDM_ARCHIVEM;
[194]2661 }
2662 break;
2663 case DND_OBJECT:
[551]2664 li->type = IDM_OBJECT;
[194]2665 action = UM_MASSACTION;
2666 break;
2667 case DND_SHADOW:
[551]2668 li->type = IDM_SHADOW;
[194]2669 action = UM_MASSACTION;
2670 break;
2671 case DND_COMPARE:
[551]2672 li->type = IDM_COMPARE;
[194]2673 break;
2674 case DND_SETICON:
2675 action = UM_MASSACTION;
[551]2676 li->type = IDM_SETICON;
[194]2677 break;
2678 case DND_WILDCOPY:
[551]2679 li->type = IDM_WILDCOPY;
2680 if (*li->targetpath && IsFile(li->targetpath) == 1) {
[194]2681 action = UM_MASSACTION;
[551]2682 li->type = IDM_ARCHIVE;
[194]2683 }
2684 break;
2685 case DND_COPY:
[551]2686 li->type = IDM_COPY;
2687 if (*li->targetpath && IsFile(li->targetpath) == 1) {
[194]2688 action = UM_MASSACTION;
[551]2689 li->type = IDM_ARCHIVE;
[194]2690 }
2691 break;
2692 default:
[551]2693 if (*li->arcname && li->info) {
[194]2694 action = UM_MASSACTION;
[551]2695 li->type =
2696 (li->type ==
2697 DO_MOVE) ? IDM_FAKEEXTRACTM : IDM_FAKEEXTRACT;
[194]2698 }
[551]2699 else if (*li->targetpath && IsFile(li->targetpath) == 1) {
[194]2700 action = UM_MASSACTION;
[551]2701 li->type =
2702 (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
[194]2703 }
2704 else
[551]2705 li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
[194]2706 break;
2707 }
2708 }
[551]2709 if (!li->list || !li->list[0])
[194]2710 FreeListInfo(li);
[551]2711 else if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID))
[194]2712 FreeListInfo(li);
[444]2713 else {
[194]2714 USHORT usop = 0;
[2]2715
[551]2716 switch (li->type) {
[194]2717 case IDM_COPY:
2718 case IDM_WILDCOPY:
2719 usop = DO_COPY;
2720 break;
2721 case IDM_MOVE:
2722 case IDM_WILDMOVE:
2723 case IDM_ARCHIVEM:
2724 usop = DO_MOVE;
2725 break;
2726 }
2727 if (usop)
2728 return MRFROM2SHORT(DOR_DROP, usop);
2729 }
2730 }
2731 }
2732 return 0;
[2]2733
[194]2734 case CN_BEGINEDIT:
2735 case CN_REALLOCPSZ:
2736 case CN_ENDEDIT:
2737 {
2738 MRESULT mre;
[2]2739
[194]2740 mre = CnrDirectEdit(hwnd, msg, mp1, mp2);
2741 if (mre != (MRESULT) - 1)
2742 return mre;
2743 }
2744 break;
[2]2745
[194]2746 case CN_EMPHASIS:
[444]2747 if (mp2) {
[194]2748 PNOTIFYRECORDEMPHASIS pre = mp2;
2749 PCNRITEM pci;
[1397]2750 CHAR s[CCHMAXPATH + 91], tb[81], tf[81], szDate[DATE_BUF_BYTES], *p;
[2]2751
[551]2752 pci = (PCNRITEM) ((pre) ? pre->pRecord : NULL);
[444]2753 if (!pci) {
[194]2754 if (hwndStatus2)
2755 WinSetWindowText(hwndStatus2, NullStr);
[444]2756 if (fMoreButtons) {
[194]2757 WinSetWindowText(hwndName, NullStr);
2758 WinSetWindowText(hwndDate, NullStr);
2759 WinSetWindowText(hwndAttr, NullStr);
2760 }
2761 if (hwndMain)
2762 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
2763 break;
2764 }
[551]2765 if (pre->fEmphasisMask & CRA_SELECTED) {
2766 if (pci->rc.flRecordAttr & CRA_SELECTED) {
2767 dcd->selectedbytes += (pci->cbFile + pci->easize);
2768 dcd->selectedfiles++;
[194]2769 }
[551]2770 else if (dcd->selectedfiles) {
2771 dcd->selectedbytes -= (pci->cbFile + pci->easize);
2772 dcd->selectedfiles--;
[194]2773 }
[551]2774 if (!dcd->suspendview) {
2775 commafmt(tf, sizeof(tf), dcd->selectedfiles);
2776 CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, ' ');
[194]2777 sprintf(s, "%s / %s", tf, tb);
[551]2778 WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
[194]2779 }
2780 }
[551]2781 if (!dcd->suspendview &&
2782 WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame) {
2783 if (pre->fEmphasisMask & CRA_CURSORED) {
2784 if (pci->rc.flRecordAttr & CRA_CURSORED) {
[444]2785 if (fSplitStatus && hwndStatus2) {
[551]2786 if (pci->attrFile & FILE_DIRECTORY)
2787 p = pci->pszFileName;
[444]2788 else {
[730]2789 p = strrchr(pci->pszFileName, '\\');
[444]2790 if (p) {
[194]2791 if (*(p + 1))
2792 p++;
2793 else
[551]2794 p = pci->pszFileName;
[194]2795 }
2796 else
[551]2797 p = pci->pszFileName;
[194]2798 }
[551]2799 CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
[1456]2800 if (!fMoreButtons) {
2801 DateFormat(szDate, pci->date);
[1395]2802 sprintf(s, " %s %s %02u%s%02u%s%02u [%s] %s",
2803 tb, szDate, pci->time.hours, TimeSeparator,
2804 pci->time.minutes, TimeSeparator, pci->time.seconds,
[1456]2805 pci->pszDispAttr, p);
2806 }
[444]2807 else {
[551]2808 if (pci->cbFile + pci->easize > 1024)
2809 CommaFmtULL(tf, sizeof(tf), pci->cbFile + pci->easize,
2810 ' ');
[194]2811 else
2812 *tf = 0;
2813 sprintf(s, GetPString(IDS_STATUSSIZETEXT),
2814 tb,
[551]2815 *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
[194]2816 }
2817 WinSetWindowText(hwndStatus2, s);
2818 }
[444]2819 if (fMoreButtons) {
[1456]2820 WinSetWindowText(hwndName, pci->pszFileName);
2821 DateFormat(szDate, pci->date);
[1395]2822 sprintf(s, "%s %02u%s%02u%s%02u",
2823 szDate, pci->time.hours, TimeSeparator, pci->time.minutes,
2824 TimeSeparator, pci->time.seconds);
[194]2825 WinSetWindowText(hwndDate, s);
[551]2826 WinSetWindowText(hwndAttr, pci->pszDispAttr);
[194]2827 }
2828 }
2829 }
2830 }
[551]2831 if (!dcd->suspendview && hwndMain &&
2832 (pre->fEmphasisMask & CRA_CURSORED) &&
2833 (pci->rc.flRecordAttr & CRA_CURSORED) &&
2834 WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame)
[194]2835 WinSendMsg(hwndMain, UM_LOADFILE,
[551]2836 MPFROMP(((fComments
2837 || (pci->attrFile & FILE_DIRECTORY) ==
[730]2838 0) ? pci->pszFileName : NULL)), MPVOID);
[194]2839 }
2840 break;
[2]2841
[194]2842 case CN_ENTER:
[444]2843 if (mp2) {
[551]2844 PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
[847]2845 FILEFINDBUF3 ffb;
[194]2846 HDIR hDir = HDIR_CREATE;
[750]2847 ULONG nm = 1;
[194]2848 APIRET status = 0;
[2]2849
[194]2850 SetShiftState();
[444]2851 if (pci) {
[551]2852 if (pci->rc.flRecordAttr & CRA_INUSE)
[194]2853 break;
2854 DosError(FERR_DISABLEHARDERR);
[847]2855 status = DosFindFirst(pci->pszFileName, &hDir,
[907]2856 FILE_NORMAL | FILE_DIRECTORY |
[838]2857 FILE_ARCHIVED | FILE_READONLY |
2858 FILE_HIDDEN | FILE_SYSTEM,
[847]2859 &ffb, sizeof(ffb), &nm, FIL_STANDARD);
[194]2860 priority_bumped();
[444]2861 if (!status) {
[194]2862 DosFindClose(hDir);
[444]2863 if (ffb.attrFile & FILE_DIRECTORY) {
[551]2864 if ((shiftstate & (KC_CTRL | KC_ALT)) == (KC_CTRL | KC_ALT))
[194]2865 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SHOWALLFILES, 0),
2866 MPVOID);
2867 else if ((shiftstate & (KC_CTRL | KC_SHIFT)) ==
2868 (KC_CTRL | KC_SHIFT))
[730]2869 OpenObject(pci->pszFileName, Settings, dcd->hwndFrame);
[194]2870 else if (shiftstate & KC_CTRL)
[730]2871 OpenObject(pci->pszFileName, Default, dcd->hwndFrame);
[194]2872 else
[280]2873 OpenDirCnr(HWND_DESKTOP,
[194]2874 hwndMain,
[730]2875 dcd->hwndFrame, FALSE, pci->pszFileName);
[194]2876 }
[444]2877 else {
[194]2878 SWP swp;
[2]2879
[194]2880 WinSendMsg(hwnd,
2881 CM_SETRECORDEMPHASIS,
[551]2882 MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_INUSE));
2883 WinQueryWindowPos(dcd->hwndFrame, &swp);
[194]2884 DefaultViewKeys(hwnd,
[551]2885 dcd->hwndFrame,
[730]2886 dcd->hwndParent, &swp, pci->pszFileName);
[194]2887 WinSendMsg(hwnd,
2888 CM_SETRECORDEMPHASIS,
2889 MPFROMP(pci),
2890 MPFROM2SHORT(FALSE, CRA_INUSE |
2891 ((fUnHilite) ? CRA_SELECTED : 0)));
2892 }
2893 }
2894 else
[751]2895 RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE | CMA_ERASE);
[194]2896 }
2897 }
2898 break;
[2]2899 }
[194]2900 }
2901 return 0;
[2]2902
[194]2903 case UM_LOADFILE:
[444]2904 if (dcd && mp2) {
[2]2905
[1037]2906 HWND hwnd;
2907
2908 if ((INT)mp1 == 5 || (INT)mp1 == 13 || (INT)mp1 == 21)
[1077]2909 hwnd = StartViewer(HWND_DESKTOP, (INT)mp1,
2910 (CHAR *)mp2, dcd->hwndFrame);
[1037]2911 else
[1077]2912 hwnd = StartMLEEditor(dcd->hwndParent,
2913 (INT)mp1, (CHAR *)mp2, dcd->hwndFrame);
[1039]2914 free((CHAR *)mp2);
[1037]2915 return MRFROMLONG(hwnd);
[194]2916 }
2917 return 0;
[2]2918
[194]2919 case UM_CLOSE:
2920 WinDestroyWindow(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
2921 QW_PARENT));
2922 return 0;
[2]2923
[194]2924 case UM_FOLDUP:
[551]2925 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
[194]2926 DosExit(EXIT_PROCESS, 1);
2927 return 0;
[2]2928
[194]2929 case WM_CLOSE:
[444]2930 if (dcd) {
[551]2931 dcd->namecanchange = TRUE;
2932 dcd->stopflag = 1;
2933 if (dcd->amextracted)
2934 return 0; // Can not close yet
[194]2935 }
2936 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
[444]2937 if (dcd) {
[551]2938 if (!dcd->dontclose && ParentIsDesktop(hwnd, dcd->hwndParent))
[194]2939 PostMsg(hwnd, UM_FOLDUP, MPVOID, MPVOID);
[551]2940 if (dcd->hwndObject) {
[942]2941 DosSleep(32); // Allow UM_FOLDUP to process
[551]2942 if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
2943 WinSendMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID);
[2]2944 }
[194]2945 }
2946 else
2947 WinSendMsg(hwnd, UM_CLOSE, MPVOID, MPVOID);
2948 return 0;
[2]2949
[194]2950 case WM_DESTROY:
2951 if (CollectorDirMenu)
2952 WinDestroyWindow(CollectorDirMenu);
2953 if (CollectorFileMenu)
2954 WinDestroyWindow(CollectorFileMenu);
2955 if (CollectorCnrMenu)
2956 WinDestroyWindow(CollectorCnrMenu);
[551]2957 CollectorCnrMenu = CollectorFileMenu = CollectorDirMenu = (HWND) 0;
2958 Collector = (HWND) 0;
[194]2959 EmptyCnr(hwnd);
2960 break;
[2]2961 }
[705]2962 if (dcd && dcd->oldproc){
2963 return dcd->oldproc(hwnd, msg, mp1, mp2);
2964 }
2965 else
2966 return PFNWPCnr(hwnd, msg, mp1, mp2);
[2]2967}
2968
[942]2969MRESULT EXPENTRY CollectorMenuProc(HWND hwnd, ULONG msg, MPARAM mp1,
2970 MPARAM mp2)
2971{
2972 PFNWP oldMenuProc = WinQueryWindowPtr(hwnd, QWL_USER);
[1077]2973 static short sLastMenuitem;
[942]2974
2975 switch (msg) {
2976 case WM_MOUSEMOVE: {
2977 if (fOtherHelp) {
[948]2978 RECTL rectl;
2979 SHORT i, sCurrentMenuitem;
2980 SHORT MenuItems = 5;
2981 SHORT asMenuIDs[5] = {IDM_GREP,
2982 IDM_SEEALL,
2983 IDM_CLEARCNR,
2984 IDM_REMOVE,
2985 0};
[1394]2986 PCSZ szHelpString = NULL;
[942]2987
2988
[948]2989 for (i=0; i<MenuItems; i++) {
2990 sCurrentMenuitem = asMenuIDs[i];
2991 oldMenuProc(hwnd,MM_QUERYITEMRECT,
2992 MPFROM2SHORT(asMenuIDs[i], FALSE),
2993 &rectl);
[942]2994
[948]2995 if (MOUSEMSG(&msg)->x > rectl.xLeft &&
2996 MOUSEMSG(&msg)->x < rectl.xRight &&
2997 MOUSEMSG(&msg)->y > rectl.yBottom &&
2998 MOUSEMSG(&msg)->y < rectl.yTop)
2999 break;
[1077]3000 } // for
[942]3001
3002
[948]3003 switch (sCurrentMenuitem) {
3004 case 0:
3005 break;
3006 case IDM_GREP:
3007 szHelpString = GetPString(IDS_COLMENUSEEKSCANHELP);
3008 break;
3009 case IDM_SEEALL:
3010 szHelpString = GetPString(IDS_COLMENUSEEALLHELP);
3011 break;
3012 case IDM_CLEARCNR:
3013 szHelpString = GetPString(IDS_COLMENUCLEARCNRHELP);
3014 break;
3015 case IDM_REMOVE:
3016 szHelpString = GetPString(IDS_COLMENUREMOVECNRHELP);
3017 break;
3018 default:
3019 break;
3020 }
[942]3021
[948]3022 if (sLastMenuitem != sCurrentMenuitem && szHelpString) {
3023 sLastMenuitem = sCurrentMenuitem;
3024 MakeBubble(hwnd, TRUE, szHelpString);
3025 }
3026 else if (hwndBubble && !sCurrentMenuitem){
3027 sLastMenuitem = sCurrentMenuitem;
3028 WinDestroyWindow(hwndBubble);
3029 }
[942]3030 }
3031 }
3032 }
3033 return oldMenuProc(hwnd, msg, mp1, mp2);
3034}
3035
[194]3036HWND StartCollector(HWND hwndParent, INT flags)
[155]3037{
[551]3038 HWND hwndFrame = (HWND) 0;
[197]3039 HWND hwndClient;
[194]3040 ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
[551]3041 FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_NOBYTEALIGN | FCF_ACCELTABLE;
[194]3042 USHORT id;
3043 DIRCNRDATA *dcd;
[2]3044
[197]3045 static USHORT idinc = 0;
3046
[194]3047 if (ParentIsDesktop(hwndParent, hwndParent))
[2]3048 FrameFlags |= (FCF_TASKLIST | FCF_SHELLPOSITION | FCF_MENU);
[444]3049 if (Collector) {
[2]3050 WinSetWindowPos(WinQueryWindow(WinQueryWindow(Collector,
[194]3051 QW_PARENT),
3052 QW_PARENT),
[551]3053 HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE);
3054 return WinQueryWindow(WinQueryWindow(Collector, QW_PARENT), QW_PARENT);
[2]3055 }
3056 hwndFrame = WinCreateStdWindow(hwndParent,
[194]3057 WS_VISIBLE,
3058 &FrameFlags,
[1498]3059 (CHAR *) WC_COLLECTOR,
[194]3060 NULL,
3061 WS_VISIBLE | fwsAnimate,
[551]3062 FM3ModHandle, COLLECTOR_FRAME, &hwndClient);
[444]3063 if (hwndFrame && hwndClient) {
[2]3064 id = COLLECTOR_FRAME + idinc++;
[194]3065 WinSetWindowUShort(hwndFrame, QWS_ID, id);
[1063]3066# ifdef FORTIFY
3067 Fortify_EnterScope();
[1077]3068# endif
[551]3069 dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__);
[377]3070 if (!dcd) {
[1398]3071 Runtime_Error(pszSrcFile, __LINE__, NULL);
[551]3072 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
3073 hwndFrame = (HWND) 0;
[377]3074 }
3075 else {
[551]3076 dcd->size = sizeof(DIRCNRDATA);
3077 dcd->id = id;
3078 dcd->type = COLLECTOR_FRAME;
3079 dcd->hwndParent = (hwndParent) ? hwndParent : HWND_DESKTOP;
3080 dcd->hwndFrame = hwndFrame;
3081 dcd->hwndClient = hwndClient;
[194]3082 if (flags & 4)
[551]3083 dcd->dontclose = TRUE;
[2]3084 {
[194]3085 PFNWP oldproc;
[2]3086
[551]3087 oldproc = WinSubclassWindow(hwndFrame, (PFNWP) CollectorFrameWndProc);
3088 WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
[2]3089 }
[551]3090 dcd->hwndCnr = WinCreateWindow(hwndClient,
3091 WC_CONTAINER,
3092 NULL,
3093 CCS_AUTOPOSITION | CCS_MINIICONS |
3094 CCS_MINIRECORDCORE | ulCnrType |
3095 WS_VISIBLE,
3096 0,
3097 0,
3098 0,
3099 0,
3100 hwndClient,
3101 HWND_TOP,
3102 (ULONG) COLLECTOR_CNR, NULL, NULL);
3103 if (!dcd->hwndCnr) {
[1395]3104 Win_Error(hwndClient, hwndClient, pszSrcFile, __LINE__,
3105 PCSZ_WINCREATEWINDOW);
[551]3106 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
[1077]3107 free(dcd);
[551]3108 hwndFrame = (HWND) 0;
[377]3109 }
3110 else {
[551]3111 Collector = dcd->hwndCnr;
3112 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
[1498]3113 WinSetWindowText(hwndFrame, (CHAR *) GetPString(IDS_COLLECTORTITLETEXT));
[948]3114 if (FrameFlags & FCF_MENU) {
3115 PFNWP oldmenuproc;
3116 HWND hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
[942]3117
3118 oldmenuproc = WinSubclassWindow(hwndMenu, (PFNWP) CollectorMenuProc);
3119 WinSetWindowPtr(hwndMenu, QWL_USER, (PVOID) oldmenuproc);
[444]3120 if (!fToolbar) {
[948]3121 if (hwndMenu) {
[2]3122
[194]3123 WinSendMsg(hwndMenu,
3124 MM_DELETEITEM,
[551]3125 MPFROM2SHORT(IDM_SEEALL, FALSE), MPVOID);
[194]3126 WinSendMsg(hwndMenu,
3127 MM_DELETEITEM,
[551]3128 MPFROM2SHORT(IDM_GREP, FALSE), MPVOID);
[194]3129 WinSendMsg(hwndMenu,
3130 MM_DELETEITEM,
[551]3131 MPFROM2SHORT(IDM_CLEARCNR, FALSE), MPVOID);
[194]3132 WinSendMsg(hwndMenu,
3133 MM_DELETEITEM,
[551]3134 MPFROM2SHORT(IDM_REMOVE, FALSE), MPVOID);
[194]3135 }
3136 }
3137 }
[551]3138 dcd->oldproc = WinSubclassWindow(dcd->hwndCnr,
3139 (PFNWP) CollectorCnrWndProc);
[194]3140 {
[942]3141 USHORT ids[] = { DIR_TOTALS,
3142 DIR_SELECTED,
3143 DIR_VIEW,
3144 DIR_SORT,
3145 DIR_FILTER,
3146 0
[551]3147 };
[2]3148
[551]3149 CommonCreateTextChildren(dcd->hwndClient,
[593]3150 WC_COLSTATUS, ids);
[194]3151 }
3152 if (FrameFlags & FCF_SHELLPOSITION)
[551]3153 PostMsg(hwndClient, UM_SIZE, MPVOID, MPVOID);
3154 if (!PostMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID))
3155 WinSendMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID);
[2]3156 }
3157 }
[1077]3158# ifdef FORTIFY
3159 DosSleep(1); // Let receiver take ownership
3160 Fortify_LeaveScope();
3161# endif
[2]3162 }
3163 return hwndFrame;
3164}
[793]3165
3166#pragma alloc_text(COLLECTOR,CollectorCnrWndProc,CollectorObjWndProc)
3167#pragma alloc_text(COLLECTOR,CollectorClientWndProc,CollectorTextProc)
3168#pragma alloc_text(COLLECTOR,CollectorFrameWndProc)
3169#pragma alloc_text(STARTUP,StartCollector)
Note: See TracBrowser for help on using the repository browser.