| 1 | 
 | 
|---|
| 2 | /***********************************************************************
 | 
|---|
| 3 | 
 | 
|---|
| 4 |   $Id: seeall.c 1803 2015-05-02 21:56:39Z gyoung $
 | 
|---|
| 5 | 
 | 
|---|
| 6 |   See all matching files
 | 
|---|
| 7 | 
 | 
|---|
| 8 |   Copyright (c) 1993-98 M. Kimes
 | 
|---|
| 9 |   Copyright (c) 2001, 2010 Steven H. Levine
 | 
|---|
| 10 | 
 | 
|---|
| 11 |   16 Oct 02 SHL Handle large partitions
 | 
|---|
| 12 |   25 Nov 03 SHL StartSeeAll: avoid forgetting startpath
 | 
|---|
| 13 |   06 Dec 03 SHL StartSeeAll: correct malloc arg oops
 | 
|---|
| 14 |   23 May 05 SHL Use QWL_USER
 | 
|---|
| 15 |   25 May 05 SHL Use ULONGLONG and CommaFmtULL
 | 
|---|
| 16 |   05 Jun 05 SHL Use QWL_USER
 | 
|---|
| 17 |   06 Jun 05 SHL Drop unused code
 | 
|---|
| 18 |   29 May 06 SHL Comments
 | 
|---|
| 19 |   17 Jul 06 SHL Use Runtime_Error
 | 
|---|
| 20 |   19 Oct 06 SHL Correct . and .. detect
 | 
|---|
| 21 |   03 Nov 06 SHL Renames
 | 
|---|
| 22 |   03 Nov 06 SHL Count thread usage
 | 
|---|
| 23 |   30 Mar 07 GKY Remove GetPString for window class names
 | 
|---|
| 24 |   03 Aug 07 GKY Enlarged and made setable everywhere Findbuf (speeds file loading)
 | 
|---|
| 25 |   06 Aug 07 GKY Reduce DosSleep times (ticket 148)
 | 
|---|
| 26 |   07 Aug 07 SHL Use BldQuotedFullPathName and BldQuotedFileName
 | 
|---|
| 27 |   13 Aug 07 SHL Sync code with other FilesToGet usage
 | 
|---|
| 28 |   13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat
 | 
|---|
| 29 |   14 Aug 07 SHL Revert to DosSleep(0) to speed up inner loops
 | 
|---|
| 30 |   14 Aug 07 SHL Drop afFilesToGet
 | 
|---|
| 31 |   26 Aug 07 GKY DosSleep(1) in loops changed to (0)
 | 
|---|
| 32 |   27 Sep 07 SHL Correct ULONGLONG size formatting
 | 
|---|
| 33 |   30 Dec 07 GKY Use CommaFmtULL
 | 
|---|
| 34 |   30 Dec 07 GKY Use TestFDates for comparing by date
 | 
|---|
| 35 |   15 Feb 08 GKY Prevent trap on scan of drive containing files that exceed maxpath
 | 
|---|
| 36 |   29 Feb 08 GKY Use xfree where appropriate
 | 
|---|
| 37 |   29 Feb 08 GKY Refactor global command line variables to notebook.h
 | 
|---|
| 38 |   20 Jul 08 GKY Add save/append filename to clipboard.
 | 
|---|
| 39 |                 Change menu wording to make these easier to find
 | 
|---|
| 40 |   10 Dec 08 SHL Integrate exception handler support
 | 
|---|
| 41 |   25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis
 | 
|---|
| 42 |   11 Jan 09 GKY Replace font names in the string file with global set at compile in init.c
 | 
|---|
| 43 |   11 Jan 08 GKY Change flag on GetMLEFont to 3 from 11 to give a larger selection of mono spaced fonts
 | 
|---|
| 44 |   07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook.
 | 
|---|
| 45 |   07 Feb 09 GKY Add *DateFormat functions to format dates based on locale
 | 
|---|
| 46 |   07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error
 | 
|---|
| 47 |   08 Mar 09 GKY Renamed commafmt.h i18nutil.h
 | 
|---|
| 48 |   08 Mar 09 GKY Additional strings move to PCSZs in init.c
 | 
|---|
| 49 |   08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used)
 | 
|---|
| 50 |   28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
 | 
|---|
| 51 |   17 Jan 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
 | 
|---|
| 52 |   01 Dec 10 SHL Ensure FindAllThread thread quits fast when requested
 | 
|---|
| 53 |   04 Aug 12 GKY Changes to use Unlock to unlock files if Unlock.exe is in path both from menu/toolbar and as part of
 | 
|---|
| 54 |                 copy, move and delete operations
 | 
|---|
| 55 |   04 Aug 12 GKY Changes to allow copy and move over readonly files with a warning dialog; also added a warning dialog
 | 
|---|
| 56 |                 for delete of readonly files
 | 
|---|
| 57 |   10 Mar 13 GKY Improvrd readonly check on delete to allow cancel and don't ask again options
 | 
|---|
| 58 |                 Added saymsg2 for this purpose
 | 
|---|
| 59 |   09 Feb 14 GKY Modified wipeallf to allow suppression of the readonly warning on delete
 | 
|---|
| 60 |                 of temporary files
 | 
|---|
| 61 |   16 Feb 14 GKY Rework readonly check on delete code so it actually works in a logical way
 | 
|---|
| 62 |                 and so it works with move to trashcan inabled.
 | 
|---|
| 63 |   22 Feb 14 GKY Fix warn readonly yes don't ask to work when recursing directories.
 | 
|---|
| 64 |   02 May 15 GKY Changes to allow a JAVA executable object to be created using "Real object"
 | 
|---|
| 65 |                 menu item on a jar file.
 | 
|---|
| 66 | 
 | 
|---|
| 67 | ***********************************************************************/
 | 
|---|
| 68 | 
 | 
|---|
| 69 | #include <stdlib.h>
 | 
|---|
| 70 | #include <string.h>
 | 
|---|
| 71 | #include <ctype.h>
 | 
|---|
| 72 | // #include <process.h>
 | 
|---|
| 73 | 
 | 
|---|
| 74 | #define INCL_DOS
 | 
|---|
| 75 | #define INCL_DOSERRORS
 | 
|---|
| 76 | #define INCL_WIN
 | 
|---|
| 77 | #define INCL_GPI
 | 
|---|
| 78 | #define INCL_LONGLONG
 | 
|---|
| 79 | 
 | 
|---|
| 80 | #include "fm3dll.h"
 | 
|---|
| 81 | #include "fm3dll2.h"                    // #define's for UM_*, control id's, etc.
 | 
|---|
| 82 | #include "seeall.h"
 | 
|---|
| 83 | #include "mainwnd2.h"                   // Data declaration(s)
 | 
|---|
| 84 | #include "grep.h"                       // Data declaration(s)
 | 
|---|
| 85 | #include "arccnrs.h"                    // Data declaration(s)
 | 
|---|
| 86 | #include "init.h"                       // Data declaration(s)
 | 
|---|
| 87 | #include "worker.h"                     // Data declaration(s)
 | 
|---|
| 88 | #include "newview.h"                    // Data declarations
 | 
|---|
| 89 | #include "fm3dlg.h"
 | 
|---|
| 90 | #include "fm3str.h"
 | 
|---|
| 91 | #include "pathutil.h"                   // BldQuotedFullPathName...
 | 
|---|
| 92 | #include "makelist.h"                   // AddToList
 | 
|---|
| 93 | #include "errutil.h"                    // Dos_Error...
 | 
|---|
| 94 | #include "strutil.h"                    // GetPString
 | 
|---|
| 95 | #include "notebook.h"                   // targetdirectory
 | 
|---|
| 96 | #include "copyf.h"                      // AdjustWildcardName, make_deleteable
 | 
|---|
| 97 | #include "attribs.h"                    // AttrListDlgProc
 | 
|---|
| 98 | #include "chklist.h"                    // CenterOverWindow, CheckListProc
 | 
|---|
| 99 | #include "colors.h"                     // ColorDlgProc
 | 
|---|
| 100 | #include "draglist.h"                   // DragList
 | 
|---|
| 101 | #include "extract.h"                    // ExtractDlgProc
 | 
|---|
| 102 | #include "info.h"                       // FileInfoProc
 | 
|---|
| 103 | #include "valid.h"                      // GetDesktopName, IsNewer, TestFDates
 | 
|---|
| 104 | #include "saveclip.h"                   // ListToClipboardHab, SaveAllListDlgProc
 | 
|---|
| 105 | #include "shadow.h"                     // MakeShadows
 | 
|---|
| 106 | #include "mkdir.h"                      // MassMkdir
 | 
|---|
| 107 | #include "objcnr.h"                     // ObjCnrDlgProc
 | 
|---|
| 108 | #include "codepage.h"                   // PickCodepage
 | 
|---|
| 109 | #include "printer.h"                    // PrintDlgProc, PrintListThread
 | 
|---|
| 110 | #include "rename.h"                     // RenameProc
 | 
|---|
| 111 | #include "uudecode.h"                   // UUD
 | 
|---|
| 112 | #include "walkem.h"                     // WalkCopyDlgProc, WalkMoveDlgProc
 | 
|---|
| 113 | #include "archive.h"                    // ArchiveDlgProc
 | 
|---|
| 114 | #include "common.h"                     // CommonTextProc, DecrThreadUsage, IncrThreadUsage
 | 
|---|
| 115 | #include "defview.h"                    // DefaultViewKeys
 | 
|---|
| 116 | #include "eas.h"                        // DisplayEAsProc
 | 
|---|
| 117 | #include "mainwnd.h"                    // GetNextWindowPos
 | 
|---|
| 118 | #include "filter.h"                     // PickMaskDlgProc
 | 
|---|
| 119 | #include "avl.h"                        // SBoxDlgProc
 | 
|---|
| 120 | #include "collect.h"                    // StartCollector
 | 
|---|
| 121 | #include "subj.h"                       // Subject
 | 
|---|
| 122 | #include "i18nutil.h"                   // commafmt
 | 
|---|
| 123 | #include "literal.h"                    // wildcard
 | 
|---|
| 124 | #include "wrappers.h"                   // xDosFindNext
 | 
|---|
| 125 | #include "misc.h"                       // SetConditionalCascade
 | 
|---|
| 126 | #include "fonts.h"                      // SetMLEFont
 | 
|---|
| 127 | #include "stristr.h"                    // stristr
 | 
|---|
| 128 | #include "systemf.h"                    // runemf2
 | 
|---|
| 129 | #include "fortify.h"
 | 
|---|
| 130 | #include "excputil.h"                   // xbeginthread
 | 
|---|
| 131 | 
 | 
|---|
| 132 | #pragma data_seg(DATA2)
 | 
|---|
| 133 | 
 | 
|---|
| 134 | static PSZ pszSrcFile = __FILE__;
 | 
|---|
| 135 | 
 | 
|---|
| 136 | typedef struct
 | 
|---|
| 137 | {
 | 
|---|
| 138 |   CHAR *fullname, *filename;
 | 
|---|
| 139 |   USHORT attrFile, flags;
 | 
|---|
| 140 |   FDATE date;
 | 
|---|
| 141 |   FTIME time;
 | 
|---|
| 142 |   ULONGLONG cbFile;
 | 
|---|
| 143 |   ULONG CRC;
 | 
|---|
| 144 | }
 | 
|---|
| 145 | ALLFILES;
 | 
|---|
| 146 | 
 | 
|---|
| 147 | #define AF_SELECTED     0x0001
 | 
|---|
| 148 | #define AF_DELETED      0x0002
 | 
|---|
| 149 | #define AF_FILTERED     0x0004
 | 
|---|
| 150 | #define AF_DUPE         0x0008
 | 
|---|
| 151 | #define AF_CRCED        0x0010
 | 
|---|
| 152 | 
 | 
|---|
| 153 | #define AFM_MARK        0
 | 
|---|
| 154 | #define AFM_UNMARK      1
 | 
|---|
| 155 | #define AFM_INVERT      2
 | 
|---|
| 156 | #define AFM_MARKDELETED 3
 | 
|---|
| 157 | #define AFM_FILTER      4
 | 
|---|
| 158 | 
 | 
|---|
| 159 | #define DP_NAMES        0x0001
 | 
|---|
| 160 | #define DP_DATES        0x0002
 | 
|---|
| 161 | #define DP_SIZES        0x0004
 | 
|---|
| 162 | #define DP_CRCS         0x0008
 | 
|---|
| 163 | #define DP_EXTS         0x0010
 | 
|---|
| 164 | 
 | 
|---|
| 165 | #define SEEALLFILECNR_FONT_LCID 15
 | 
|---|
| 166 | 
 | 
|---|
| 167 | #define COLORS_MAX                   8
 | 
|---|
| 168 | 
 | 
|---|
| 169 | #define COLORS_CURSOREDNORMALBACK    0
 | 
|---|
| 170 | #define COLORS_CURSOREDSELECTEDBACK  1
 | 
|---|
| 171 | #define COLORS_NORMALBACK            2
 | 
|---|
| 172 | #define COLORS_SELECTEDBACK          3
 | 
|---|
| 173 | #define COLORS_SELECTEDNORMALFORE    4
 | 
|---|
| 174 | #define COLORS_NORMALFORE            5
 | 
|---|
| 175 | #define COLORS_READONLYFORE          6
 | 
|---|
| 176 | #define COLORS_SYSTEMFORE            7
 | 
|---|
| 177 | 
 | 
|---|
| 178 | static LONG Colors[COLORS_MAX] = { COLR_WHITE, COLR_DARKGRAY, COLR_PALEGRAY,
 | 
|---|
| 179 |   COLR_BLACK, COLR_WHITE, COLR_BLACK,
 | 
|---|
| 180 |   COLR_DARKBLUE, COLR_DARKRED
 | 
|---|
| 181 | };
 | 
|---|
| 182 | 
 | 
|---|
| 183 | typedef int (FNSORT) (const void *, const void *);
 | 
|---|
| 184 | typedef FNSORT *PFNSORT;
 | 
|---|
| 185 | 
 | 
|---|
| 186 | typedef struct
 | 
|---|
| 187 | {
 | 
|---|
| 188 |   USHORT size;
 | 
|---|
| 189 |   USHORT dupeflags;
 | 
|---|
| 190 |   ALLFILES *afhead;
 | 
|---|
| 191 |   ALLFILES **afindex;
 | 
|---|
| 192 |   ULONG afheadcnt;
 | 
|---|
| 193 |   ULONG afalloc;
 | 
|---|
| 194 |   ULONG longest;
 | 
|---|
| 195 |   ULONG longestw;
 | 
|---|
| 196 |   ULONG topfile;
 | 
|---|
| 197 |   ULONG cursored;
 | 
|---|
| 198 |   ULONG selected;
 | 
|---|
| 199 |   ULONGLONG ullSelectedBytes;
 | 
|---|
| 200 |   ULONG afindexcnt;
 | 
|---|
| 201 |   ULONG lastselected;
 | 
|---|
| 202 |   ULONG lastdirection;
 | 
|---|
| 203 |   ULONG multiplier;
 | 
|---|
| 204 |   ULONG lasttime;
 | 
|---|
| 205 |   CHAR stopflag;
 | 
|---|
| 206 |   CHAR abDrvFlags[26];
 | 
|---|
| 207 |   CHAR szCommonName[CCHMAXPATH];
 | 
|---|
| 208 |   CHAR szFindPath[CCHMAXPATH];
 | 
|---|
| 209 |   LONG lMaxAscender;
 | 
|---|
| 210 |   LONG lMaxDescender;
 | 
|---|
| 211 |   LONG lMaxHeight;
 | 
|---|
| 212 |   LONG maxx;
 | 
|---|
| 213 |   LONG horzscroll;
 | 
|---|
| 214 |   BOOL fullnames;
 | 
|---|
| 215 |   BOOL invertsort;
 | 
|---|
| 216 |   BOOL mousecaptured;
 | 
|---|
| 217 |   HMTX hmtxScan;
 | 
|---|
| 218 |   HWND hvscroll;
 | 
|---|
| 219 |   HWND hhscroll;
 | 
|---|
| 220 |   HWND hwndMenu;
 | 
|---|
| 221 |   HWND hwndObj;
 | 
|---|
| 222 |   HWND hwndClient;
 | 
|---|
| 223 |   HWND hwndPopup;
 | 
|---|
| 224 |   HWND hwndStatus;
 | 
|---|
| 225 |   HWND hwndFrame;
 | 
|---|
| 226 |   HPS hps;
 | 
|---|
| 227 |   PFNSORT pfnCompare;
 | 
|---|
| 228 |   MASK mask;
 | 
|---|
| 229 |   FATTRS fattrs;
 | 
|---|
| 230 |   LONG aulColors[8];
 | 
|---|
| 231 |   BOOL killme;
 | 
|---|
| 232 | }
 | 
|---|
| 233 | ALLDATA;
 | 
|---|
| 234 | 
 | 
|---|
| 235 | static BOOL Fullnames = FALSE;
 | 
|---|
| 236 | static BOOL Firsttime = TRUE;
 | 
|---|
| 237 | static BOOL SortReverse;
 | 
|---|
| 238 | static USHORT Codepage, SortType;
 | 
|---|
| 239 | static FATTRS Fattrs;
 | 
|---|
| 240 | 
 | 
|---|
| 241 | extern LONG CRCFile(CHAR * filename, INT * error);
 | 
|---|
| 242 | 
 | 
|---|
| 243 | MRESULT EXPENTRY DupeDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| 244 | {
 | 
|---|
| 245 |   switch (msg) {
 | 
|---|
| 246 |   case WM_INITDLG:
 | 
|---|
| 247 |     {
 | 
|---|
| 248 |       USHORT flags = SHORT1FROMMP(mp2);
 | 
|---|
| 249 | 
 | 
|---|
| 250 |       WinCheckButton(hwnd, DUPE_NAMES, ((flags & DP_NAMES) != 0));
 | 
|---|
| 251 |       WinCheckButton(hwnd, DUPE_DATES, ((flags & DP_NAMES) != 0));
 | 
|---|
| 252 |       WinCheckButton(hwnd, DUPE_SIZES, ((flags & DP_NAMES) != 0));
 | 
|---|
| 253 |       WinCheckButton(hwnd, DUPE_CRCS, ((flags & DP_NAMES) != 0));
 | 
|---|
| 254 |       if (!(flags & DP_NAMES))
 | 
|---|
| 255 |         WinEnableWindow(WinWindowFromID(hwnd, DUPE_EXTS), FALSE);
 | 
|---|
| 256 |     }
 | 
|---|
| 257 |     break;
 | 
|---|
| 258 | 
 | 
|---|
| 259 |   case WM_CONTROL:
 | 
|---|
| 260 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 261 |     case DUPE_NAMES:
 | 
|---|
| 262 |       if (WinQueryButtonCheckstate(hwnd, DUPE_NAMES))
 | 
|---|
| 263 |         WinEnableWindow(WinWindowFromID(hwnd, DUPE_EXTS), TRUE);
 | 
|---|
| 264 |       else {
 | 
|---|
| 265 |         WinCheckButton(hwnd, DUPE_EXTS, FALSE);
 | 
|---|
| 266 |         WinEnableWindow(WinWindowFromID(hwnd, DUPE_EXTS), FALSE);
 | 
|---|
| 267 |       }
 | 
|---|
| 268 |       break;
 | 
|---|
| 269 |     case DUPE_SIZES:
 | 
|---|
| 270 |       if (!WinQueryButtonCheckstate(hwnd, DUPE_SIZES))
 | 
|---|
| 271 |         WinCheckButton(hwnd, DUPE_CRCS, FALSE);
 | 
|---|
| 272 |       break;
 | 
|---|
| 273 |     case DUPE_CRCS:
 | 
|---|
| 274 |       if (WinQueryButtonCheckstate(hwnd, DUPE_CRCS))
 | 
|---|
| 275 |         WinCheckButton(hwnd, DUPE_SIZES, TRUE);
 | 
|---|
| 276 |       break;
 | 
|---|
| 277 |     }
 | 
|---|
| 278 |     return 0;
 | 
|---|
| 279 | 
 | 
|---|
| 280 |   case WM_COMMAND:
 | 
|---|
| 281 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 282 |     case DID_OK:
 | 
|---|
| 283 |       {
 | 
|---|
| 284 |         USHORT flags = 0;
 | 
|---|
| 285 | 
 | 
|---|
| 286 |         if (WinQueryButtonCheckstate(hwnd, DUPE_NAMES)) {
 | 
|---|
| 287 |           flags |= DP_NAMES;
 | 
|---|
| 288 |           if (WinQueryButtonCheckstate(hwnd, DUPE_EXTS))
 | 
|---|
| 289 |             flags |= DP_EXTS;
 | 
|---|
| 290 |         }
 | 
|---|
| 291 |         if (WinQueryButtonCheckstate(hwnd, DUPE_DATES))
 | 
|---|
| 292 |           flags |= DP_DATES;
 | 
|---|
| 293 |         if (WinQueryButtonCheckstate(hwnd, DUPE_SIZES)) {
 | 
|---|
| 294 |           flags |= DP_SIZES;
 | 
|---|
| 295 |           if (WinQueryButtonCheckstate(hwnd, DUPE_CRCS))
 | 
|---|
| 296 |             flags |= (DP_CRCS | DP_SIZES);
 | 
|---|
| 297 |         }
 | 
|---|
| 298 |         if (!flags)
 | 
|---|
| 299 |           saymsg(MB_ENTER,
 | 
|---|
| 300 |                  hwnd,
 | 
|---|
| 301 |                  GetPString(IDS_ERRORTEXT),
 | 
|---|
| 302 |                  GetPString(IDS_CHECKONETEXT));
 | 
|---|
| 303 |         else
 | 
|---|
| 304 |           WinDismissDlg(hwnd, flags);
 | 
|---|
| 305 |       }
 | 
|---|
| 306 |       break;
 | 
|---|
| 307 | 
 | 
|---|
| 308 |     case DID_CANCEL:
 | 
|---|
| 309 |       WinDismissDlg(hwnd, 0);
 | 
|---|
| 310 |       break;
 | 
|---|
| 311 | 
 | 
|---|
| 312 |     case IDM_HELP:
 | 
|---|
| 313 |       if (hwndHelp)
 | 
|---|
| 314 |         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
 | 
|---|
| 315 |                    MPFROM2SHORT(HELP_DUPES, 0), MPFROMSHORT(HM_RESOURCEID));
 | 
|---|
| 316 |       break;
 | 
|---|
| 317 |     }
 | 
|---|
| 318 |     return 0;
 | 
|---|
| 319 |   }
 | 
|---|
| 320 |   return WinDefDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| 321 | }
 | 
|---|
| 322 | 
 | 
|---|
| 323 | static ULONG NumLines(RECTL * rcl, ALLDATA * ad)
 | 
|---|
| 324 | {
 | 
|---|
| 325 |   ULONG numlines;
 | 
|---|
| 326 | 
 | 
|---|
| 327 |   numlines = (rcl->yTop - rcl->yBottom) / ad->lMaxHeight;
 | 
|---|
| 328 |   if (ad->lMaxDescender && numlines &&
 | 
|---|
| 329 |       ((rcl->yTop - rcl->yBottom) -
 | 
|---|
| 330 |        (numlines * ad->lMaxHeight) <= ad->lMaxDescender))
 | 
|---|
| 331 |     numlines--;
 | 
|---|
| 332 |   return numlines;
 | 
|---|
| 333 | }
 | 
|---|
| 334 | 
 | 
|---|
| 335 | MRESULT EXPENTRY SeeObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| 336 | {
 | 
|---|
| 337 |   switch (msg) {
 | 
|---|
| 338 |   case UM_MASSACTION:
 | 
|---|
| 339 |     {
 | 
|---|
| 340 |       CHAR **files = NULL, **list = (CHAR **) mp2, path[CCHMAXPATH];
 | 
|---|
| 341 |       UINT numfiles = 0, numalloc = 0;
 | 
|---|
| 342 |       INT plen = 0;
 | 
|---|
| 343 |       HWND hwndFrame = WinQueryWindowULong(hwnd, QWL_USER);
 | 
|---|
| 344 |       CHAR message[CCHMAXPATH * 2], wildname[CCHMAXPATH];
 | 
|---|
| 345 |       register INT x;
 | 
|---|
| 346 |       register CHAR *p, *pp;
 | 
|---|
| 347 |       BOOL dontask = FALSE, wildcarding = FALSE,
 | 
|---|
| 348 |         overold = FALSE, overnew = FALSE;
 | 
|---|
| 349 | 
 | 
|---|
| 350 |       if (!list || !list[0])
 | 
|---|
| 351 |         goto Abort;
 | 
|---|
| 352 |       *path = *wildname = 0;
 | 
|---|
| 353 | 
 | 
|---|
| 354 |       switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 355 |       case IDM_MOVEPRESERVE:
 | 
|---|
| 356 |         {
 | 
|---|
| 357 |           CHAR preserve[CCHMAXPATH], *end;
 | 
|---|
| 358 | 
 | 
|---|
| 359 |           mp1 = MPFROM2SHORT(IDM_MOVE, SHORT2FROMMP(mp1));
 | 
|---|
| 360 |           strcpy(preserve, list[0] + 2);
 | 
|---|
| 361 |           end = strrchr(preserve, '\\');
 | 
|---|
| 362 |           if (end) {
 | 
|---|
| 363 |             end++;
 | 
|---|
| 364 |             for (x = 1; list[x]; x++) {
 | 
|---|
| 365 |               p = preserve;
 | 
|---|
| 366 |               pp = list[x] + 2;
 | 
|---|
| 367 |               while (p < end && toupper(*p) == toupper(*pp)) {
 | 
|---|
| 368 |                 p++;
 | 
|---|
| 369 |                 pp++;
 | 
|---|
| 370 |               }
 | 
|---|
| 371 |               if (*p == '\\')
 | 
|---|
| 372 |                 p++;
 | 
|---|
| 373 |               if (p < end)
 | 
|---|
| 374 |                 end = p;
 | 
|---|
| 375 |             }
 | 
|---|
| 376 |             *end = 0;
 | 
|---|
| 377 |           }
 | 
|---|
| 378 |           else
 | 
|---|
| 379 |             *preserve = 0;
 | 
|---|
| 380 |           plen = strlen(preserve);
 | 
|---|
| 381 |           if (plen)
 | 
|---|
| 382 |             plen += 2;
 | 
|---|
| 383 |         }
 | 
|---|
| 384 |         break;
 | 
|---|
| 385 |       case IDM_COPYPRESERVE:
 | 
|---|
| 386 |         {
 | 
|---|
| 387 |           CHAR preserve[CCHMAXPATH], *end;
 | 
|---|
| 388 | 
 | 
|---|
| 389 |           mp1 = MPFROM2SHORT(IDM_COPY, SHORT2FROMMP(mp1));
 | 
|---|
| 390 |           strcpy(preserve, list[0] + 2);
 | 
|---|
| 391 |           end = strrchr(preserve, '\\');
 | 
|---|
| 392 |           if (end) {
 | 
|---|
| 393 |             end++;
 | 
|---|
| 394 |             for (x = 1; list[x]; x++) {
 | 
|---|
| 395 |               p = preserve;
 | 
|---|
| 396 |               pp = list[x] + 2;
 | 
|---|
| 397 |               while (p < end && toupper(*p) == toupper(*pp)) {
 | 
|---|
| 398 |                 p++;
 | 
|---|
| 399 |                 pp++;
 | 
|---|
| 400 |               }
 | 
|---|
| 401 |               if (*p == '\\')
 | 
|---|
| 402 |                 p++;
 | 
|---|
| 403 |               if (p < end)
 | 
|---|
| 404 |                 end = p;
 | 
|---|
| 405 |             }
 | 
|---|
| 406 |             *end = 0;
 | 
|---|
| 407 |           }
 | 
|---|
| 408 |           else
 | 
|---|
| 409 |             *preserve = 0;
 | 
|---|
| 410 |           plen = strlen(preserve);
 | 
|---|
| 411 |           if (plen)
 | 
|---|
| 412 |             plen += 2;
 | 
|---|
| 413 |         }
 | 
|---|
| 414 |         break;
 | 
|---|
| 415 |       case IDM_WILDMOVE:
 | 
|---|
| 416 |         wildcarding = TRUE;
 | 
|---|
| 417 |         mp1 = MPFROM2SHORT(IDM_MOVE, SHORT2FROMMP(mp1));
 | 
|---|
| 418 |         break;
 | 
|---|
| 419 |       case IDM_WILDRENAME:
 | 
|---|
| 420 |         wildcarding = TRUE;
 | 
|---|
| 421 |         mp1 = MPFROM2SHORT(IDM_RENAME, SHORT2FROMMP(mp1));
 | 
|---|
| 422 |         break;
 | 
|---|
| 423 |       case IDM_WILDCOPY:
 | 
|---|
| 424 |         wildcarding = TRUE;
 | 
|---|
| 425 |         mp1 = MPFROM2SHORT(IDM_COPY, SHORT2FROMMP(mp1));
 | 
|---|
| 426 |         break;
 | 
|---|
| 427 |       }
 | 
|---|
| 428 | 
 | 
|---|
| 429 |       switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 430 |       case IDM_OBJECT:
 | 
|---|
| 431 |       case IDM_SHADOW:
 | 
|---|
| 432 |         {
 | 
|---|
| 433 |           APIRET rc;
 | 
|---|
| 434 | 
 | 
|---|
| 435 |           GetDesktopName(path, sizeof(path));
 | 
|---|
| 436 |           rc = WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 437 |                          hwndFrame,
 | 
|---|
| 438 |                          ObjCnrDlgProc,
 | 
|---|
| 439 |                          FM3ModHandle, OBJCNR_FRAME, MPFROMP(path));
 | 
|---|
| 440 |           if (rc) {
 | 
|---|
| 441 |             if (rc > 1)
 | 
|---|
| 442 |               strcpy(path, "<WP_DESKTOP>");
 | 
|---|
| 443 |           }
 | 
|---|
| 444 |           else {
 | 
|---|
| 445 |             FreeList(list);
 | 
|---|
| 446 |             break;
 | 
|---|
| 447 |           }
 | 
|---|
| 448 |           MakeShadows(hwndFrame,
 | 
|---|
| 449 |                       list, (SHORT1FROMMP(mp1) == IDM_SHADOW), path, NULL);
 | 
|---|
| 450 |         }
 | 
|---|
| 451 |         FreeList(list);
 | 
|---|
| 452 |         break;
 | 
|---|
| 453 | 
 | 
|---|
| 454 |       case IDM_PRINT:
 | 
|---|
| 455 |         {
 | 
|---|
| 456 |           LISTINFO *li;
 | 
|---|
| 457 | #         ifdef FORTIFY
 | 
|---|
| 458 |           Fortify_EnterScope();
 | 
|---|
| 459 | #          endif
 | 
|---|
| 460 |           li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
 | 
|---|
| 461 |           if (li) {
 | 
|---|
| 462 |             li->hwndS = WinWindowFromID(hwndFrame, FID_CLIENT);
 | 
|---|
| 463 |             li->type = IDM_PRINT;
 | 
|---|
| 464 |             li->list = list;
 | 
|---|
| 465 |             if (WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 466 |                           li->hwndS,
 | 
|---|
| 467 |                           PrintDlgProc,
 | 
|---|
| 468 |                           FM3ModHandle, PRN_FRAME, MPFROMP(li))) {
 | 
|---|
| 469 |               if (li && li->list && li->list[0]) {
 | 
|---|
| 470 |                 strcpy(li->targetpath, printer);
 | 
|---|
| 471 |                 if (xbeginthread(PrintListThread,
 | 
|---|
| 472 |                                  65536,
 | 
|---|
| 473 |                                  li,
 | 
|---|
| 474 |                                  pszSrcFile,
 | 
|---|
| 475 |                                  __LINE__) == -1)
 | 
|---|
| 476 |                 {
 | 
|---|
| 477 |                   FreeListInfo(li);
 | 
|---|
| 478 |                 }
 | 
|---|
| 479 |               }
 | 
|---|
| 480 |             }
 | 
|---|
| 481 |           }
 | 
|---|
| 482 |         }
 | 
|---|
| 483 |         break;
 | 
|---|
| 484 | 
 | 
|---|
| 485 |       case IDM_EAS:
 | 
|---|
| 486 |         if (WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 487 |                       hwndFrame,
 | 
|---|
| 488 |                       DisplayEAsProc, FM3ModHandle, EA_FRAME, (PVOID) list)) {
 | 
|---|
| 489 |           if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT),
 | 
|---|
| 490 |                        UM_UPDATERECORDLIST, MPFROMP(list), MPVOID))
 | 
|---|
| 491 |             FreeList(list);
 | 
|---|
| 492 |         }
 | 
|---|
| 493 |         else
 | 
|---|
| 494 |           FreeList(list);
 | 
|---|
| 495 |         break;
 | 
|---|
| 496 | 
 | 
|---|
| 497 |       case IDM_INFO:
 | 
|---|
| 498 |         if (WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 499 |                       hwndFrame,
 | 
|---|
| 500 |                       FileInfoProc,
 | 
|---|
| 501 |                       FM3ModHandle, FLE_FRAME, (PVOID) list) == 2) {
 | 
|---|
| 502 |           if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT),
 | 
|---|
| 503 |                        UM_UPDATERECORDLIST, MPFROMP(list), MPVOID))
 | 
|---|
| 504 |             FreeList(list);
 | 
|---|
| 505 |         }
 | 
|---|
| 506 |         else
 | 
|---|
| 507 |           FreeList(list);
 | 
|---|
| 508 |         break;
 | 
|---|
| 509 | 
 | 
|---|
| 510 |       case IDM_ARCHIVE:
 | 
|---|
| 511 |         {
 | 
|---|
| 512 |           DIRCNRDATA ad;
 | 
|---|
| 513 |           CHAR szBuffer[1025];
 | 
|---|
| 514 | 
 | 
|---|
| 515 |           memset(&ad, 0, sizeof(ad));
 | 
|---|
| 516 |           ad.namecanchange = 1;
 | 
|---|
| 517 |           ad.info = arcsighead;         // Hide dups
 | 
|---|
| 518 |           if (!WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 519 |                          hwndFrame,
 | 
|---|
| 520 |                          SBoxDlgProc,
 | 
|---|
| 521 |                          FM3ModHandle,
 | 
|---|
| 522 |                          ASEL_FRAME, (PVOID) & ad.info) || !ad.info) {
 | 
|---|
| 523 |             // we blew it
 | 
|---|
| 524 |             FreeList(list);
 | 
|---|
| 525 |             break;
 | 
|---|
| 526 |           }
 | 
|---|
| 527 |           if (!ad.info->create &&
 | 
|---|
| 528 |               !ad.info->move &&
 | 
|---|
| 529 |               !ad.info->createwdirs &&
 | 
|---|
| 530 |               !ad.info->movewdirs && !ad.info->createrecurse) {
 | 
|---|
| 531 |             // 14 Aug 07 SHL fixme to tell user why we failed
 | 
|---|
| 532 |             FreeList(list);
 | 
|---|
| 533 |             break;
 | 
|---|
| 534 |           }
 | 
|---|
| 535 |           if (!WinDlgBox(HWND_DESKTOP, hwndFrame, ArchiveDlgProc, FM3ModHandle, ARCH_FRAME, (PVOID) & ad) ||
 | 
|---|
| 536 |               !*ad.arcname || !*ad.command) {    // we blew it
 | 
|---|
| 537 |             FreeList(list);
 | 
|---|
| 538 |             break;
 | 
|---|
| 539 |           }
 | 
|---|
| 540 |           // Build archiver command line
 | 
|---|
| 541 |           strcpy(szBuffer, ad.command);
 | 
|---|
| 542 |           strcat(szBuffer, " ");
 | 
|---|
| 543 |           strcat(szBuffer, ad.arcname);
 | 
|---|
| 544 |           p = &szBuffer[strlen(szBuffer)];
 | 
|---|
| 545 |           if (ad.mask.szMask) {
 | 
|---|
| 546 |             strcat(szBuffer, " ");
 | 
|---|
| 547 |             strcat(szBuffer, ad.mask.szMask);
 | 
|---|
| 548 |           }
 | 
|---|
| 549 |           strcat(szBuffer, " ");
 | 
|---|
| 550 |           x = 0;
 | 
|---|
| 551 |           while (list[x]) {
 | 
|---|
| 552 |             FILESTATUS3 fsa;
 | 
|---|
| 553 |             memset(&fsa, 0, sizeof(fsa));
 | 
|---|
| 554 |             DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 555 |             DosQueryPathInfo(list[x], FIL_STANDARD, &fsa, sizeof(fsa));
 | 
|---|
| 556 |             if (fsa.attrFile & FILE_DIRECTORY) {
 | 
|---|
| 557 |               BldQuotedFullPathName(szBuffer + strlen(szBuffer),
 | 
|---|
| 558 |                                     list[x], "*");
 | 
|---|
| 559 |             }
 | 
|---|
| 560 |             else
 | 
|---|
| 561 |               BldQuotedFileName(szBuffer + strlen(szBuffer), list[x]);
 | 
|---|
| 562 |             x++;
 | 
|---|
| 563 |             if (!list[x] || strlen(szBuffer) + strlen(list[x]) + 5 > 1024) {
 | 
|---|
| 564 |               runemf2(SEPARATE | WINDOWED | WAIT |
 | 
|---|
| 565 |                       (fArcStuffVisible ? 0 : (BACKGROUND | MINIMIZED)),
 | 
|---|
| 566 |                       HWND_DESKTOP, pszSrcFile, __LINE__,
 | 
|---|
| 567 |                       NULL, NULL, "%s", szBuffer);
 | 
|---|
| 568 |               DosSleep(1);              // Let archiver get started
 | 
|---|
| 569 |               *p = 0;
 | 
|---|
| 570 |             }
 | 
|---|
| 571 |             strcat(szBuffer, " ");
 | 
|---|
| 572 |           } // while
 | 
|---|
| 573 |           AddToList(ad.arcname, &files, &numfiles, &numalloc);
 | 
|---|
| 574 |         }
 | 
|---|
| 575 |         if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT),
 | 
|---|
| 576 |                      UM_UPDATERECORDLIST, MPFROMP(list), MPVOID))
 | 
|---|
| 577 |           FreeList(list);
 | 
|---|
| 578 |         break;
 | 
|---|
| 579 | 
 | 
|---|
| 580 |       case IDM_ATTRS:
 | 
|---|
| 581 |         {
 | 
|---|
| 582 |           LISTINFO li;
 | 
|---|
| 583 | 
 | 
|---|
| 584 |           memset(&li, 0, sizeof(li));
 | 
|---|
| 585 |           li.list = list;
 | 
|---|
| 586 |           if (WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 587 |                         hwndFrame,
 | 
|---|
| 588 |                         AttrListDlgProc,
 | 
|---|
| 589 |                         FM3ModHandle, ATR_FRAME, MPFROMP(&li))) {
 | 
|---|
| 590 |             if (li.list && li.list[0]) {
 | 
|---|
| 591 |               if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT),
 | 
|---|
| 592 |                            UM_UPDATERECORDLIST, MPFROMP(li.list), MPVOID))
 | 
|---|
| 593 |                 FreeList(li.list);
 | 
|---|
| 594 |             }
 | 
|---|
| 595 |           }
 | 
|---|
| 596 |           else
 | 
|---|
| 597 |             FreeList(list);
 | 
|---|
| 598 |         }
 | 
|---|
| 599 |         break;
 | 
|---|
| 600 | 
 | 
|---|
| 601 |       case IDM_MOVE:
 | 
|---|
| 602 |       case IDM_COPY:
 | 
|---|
| 603 |         if (!*path)
 | 
|---|
| 604 |           strcpy(path, targetdir);
 | 
|---|
| 605 |         if (!*path)
 | 
|---|
| 606 |           strcpy(path, list[0]);
 | 
|---|
| 607 |         MakeValidDir(path);
 | 
|---|
| 608 |       RetryPath:
 | 
|---|
| 609 |         if (SHORT1FROMMP(mp1) == IDM_MOVE) {
 | 
|---|
| 610 |           if (!WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 611 |                          hwndFrame,
 | 
|---|
| 612 |                          WalkMoveDlgProc,
 | 
|---|
| 613 |                          FM3ModHandle, WALK_FRAME, MPFROMP(path)) || !*path) {
 | 
|---|
| 614 |             FreeList(list);
 | 
|---|
| 615 |             goto Abort;
 | 
|---|
| 616 |           }
 | 
|---|
| 617 |         }
 | 
|---|
| 618 |         else {
 | 
|---|
| 619 |           if (!WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 620 |                          hwndFrame,
 | 
|---|
| 621 |                          WalkCopyDlgProc,
 | 
|---|
| 622 |                          FM3ModHandle, WALK_FRAME, MPFROMP(path)) || !*path) {
 | 
|---|
| 623 |             FreeList(list);
 | 
|---|
| 624 |             goto Abort;
 | 
|---|
| 625 |           }
 | 
|---|
| 626 |         }
 | 
|---|
| 627 |         if (driveflags[toupper(*path) - 'A'] & DRIVE_NOTWRITEABLE) {
 | 
|---|
| 628 |           saymsg(MB_CANCEL,
 | 
|---|
| 629 |                  hwndFrame,
 | 
|---|
| 630 |                  GetPString(IDS_ERRORTEXT),
 | 
|---|
| 631 |                  GetPString(IDS_NOTWRITENOTARGETTEXT));
 | 
|---|
| 632 |           goto RetryPath;
 | 
|---|
| 633 |         }
 | 
|---|
| 634 |         // intentional fallthru
 | 
|---|
| 635 |       case IDM_RENAME:
 | 
|---|
| 636 |         {
 | 
|---|
| 637 |           CHAR newname[CCHMAXPATH];
 | 
|---|
| 638 |           PCSZ moving, move, moved;
 | 
|---|
| 639 |           APIRET rc;
 | 
|---|
| 640 |           INT type;
 | 
|---|
| 641 |           FILESTATUS4L fs4;
 | 
|---|
| 642 |           BOOL isnewer, existed, fResetVerify = FALSE;
 | 
|---|
| 643 | 
 | 
|---|
| 644 |           for (x = 0; list[x]; x++) {
 | 
|---|
| 645 |           Retry:
 | 
|---|
| 646 |             type = (SHORT1FROMMP(mp1) == IDM_RENAME) ? MOVE :
 | 
|---|
| 647 |               (SHORT1FROMMP(mp1) == IDM_MOVE) ? MOVE :
 | 
|---|
| 648 |               (SHORT1FROMMP(mp1) == IDM_WPSMOVE) ? WPSMOVE :
 | 
|---|
| 649 |               (SHORT1FROMMP(mp1) == IDM_WPSCOPY) ? WPSCOPY : COPY;
 | 
|---|
| 650 |             moving = (SHORT1FROMMP(mp1) == IDM_RENAME) ?
 | 
|---|
| 651 |               GetPString(IDS_RENAMINGTEXT) :
 | 
|---|
| 652 |               (SHORT1FROMMP(mp1) == IDM_MOVE ||
 | 
|---|
| 653 |                SHORT1FROMMP(mp1) == IDM_WPSMOVE) ?
 | 
|---|
| 654 |               GetPString(IDS_MOVINGTEXT) : GetPString(IDS_COPYINGTEXT);
 | 
|---|
| 655 |             move = (SHORT1FROMMP(mp1) == IDM_RENAME) ?
 | 
|---|
| 656 |               GetPString(IDS_RENAMETEXT) :
 | 
|---|
| 657 |               (SHORT1FROMMP(mp1) == IDM_MOVE ||
 | 
|---|
| 658 |                SHORT1FROMMP(mp1) == IDM_WPSMOVE) ?
 | 
|---|
| 659 |               GetPString(IDS_MOVETEXT) : GetPString(IDS_COPYTEXT);
 | 
|---|
| 660 |             moved = (SHORT1FROMMP(mp1) == IDM_RENAME) ?
 | 
|---|
| 661 |               GetPString(IDS_RENAMEDTEXT) :
 | 
|---|
| 662 |               (SHORT1FROMMP(mp1) == IDM_MOVE ||
 | 
|---|
| 663 |                SHORT1FROMMP(mp1) == IDM_WPSMOVE) ?
 | 
|---|
| 664 |               GetPString(IDS_MOVEDTEXT) : GetPString(IDS_COPIEDTEXT);
 | 
|---|
| 665 |             if (*path) {
 | 
|---|
| 666 |               strcpy(newname, path);
 | 
|---|
| 667 |               AddBackslashToPath(newname);
 | 
|---|
| 668 |               if (plen)
 | 
|---|
| 669 |                 p = list[x] + plen;
 | 
|---|
| 670 |               else {
 | 
|---|
| 671 |                 p = strrchr(list[x], '\\');
 | 
|---|
| 672 |                 if (p)
 | 
|---|
| 673 |                   p++;
 | 
|---|
| 674 |                 else
 | 
|---|
| 675 |                   p = list[x];
 | 
|---|
| 676 |               }
 | 
|---|
| 677 |               strcat(newname, p);
 | 
|---|
| 678 |             }
 | 
|---|
| 679 |             else
 | 
|---|
| 680 |               strcpy(newname, list[x]);
 | 
|---|
| 681 |             if ((wildcarding || SHORT1FROMMP(mp1) == IDM_RENAME) && *wildname) {
 | 
|---|
| 682 | 
 | 
|---|
| 683 |               CHAR testname[CCHMAXPATH];
 | 
|---|
| 684 | 
 | 
|---|
| 685 |               strcpy(testname, wildname);
 | 
|---|
| 686 |               if (AdjustWildcardName(newname, testname))
 | 
|---|
| 687 |                 strcpy(newname, testname);
 | 
|---|
| 688 |             }
 | 
|---|
| 689 |             existed = (IsFile(newname) != -1);
 | 
|---|
| 690 |             isnewer = IsNewer(list[x], newname);
 | 
|---|
| 691 |             if (existed && SHORT1FROMMP(mp1) != IDM_RENAME && dontask) {
 | 
|---|
| 692 |               if (!overold && !overnew)
 | 
|---|
| 693 |                 break;
 | 
|---|
| 694 |               if (!overold && !isnewer)
 | 
|---|
| 695 |                 break;
 | 
|---|
| 696 |               if (!overnew && isnewer)
 | 
|---|
| 697 |                 break;
 | 
|---|
| 698 |             }
 | 
|---|
| 699 |             if ((SHORT1FROMMP(mp1) == IDM_RENAME &&
 | 
|---|
| 700 |                  (!dontask || !*wildname)) ||
 | 
|---|
| 701 |                 (!dontask && existed) ||
 | 
|---|
| 702 |                 (!dontask && wildcarding) ||
 | 
|---|
| 703 |                 (IsFile(newname) == 0 && IsFile(list[x]) == 1)) {
 | 
|---|
| 704 | 
 | 
|---|
| 705 |               MOVEIT mv;
 | 
|---|
| 706 | 
 | 
|---|
| 707 |               memset(&mv, 0, sizeof(mv));
 | 
|---|
| 708 |               mv.rename = (SHORT1FROMMP(mp1) == IDM_RENAME);
 | 
|---|
| 709 |               mv.source = list[x];
 | 
|---|
| 710 |               strcpy(mv.target, newname);
 | 
|---|
| 711 |               rc = WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 712 |                              hwndFrame,
 | 
|---|
| 713 |                              RenameProc,
 | 
|---|
| 714 |                              FM3ModHandle, REN_FRAME, (PVOID) & mv);
 | 
|---|
| 715 |               if (!rc) {
 | 
|---|
| 716 |                 FreeList(list);
 | 
|---|
| 717 |                 goto Abort;
 | 
|---|
| 718 |               }
 | 
|---|
| 719 |               DosSleep(0);              //26 Aug 07 GKY 1
 | 
|---|
| 720 |               if (mv.skip || !*mv.target)
 | 
|---|
| 721 |                 break;
 | 
|---|
| 722 |               if (mv.dontask)
 | 
|---|
| 723 |                 dontask = TRUE;
 | 
|---|
| 724 |               if (mv.overold)
 | 
|---|
| 725 |                 overold = TRUE;
 | 
|---|
| 726 |               if (mv.overnew)
 | 
|---|
| 727 |                 overnew = TRUE;
 | 
|---|
| 728 |               if (wildcarding || SHORT1FROMMP(mp1) == IDM_RENAME) {
 | 
|---|
| 729 |                 p = strrchr(mv.target, '\\');
 | 
|---|
| 730 |                 if (p && (strchr(p, '*') || strchr(p, '?'))) {
 | 
|---|
| 731 |                   strcpy(wildname, mv.target);
 | 
|---|
| 732 |                   AdjustWildcardName(list[x], mv.target);
 | 
|---|
| 733 |                 }
 | 
|---|
| 734 |                 else
 | 
|---|
| 735 |                   *wildname = 0;
 | 
|---|
| 736 |               }
 | 
|---|
| 737 |               strcpy(newname, mv.target);
 | 
|---|
| 738 |               existed = (IsFile(newname) != -1);
 | 
|---|
| 739 |               isnewer = IsNewer(list[x], newname);
 | 
|---|
| 740 |               if (!mv.overwrite) {
 | 
|---|
| 741 |                 if (existed && SHORT1FROMMP(mp1) != IDM_RENAME && dontask) {
 | 
|---|
| 742 |                   if (!overold && !overnew)
 | 
|---|
| 743 |                     break;
 | 
|---|
| 744 |                   if (!overold && !isnewer)
 | 
|---|
| 745 |                     break;
 | 
|---|
| 746 |                   if (!overnew && isnewer)
 | 
|---|
| 747 |                     break;
 | 
|---|
| 748 |                 }
 | 
|---|
| 749 |               }
 | 
|---|
| 750 |             }
 | 
|---|
| 751 |             if (!stricmp(list[x], newname))
 | 
|---|
| 752 |               break;
 | 
|---|
| 753 |             sprintf(message,
 | 
|---|
| 754 |                     " %s \"%s\" %s \"%s\"",
 | 
|---|
| 755 |                     moving, list[x], GetPString(IDS_TOTEXT), newname);
 | 
|---|
| 756 |             WinSetWindowText(WinWindowFromID(hwndFrame, SEEALL_STATUS),
 | 
|---|
| 757 |                              message);
 | 
|---|
| 758 |             if (fRealIdle)
 | 
|---|
| 759 |               priority_idle();
 | 
|---|
| 760 |             if (fVerify && (driveflags[toupper(*list[x]) - 'A'] & DRIVE_WRITEVERIFYOFF ||
 | 
|---|
| 761 |                             driveflags[toupper(*newname) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
 | 
|---|
| 762 |               DosSetVerify(FALSE);
 | 
|---|
| 763 |               fResetVerify = TRUE;
 | 
|---|
| 764 |             }
 | 
|---|
| 765 |             if (plen) {
 | 
|---|
| 766 |               // make directory/ies, if required
 | 
|---|
| 767 | 
 | 
|---|
| 768 |               CHAR dirpart[CCHMAXPATH];
 | 
|---|
| 769 | 
 | 
|---|
| 770 |               strcpy(dirpart, newname);
 | 
|---|
| 771 |               p = strrchr(dirpart, '\\');
 | 
|---|
| 772 |               if (p) {
 | 
|---|
| 773 |                 *p = 0;
 | 
|---|
| 774 |                 if (p > dirpart + 3)
 | 
|---|
| 775 |                   MassMkdir((hwndMain) ? hwndMain : (HWND) 0, dirpart);
 | 
|---|
| 776 |               }
 | 
|---|
| 777 |             }
 | 
|---|
| 778 |             rc = docopyf(type, list[x], newname);
 | 
|---|
| 779 |             if (fResetVerify) {
 | 
|---|
| 780 |               DosSetVerify(fVerify);
 | 
|---|
| 781 |               fResetVerify = FALSE;
 | 
|---|
| 782 |             }
 | 
|---|
| 783 |             priority_normal();
 | 
|---|
| 784 |             if (rc) {
 | 
|---|
| 785 |               if ((rc == ERROR_DISK_FULL ||
 | 
|---|
| 786 |                    rc == ERROR_HANDLE_DISK_FULL) &&
 | 
|---|
| 787 |                   isalpha(*newname) &&
 | 
|---|
| 788 |                   (driveflags[toupper(*newname) - 'A'] & DRIVE_REMOVABLE) &&
 | 
|---|
| 789 |                   !(driveflags[toupper(*newname) - 'A'] & DRIVE_NOTWRITEABLE)
 | 
|---|
| 790 |                   && toupper(*newname) != toupper(*list[x])
 | 
|---|
| 791 |                   && !DosQueryPathInfo(list[x], FIL_QUERYEASIZEL, &fs4,
 | 
|---|
| 792 |                                        sizeof(fs4))
 | 
|---|
| 793 |                   && !(fs4.attrFile & FILE_DIRECTORY)) {
 | 
|---|
| 794 | 
 | 
|---|
| 795 |                 FSALLOCATE fsa;
 | 
|---|
| 796 |                 ULONGLONG ullFreeBytes;
 | 
|---|
| 797 |                 CHAR *ptr;
 | 
|---|
| 798 |                 INT cntr;
 | 
|---|
| 799 | 
 | 
|---|
| 800 |                 WinSetWindowText(WinWindowFromID(hwndFrame, SEEALL_STATUS),
 | 
|---|
| 801 |                                  (CHAR *) GetPString(IDS_FITTINGTEXT));
 | 
|---|
| 802 |                 DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 803 |                 if (!DosQueryFSInfo(toupper(*newname) - '@',
 | 
|---|
| 804 |                                     FSIL_ALLOC, &fsa, sizeof(fsa))) {
 | 
|---|
| 805 |                   // Assume large file support
 | 
|---|
| 806 |                   ullFreeBytes = (ULONGLONG) fsa.cUnitAvail * fsa.cSectorUnit *
 | 
|---|
| 807 |                                 fsa.cbSector;
 | 
|---|
| 808 |                   if (ullFreeBytes) {
 | 
|---|
| 809 |                     // Find item that will fit in available space
 | 
|---|
| 810 |                     for (cntr = x + 1; list[cntr]; cntr++) {
 | 
|---|
| 811 |                       DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 812 |                       if (!DosQueryPathInfo(list[cntr],
 | 
|---|
| 813 |                                             FIL_QUERYEASIZEL,
 | 
|---|
| 814 |                                             &fs4, sizeof(fs4)) &&
 | 
|---|
| 815 |                           !(fs4.attrFile & FILE_DIRECTORY) &&
 | 
|---|
| 816 |                           // fixme to use CBLIST_TO_EASIZE?
 | 
|---|
| 817 |                           fs4.cbFile + fs4.cbList <= ullFreeBytes) {
 | 
|---|
| 818 |                         // Swap with failing item
 | 
|---|
| 819 |                         ptr = list[x];
 | 
|---|
| 820 |                         list[x] = list[cntr];
 | 
|---|
| 821 |                         list[cntr] = ptr;
 | 
|---|
| 822 |                         goto Retry;
 | 
|---|
| 823 |                       }
 | 
|---|
| 824 |                     }
 | 
|---|
| 825 |                     WinSetWindowText(WinWindowFromID(hwndFrame,
 | 
|---|
| 826 |                                                      SEEALL_STATUS),
 | 
|---|
| 827 |                                      (CHAR *) GetPString(IDS_COULDNTFITTEXT));
 | 
|---|
| 828 |                   }
 | 
|---|
| 829 |                 }
 | 
|---|
| 830 |                 rc = saymsg(MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION,
 | 
|---|
| 831 |                             hwndFrame,
 | 
|---|
| 832 |                             GetPString(IDS_DISKFULLTEXT),
 | 
|---|
| 833 |                             GetPString(IDS_ANOTHERDISKTEXT));
 | 
|---|
| 834 |                 if (rc == MBID_RETRY)
 | 
|---|
| 835 |                   goto Retry;
 | 
|---|
| 836 |                 if (rc == MBID_ABORT) {
 | 
|---|
| 837 |                   FreeList(list);
 | 
|---|
| 838 |                   goto Abort;
 | 
|---|
| 839 |                 }
 | 
|---|
| 840 |               }
 | 
|---|
| 841 |               else {
 | 
|---|
| 842 |                 if (LogFileHandle)
 | 
|---|
| 843 |                   fprintf(LogFileHandle,
 | 
|---|
| 844 |                           GetPString(IDS_LOGTOFAILEDTEXT),
 | 
|---|
| 845 |                           move, list[x], newname, rc);
 | 
|---|
| 846 |                 rc = Dos_Error(MB_ENTERCANCEL,
 | 
|---|
| 847 |                                rc,
 | 
|---|
| 848 |                                hwndFrame,
 | 
|---|
| 849 |                                pszSrcFile,
 | 
|---|
| 850 |                                __LINE__,
 | 
|---|
| 851 |                                "%s %s \"%s\" %s\"%s\" %s.",
 | 
|---|
| 852 |                                move,
 | 
|---|
| 853 |                                GetPString(IDS_OFTEXT),
 | 
|---|
| 854 |                                list[x],
 | 
|---|
| 855 |                                GetPString(IDS_TOTEXT),
 | 
|---|
| 856 |                                newname, GetPString(IDS_FAILEDTEXT));
 | 
|---|
| 857 |                 if (rc == MBID_CANCEL) {
 | 
|---|
| 858 |                   FreeList(list);
 | 
|---|
| 859 |                   goto Abort;
 | 
|---|
| 860 |                 }
 | 
|---|
| 861 |               }
 | 
|---|
| 862 |             }
 | 
|---|
| 863 |             else {
 | 
|---|
| 864 |               if (LogFileHandle)
 | 
|---|
| 865 |                 fprintf(LogFileHandle,
 | 
|---|
| 866 |                         "%s \"%s\" %s \"%s\"\n",
 | 
|---|
| 867 |                         moved, list[x], GetPString(IDS_TOTEXT), newname);
 | 
|---|
| 868 |               AddToList(newname, &files, &numfiles, &numalloc);
 | 
|---|
| 869 |             }
 | 
|---|
| 870 |           }
 | 
|---|
| 871 |         }
 | 
|---|
| 872 |         if (SHORT1FROMMP(mp1) != IDM_COPY) {
 | 
|---|
| 873 |           if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT),
 | 
|---|
| 874 |                        UM_UPDATERECORDLIST, MPFROMP(list), MPVOID))
 | 
|---|
| 875 |             FreeList(list);
 | 
|---|
| 876 |         }
 | 
|---|
| 877 |         else
 | 
|---|
| 878 |           FreeList(list);
 | 
|---|
| 879 |         break;
 | 
|---|
| 880 | 
 | 
|---|
| 881 |       case IDM_UUDECODE:
 | 
|---|
| 882 |         for (x = 0; list[x]; x++)
 | 
|---|
| 883 |           UUD(list[x], NULL);
 | 
|---|
| 884 |         break;
 | 
|---|
| 885 | 
 | 
|---|
| 886 |       case IDM_UNLOCKFILE:
 | 
|---|
| 887 |         for (x = 0; list[x]; x++) {
 | 
|---|
| 888 |           if (IsFile(list[x]) > 0 && fUnlock) {
 | 
|---|
| 889 |             runemf2(SEPARATE | INVISIBLE | BACKGROUND | WAIT,
 | 
|---|
| 890 |                     HWND_DESKTOP, pszSrcFile, __LINE__,
 | 
|---|
| 891 |                     NULL, NULL, "%s %s", PCSZ_UNLOCKEXE, list[x]);
 | 
|---|
| 892 |           }
 | 
|---|
| 893 |         }
 | 
|---|
| 894 |         break;
 | 
|---|
| 895 | 
 | 
|---|
| 896 |       case IDM_EXTRACT:
 | 
|---|
| 897 |         for (x = 0; list[x]; x++) {
 | 
|---|
| 898 | 
 | 
|---|
| 899 |           EXTRDATA ex;
 | 
|---|
| 900 |           BOOL maskspaces = FALSE;
 | 
|---|
| 901 | 
 | 
|---|
| 902 |           memset(&ex, 0, sizeof(ex));
 | 
|---|
| 903 |           ex.info = find_type(list[x], NULL);
 | 
|---|
| 904 |           if (!ex.info || (!ex.info->extract && !ex.info->exwdirs))
 | 
|---|
| 905 |             break;
 | 
|---|
| 906 |           ex.size = sizeof(ex);
 | 
|---|
| 907 |           ex.arcname = list[x];
 | 
|---|
| 908 |           strcpy(ex.masks, "*");
 | 
|---|
| 909 |           if (!WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 910 |                          hwndFrame,
 | 
|---|
| 911 |                          ExtractDlgProc,
 | 
|---|
| 912 |                          FM3ModHandle,
 | 
|---|
| 913 |                          EXT_FRAME,
 | 
|---|
| 914 |                          (PVOID) & ex) ||
 | 
|---|
| 915 |               !ex.ret || !*ex.command || !*ex.arcname || !*ex.extractdir)
 | 
|---|
| 916 |             break;
 | 
|---|
| 917 |           if (IsFile(ex.extractdir) != 0)
 | 
|---|
| 918 |             Runtime_Error(pszSrcFile, __LINE__, "directory expected");
 | 
|---|
| 919 |           else {
 | 
|---|
| 920 |             if (needs_quoting(ex.masks) && !strchr(ex.masks, '\"'))
 | 
|---|
| 921 |               maskspaces = TRUE;
 | 
|---|
| 922 |             runemf2(SEPARATE | WINDOWED |
 | 
|---|
| 923 |                     (fArcStuffVisible ? 0 : (BACKGROUND | MINIMIZED)),
 | 
|---|
| 924 |                     HWND_DESKTOP, pszSrcFile, __LINE__,
 | 
|---|
| 925 |                     ex.extractdir, NULL,
 | 
|---|
| 926 |                     "%s %s %s%s%s",
 | 
|---|
| 927 |                     ex.command,
 | 
|---|
| 928 |                     ex.arcname,
 | 
|---|
| 929 |                     maskspaces ? "\"" : NullStr,
 | 
|---|
| 930 |                     *ex.masks ? ex.masks : "*",
 | 
|---|
| 931 |                     maskspaces ? "\"" : NullStr);
 | 
|---|
| 932 |           }
 | 
|---|
| 933 |         }
 | 
|---|
| 934 |         // fixme to not leak?
 | 
|---|
| 935 |         if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT),
 | 
|---|
| 936 |                      UM_UPDATERECORDLIST, MPFROMP(list), MPVOID))
 | 
|---|
| 937 |           FreeList(list);
 | 
|---|
| 938 |         break;
 | 
|---|
| 939 | 
 | 
|---|
| 940 |       case IDM_SUBJECT:
 | 
|---|
| 941 |         for (x = 0; list[x]; x++) {
 | 
|---|
| 942 | 
 | 
|---|
| 943 |           INT ret;
 | 
|---|
| 944 | 
 | 
|---|
| 945 |           if (IsFile(list[x]) == 1) {
 | 
|---|
| 946 |             ret = Subject(hwndFrame, list[x]);
 | 
|---|
| 947 |             if (!ret)
 | 
|---|
| 948 |               break;
 | 
|---|
| 949 |           }
 | 
|---|
| 950 |         }
 | 
|---|
| 951 |         if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT),
 | 
|---|
| 952 |                      UM_UPDATERECORDLIST, MPFROMP(list), MPVOID))
 | 
|---|
| 953 |           FreeList(list);
 | 
|---|
| 954 |         break;
 | 
|---|
| 955 | 
 | 
|---|
| 956 |       case IDM_OPENDEFAULT:
 | 
|---|
| 957 |       case IDM_OPENSETTINGS:
 | 
|---|
| 958 |         for (x = 0; list[x]; x++) {
 | 
|---|
| 959 |           if (IsFile(list[x]) != -1) {
 | 
|---|
| 960 | 
 | 
|---|
| 961 |             CHAR *s;
 | 
|---|
| 962 | 
 | 
|---|
| 963 |             switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 964 |             case IDM_OPENSETTINGS:
 | 
|---|
| 965 |               s = (PSZ) Settings;
 | 
|---|
| 966 |               break;
 | 
|---|
| 967 |             default:
 | 
|---|
| 968 |               s = (PSZ) Default;
 | 
|---|
| 969 |               break;
 | 
|---|
| 970 |             }
 | 
|---|
| 971 |             OpenObject(list[x], s, hwndFrame);
 | 
|---|
| 972 |           }
 | 
|---|
| 973 |         }
 | 
|---|
| 974 |         FreeList(list);
 | 
|---|
| 975 |         break;
 | 
|---|
| 976 | 
 | 
|---|
| 977 |       case IDM_DELETE:
 | 
|---|
| 978 |       case IDM_PERMDELETE:
 | 
|---|
| 979 |         {
 | 
|---|
| 980 |           CHECKLIST cl;
 | 
|---|
| 981 |           INT isdir = 0, sysdir = 0, ro = 0, hs = 0;
 | 
|---|
| 982 |           FILESTATUS3 fsa;
 | 
|---|
| 983 |           CHAR prompt[CCHMAXPATH * 3];
 | 
|---|
| 984 |           APIRET error;
 | 
|---|
| 985 | 
 | 
|---|
| 986 |           for (x = 0; list[x]; x++) {
 | 
|---|
| 987 |             if (IsRoot(list[x])) {
 | 
|---|
| 988 |               list = RemoveFromList(list, list[x]);
 | 
|---|
| 989 |               if (!list)
 | 
|---|
| 990 |                 break;
 | 
|---|
| 991 |               x--;
 | 
|---|
| 992 |               continue;
 | 
|---|
| 993 |             }
 | 
|---|
| 994 |             DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 995 |             if (DosQueryPathInfo(list[x], FIL_STANDARD, &fsa, sizeof(fsa))) {
 | 
|---|
| 996 |               list = RemoveFromList(list, list[x]);
 | 
|---|
| 997 |               if (!list)
 | 
|---|
| 998 |                 break;
 | 
|---|
| 999 |               x--;
 | 
|---|
| 1000 |               continue;
 | 
|---|
| 1001 |             }
 | 
|---|
| 1002 |             if (fsa.attrFile & FILE_DIRECTORY) {
 | 
|---|
| 1003 |               isdir++;
 | 
|---|
| 1004 |               if (stristr(list[x], ":\\OS2\\") ||
 | 
|---|
| 1005 |                   !stricmp(list[x] + 1, ":\\OS2"))
 | 
|---|
| 1006 |                 sysdir++;
 | 
|---|
| 1007 |             }
 | 
|---|
| 1008 |             else {
 | 
|---|
| 1009 |               if (fsa.attrFile & (FILE_HIDDEN | FILE_SYSTEM))
 | 
|---|
| 1010 |                 hs++;
 | 
|---|
| 1011 |               if (fsa.attrFile & FILE_READONLY)
 | 
|---|
| 1012 |                 ro++;
 | 
|---|
| 1013 |             }
 | 
|---|
| 1014 |           }
 | 
|---|
| 1015 |           if (!list)
 | 
|---|
| 1016 |             break;
 | 
|---|
| 1017 |           if (fConfirmDelete || isdir) {
 | 
|---|
| 1018 |             memset(&cl, 0, sizeof(cl));
 | 
|---|
| 1019 |             cl.size = sizeof(cl);
 | 
|---|
| 1020 |             cl.list = list;
 | 
|---|
| 1021 |             cl.prompt = prompt;
 | 
|---|
| 1022 |             cl.flags |= CHECK_FILES;
 | 
|---|
| 1023 |             cl.cmd = SHORT1FROMMP(mp1);
 | 
|---|
| 1024 |             sprintf(prompt,
 | 
|---|
| 1025 |                     GetPString(IDS_DELPROMPT1TEXT),
 | 
|---|
| 1026 |                     (SHORT1FROMMP(mp1) == IDM_DELETE) ?
 | 
|---|
| 1027 |                     NullStr :
 | 
|---|
| 1028 |                     GetPString(IDS_PERMANENTLYTEXT), &"s"[list[1] == NULL]);
 | 
|---|
| 1029 |             if (isdir) {
 | 
|---|
| 1030 |               sprintf(&prompt[strlen(prompt)],
 | 
|---|
| 1031 |                       GetPString(IDS_DELPROMPT2TEXT),
 | 
|---|
| 1032 |                       isdir,
 | 
|---|
| 1033 |                       (isdir > 1) ?
 | 
|---|
| 1034 |                       GetPString(IDS_ARETEXT) :
 | 
|---|
| 1035 |                       GetPString(IDS_ISTEXT),
 | 
|---|
| 1036 |                       (isdir == 1) ?
 | 
|---|
| 1037 |                       GetPString(IDS_ATEXT) :
 | 
|---|
| 1038 |                       NullStr,
 | 
|---|
| 1039 |                       (isdir > 1) ?
 | 
|---|
| 1040 |                       GetPString(IDS_IESTEXT) : GetPString(IDS_YTEXT));
 | 
|---|
| 1041 |               if (sysdir)
 | 
|---|
| 1042 |                 sprintf(&prompt[strlen(prompt)],
 | 
|---|
| 1043 |                         GetPString(IDS_DELPROMPT3TEXT),
 | 
|---|
| 1044 |                         sysdir,
 | 
|---|
| 1045 |                         (sysdir == 1) ?
 | 
|---|
| 1046 |                         GetPString(IDS_YTEXT) : GetPString(IDS_IESTEXT));
 | 
|---|
| 1047 |             }
 | 
|---|
| 1048 |             if (ro)
 | 
|---|
| 1049 |               sprintf(&prompt[strlen(prompt)],
 | 
|---|
| 1050 |                       GetPString(IDS_DELPROMPT4TEXT),
 | 
|---|
| 1051 |                       ro,
 | 
|---|
| 1052 |                       &"s"[ro == 1],
 | 
|---|
| 1053 |                       (ro > 1) ?
 | 
|---|
| 1054 |                       GetPString(IDS_ARETEXT) : GetPString(IDS_ISTEXT));
 | 
|---|
| 1055 |             if (hs)
 | 
|---|
| 1056 |               sprintf(&prompt[strlen(prompt)],
 | 
|---|
| 1057 |                       GetPString(IDS_DELPROMPT5TEXT),
 | 
|---|
| 1058 |                       hs,
 | 
|---|
| 1059 |                       &"s"[hs == 1],
 | 
|---|
| 1060 |                       (hs > 1) ?
 | 
|---|
| 1061 |                       GetPString(IDS_ARETEXT) : GetPString(IDS_ISTEXT));
 | 
|---|
| 1062 |             if ((ro || hs || sysdir) && !fAlertBeepOff)
 | 
|---|
| 1063 |               DosBeep(300, 100);
 | 
|---|
| 1064 |             strcat(prompt, GetPString(IDS_DELPROMPT6TEXT));
 | 
|---|
| 1065 |             if (!WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 1066 |                            WinWindowFromID(hwndFrame, FID_CLIENT),
 | 
|---|
| 1067 |                            CheckListProc,
 | 
|---|
| 1068 |                            FM3ModHandle, CHECK_FRAME, MPFROMP(&cl)))
 | 
|---|
| 1069 |               break;
 | 
|---|
| 1070 |             list = cl.list;
 | 
|---|
| 1071 |             if (!list || !list[0])
 | 
|---|
| 1072 |               break;
 | 
|---|
| 1073 |           }
 | 
|---|
| 1074 |           for (x = 0; list[x]; x++) {
 | 
|---|
| 1075 |             fsa.attrFile = 0;
 | 
|---|
| 1076 |             DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 1077 |             DosQueryPathInfo(list[x], FIL_STANDARD, &fsa, sizeof(fsa));
 | 
|---|
| 1078 |             if (fsa.attrFile & FILE_DIRECTORY) {
 | 
|---|
| 1079 |               sprintf(prompt, GetPString(IDS_DELETINGTEXT), list[x]);
 | 
|---|
| 1080 |               WinSetWindowText(WinWindowFromID(hwndFrame, SEEALL_STATUS),
 | 
|---|
| 1081 |                                prompt);
 | 
|---|
| 1082 |               error = (APIRET) wipeallf(FALSE, "%s%s*",
 | 
|---|
| 1083 |                                         list[x],
 | 
|---|
| 1084 |                                         (*list[x] &&
 | 
|---|
| 1085 |                                          list[x][strlen(list[x]) - 1] !=
 | 
|---|
| 1086 |                                          '\\') ? PCSZ_BACKSLASH : NullStr);
 | 
|---|
| 1087 |               DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 1088 |               if (!error)
 | 
|---|
| 1089 |                 error = DosDeleteDir(list[x]);
 | 
|---|
| 1090 |               else
 | 
|---|
| 1091 |                 DosDeleteDir(list[x]);
 | 
|---|
| 1092 |             }
 | 
|---|
| 1093 |             else {
 | 
|---|
| 1094 |               INT retrn = 0;
 | 
|---|
| 1095 | 
 | 
|---|
| 1096 |               DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 1097 |               if (SHORT1FROMMP(mp1) == IDM_DELETE)
 | 
|---|
| 1098 |                 error = DosDelete(list[x]);
 | 
|---|
| 1099 |               else
 | 
|---|
| 1100 |                 error = DosForceDelete(list[x]);
 | 
|---|
| 1101 |               if (error) {
 | 
|---|
| 1102 |                 DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 1103 |                 retrn = make_deleteable(list[x], error, ignorereadonly);
 | 
|---|
| 1104 |                 if (retrn == SM2_CANCEL)
 | 
|---|
| 1105 |                   break;
 | 
|---|
| 1106 |                 if (retrn == SM2_DONTASK)
 | 
|---|
| 1107 |                   ignorereadonly = TRUE;
 | 
|---|
| 1108 |                 if (retrn == SM2_NO)
 | 
|---|
| 1109 |                   continue;
 | 
|---|
| 1110 |                 if (SHORT1FROMMP(mp1) == IDM_DELETE)
 | 
|---|
| 1111 |                   error = DosDelete(list[x]);
 | 
|---|
| 1112 |                 else
 | 
|---|
| 1113 |                   error = DosForceDelete(list[x]);
 | 
|---|
| 1114 |               }
 | 
|---|
| 1115 |             }
 | 
|---|
| 1116 |             if (error) {
 | 
|---|
| 1117 |               if (LogFileHandle)
 | 
|---|
| 1118 |                 fprintf(LogFileHandle,
 | 
|---|
| 1119 |                         GetPString(IDS_DELETEFAILED1TEXT), list[x], error);
 | 
|---|
| 1120 |               if (Dos_Error(MB_ENTERCANCEL,
 | 
|---|
| 1121 |                             error,
 | 
|---|
| 1122 |                             hwndFrame,
 | 
|---|
| 1123 |                             pszSrcFile,
 | 
|---|
| 1124 |                             __LINE__,
 | 
|---|
| 1125 |                             GetPString(IDS_DELETEFAILED2TEXT),
 | 
|---|
| 1126 |                             list[x]) == MBID_CANCEL)
 | 
|---|
| 1127 |                 break;
 | 
|---|
| 1128 |             }
 | 
|---|
| 1129 |             else if (LogFileHandle)
 | 
|---|
| 1130 |               fprintf(LogFileHandle,
 | 
|---|
| 1131 |                       "%s\n", GetPString(IDS_DELETEDTEXT), list[x]);
 | 
|---|
| 1132 |             AddToList(list[x], &files, &numfiles, &numalloc);
 | 
|---|
| 1133 |           }
 | 
|---|
| 1134 |         }
 | 
|---|
| 1135 |         FreeList(list);
 | 
|---|
| 1136 |         break;
 | 
|---|
| 1137 | 
 | 
|---|
| 1138 |       case IDM_SAVETOLIST:
 | 
|---|
| 1139 |         if (list) {
 | 
|---|
| 1140 |           WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 1141 |                     WinWindowFromID(hwndFrame, FID_CLIENT),
 | 
|---|
| 1142 |                     SaveAllListDlgProc,
 | 
|---|
| 1143 |                     FM3ModHandle, SAV_FRAME, MPFROMP(list));
 | 
|---|
| 1144 |           FreeList(list);
 | 
|---|
| 1145 |         }
 | 
|---|
| 1146 |         break;
 | 
|---|
| 1147 | 
 | 
|---|
| 1148 |       case IDM_SAVETOCLIP:
 | 
|---|
| 1149 |       case IDM_APPENDTOCLIP:
 | 
|---|
| 1150 |       case IDM_SAVETOCLIPFILENAME:
 | 
|---|
| 1151 |       case IDM_APPENDTOCLIPFILENAME:
 | 
|---|
| 1152 |         if (list) {
 | 
|---|
| 1153 |           ListToClipboardHab(WinQueryAnchorBlock(hwnd),
 | 
|---|
| 1154 |                              list, SHORT1FROMMP(mp1));
 | 
|---|
| 1155 |           FreeList(list);
 | 
|---|
| 1156 |         }
 | 
|---|
| 1157 |         break;
 | 
|---|
| 1158 | 
 | 
|---|
| 1159 |       default:
 | 
|---|
| 1160 |         if (list)
 | 
|---|
| 1161 |           FreeList(list);
 | 
|---|
| 1162 |         break;
 | 
|---|
| 1163 |       }
 | 
|---|
| 1164 | 
 | 
|---|
| 1165 |       switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 1166 |       case IDM_MOVE:
 | 
|---|
| 1167 |       case IDM_COPY:
 | 
|---|
| 1168 |       case IDM_RENAME:
 | 
|---|
| 1169 |         sprintf(message,
 | 
|---|
| 1170 |                 GetPString(IDS_OPSCOMPLETETEXT),
 | 
|---|
| 1171 |                 SHORT1FROMMP(mp1) == IDM_MOVE ?
 | 
|---|
| 1172 |                   GetPString(IDS_MOVETEXT) :
 | 
|---|
| 1173 |                   SHORT1FROMMP(mp1) == IDM_COPY ?
 | 
|---|
| 1174 |                     GetPString(IDS_COPYTEXT) :
 | 
|---|
| 1175 |                     SHORT1FROMMP(mp1) == IDM_WPSMOVE ?
 | 
|---|
| 1176 |                       GetPString(IDS_WPSMOVETEXT) :
 | 
|---|
| 1177 |                       SHORT1FROMMP(mp1) == IDM_WPSCOPY ?
 | 
|---|
| 1178 |                         GetPString(IDS_WPSCOPYTEXT) :
 | 
|---|
| 1179 |                         GetPString(IDS_RENAMETEXT),
 | 
|---|
| 1180 |                 &"s"[x == 1],
 | 
|---|
| 1181 |                 SHORT1FROMMP(mp1) == IDM_MOVE ||
 | 
|---|
| 1182 |                 SHORT1FROMMP(mp1) == IDM_COPY ||
 | 
|---|
| 1183 |                 SHORT1FROMMP(mp1) == IDM_WPSMOVE ||
 | 
|---|
| 1184 |                 SHORT1FROMMP(mp1) == IDM_WPSCOPY ?
 | 
|---|
| 1185 |                   GetPString(IDS_TOTEXT) : NullStr,
 | 
|---|
| 1186 |                 SHORT1FROMMP(mp1) == IDM_MOVE ||
 | 
|---|
| 1187 |                 SHORT1FROMMP(mp1) == IDM_COPY ||
 | 
|---|
| 1188 |                 SHORT1FROMMP(mp1) == IDM_WPSCOPY ?
 | 
|---|
| 1189 |                   path : NullStr,
 | 
|---|
| 1190 |                 x != 1 ? GetPString(IDS_ARETEXT) : GetPString(IDS_ISTEXT));
 | 
|---|
| 1191 |         WinSetWindowText(WinWindowFromID(hwndFrame, SEEALL_STATUS), message);
 | 
|---|
| 1192 |         if (toupper(*path) < 'C' && !fAlertBeepOff)
 | 
|---|
| 1193 |           DosBeep(1000, 25);
 | 
|---|
| 1194 |         DosSleep(16);                   // 05 Aug 07 GKY 33
 | 
|---|
| 1195 |         break;
 | 
|---|
| 1196 | 
 | 
|---|
| 1197 |       default:
 | 
|---|
| 1198 |         break;
 | 
|---|
| 1199 |       }
 | 
|---|
| 1200 |     Abort:
 | 
|---|
| 1201 |       if (files) {
 | 
|---|
| 1202 |         if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT),
 | 
|---|
| 1203 |                      UM_UPDATERECORDLIST, MPFROMP(files), MPVOID))
 | 
|---|
| 1204 |           FreeList(files);
 | 
|---|
| 1205 |       }
 | 
|---|
| 1206 |       PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT),
 | 
|---|
| 1207 |               UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| 1208 |     }
 | 
|---|
| 1209 |     return 0;
 | 
|---|
| 1210 | 
 | 
|---|
| 1211 |   case WM_CLOSE:
 | 
|---|
| 1212 |     WinDestroyWindow(hwnd);
 | 
|---|
| 1213 |     break;
 | 
|---|
| 1214 | 
 | 
|---|
| 1215 |   case WM_DESTROY:
 | 
|---|
| 1216 |     if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
 | 
|---|
| 1217 |       WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
 | 
|---|
| 1218 |     break;
 | 
|---|
| 1219 |   }
 | 
|---|
| 1220 |   return WinDefWindowProc(hwnd, msg, mp1, mp2);
 | 
|---|
| 1221 | }
 | 
|---|
| 1222 | 
 | 
|---|
| 1223 | static VOID MakeSeeObjWinThread(VOID * args)
 | 
|---|
| 1224 | {
 | 
|---|
| 1225 |   HAB hab2;
 | 
|---|
| 1226 |   HMQ hmq2;
 | 
|---|
| 1227 |   HWND hwndObj;
 | 
|---|
| 1228 |   ALLDATA *ad = (ALLDATA *) args;
 | 
|---|
| 1229 |   QMSG qmsg2;
 | 
|---|
| 1230 | 
 | 
|---|
| 1231 |   if (ad) {
 | 
|---|
| 1232 | #   ifdef FORTIFY
 | 
|---|
| 1233 |     Fortify_EnterScope();
 | 
|---|
| 1234 | #    endif
 | 
|---|
| 1235 |     hab2 = WinInitialize(0);
 | 
|---|
| 1236 |     if (hab2) {
 | 
|---|
| 1237 |       hmq2 = WinCreateMsgQueue(hab2, 256);
 | 
|---|
| 1238 |       if (hmq2) {
 | 
|---|
| 1239 |         DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 1240 |         WinRegisterClass(hab2,
 | 
|---|
| 1241 |                          (CHAR *) WC_OBJECTWINDOW,
 | 
|---|
| 1242 |                          SeeObjWndProc, 0, sizeof(PVOID));
 | 
|---|
| 1243 |         hwndObj = WinCreateWindow(HWND_OBJECT,
 | 
|---|
| 1244 |                                   (CHAR *) WC_OBJECTWINDOW,
 | 
|---|
| 1245 |                                   (PSZ) NULL,
 | 
|---|
| 1246 |                                   0,
 | 
|---|
| 1247 |                                   0,
 | 
|---|
| 1248 |                                   0,
 | 
|---|
| 1249 |                                   0,
 | 
|---|
| 1250 |                                   0, 0, HWND_TOP, SEEALL_OBJ, NULL, NULL);
 | 
|---|
| 1251 |         if (!hwndObj) {
 | 
|---|
| 1252 |           Win_Error(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,
 | 
|---|
| 1253 |                     PCSZ_WINCREATEWINDOW);
 | 
|---|
| 1254 |           if (!PostMsg(ad->hwndClient, WM_CLOSE, MPVOID, MPVOID))
 | 
|---|
| 1255 |             WinSendMsg(ad->hwndClient, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
| 1256 |         }
 | 
|---|
| 1257 |         else {
 | 
|---|
| 1258 |           ad->hwndObj = hwndObj;
 | 
|---|
| 1259 |           WinSetWindowULong(hwndObj, QWL_USER, ad->hwndFrame);
 | 
|---|
| 1260 |           priority_normal();
 | 
|---|
| 1261 |           while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0))
 | 
|---|
| 1262 |             WinDispatchMsg(hab2, &qmsg2);
 | 
|---|
| 1263 |           WinDestroyWindow(hwndObj);
 | 
|---|
| 1264 |         }
 | 
|---|
| 1265 |         WinDestroyMsgQueue(hmq2);
 | 
|---|
| 1266 |       }
 | 
|---|
| 1267 |       else
 | 
|---|
| 1268 |         WinTerminate(hab2);
 | 
|---|
| 1269 |     }
 | 
|---|
| 1270 | #   ifdef FORTIFY
 | 
|---|
| 1271 |     Fortify_LeaveScope();
 | 
|---|
| 1272 | #    endif
 | 
|---|
| 1273 |   }
 | 
|---|
| 1274 | }
 | 
|---|
| 1275 | 
 | 
|---|
| 1276 | static VOID SelectMask(HWND hwnd, BOOL deselect)
 | 
|---|
| 1277 | {
 | 
|---|
| 1278 |   MASK mask;
 | 
|---|
| 1279 |   register ULONG x, y, z;
 | 
|---|
| 1280 |   BOOL ret;
 | 
|---|
| 1281 |   ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 1282 | 
 | 
|---|
| 1283 |   memset(&mask, 0, sizeof(mask));
 | 
|---|
| 1284 |   mask.fNoAttribs = FALSE;
 | 
|---|
| 1285 |   mask.fNoDirs = TRUE;
 | 
|---|
| 1286 |   mask.attrFile = pAD->mask.attrFile;
 | 
|---|
| 1287 |   mask.antiattr = pAD->mask.antiattr;
 | 
|---|
| 1288 |   mask.fIsSeeAll = TRUE;
 | 
|---|
| 1289 |   strcpy(mask.prompt,
 | 
|---|
| 1290 |          GetPString((!deselect) ?
 | 
|---|
| 1291 |                     IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT));
 | 
|---|
| 1292 |   if (WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 1293 |                 hwnd,
 | 
|---|
| 1294 |                 PickMaskDlgProc,
 | 
|---|
| 1295 |                 FM3ModHandle,
 | 
|---|
| 1296 |                 MSK_FRAME,
 | 
|---|
| 1297 |                 MPFROMP(&mask)) &&
 | 
|---|
| 1298 |       (*mask.szMask ||
 | 
|---|
| 1299 |        mask.attrFile != pAD->mask.attrFile ||
 | 
|---|
| 1300 |        mask.antiattr != pAD->mask.antiattr)) {
 | 
|---|
| 1301 |     for (x = 0; x < pAD->afindexcnt; x++) {
 | 
|---|
| 1302 |       y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x;
 | 
|---|
| 1303 |       ret = FALSE;
 | 
|---|
| 1304 |       if (mask.pszMasks[1]) {
 | 
|---|
| 1305 |         for (z = 0; mask.pszMasks[z]; z++) {
 | 
|---|
| 1306 |           if (*mask.pszMasks[z]) {
 | 
|---|
| 1307 |             if (*mask.pszMasks[z] != '/') {
 | 
|---|
| 1308 |               if (wildcard((strchr(mask.pszMasks[z], '\\') ||
 | 
|---|
| 1309 |                             strchr(mask.pszMasks[z], ':')) ?
 | 
|---|
| 1310 |                            pAD->afindex[y]->fullname : pAD->afindex[y]->
 | 
|---|
| 1311 |                            filename, mask.pszMasks[z], FALSE))
 | 
|---|
| 1312 |                 ret = TRUE;
 | 
|---|
| 1313 |             }
 | 
|---|
| 1314 |             else {
 | 
|---|
| 1315 |               if (wildcard((strchr(mask.pszMasks[z], '\\') ||
 | 
|---|
| 1316 |                             strchr(mask.pszMasks[z], ':')) ?
 | 
|---|
| 1317 |                            pAD->afindex[y]->fullname : pAD->afindex[y]->
 | 
|---|
| 1318 |                            filename, mask.pszMasks[y] + 1, FALSE)) {
 | 
|---|
| 1319 |                 ret = FALSE;
 | 
|---|
| 1320 |                 break;
 | 
|---|
| 1321 |               }
 | 
|---|
| 1322 |             }
 | 
|---|
| 1323 |           }
 | 
|---|
| 1324 |         }
 | 
|---|
| 1325 |       }
 | 
|---|
| 1326 |       else if (*mask.szMask) {
 | 
|---|
| 1327 |         if (wildcard((strchr(mask.szMask, '\\') ||
 | 
|---|
| 1328 |                       strchr(mask.szMask, ':')) ?
 | 
|---|
| 1329 |                      pAD->afindex[y]->fullname : pAD->afindex[y]->filename,
 | 
|---|
| 1330 |                      mask.szMask, FALSE))
 | 
|---|
| 1331 |           ret = TRUE;
 | 
|---|
| 1332 |       }
 | 
|---|
| 1333 |       else
 | 
|---|
| 1334 |         ret = TRUE;
 | 
|---|
| 1335 |       if (ret) {
 | 
|---|
| 1336 |         if ((!(mask.attrFile & FILE_HIDDEN)
 | 
|---|
| 1337 |              && (pAD->afindex[y]->attrFile & FILE_HIDDEN))
 | 
|---|
| 1338 |             || (!(mask.attrFile & FILE_SYSTEM)
 | 
|---|
| 1339 |                 && (pAD->afindex[y]->attrFile & FILE_SYSTEM))
 | 
|---|
| 1340 |             || (!(mask.attrFile & FILE_READONLY)
 | 
|---|
| 1341 |                 && (pAD->afindex[y]->attrFile & FILE_READONLY))
 | 
|---|
| 1342 |             || (!(mask.attrFile & FILE_ARCHIVED)
 | 
|---|
| 1343 |                 && (pAD->afindex[y]->attrFile & FILE_ARCHIVED)))
 | 
|---|
| 1344 |           ret = FALSE;
 | 
|---|
| 1345 |         else
 | 
|---|
| 1346 |           if (((mask.antiattr & FILE_HIDDEN)
 | 
|---|
| 1347 |                && !(pAD->afindex[y]->attrFile & FILE_HIDDEN))
 | 
|---|
| 1348 |               || ((mask.antiattr & FILE_SYSTEM)
 | 
|---|
| 1349 |                   && !(pAD->afindex[y]->attrFile & FILE_SYSTEM))
 | 
|---|
| 1350 |               || ((mask.antiattr & FILE_READONLY)
 | 
|---|
| 1351 |                   && !(pAD->afindex[y]->attrFile & FILE_READONLY))
 | 
|---|
| 1352 |               || ((mask.antiattr & FILE_ARCHIVED)
 | 
|---|
| 1353 |                   && !(pAD->afindex[y]->attrFile & FILE_ARCHIVED)))
 | 
|---|
| 1354 |           ret = FALSE;
 | 
|---|
| 1355 |       }
 | 
|---|
| 1356 |       if (ret) {
 | 
|---|
| 1357 |         if (deselect) {
 | 
|---|
| 1358 |           if (pAD->afindex[y]->flags & AF_SELECTED) {
 | 
|---|
| 1359 |             pAD->selected--;
 | 
|---|
| 1360 |             pAD->ullSelectedBytes -= pAD->afindex[y]->cbFile;
 | 
|---|
| 1361 |             pAD->afindex[y]->flags &= ~AF_SELECTED;
 | 
|---|
| 1362 |           }
 | 
|---|
| 1363 |         }
 | 
|---|
| 1364 |         else {
 | 
|---|
| 1365 |           if (~pAD->afindex[y]->flags & AF_SELECTED) {
 | 
|---|
| 1366 |             pAD->selected++;
 | 
|---|
| 1367 |             pAD->ullSelectedBytes += pAD->afindex[y]->cbFile;
 | 
|---|
| 1368 |             pAD->afindex[y]->flags |= AF_SELECTED;
 | 
|---|
| 1369 |           }
 | 
|---|
| 1370 |         }
 | 
|---|
| 1371 |       }
 | 
|---|
| 1372 |     }                                   // for
 | 
|---|
| 1373 |   }
 | 
|---|
| 1374 | }
 | 
|---|
| 1375 | 
 | 
|---|
| 1376 | static VOID CollectList(HWND hwnd, CHAR ** list)
 | 
|---|
| 1377 | {
 | 
|---|
| 1378 |   if (!Collector) {
 | 
|---|
| 1379 |     if (hwndMain && !fExternalCollector && !strcmp(realappname, FM3Str)) {
 | 
|---|
| 1380 | 
 | 
|---|
| 1381 |       HWND hwndC;
 | 
|---|
| 1382 |       SWP swp;
 | 
|---|
| 1383 | 
 | 
|---|
| 1384 |       if (!fAutoTile)
 | 
|---|
| 1385 |         GetNextWindowPos(hwndMain, &swp, NULL, NULL);
 | 
|---|
| 1386 |       hwndC = StartCollector(hwndMain, 4);
 | 
|---|
| 1387 |       if (hwndC) {
 | 
|---|
| 1388 |         if (!fAutoTile)
 | 
|---|
| 1389 |           WinSetWindowPos(hwndC, HWND_TOP, swp.x, swp.y,
 | 
|---|
| 1390 |                           swp.cx, swp.cy, SWP_MOVE | SWP_SIZE |
 | 
|---|
| 1391 |                           SWP_SHOW | SWP_ZORDER);
 | 
|---|
| 1392 |         else
 | 
|---|
| 1393 |           TileChildren(hwndMain, TRUE);
 | 
|---|
| 1394 |         WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
 | 
|---|
| 1395 |         DosSleep(100);//05 Aug 07 GKY 250
 | 
|---|
| 1396 |       }
 | 
|---|
| 1397 |     }
 | 
|---|
| 1398 |     else {
 | 
|---|
| 1399 |       StartCollector(HWND_DESKTOP, 4);
 | 
|---|
| 1400 |       DosSleep(100);//05 Aug 07 GKY 250
 | 
|---|
| 1401 |     }
 | 
|---|
| 1402 |   }
 | 
|---|
| 1403 |   if (!PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_COLLECTOR, 0),
 | 
|---|
| 1404 |                MPFROMP(list)))
 | 
|---|
| 1405 |     FreeList(list);
 | 
|---|
| 1406 | }
 | 
|---|
| 1407 | 
 | 
|---|
| 1408 | static VOID FreeAllFilesList(HWND hwnd)
 | 
|---|
| 1409 | {
 | 
|---|
| 1410 |   ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 1411 |   register ULONG x;
 | 
|---|
| 1412 | 
 | 
|---|
| 1413 |   if (ad->afhead && ad->afheadcnt) {
 | 
|---|
| 1414 |     for (x = 0; x < ad->afheadcnt; x++) {
 | 
|---|
| 1415 |       xfree(ad->afhead[x].fullname, pszSrcFile, __LINE__);
 | 
|---|
| 1416 |     }
 | 
|---|
| 1417 |     free(ad->afhead);
 | 
|---|
| 1418 |     ad->afhead = NULL;
 | 
|---|
| 1419 |     xfree(ad->afindex, pszSrcFile, __LINE__);
 | 
|---|
| 1420 |     ad->afindex = NULL;
 | 
|---|
| 1421 |   }
 | 
|---|
| 1422 |   DosPostEventSem(CompactSem);
 | 
|---|
| 1423 |   ad->afalloc = ad->afindexcnt = ad->afheadcnt = ad->longest = ad->longestw =
 | 
|---|
| 1424 |     ad->maxx = ad->horzscroll = 0;
 | 
|---|
| 1425 | }
 | 
|---|
| 1426 | 
 | 
|---|
| 1427 | static CHAR **BuildAList(HWND hwnd)
 | 
|---|
| 1428 | {
 | 
|---|
| 1429 |   ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 1430 |   ULONG x;
 | 
|---|
| 1431 |   ULONG y;
 | 
|---|
| 1432 |   ULONG z = 0;
 | 
|---|
| 1433 |   CHAR **list = NULL;
 | 
|---|
| 1434 |   UINT numfiles = 0;
 | 
|---|
| 1435 |   UINT numalloc = 0;
 | 
|---|
| 1436 |   INT error;
 | 
|---|
| 1437 | 
 | 
|---|
| 1438 |   if (ad->selected) {
 | 
|---|
| 1439 |     for (x = 0; x < ad->afindexcnt; x++) {
 | 
|---|
| 1440 |       y = (ad->invertsort) ? (ad->afindexcnt - 1) - x : x;
 | 
|---|
| 1441 |       if (ad->afindex[y]->flags & AF_SELECTED) {
 | 
|---|
| 1442 |         error = AddToList(ad->afindex[y]->fullname, &list,
 | 
|---|
| 1443 |                           &numfiles, &numalloc);
 | 
|---|
| 1444 |         if (error)
 | 
|---|
| 1445 |           break;
 | 
|---|
| 1446 |         z++;
 | 
|---|
| 1447 |         if (z >= ad->selected)
 | 
|---|
| 1448 |           break;
 | 
|---|
| 1449 |       }
 | 
|---|
| 1450 |     }
 | 
|---|
| 1451 |   }
 | 
|---|
| 1452 |   return list;
 | 
|---|
| 1453 | }
 | 
|---|
| 1454 | 
 | 
|---|
| 1455 | static BOOL Mark(HWND hwnd, INT command, CHAR ** list)
 | 
|---|
| 1456 | {
 | 
|---|
| 1457 |   // Marks only unfiltered files
 | 
|---|
| 1458 | 
 | 
|---|
| 1459 |   ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 1460 |   register ULONG x, y, z;
 | 
|---|
| 1461 |   BOOL ret = TRUE;
 | 
|---|
| 1462 |   BOOL didone = FALSE;
 | 
|---|
| 1463 | 
 | 
|---|
| 1464 |   for (x = 0; x < pAD->afindexcnt; x++) {
 | 
|---|
| 1465 |     y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x;
 | 
|---|
| 1466 |     if (list) {
 | 
|---|
| 1467 |       ret = FALSE;
 | 
|---|
| 1468 |       for (z = 0; list[z]; z++) {
 | 
|---|
| 1469 |         if (!stricmp(list[z], pAD->afindex[y]->fullname)) {
 | 
|---|
| 1470 |           ret = TRUE;
 | 
|---|
| 1471 |           break;
 | 
|---|
| 1472 |         }
 | 
|---|
| 1473 |       }
 | 
|---|
| 1474 |     }
 | 
|---|
| 1475 |     if (ret) {
 | 
|---|
| 1476 |       didone = TRUE;
 | 
|---|
| 1477 |       if (command == AFM_UNMARK) {
 | 
|---|
| 1478 |         if (pAD->afindex[y]->flags & AF_SELECTED) {
 | 
|---|
| 1479 |           pAD->selected--;
 | 
|---|
| 1480 |           pAD->ullSelectedBytes -= pAD->afindex[y]->cbFile;
 | 
|---|
| 1481 |           pAD->afindex[y]->flags &= ~AF_SELECTED;
 | 
|---|
| 1482 |         }
 | 
|---|
| 1483 |       }
 | 
|---|
| 1484 |       else if (command == AFM_MARK) {
 | 
|---|
| 1485 |         if (~pAD->afindex[y]->flags & AF_SELECTED) {
 | 
|---|
| 1486 |           pAD->selected++;
 | 
|---|
| 1487 |           pAD->ullSelectedBytes += pAD->afindex[y]->cbFile;
 | 
|---|
| 1488 |           pAD->afindex[y]->flags |= AF_SELECTED;
 | 
|---|
| 1489 |         }
 | 
|---|
| 1490 |       }
 | 
|---|
| 1491 |       else if (command == AFM_INVERT) {
 | 
|---|
| 1492 |         if (pAD->afindex[y]->flags & AF_SELECTED) {
 | 
|---|
| 1493 |           pAD->selected--;
 | 
|---|
| 1494 |           pAD->ullSelectedBytes -= pAD->afindex[y]->cbFile;
 | 
|---|
| 1495 |           pAD->afindex[y]->flags &= ~AF_SELECTED;
 | 
|---|
| 1496 |         }
 | 
|---|
| 1497 |         else {
 | 
|---|
| 1498 |           pAD->selected++;
 | 
|---|
| 1499 |           pAD->ullSelectedBytes += pAD->afindex[y]->cbFile;
 | 
|---|
| 1500 |           pAD->afindex[y]->flags |= AF_SELECTED;
 | 
|---|
| 1501 |         }
 | 
|---|
| 1502 |       }
 | 
|---|
| 1503 |       else if (command == AFM_MARKDELETED) {
 | 
|---|
| 1504 |         if (pAD->afindex[y]->flags & AF_SELECTED)
 | 
|---|
| 1505 |           pAD->afindex[y]->flags |= AF_DELETED;
 | 
|---|
| 1506 |       }
 | 
|---|
| 1507 |       else if (command == AFM_FILTER) {
 | 
|---|
| 1508 |         if (pAD->afindex[y]->flags & AF_SELECTED)
 | 
|---|
| 1509 |           pAD->afindex[y]->flags |= AF_FILTERED;
 | 
|---|
| 1510 |       }
 | 
|---|
| 1511 |     }
 | 
|---|
| 1512 |   }                                     // for x
 | 
|---|
| 1513 |   return didone;
 | 
|---|
| 1514 | }
 | 
|---|
| 1515 | 
 | 
|---|
| 1516 | static BOOL UpdateList(HWND hwnd, CHAR **list)
 | 
|---|
| 1517 | {
 | 
|---|
| 1518 |   // Updates files in the list
 | 
|---|
| 1519 | 
 | 
|---|
| 1520 |   ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 1521 |   ULONG x, z;
 | 
|---|
| 1522 |   BOOL ret, didone = FALSE;
 | 
|---|
| 1523 |   FILEFINDBUF3L ffb;
 | 
|---|
| 1524 |   ULONG ulFindCnt;
 | 
|---|
| 1525 |   HDIR hdir;
 | 
|---|
| 1526 |   CHAR *p;
 | 
|---|
| 1527 | 
 | 
|---|
| 1528 |   if (list) {
 | 
|---|
| 1529 |     for (z = 0; list[z] && !ad->stopflag; z++) {
 | 
|---|
| 1530 |       ret = FALSE;
 | 
|---|
| 1531 |       for (x = 0; x < ad->afheadcnt; x++) {
 | 
|---|
| 1532 |         if (!stricmp(list[z], ad->afhead[x].fullname)) {
 | 
|---|
| 1533 |           ret = TRUE;
 | 
|---|
| 1534 |           break;
 | 
|---|
| 1535 |         }
 | 
|---|
| 1536 |       }
 | 
|---|
| 1537 |       if (ret) {
 | 
|---|
| 1538 |         didone = TRUE;
 | 
|---|
| 1539 |         hdir = HDIR_CREATE;
 | 
|---|
| 1540 |         ulFindCnt = 1;
 | 
|---|
| 1541 |         if (!xDosFindFirst(list[z], &hdir, FILE_NORMAL | FILE_ARCHIVED |
 | 
|---|
| 1542 |                            FILE_DIRECTORY | FILE_READONLY | FILE_SYSTEM |
 | 
|---|
| 1543 |                            FILE_HIDDEN, &ffb, sizeof(ffb), &ulFindCnt,
 | 
|---|
| 1544 |                            FIL_STANDARDL)) {
 | 
|---|
| 1545 |           DosFindClose(hdir);
 | 
|---|
| 1546 |           if (!(ffb.attrFile & FILE_DIRECTORY)) {
 | 
|---|
| 1547 |             ad->afhead[x].attrFile = (USHORT) ffb.attrFile;
 | 
|---|
| 1548 |             ad->afhead[x].cbFile = ffb.cbFile;
 | 
|---|
| 1549 |             ad->afhead[x].date = ffb.fdateLastWrite;
 | 
|---|
| 1550 |             ad->afhead[x].time = ffb.ftimeLastWrite;
 | 
|---|
| 1551 |           }
 | 
|---|
| 1552 |           else
 | 
|---|
| 1553 |             ad->afhead[x].flags |= AF_DELETED;
 | 
|---|
| 1554 |         }
 | 
|---|
| 1555 |         else
 | 
|---|
| 1556 |           ad->afhead[x].flags |= AF_DELETED;
 | 
|---|
| 1557 |       }
 | 
|---|
| 1558 |       else if (isalpha(*list[z]) && ad->abDrvFlags[toupper(*list[z]) - 'A']) {
 | 
|---|
| 1559 |         didone = TRUE;
 | 
|---|
| 1560 |         hdir = HDIR_CREATE;
 | 
|---|
| 1561 |         ulFindCnt = 1;
 | 
|---|
| 1562 |         if (!xDosFindFirst(list[z], &hdir, FILE_NORMAL | FILE_ARCHIVED |
 | 
|---|
| 1563 |                            FILE_DIRECTORY | FILE_READONLY | FILE_SYSTEM |
 | 
|---|
| 1564 |                            FILE_HIDDEN, &ffb, sizeof(ffb), &ulFindCnt,
 | 
|---|
| 1565 |                            FIL_STANDARDL)) {
 | 
|---|
| 1566 |           DosFindClose(hdir);
 | 
|---|
| 1567 |           if (!(ffb.attrFile & FILE_DIRECTORY)) {
 | 
|---|
| 1568 |             if (!ad->afalloc || ad->afheadcnt > ad->afalloc - 1) {
 | 
|---|
| 1569 | 
 | 
|---|
| 1570 |               ALLFILES *temp, **templ;
 | 
|---|
| 1571 | 
 | 
|---|
| 1572 |               temp =
 | 
|---|
| 1573 |                 xrealloc(ad->afhead, (ad->afalloc + 1) * sizeof(ALLFILES),
 | 
|---|
| 1574 |                          pszSrcFile, __LINE__);
 | 
|---|
| 1575 |               if (!temp) {
 | 
|---|
| 1576 |                 ad->stopflag = 1;
 | 
|---|
| 1577 |                 break;
 | 
|---|
| 1578 |               }
 | 
|---|
| 1579 |               else {
 | 
|---|
| 1580 |                 ad->afhead = temp;
 | 
|---|
| 1581 |                 templ =
 | 
|---|
| 1582 |                   xrealloc(ad->afindex,
 | 
|---|
| 1583 |                            (ad->afalloc + 1) * sizeof(ALLFILES *), pszSrcFile,
 | 
|---|
| 1584 |                            __LINE__);
 | 
|---|
| 1585 |                 if (!templ) {
 | 
|---|
| 1586 |                   ad->stopflag = 1;
 | 
|---|
| 1587 |                   break;
 | 
|---|
| 1588 |                 }
 | 
|---|
| 1589 |                 else
 | 
|---|
| 1590 |                   ad->afindex = templ;
 | 
|---|
| 1591 |                 ad->afalloc++;
 | 
|---|
| 1592 |               }
 | 
|---|
| 1593 |             }
 | 
|---|
| 1594 |             ad->afhead[ad->afheadcnt].fullname =
 | 
|---|
| 1595 |               xstrdup(list[z], pszSrcFile, __LINE__);
 | 
|---|
| 1596 |             if (ad->afhead[ad->afheadcnt].fullname) {
 | 
|---|
| 1597 |               p = strrchr(ad->afhead[ad->afheadcnt].fullname, '\\');
 | 
|---|
| 1598 |               if (!p)
 | 
|---|
| 1599 |                 p = ad->afhead[ad->afheadcnt].fullname;
 | 
|---|
| 1600 |               else
 | 
|---|
| 1601 |                 p++;
 | 
|---|
| 1602 |               ad->afhead[ad->afheadcnt].filename = p;
 | 
|---|
| 1603 |               ad->afhead[ad->afheadcnt].cbFile = ffb.cbFile;
 | 
|---|
| 1604 |               ad->afhead[ad->afheadcnt].date = ffb.fdateLastWrite;
 | 
|---|
| 1605 |               ad->afhead[ad->afheadcnt].time = ffb.ftimeLastWrite;
 | 
|---|
| 1606 |               ad->afhead[ad->afheadcnt].attrFile = (USHORT) ffb.attrFile;
 | 
|---|
| 1607 |               ad->afhead[ad->afheadcnt].flags = 0;
 | 
|---|
| 1608 |               if (ad->longest < strlen(ad->afhead[ad->afheadcnt].filename))
 | 
|---|
| 1609 |                 ad->longest = strlen(ad->afhead[ad->afheadcnt].filename);
 | 
|---|
| 1610 |               if (ad->longestw < strlen(ad->afhead[ad->afheadcnt].fullname))
 | 
|---|
| 1611 |                 ad->longestw = strlen(ad->afhead[ad->afheadcnt].fullname);
 | 
|---|
| 1612 | 
 | 
|---|
| 1613 |               ad->afheadcnt++;
 | 
|---|
| 1614 |             }
 | 
|---|
| 1615 |             else {
 | 
|---|
| 1616 |               ad->stopflag = 1;
 | 
|---|
| 1617 |               break;
 | 
|---|
| 1618 |             }
 | 
|---|
| 1619 |           }
 | 
|---|
| 1620 |         }
 | 
|---|
| 1621 |       }
 | 
|---|
| 1622 |     }
 | 
|---|
| 1623 |   }
 | 
|---|
| 1624 |   return didone;
 | 
|---|
| 1625 | }
 | 
|---|
| 1626 | 
 | 
|---|
| 1627 | static int comparefullnames(const void *v1, const void *v2)
 | 
|---|
| 1628 | {
 | 
|---|
| 1629 |   ALLFILES *d1 = *(ALLFILES **) v1;
 | 
|---|
| 1630 |   ALLFILES *d2 = *(ALLFILES **) v2;
 | 
|---|
| 1631 |   int ret;
 | 
|---|
| 1632 | 
 | 
|---|
| 1633 |   ret = stricmp(d1->fullname, d2->fullname);
 | 
|---|
| 1634 |   return ret;
 | 
|---|
| 1635 | }
 | 
|---|
| 1636 | 
 | 
|---|
| 1637 | static int comparenames(const void *v1, const void *v2)
 | 
|---|
| 1638 | {
 | 
|---|
| 1639 |   ALLFILES *d1 = *(ALLFILES **) v1;
 | 
|---|
| 1640 |   ALLFILES *d2 = *(ALLFILES **) v2;
 | 
|---|
| 1641 |   int ret;
 | 
|---|
| 1642 | 
 | 
|---|
| 1643 |   ret = stricmp(d1->filename, d2->filename);
 | 
|---|
| 1644 |   if (!ret)
 | 
|---|
| 1645 |     ret = comparefullnames(v1, v2);
 | 
|---|
| 1646 |   return ret;
 | 
|---|
| 1647 | }
 | 
|---|
| 1648 | 
 | 
|---|
| 1649 | static int compareexts(const void *v1, const void *v2)
 | 
|---|
| 1650 | {
 | 
|---|
| 1651 |   ALLFILES *d1 = *(ALLFILES **) v1;
 | 
|---|
| 1652 |   ALLFILES *d2 = *(ALLFILES **) v2;
 | 
|---|
| 1653 |   register CHAR *p1, *p2;
 | 
|---|
| 1654 |   int ret;
 | 
|---|
| 1655 | 
 | 
|---|
| 1656 |   p1 = strrchr(d1->filename, '.');
 | 
|---|
| 1657 |   p2 = strrchr(d2->filename, '.');
 | 
|---|
| 1658 |   if (!p1)
 | 
|---|
| 1659 |     p1 = NullStr;
 | 
|---|
| 1660 |   else
 | 
|---|
| 1661 |     p1++;
 | 
|---|
| 1662 |   if (!p2)
 | 
|---|
| 1663 |     p2 = NullStr;
 | 
|---|
| 1664 |   else
 | 
|---|
| 1665 |     p2++;
 | 
|---|
| 1666 |   ret = stricmp(p1, p2);
 | 
|---|
| 1667 |   if (!ret)
 | 
|---|
| 1668 |     ret = comparenames(v1, v2);
 | 
|---|
| 1669 |   return ret;
 | 
|---|
| 1670 | }
 | 
|---|
| 1671 | 
 | 
|---|
| 1672 | static int comparesizes(const void *v1, const void *v2)
 | 
|---|
| 1673 | {
 | 
|---|
| 1674 |   ALLFILES *d1 = *(ALLFILES **) v1;
 | 
|---|
| 1675 |   ALLFILES *d2 = *(ALLFILES **) v2;
 | 
|---|
| 1676 |   int ret;
 | 
|---|
| 1677 | 
 | 
|---|
| 1678 |   ret = (d1->cbFile > d2->cbFile) ? 1 : (d1->cbFile == d2->cbFile) ? 0 : -1;
 | 
|---|
| 1679 |   if (!ret)
 | 
|---|
| 1680 |     ret = comparenames(v1, v2);
 | 
|---|
| 1681 |   return ret;
 | 
|---|
| 1682 | }
 | 
|---|
| 1683 | 
 | 
|---|
| 1684 | static int comparedates(const void *v1, const void *v2)
 | 
|---|
| 1685 | {
 | 
|---|
| 1686 |   ALLFILES *d1 = *(ALLFILES **) v1;
 | 
|---|
| 1687 |   ALLFILES *d2 = *(ALLFILES **) v2;
 | 
|---|
| 1688 |   int ret;
 | 
|---|
| 1689 | 
 | 
|---|
| 1690 |   ret = TestFDates(NULL, NULL,
 | 
|---|
| 1691 |                   &d2->date, &d2->time,
 | 
|---|
| 1692 |                   &d1->date, &d1->time);
 | 
|---|
| 1693 | 
 | 
|---|
| 1694 |   if (!ret)
 | 
|---|
| 1695 |     ret = comparenames(v1, v2);
 | 
|---|
| 1696 |   return ret;
 | 
|---|
| 1697 | }
 | 
|---|
| 1698 | 
 | 
|---|
| 1699 | static VOID ReSort(HWND hwnd)
 | 
|---|
| 1700 | {
 | 
|---|
| 1701 |   ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 1702 |   register ULONG x, y;
 | 
|---|
| 1703 | 
 | 
|---|
| 1704 |   pAD->selected = 0;
 | 
|---|
| 1705 |   pAD->ullSelectedBytes = 0;
 | 
|---|
| 1706 |   for (x = 0, y = 0; x < pAD->afheadcnt; x++) {
 | 
|---|
| 1707 |     if (!(pAD->afhead[x].flags & (AF_DELETED | AF_FILTERED))) {
 | 
|---|
| 1708 |       if (pAD->afhead[x].flags & AF_SELECTED) {
 | 
|---|
| 1709 |         pAD->selected++;
 | 
|---|
| 1710 |         pAD->ullSelectedBytes += pAD->afhead[x].cbFile;
 | 
|---|
| 1711 |       }
 | 
|---|
| 1712 |       pAD->afindex[y++] = &(pAD->afhead[x]);
 | 
|---|
| 1713 |     }
 | 
|---|
| 1714 |   }                                     // for x
 | 
|---|
| 1715 |   pAD->afindexcnt = y;
 | 
|---|
| 1716 |   PostMsg(hwnd, UM_SETUP3, MPVOID, MPVOID);
 | 
|---|
| 1717 |   if (!pAD->stopflag && pAD->pfnCompare && pAD->afindexcnt) {
 | 
|---|
| 1718 |     WinSendMsg(hwnd, UM_RESCAN, MPFROMLONG(1), MPVOID);
 | 
|---|
| 1719 |     qsort(pAD->afindex, pAD->afindexcnt, sizeof(ALLFILES *), pAD->pfnCompare);
 | 
|---|
| 1720 |   }
 | 
|---|
| 1721 | }
 | 
|---|
| 1722 | 
 | 
|---|
| 1723 | VOID FindDupesThread(VOID * args)
 | 
|---|
| 1724 | {
 | 
|---|
| 1725 |   register ULONG x, z;
 | 
|---|
| 1726 |   register CHAR *px, *pz;
 | 
|---|
| 1727 |   CHAR s[80];
 | 
|---|
| 1728 |   INT error;
 | 
|---|
| 1729 |   HWND hwnd = (HWND) args;
 | 
|---|
| 1730 |   HAB hab2 = (HAB) 0;
 | 
|---|
| 1731 |   HMQ hmq2 = (HMQ) 0;
 | 
|---|
| 1732 |   ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 1733 | 
 | 
|---|
| 1734 | # ifdef FORTIFY
 | 
|---|
| 1735 |   Fortify_EnterScope();
 | 
|---|
| 1736 | #  endif
 | 
|---|
| 1737 |   if (!DosRequestMutexSem(ad->hmtxScan, SEM_INDEFINITE_WAIT)) {
 | 
|---|
| 1738 |     priority_normal();
 | 
|---|
| 1739 |     hab2 = WinInitialize(0);
 | 
|---|
| 1740 |     if (hab2) {
 | 
|---|
| 1741 |       hmq2 = WinCreateMsgQueue(hab2, 0);
 | 
|---|
| 1742 |       if (hmq2) {
 | 
|---|
| 1743 |         WinCancelShutdown(hmq2, TRUE);
 | 
|---|
| 1744 |         IncrThreadUsage();
 | 
|---|
| 1745 |         if (ad->cursored <= ad->afindexcnt) {
 | 
|---|
| 1746 |           for (x = 0; x < ad->afheadcnt; x++)
 | 
|---|
| 1747 |             ad->afhead[x].flags &= (~(AF_DUPE | AF_SELECTED));
 | 
|---|
| 1748 |           DosSleep(0);  //26 Aug 07 GKY 1
 | 
|---|
| 1749 |           for (x = 0; x < ad->afheadcnt && !ad->stopflag; x++) {
 | 
|---|
| 1750 |             if (!(ad->afhead[x].flags & (AF_DUPE | AF_FILTERED))) {
 | 
|---|
| 1751 |               if (!(x % 50)) {
 | 
|---|
| 1752 |                 sprintf(s,
 | 
|---|
| 1753 |                         GetPString(IDS_DUPECHECKINGOFTEXT), x, ad->afheadcnt);
 | 
|---|
| 1754 |                 WinSetWindowText(ad->hwndStatus, s);
 | 
|---|
| 1755 |               }
 | 
|---|
| 1756 |               for (z = 0; z < ad->afheadcnt && !ad->stopflag; z++) {
 | 
|---|
| 1757 |                 if (x != z &&
 | 
|---|
| 1758 |                     !(ad->afhead[z].flags & (AF_DUPE | AF_FILTERED)))
 | 
|---|
| 1759 |                 {
 | 
|---|
| 1760 |                   if (ad->dupeflags & DP_SIZES) {
 | 
|---|
| 1761 |                     if (ad->afhead[x].cbFile != ad->afhead[z].cbFile)
 | 
|---|
| 1762 |                       goto SkipNonDupe;
 | 
|---|
| 1763 |                   }
 | 
|---|
| 1764 |                   if (ad->dupeflags & DP_DATES) {
 | 
|---|
| 1765 |                     if (*(INT *) & ad->afhead[x].date !=
 | 
|---|
| 1766 |                         *(INT *) & ad->afhead[z].date ||
 | 
|---|
| 1767 |                         *(INT *) & ad->afhead[x].time !=
 | 
|---|
| 1768 |                         *(INT *) & ad->afhead[z].time)
 | 
|---|
| 1769 |                       goto SkipNonDupe;
 | 
|---|
| 1770 |                   }
 | 
|---|
| 1771 |                   if (ad->dupeflags & DP_NAMES) {
 | 
|---|
| 1772 |                     if (ad->dupeflags & DP_EXTS) {
 | 
|---|
| 1773 |                       px = strrchr(ad->afhead[x].filename, '.');
 | 
|---|
| 1774 |                       pz = strrchr(ad->afhead[z].filename, '.');
 | 
|---|
| 1775 |                       if ((px || pz) && (!px || !pz))
 | 
|---|
| 1776 |                         goto SkipNonDupe;
 | 
|---|
| 1777 |                       if (px) {
 | 
|---|
| 1778 |                         *px = 0;
 | 
|---|
| 1779 |                         *pz = 0;
 | 
|---|
| 1780 |                       }
 | 
|---|
| 1781 |                     }
 | 
|---|
| 1782 |                     if (stricmp(ad->afhead[x].filename,
 | 
|---|
| 1783 |                                 ad->afhead[z].filename)) {
 | 
|---|
| 1784 |                       if (ad->dupeflags & DP_EXTS) {
 | 
|---|
| 1785 |                         if (px) {
 | 
|---|
| 1786 |                           *px = '.';
 | 
|---|
| 1787 |                           *pz = '.';
 | 
|---|
| 1788 |                         }
 | 
|---|
| 1789 |                       }
 | 
|---|
| 1790 |                       goto SkipNonDupe;
 | 
|---|
| 1791 |                     }
 | 
|---|
| 1792 |                     if (ad->dupeflags & DP_EXTS) {
 | 
|---|
| 1793 |                       if (px) {
 | 
|---|
| 1794 |                         *px = '.';
 | 
|---|
| 1795 |                         *pz = '.';
 | 
|---|
| 1796 |                       }
 | 
|---|
| 1797 |                     }
 | 
|---|
| 1798 |                   }
 | 
|---|
| 1799 |                   if (ad->dupeflags & DP_CRCS) {
 | 
|---|
| 1800 |                     if (!(ad->afhead[x].flags & AF_CRCED)) {
 | 
|---|
| 1801 |                       ad->afhead[x].CRC = CRCFile(ad->afhead[x].fullname,
 | 
|---|
| 1802 |                                                   &error);
 | 
|---|
| 1803 |                       if (!error)
 | 
|---|
| 1804 |                         ad->afhead[x].flags |= AF_CRCED;
 | 
|---|
| 1805 |                     }
 | 
|---|
| 1806 |                     if (!(ad->afhead[z].flags & AF_CRCED)) {
 | 
|---|
| 1807 |                       ad->afhead[z].CRC = CRCFile(ad->afhead[z].fullname,
 | 
|---|
| 1808 |                                                   &error);
 | 
|---|
| 1809 |                       if (!error)
 | 
|---|
| 1810 |                         ad->afhead[z].flags |= AF_CRCED;
 | 
|---|
| 1811 |                     }
 | 
|---|
| 1812 |                     if ((ad->afhead[x].flags & AF_CRCED) &&
 | 
|---|
| 1813 |                         (ad->afhead[z].flags & AF_CRCED)) {
 | 
|---|
| 1814 |                       if (ad->afhead[x].CRC != ad->afhead[z].CRC)
 | 
|---|
| 1815 |                         goto SkipNonDupe;
 | 
|---|
| 1816 |                     }
 | 
|---|
| 1817 |                     DosSleep(0);
 | 
|---|
| 1818 |                   }
 | 
|---|
| 1819 |                   ad->afhead[x].flags |= AF_DUPE;
 | 
|---|
| 1820 |                   ad->afhead[z].flags |= AF_DUPE;
 | 
|---|
| 1821 |                 SkipNonDupe:
 | 
|---|
| 1822 |                   ;
 | 
|---|
| 1823 |                 }
 | 
|---|
| 1824 |               } // for
 | 
|---|
| 1825 |               DosSleep(0);
 | 
|---|
| 1826 |             }
 | 
|---|
| 1827 |           } // for
 | 
|---|
| 1828 |           for (x = 0; x < ad->afheadcnt && !ad->stopflag; x++) {
 | 
|---|
| 1829 |             if (!(ad->afhead[x].flags & AF_DUPE))
 | 
|---|
| 1830 |               ad->afhead[x].flags |= AF_FILTERED;
 | 
|---|
| 1831 |           }
 | 
|---|
| 1832 |           ReSort(hwnd);
 | 
|---|
| 1833 |           WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 1834 |         }
 | 
|---|
| 1835 |       }
 | 
|---|
| 1836 |     }
 | 
|---|
| 1837 |     PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| 1838 |     DosReleaseMutexSem(ad->hmtxScan);
 | 
|---|
| 1839 |   } // if got sem
 | 
|---|
| 1840 |   if (hmq2) {
 | 
|---|
| 1841 |     PostMsg(hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID);
 | 
|---|
| 1842 |     WinDestroyMsgQueue(hmq2);
 | 
|---|
| 1843 |   }
 | 
|---|
| 1844 |   if (hab2) {
 | 
|---|
| 1845 |     DecrThreadUsage();
 | 
|---|
| 1846 |     WinTerminate(hab2);
 | 
|---|
| 1847 |   }
 | 
|---|
| 1848 | # ifdef FORTIFY
 | 
|---|
| 1849 |   Fortify_LeaveScope();
 | 
|---|
| 1850 | #  endif
 | 
|---|
| 1851 | }
 | 
|---|
| 1852 | 
 | 
|---|
| 1853 | static VOID FilterAll(HWND hwnd, ALLDATA *ad);
 | 
|---|
| 1854 | 
 | 
|---|
| 1855 | static VOID FilterList(HWND hwnd)
 | 
|---|
| 1856 | {
 | 
|---|
| 1857 |   ULONG x;
 | 
|---|
| 1858 |   ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 1859 |   CHAR *p;
 | 
|---|
| 1860 | 
 | 
|---|
| 1861 |   if (ad->cursored <= ad->afindexcnt) {
 | 
|---|
| 1862 |     x = ad->cursored - 1;
 | 
|---|
| 1863 |     x = (ad->invertsort) ? (ad->afindexcnt - 1) - x : x;
 | 
|---|
| 1864 |     p = strrchr(ad->afindex[x]->filename, '.');
 | 
|---|
| 1865 |     if (p) {
 | 
|---|
| 1866 |       strcpy(ad->mask.szMask, "*");
 | 
|---|
| 1867 |       strcat(ad->mask.szMask, p);
 | 
|---|
| 1868 |     }
 | 
|---|
| 1869 |   }
 | 
|---|
| 1870 |   *(ad->mask.prompt) = 0;
 | 
|---|
| 1871 |   ad->mask.fIsSeeAll = TRUE;
 | 
|---|
| 1872 |   if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
 | 
|---|
| 1873 |                 FM3ModHandle, MSK_FRAME, MPFROMP(&ad->mask)))
 | 
|---|
| 1874 |     FilterAll(hwnd, ad);
 | 
|---|
| 1875 | }
 | 
|---|
| 1876 | 
 | 
|---|
| 1877 | static VOID FilterAll(HWND hwnd, ALLDATA *ad)
 | 
|---|
| 1878 | {
 | 
|---|
| 1879 |   ULONG x, z;
 | 
|---|
| 1880 |   BOOL ret;
 | 
|---|
| 1881 | 
 | 
|---|
| 1882 |   if (ad) {
 | 
|---|
| 1883 |     for (x = 0; x < ad->afheadcnt; x++) {
 | 
|---|
| 1884 |       ret = FALSE;
 | 
|---|
| 1885 |       if (ad->mask.pszMasks[1]) {
 | 
|---|
| 1886 |         for (z = 0; ad->mask.pszMasks[z]; z++) {
 | 
|---|
| 1887 |           if (*ad->mask.pszMasks[z]) {
 | 
|---|
| 1888 |             if (*ad->mask.pszMasks[z] != '/') {
 | 
|---|
| 1889 |               if (wildcard((strchr(ad->mask.pszMasks[z], '\\') ||
 | 
|---|
| 1890 |                             strchr(ad->mask.pszMasks[z], ':')) ?
 | 
|---|
| 1891 |                            ad->afhead[x].fullname : ad->afhead[x].filename,
 | 
|---|
| 1892 |                            ad->mask.pszMasks[z], FALSE))
 | 
|---|
| 1893 |                 ret = TRUE;
 | 
|---|
| 1894 |             }
 | 
|---|
| 1895 |             else {
 | 
|---|
| 1896 |               if (wildcard((strchr(ad->mask.pszMasks[z], '\\') ||
 | 
|---|
| 1897 |                             strchr(ad->mask.pszMasks[z], ':')) ?
 | 
|---|
| 1898 |                            ad->afhead[x].fullname : ad->afhead[x].filename,
 | 
|---|
| 1899 |                            ad->mask.pszMasks[z] + 1, FALSE)) {
 | 
|---|
| 1900 |                 ret = FALSE;
 | 
|---|
| 1901 |                 break;
 | 
|---|
| 1902 |               }
 | 
|---|
| 1903 |             }
 | 
|---|
| 1904 |           }
 | 
|---|
| 1905 |         }
 | 
|---|
| 1906 |       }
 | 
|---|
| 1907 |       else if (*ad->mask.szMask) {
 | 
|---|
| 1908 |         if (wildcard((strchr(ad->mask.szMask, '\\') ||
 | 
|---|
| 1909 |                       strchr(ad->mask.szMask, ':')) ?
 | 
|---|
| 1910 |                      ad->afhead[x].fullname : ad->afhead[x].filename,
 | 
|---|
| 1911 |                      ad->mask.szMask, FALSE))
 | 
|---|
| 1912 |           ret = TRUE;
 | 
|---|
| 1913 |       }
 | 
|---|
| 1914 |       else
 | 
|---|
| 1915 |         ret = TRUE;
 | 
|---|
| 1916 | 
 | 
|---|
| 1917 |       if (ret) {
 | 
|---|
| 1918 |         if ((!(ad->mask.attrFile & FILE_HIDDEN)
 | 
|---|
| 1919 |              && (ad->afhead[x].attrFile & FILE_HIDDEN))
 | 
|---|
| 1920 |             || (!(ad->mask.attrFile & FILE_SYSTEM)
 | 
|---|
| 1921 |                 && (ad->afhead[x].attrFile & FILE_SYSTEM))
 | 
|---|
| 1922 |             || (!(ad->mask.attrFile & FILE_READONLY)
 | 
|---|
| 1923 |                 && (ad->afhead[x].attrFile & FILE_READONLY))
 | 
|---|
| 1924 |             || (!(ad->mask.attrFile & FILE_ARCHIVED)
 | 
|---|
| 1925 |                 && (ad->afhead[x].attrFile & FILE_ARCHIVED)))
 | 
|---|
| 1926 |           ret = FALSE;
 | 
|---|
| 1927 |         else
 | 
|---|
| 1928 |           if (((ad->mask.antiattr & FILE_HIDDEN)
 | 
|---|
| 1929 |                && !(ad->afhead[x].attrFile & FILE_HIDDEN))
 | 
|---|
| 1930 |               || ((ad->mask.antiattr & FILE_SYSTEM)
 | 
|---|
| 1931 |                   && !(ad->afhead[x].attrFile & FILE_SYSTEM))
 | 
|---|
| 1932 |               || ((ad->mask.antiattr & FILE_READONLY)
 | 
|---|
| 1933 |                   && !(ad->afhead[x].attrFile & FILE_READONLY))
 | 
|---|
| 1934 |               || ((ad->mask.antiattr & FILE_ARCHIVED)
 | 
|---|
| 1935 |                   && !(ad->afhead[x].attrFile & FILE_ARCHIVED)))
 | 
|---|
| 1936 |           ret = FALSE;
 | 
|---|
| 1937 |       }
 | 
|---|
| 1938 | 
 | 
|---|
| 1939 |       if (!ret)
 | 
|---|
| 1940 |         ad->afhead[x].flags |= AF_FILTERED;
 | 
|---|
| 1941 |       else
 | 
|---|
| 1942 |         ad->afhead[x].flags &= (~AF_FILTERED);
 | 
|---|
| 1943 |     }
 | 
|---|
| 1944 |     ReSort(hwnd);
 | 
|---|
| 1945 |     PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| 1946 |     WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 1947 |   }
 | 
|---|
| 1948 | }
 | 
|---|
| 1949 | 
 | 
|---|
| 1950 | static ULONG RemoveDeleted(HWND hwnd)
 | 
|---|
| 1951 | {
 | 
|---|
| 1952 |   ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 1953 |   ULONG oldafheadcnt = pAD->afheadcnt;
 | 
|---|
| 1954 |   register ULONG x, y;
 | 
|---|
| 1955 | 
 | 
|---|
| 1956 |   for (x = 0; x < pAD->afheadcnt; x++) {
 | 
|---|
| 1957 |     if (pAD->afhead[x].flags & AF_DELETED) {
 | 
|---|
| 1958 |       for (y = x; y < pAD->afheadcnt; y++) {
 | 
|---|
| 1959 |         if (~pAD->afhead[y].flags & AF_DELETED)
 | 
|---|
| 1960 |           break;
 | 
|---|
| 1961 |         if (pAD->afhead[y].flags & AF_SELECTED &&
 | 
|---|
| 1962 |             ~pAD->afhead[y].flags & AF_FILTERED) {
 | 
|---|
| 1963 |           pAD->selected--;
 | 
|---|
| 1964 |           pAD->ullSelectedBytes -= pAD->afhead[y].cbFile;
 | 
|---|
| 1965 |         }
 | 
|---|
| 1966 |         xfree(pAD->afhead[y].fullname, pszSrcFile, __LINE__);
 | 
|---|
| 1967 |       }
 | 
|---|
| 1968 |       memmove(&(pAD->afhead[x]), &(pAD->afhead[y]),
 | 
|---|
| 1969 |               (pAD->afheadcnt - y) * sizeof(ALLFILES));
 | 
|---|
| 1970 |       pAD->afheadcnt -= (y - x);
 | 
|---|
| 1971 |     }
 | 
|---|
| 1972 |   }                                     // for x
 | 
|---|
| 1973 |   if (pAD->afheadcnt != oldafheadcnt) {
 | 
|---|
| 1974 | 
 | 
|---|
| 1975 |     ALLFILES *tempa, **templ;
 | 
|---|
| 1976 | 
 | 
|---|
| 1977 |     if (!pAD->afheadcnt)
 | 
|---|
| 1978 |       FreeAllFilesList(hwnd);
 | 
|---|
| 1979 |     else {
 | 
|---|
| 1980 |       tempa =
 | 
|---|
| 1981 |         xrealloc(pAD->afhead, pAD->afheadcnt * sizeof(ALLFILES), pszSrcFile,
 | 
|---|
| 1982 |                  __LINE__);
 | 
|---|
| 1983 |       if (tempa) {
 | 
|---|
| 1984 |         pAD->afhead = tempa;
 | 
|---|
| 1985 |         pAD->afalloc = pAD->afheadcnt;
 | 
|---|
| 1986 |       }
 | 
|---|
| 1987 |       templ =
 | 
|---|
| 1988 |         xrealloc(pAD->afindex, pAD->afheadcnt * sizeof(ALLFILES *), pszSrcFile,
 | 
|---|
| 1989 |                  __LINE__);
 | 
|---|
| 1990 |       if (templ)
 | 
|---|
| 1991 |         pAD->afindex = templ;
 | 
|---|
| 1992 |       DosPostEventSem(CompactSem);
 | 
|---|
| 1993 |       ReSort(hwnd);
 | 
|---|
| 1994 |     }
 | 
|---|
| 1995 |   }
 | 
|---|
| 1996 |   return pAD->afheadcnt;
 | 
|---|
| 1997 | }
 | 
|---|
| 1998 | 
 | 
|---|
| 1999 | static VOID DoADir(HWND hwnd, CHAR * pathname)
 | 
|---|
| 2000 | {
 | 
|---|
| 2001 |   ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 2002 |   CHAR *filename, *enddir;
 | 
|---|
| 2003 |   PFILEFINDBUF3L pffbArray, pffbFile;
 | 
|---|
| 2004 |   HDIR hdir = HDIR_CREATE;
 | 
|---|
| 2005 |   ULONG ulFindCnt;
 | 
|---|
| 2006 |   ULONG ulFindMax;
 | 
|---|
| 2007 |   ULONG ulBufBytes;
 | 
|---|
| 2008 |   ULONG x;
 | 
|---|
| 2009 |   APIRET rc;
 | 
|---|
| 2010 |   static BOOL fDone;
 | 
|---|
| 2011 | 
 | 
|---|
| 2012 |   filename = xmalloc(CCHMAXPATH + 100, pszSrcFile, __LINE__);
 | 
|---|
| 2013 |   if (!filename)
 | 
|---|
| 2014 |     return;
 | 
|---|
| 2015 | 
 | 
|---|
| 2016 |   ulFindMax = FilesToGet;
 | 
|---|
| 2017 |   if (fRemoteBug && isalpha(*pathname) && pathname[1] == ':' &&
 | 
|---|
| 2018 |       pathname[2] == '\\' &&
 | 
|---|
| 2019 |       (driveflags[toupper(*pathname) - 'A'] & DRIVE_REMOTE))
 | 
|---|
| 2020 |     ulFindMax = 1;
 | 
|---|
| 2021 | 
 | 
|---|
| 2022 |   ulBufBytes = sizeof(FILEFINDBUF3L) * ulFindMax;
 | 
|---|
| 2023 |   pffbArray = xmalloc(ulBufBytes, pszSrcFile, __LINE__);
 | 
|---|
| 2024 |   if (!pffbArray) {
 | 
|---|
| 2025 |     free(filename);
 | 
|---|
| 2026 |     return;
 | 
|---|
| 2027 |   }
 | 
|---|
| 2028 | 
 | 
|---|
| 2029 |   strcpy(filename, pathname);
 | 
|---|
| 2030 |   enddir = &filename[strlen(filename) - 1];
 | 
|---|
| 2031 |   if (*enddir != '\\') {
 | 
|---|
| 2032 |     enddir++;
 | 
|---|
| 2033 |     *enddir = '\\';
 | 
|---|
| 2034 |   }
 | 
|---|
| 2035 |   enddir++;
 | 
|---|
| 2036 |   strcpy(enddir, "*");
 | 
|---|
| 2037 |   DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 2038 |   ulFindCnt = ulFindMax;
 | 
|---|
| 2039 |   rc = xDosFindFirst(filename, &hdir, FILE_NORMAL | FILE_ARCHIVED |
 | 
|---|
| 2040 |                      FILE_READONLY | FILE_DIRECTORY | FILE_SYSTEM |
 | 
|---|
| 2041 |                      FILE_HIDDEN,
 | 
|---|
| 2042 |                      pffbArray, ulBufBytes, &ulFindCnt, FIL_STANDARDL);
 | 
|---|
| 2043 |   if (!rc) {
 | 
|---|
| 2044 |     do {
 | 
|---|
| 2045 |       priority_normal();
 | 
|---|
| 2046 |       pffbFile = pffbArray;
 | 
|---|
| 2047 | 
 | 
|---|
| 2048 |       for (x = 0; x < ulFindCnt; x++) {
 | 
|---|
| 2049 |         if (ad->stopflag)
 | 
|---|
| 2050 |           break;
 | 
|---|
| 2051 |         if (pffbFile->attrFile & FILE_DIRECTORY) {
 | 
|---|
| 2052 |           // Skip . and ..
 | 
|---|
| 2053 |           if (pffbFile->achName[0] != '.' ||
 | 
|---|
| 2054 |               (pffbFile->achName[1] &&
 | 
|---|
| 2055 |                (pffbFile->achName[1] != '.' || pffbFile->achName[2]))) {
 | 
|---|
| 2056 |             strcpy(enddir, pffbFile->achName);
 | 
|---|
| 2057 |             DoADir(hwnd, filename);
 | 
|---|
| 2058 |           }
 | 
|---|
| 2059 |         }
 | 
|---|
| 2060 |         else {
 | 
|---|
| 2061 |           *enddir = 0;
 | 
|---|
| 2062 |           strcpy(enddir, pffbFile->achName);
 | 
|---|
| 2063 |           if (strlen(filename) > CCHMAXPATH) {
 | 
|---|
| 2064 |             // Complain if pathnames exceeds max
 | 
|---|
| 2065 |             DosFindClose(hdir);
 | 
|---|
| 2066 |             free(pffbArray);
 | 
|---|
| 2067 |             free(filename);
 | 
|---|
| 2068 |             if (!fDone) {
 | 
|---|
| 2069 |               fDone = TRUE;
 | 
|---|
| 2070 |               saymsg(MB_OK | MB_ICONASTERISK,
 | 
|---|
| 2071 |                      HWND_DESKTOP,
 | 
|---|
| 2072 |                      GetPString(IDS_WARNINGTEXT),
 | 
|---|
| 2073 |                      GetPString(IDS_LENGTHEXCEEDSMAXPATHTEXT));
 | 
|---|
| 2074 |             }
 | 
|---|
| 2075 |             return;
 | 
|---|
| 2076 |           }
 | 
|---|
| 2077 |           if (!ad->afalloc || ad->afheadcnt > ad->afalloc - 1) {
 | 
|---|
| 2078 | 
 | 
|---|
| 2079 |             ALLFILES *temp;
 | 
|---|
| 2080 | 
 | 
|---|
| 2081 |             temp = xrealloc(ad->afhead, (ad->afalloc + 1000) *
 | 
|---|
| 2082 |                             sizeof(ALLFILES), pszSrcFile, __LINE__);
 | 
|---|
| 2083 |             if (!temp) {
 | 
|---|
| 2084 |               ad->stopflag = 1;
 | 
|---|
| 2085 |               break;
 | 
|---|
| 2086 |             }
 | 
|---|
| 2087 |             else {
 | 
|---|
| 2088 |               ad->afhead = temp;
 | 
|---|
| 2089 |               if (ad->stopflag)
 | 
|---|
| 2090 |                 break;
 | 
|---|
| 2091 |               ad->afalloc += 1000;
 | 
|---|
| 2092 |             }
 | 
|---|
| 2093 |           }
 | 
|---|
| 2094 |           ad->afhead[ad->afheadcnt].fullname =
 | 
|---|
| 2095 |             xstrdup(filename, pszSrcFile, __LINE__);
 | 
|---|
| 2096 |           if (!ad->afhead[ad->afheadcnt].fullname) {
 | 
|---|
| 2097 |             ad->stopflag = 1;
 | 
|---|
| 2098 |             break;
 | 
|---|
| 2099 |           }
 | 
|---|
| 2100 |           else {
 | 
|---|
| 2101 |             ad->afhead[ad->afheadcnt].filename =
 | 
|---|
| 2102 |               ad->afhead[ad->afheadcnt].fullname + (enddir - filename);
 | 
|---|
| 2103 |             ad->afhead[ad->afheadcnt].cbFile = pffbFile->cbFile;
 | 
|---|
| 2104 |             ad->afhead[ad->afheadcnt].date = pffbFile->fdateLastWrite;
 | 
|---|
| 2105 |             ad->afhead[ad->afheadcnt].time = pffbFile->ftimeLastWrite;
 | 
|---|
| 2106 |             ad->afhead[ad->afheadcnt].attrFile = (USHORT) pffbFile->attrFile;
 | 
|---|
| 2107 |             ad->afhead[ad->afheadcnt].flags = 0;
 | 
|---|
| 2108 |             ad->afheadcnt++;
 | 
|---|
| 2109 |             if (ad->longest < pffbFile->cchName)
 | 
|---|
| 2110 |               ad->longest = pffbFile->cchName;
 | 
|---|
| 2111 |             if (ad->longestw < pffbFile->cchName + (enddir - filename))
 | 
|---|
| 2112 |               ad->longestw = pffbFile->cchName + (enddir - filename);
 | 
|---|
| 2113 |           }
 | 
|---|
| 2114 |         }
 | 
|---|
| 2115 |         pffbFile = (PFILEFINDBUF3L)((PBYTE)pffbFile + pffbFile->oNextEntryOffset);
 | 
|---|
| 2116 |       } // for
 | 
|---|
| 2117 | 
 | 
|---|
| 2118 |       if (ad->stopflag)
 | 
|---|
| 2119 |         break;
 | 
|---|
| 2120 | 
 | 
|---|
| 2121 |       ulFindCnt = ulFindMax;
 | 
|---|
| 2122 |       rc = xDosFindNext(hdir,
 | 
|---|
| 2123 |                         pffbArray,
 | 
|---|
| 2124 |                         sizeof(FILEFINDBUF3L) * ulFindCnt,
 | 
|---|
| 2125 |                         &ulFindCnt,
 | 
|---|
| 2126 |                         FIL_STANDARDL);
 | 
|---|
| 2127 |     } while (!rc);
 | 
|---|
| 2128 |     DosFindClose(hdir);
 | 
|---|
| 2129 |   }
 | 
|---|
| 2130 | 
 | 
|---|
| 2131 |   if (rc && rc != ERROR_NO_MORE_FILES) {
 | 
|---|
| 2132 |     Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
 | 
|---|
| 2133 |               GetPString(IDS_CANTFINDDIRTEXT), filename);
 | 
|---|
| 2134 |   }
 | 
|---|
| 2135 | 
 | 
|---|
| 2136 |   free(pffbArray);
 | 
|---|
| 2137 |   free(filename);
 | 
|---|
| 2138 | }
 | 
|---|
| 2139 | 
 | 
|---|
| 2140 | static VOID FindAllThread(VOID * args)
 | 
|---|
| 2141 | {
 | 
|---|
| 2142 |   ULONG ulDriveNum, ulDriveMap, x;
 | 
|---|
| 2143 |   CHAR startname[] = " :\\";
 | 
|---|
| 2144 |   HWND hwnd = (HWND) args;
 | 
|---|
| 2145 |   HAB hab2 = (HAB) 0;
 | 
|---|
| 2146 |   HMQ hmq2 = (HMQ) 0;
 | 
|---|
| 2147 |   ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 2148 |   APIRET apiret;
 | 
|---|
| 2149 | 
 | 
|---|
| 2150 | # ifdef FORTIFY
 | 
|---|
| 2151 |   Fortify_EnterScope();
 | 
|---|
| 2152 | #  endif
 | 
|---|
| 2153 | 
 | 
|---|
| 2154 |   // DbgMsg(pszSrcFile, __LINE__, "FindAllThread requesting hmtxScan");
 | 
|---|
| 2155 |   apiret = DosRequestMutexSem(ad->hmtxScan, SEM_INDEFINITE_WAIT);
 | 
|---|
| 2156 |   if (apiret != NO_ERROR)
 | 
|---|
| 2157 |     Dos_Error(MB_CANCEL, apiret, hwnd, pszSrcFile, __LINE__, "DosRequestMutexSem");
 | 
|---|
| 2158 |   else {
 | 
|---|
| 2159 |     priority_normal();
 | 
|---|
| 2160 |     hab2 = WinInitialize(0);
 | 
|---|
| 2161 | 
 | 
|---|
| 2162 |     if (hab2) {
 | 
|---|
| 2163 |       hmq2 = WinCreateMsgQueue(hab2, 0);
 | 
|---|
| 2164 |       if (hmq2) {
 | 
|---|
| 2165 |         WinCancelShutdown(hmq2, TRUE);
 | 
|---|
| 2166 |         IncrThreadUsage();
 | 
|---|
| 2167 |         if (!*ad->szFindPath) {
 | 
|---|
| 2168 |           DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 2169 |           if (!DosQCurDisk(&ulDriveNum, &ulDriveMap)) {
 | 
|---|
| 2170 |             for (x = 2; x < 26 && !ad->stopflag; x++) {
 | 
|---|
| 2171 |               if ((ulDriveMap & (1 << x)) && ad->abDrvFlags[x]) {
 | 
|---|
| 2172 |                 *startname = (CHAR) (x + 'A');
 | 
|---|
| 2173 |                 DoADir(hwnd, startname);
 | 
|---|
| 2174 |                 if (ad->stopflag)
 | 
|---|
| 2175 |                   break;
 | 
|---|
| 2176 |                 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| 2177 |                 DosSleep(0); //26 Aug 07 GKY 1
 | 
|---|
| 2178 |               }
 | 
|---|
| 2179 |             } // for
 | 
|---|
| 2180 |           }
 | 
|---|
| 2181 |         }
 | 
|---|
| 2182 |         else
 | 
|---|
| 2183 |           DoADir(hwnd, ad->szFindPath);
 | 
|---|
| 2184 | 
 | 
|---|
| 2185 |         DosPostEventSem(CompactSem);
 | 
|---|
| 2186 |       }
 | 
|---|
| 2187 |     }
 | 
|---|
| 2188 | 
 | 
|---|
| 2189 |     if (!ad->stopflag) {
 | 
|---|
| 2190 |       if (ad->afalloc != ad->afheadcnt) {
 | 
|---|
| 2191 | 
 | 
|---|
| 2192 |         ALLFILES *tempa, **templ;
 | 
|---|
| 2193 | 
 | 
|---|
| 2194 |         tempa =
 | 
|---|
| 2195 |           xrealloc(ad->afhead, sizeof(ALLFILES) * ad->afheadcnt, pszSrcFile,
 | 
|---|
| 2196 |                    __LINE__);
 | 
|---|
| 2197 |         if (tempa) {
 | 
|---|
| 2198 |           ad->afhead = tempa;
 | 
|---|
| 2199 |           ad->afalloc = ad->afheadcnt;
 | 
|---|
| 2200 |         }
 | 
|---|
| 2201 |         templ =
 | 
|---|
| 2202 |           xrealloc(ad->afindex, sizeof(ALLFILES *) * ad->afheadcnt, pszSrcFile,
 | 
|---|
| 2203 |                    __LINE__);
 | 
|---|
| 2204 |         if (templ)
 | 
|---|
| 2205 |           ad->afindex = templ;
 | 
|---|
| 2206 |         DosPostEventSem(CompactSem);
 | 
|---|
| 2207 |       }
 | 
|---|
| 2208 |       PostMsg(hwnd, UM_RESCAN, MPFROMLONG(1), MPVOID);
 | 
|---|
| 2209 |       ReSort(hwnd);
 | 
|---|
| 2210 |     }
 | 
|---|
| 2211 | 
 | 
|---|
| 2212 |     // DbgMsg(pszSrcFile, __LINE__, "FindAllThread releasing hmtxScan");
 | 
|---|
| 2213 |     DosReleaseMutexSem(ad->hmtxScan);
 | 
|---|
| 2214 |   }
 | 
|---|
| 2215 | 
 | 
|---|
| 2216 |   if (hmq2) {
 | 
|---|
| 2217 |     PostMsg(hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID);
 | 
|---|
| 2218 |     WinDestroyMsgQueue(hmq2);
 | 
|---|
| 2219 |   }
 | 
|---|
| 2220 | 
 | 
|---|
| 2221 |   if (hab2) {
 | 
|---|
| 2222 |     DecrThreadUsage();
 | 
|---|
| 2223 |     WinTerminate(hab2);
 | 
|---|
| 2224 |   }
 | 
|---|
| 2225 | 
 | 
|---|
| 2226 | # ifdef FORTIFY
 | 
|---|
| 2227 |   Fortify_LeaveScope();
 | 
|---|
| 2228 | #  endif
 | 
|---|
| 2229 | }
 | 
|---|
| 2230 | 
 | 
|---|
| 2231 | MRESULT EXPENTRY AFDrvsWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| 2232 | {
 | 
|---|
| 2233 |   switch (msg) {
 | 
|---|
| 2234 |   case WM_INITDLG:
 | 
|---|
| 2235 |     if (mp2) {
 | 
|---|
| 2236 | 
 | 
|---|
| 2237 |       ULONG ulDriveNum, ulDriveMap, x;
 | 
|---|
| 2238 |       CHAR startname[] = " :";
 | 
|---|
| 2239 |       SHORT sSelect;
 | 
|---|
| 2240 |       ALLDATA *ad;
 | 
|---|
| 2241 | 
 | 
|---|
| 2242 |       ad = (ALLDATA *) mp2;
 | 
|---|
| 2243 |       WinSetWindowPtr(hwnd, QWL_USER, mp2);
 | 
|---|
| 2244 |       DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 2245 |       if (!DosQCurDisk(&ulDriveNum, &ulDriveMap)) {
 | 
|---|
| 2246 |         for (x = 2; x < 26 && !ad->stopflag; x++) {
 | 
|---|
| 2247 |           if (!(driveflags[x] & (DRIVE_IGNORE | DRIVE_INVALID))) {
 | 
|---|
| 2248 |             if (ulDriveMap & (1 << x)) {
 | 
|---|
| 2249 |               *startname = (CHAR) (x + 'A');
 | 
|---|
| 2250 |               sSelect = (SHORT) WinSendDlgItemMsg(hwnd, DRVS_LISTBOX,
 | 
|---|
| 2251 |                                                   LM_INSERTITEM,
 | 
|---|
| 2252 |                                                   MPFROM2SHORT(LIT_END, 0),
 | 
|---|
| 2253 |                                                   MPFROMP(startname));
 | 
|---|
| 2254 |               if (sSelect >= 0 && ad->abDrvFlags[x])
 | 
|---|
| 2255 |                 WinSendDlgItemMsg(hwnd, DRVS_LISTBOX, LM_SELECTITEM,
 | 
|---|
| 2256 |                                   MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE));
 | 
|---|
| 2257 |             }
 | 
|---|
| 2258 |           }
 | 
|---|
| 2259 |         }
 | 
|---|
| 2260 |       }
 | 
|---|
| 2261 |     }
 | 
|---|
| 2262 |     else
 | 
|---|
| 2263 |       WinDismissDlg(hwnd, 0);
 | 
|---|
| 2264 |     break;
 | 
|---|
| 2265 | 
 | 
|---|
| 2266 |   case WM_CONTROL:
 | 
|---|
| 2267 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 2268 |     case DRVS_LISTBOX:
 | 
|---|
| 2269 |       switch (SHORT2FROMMP(mp1)) {
 | 
|---|
| 2270 |       case LN_ENTER:
 | 
|---|
| 2271 |         PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID);
 | 
|---|
| 2272 |         break;
 | 
|---|
| 2273 |       }
 | 
|---|
| 2274 |       break;
 | 
|---|
| 2275 |     }
 | 
|---|
| 2276 |     return 0;
 | 
|---|
| 2277 | 
 | 
|---|
| 2278 |   case WM_COMMAND:
 | 
|---|
| 2279 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 2280 |     case DID_OK:
 | 
|---|
| 2281 |       {
 | 
|---|
| 2282 |         INT x;
 | 
|---|
| 2283 |         SHORT sSelect;
 | 
|---|
| 2284 |         CHAR filename[3];
 | 
|---|
| 2285 |         ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 2286 | 
 | 
|---|
| 2287 |         memset(ad->abDrvFlags, 0, sizeof(ad->abDrvFlags));
 | 
|---|
| 2288 |         sSelect = (SHORT) WinSendDlgItemMsg(hwnd, DRVS_LISTBOX,
 | 
|---|
| 2289 |                                             LM_QUERYSELECTION,
 | 
|---|
| 2290 |                                             MPFROM2SHORT(LIT_FIRST, 0),
 | 
|---|
| 2291 |                                             MPVOID);
 | 
|---|
| 2292 |         while (sSelect >= 0) {
 | 
|---|
| 2293 |           *filename = 0;
 | 
|---|
| 2294 |           if (WinSendDlgItemMsg(hwnd, DRVS_LISTBOX, LM_QUERYITEMTEXT,
 | 
|---|
| 2295 |                                 MPFROM2SHORT(sSelect, 2),
 | 
|---|
| 2296 |                                 MPFROMP(filename)) && *filename)
 | 
|---|
| 2297 |             ad->abDrvFlags[*filename - 'A'] = 1;
 | 
|---|
| 2298 |           sSelect = (SHORT) WinSendDlgItemMsg(hwnd, DRVS_LISTBOX,
 | 
|---|
| 2299 |                                               LM_QUERYSELECTION,
 | 
|---|
| 2300 |                                               MPFROM2SHORT(sSelect, 0),
 | 
|---|
| 2301 |                                               MPVOID);
 | 
|---|
| 2302 |         }
 | 
|---|
| 2303 |         for (x = 2; x < 26; x++) {
 | 
|---|
| 2304 |           if (ad->abDrvFlags[x]) {
 | 
|---|
| 2305 |             WinDismissDlg(hwnd, 1);
 | 
|---|
| 2306 |             return 0;
 | 
|---|
| 2307 |           }
 | 
|---|
| 2308 |         }
 | 
|---|
| 2309 |       }
 | 
|---|
| 2310 |       WinDismissDlg(hwnd, 0);
 | 
|---|
| 2311 |       break;
 | 
|---|
| 2312 | 
 | 
|---|
| 2313 |     case IDM_HELP:
 | 
|---|
| 2314 |       if (hwndHelp)
 | 
|---|
| 2315 |         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
 | 
|---|
| 2316 |                    MPFROM2SHORT(HELP_DRVSWND, 0), MPFROMSHORT(HM_RESOURCEID));
 | 
|---|
| 2317 |       break;
 | 
|---|
| 2318 | 
 | 
|---|
| 2319 |     case DID_CANCEL:
 | 
|---|
| 2320 |       WinDismissDlg(hwnd, 0);
 | 
|---|
| 2321 |       break;
 | 
|---|
| 2322 |     }
 | 
|---|
| 2323 |     return 0;
 | 
|---|
| 2324 |   }
 | 
|---|
| 2325 |   return WinDefDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| 2326 | }
 | 
|---|
| 2327 | 
 | 
|---|
| 2328 | static HPS InitWindow(HWND hwnd)
 | 
|---|
| 2329 | {
 | 
|---|
| 2330 |   ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 2331 |   HPS hps = (HPS) 0;
 | 
|---|
| 2332 |   SIZEL sizel;
 | 
|---|
| 2333 |   FONTMETRICS FontMetrics;
 | 
|---|
| 2334 | 
 | 
|---|
| 2335 |   if (ad) {
 | 
|---|
| 2336 |     sizel.cx = sizel.cy = 0;
 | 
|---|
| 2337 |     hps = GpiCreatePS(WinQueryAnchorBlock(hwnd), WinOpenWindowDC(hwnd),
 | 
|---|
| 2338 |                       (PSIZEL) & sizel, PU_PELS | GPIF_DEFAULT | GPIT_MICRO |
 | 
|---|
| 2339 |                       GPIA_ASSOC);
 | 
|---|
| 2340 |     if (hps) {
 | 
|---|
| 2341 |       GpiSetCp(hps, (ULONG) ad->fattrs.usCodePage);
 | 
|---|
| 2342 |       GpiCreateLogFont(hps, NULL, SEEALLFILECNR_FONT_LCID, &ad->fattrs);
 | 
|---|
| 2343 |       GpiSetCharSet(hps, SEEALLFILECNR_FONT_LCID);
 | 
|---|
| 2344 |       GpiQueryFontMetrics(hps, sizeof(FontMetrics), &FontMetrics);
 | 
|---|
| 2345 |       ad->fattrs.lAveCharWidth = FontMetrics.lAveCharWidth;
 | 
|---|
| 2346 |       ad->fattrs.lMaxBaselineExt = FontMetrics.lMaxBaselineExt;
 | 
|---|
| 2347 |       ad->lMaxAscender = max(FontMetrics.lMaxAscender, 0);
 | 
|---|
| 2348 |       ad->lMaxDescender = max(FontMetrics.lMaxDescender, 0);
 | 
|---|
| 2349 |       ad->lMaxHeight = ad->lMaxDescender + ad->lMaxAscender;
 | 
|---|
| 2350 |       if (ad->fattrs.usCodePage != FontMetrics.usCodePage) {
 | 
|---|
| 2351 |         ad->fattrs.usCodePage = FontMetrics.usCodePage;
 | 
|---|
| 2352 |         Codepage = ad->fattrs.usCodePage;
 | 
|---|
| 2353 |         PrfWriteProfileData(fmprof,
 | 
|---|
| 2354 |                             appname,
 | 
|---|
| 2355 |                             "Seeall.Codepage",
 | 
|---|
| 2356 |                             &ad->fattrs.usCodePage, sizeof(USHORT));
 | 
|---|
| 2357 |       }
 | 
|---|
| 2358 |       else if (ad->fattrs.usCodePage) {
 | 
|---|
| 2359 | 
 | 
|---|
| 2360 |         HMQ hmq;
 | 
|---|
| 2361 |         ULONG cps[50], len, x;
 | 
|---|
| 2362 | 
 | 
|---|
| 2363 |         if (!DosQueryCp(sizeof(cps), cps, &len)) {
 | 
|---|
| 2364 |           for (x = 0; x < len / sizeof(ULONG); x++) {
 | 
|---|
| 2365 |             if (cps[x] == (ULONG) ad->fattrs.usCodePage) {
 | 
|---|
| 2366 |               hmq = WinQueryWindowULong(hwnd, QWL_HMQ);
 | 
|---|
| 2367 |               WinSetCp(hmq, ad->fattrs.usCodePage);
 | 
|---|
| 2368 |               break;
 | 
|---|
| 2369 |             }
 | 
|---|
| 2370 |           }
 | 
|---|
| 2371 |         }
 | 
|---|
| 2372 |         DosSetProcessCp((ULONG) ad->fattrs.usCodePage);
 | 
|---|
| 2373 |       }
 | 
|---|
| 2374 |       GpiSetBackMix(hps, BM_OVERPAINT);
 | 
|---|
| 2375 |     }
 | 
|---|
| 2376 |   }
 | 
|---|
| 2377 |   return (hps);
 | 
|---|
| 2378 | }
 | 
|---|
| 2379 | 
 | 
|---|
| 2380 | static VOID PaintLine(HWND hwnd, HPS hps, ULONG whichfile, ULONG topfile,
 | 
|---|
| 2381 |                       RECTL * Rectl)
 | 
|---|
| 2382 | {
 | 
|---|
| 2383 |   ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 2384 |   POINTL ptl;
 | 
|---|
| 2385 |   CHAR szBuff[CCHMAXPATH + 80], szCmmaFmtFileSize[81], szDate[DATE_BUF_BYTES];
 | 
|---|
| 2386 |   ULONG len, y;
 | 
|---|
| 2387 | 
 | 
|---|
| 2388 |   y = (ad->invertsort) ? (ad->afindexcnt - 1) - whichfile : whichfile;
 | 
|---|
| 2389 |   ptl.y = (Rectl->yTop -
 | 
|---|
| 2390 |            (ad->lMaxHeight * (((whichfile + 1) - topfile) + 1)));
 | 
|---|
| 2391 |   ptl.x = ad->horzscroll;
 | 
|---|
| 2392 |   if (ptl.y < Rectl->yBottom || ptl.y > Rectl->yTop || y > ad->afindexcnt)
 | 
|---|
| 2393 |     return;
 | 
|---|
| 2394 |   GpiSetBackMix(hps, BM_OVERPAINT);
 | 
|---|
| 2395 |   if (ad->afindex[y]->flags & AF_SELECTED) {
 | 
|---|
| 2396 |     GpiSetColor(hps, standardcolors[Colors[COLORS_SELECTEDNORMALFORE]]);
 | 
|---|
| 2397 |     GpiSetBackColor(hps, (whichfile == ad->cursored - 1) ?
 | 
|---|
| 2398 |                     standardcolors[Colors[COLORS_CURSOREDSELECTEDBACK]] :
 | 
|---|
| 2399 |                     standardcolors[Colors[COLORS_SELECTEDBACK]]);
 | 
|---|
| 2400 |   }
 | 
|---|
| 2401 |   else {
 | 
|---|
| 2402 |     GpiSetColor(hps,
 | 
|---|
| 2403 |                 ((ad->afindex[y]->attrFile & (FILE_SYSTEM | FILE_HIDDEN)) !=
 | 
|---|
| 2404 |                  0) ? standardcolors[Colors[COLORS_SYSTEMFORE]] : ((ad->
 | 
|---|
| 2405 |                                                                     afindex
 | 
|---|
| 2406 |                                                                     [y]->
 | 
|---|
| 2407 |                                                                     attrFile &
 | 
|---|
| 2408 |                                                                     FILE_READONLY)
 | 
|---|
| 2409 |                                                                    !=
 | 
|---|
| 2410 |                                                                    0) ?
 | 
|---|
| 2411 |                 standardcolors[Colors[COLORS_READONLYFORE]] :
 | 
|---|
| 2412 |                 standardcolors[Colors[COLORS_NORMALFORE]]);
 | 
|---|
| 2413 |     GpiSetBackColor(hps,
 | 
|---|
| 2414 |                     (whichfile ==
 | 
|---|
| 2415 |                      ad->cursored -
 | 
|---|
| 2416 |                      1) ? standardcolors[Colors[COLORS_CURSOREDNORMALBACK]] :
 | 
|---|
| 2417 |                     standardcolors[Colors[COLORS_NORMALBACK]]);
 | 
|---|
| 2418 |   }
 | 
|---|
| 2419 |   CommaFmtULL(szCmmaFmtFileSize,
 | 
|---|
| 2420 |               sizeof(szCmmaFmtFileSize), ad->afindex[y]->cbFile, ' ');
 | 
|---|
| 2421 |   FDateFormat(szDate, ad->afindex[y]->date);
 | 
|---|
| 2422 |   len = sprintf(szBuff,
 | 
|---|
| 2423 |                 "%c%-*.*s  %-12s  %c%c%c%c%c  %s %02u%s%02u%s%02u ",
 | 
|---|
| 2424 |                 whichfile == ad->cursored - 1 ? '>' : ' ',
 | 
|---|
| 2425 |                 ad->fullnames ? ad->longestw : ad->longest,
 | 
|---|
| 2426 |                 ad->fullnames ? ad->longestw : ad->longest,
 | 
|---|
| 2427 |                 ad->fullnames ? ad->afindex[y]->fullname :
 | 
|---|
| 2428 |                 ad->afindex[y]->filename,
 | 
|---|
| 2429 |                 szCmmaFmtFileSize,
 | 
|---|
| 2430 |                 "-A"[((ad->afindex[y]->attrFile & FILE_ARCHIVED) != 0)],
 | 
|---|
| 2431 |                 "-R"[((ad->afindex[y]->attrFile & FILE_READONLY) != 0)],
 | 
|---|
| 2432 |                 "-H"[((ad->afindex[y]->attrFile & FILE_HIDDEN) != 0)],
 | 
|---|
| 2433 |                 "-S"[((ad->afindex[y]->attrFile & FILE_SYSTEM) != 0)],
 | 
|---|
| 2434 |                 "-D"[((ad->afindex[y]->attrFile & FILE_DIRECTORY) != 0)],
 | 
|---|
| 2435 |                 szDate,
 | 
|---|
| 2436 |                 ad->afindex[y]->time.hours, TimeSeparator,
 | 
|---|
| 2437 |                 ad->afindex[y]->time.minutes, TimeSeparator,
 | 
|---|
| 2438 |                 ad->afindex[y]->time.twosecs * 2);
 | 
|---|
| 2439 |   GpiCharStringAt(hps, &ptl, len, szBuff);
 | 
|---|
| 2440 |   GpiQueryCurrentPosition(hps, &ptl);
 | 
|---|
| 2441 |   if (ptl.x + abs(ad->horzscroll) > ad->maxx) {
 | 
|---|
| 2442 |     ad->maxx = ptl.x + abs(ad->horzscroll);
 | 
|---|
| 2443 |     WinSendMsg(ad->hhscroll, SBM_SETTHUMBSIZE,
 | 
|---|
| 2444 |                MPFROM2SHORT((SHORT) Rectl->xRight, (SHORT) ad->maxx), MPVOID);
 | 
|---|
| 2445 |   }
 | 
|---|
| 2446 | }
 | 
|---|
| 2447 | 
 | 
|---|
| 2448 | MRESULT EXPENTRY SeeStatusProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| 2449 | {
 | 
|---|
| 2450 |   switch (msg) {
 | 
|---|
| 2451 |   case WM_CREATE:
 | 
|---|
| 2452 |     return CommonTextProc(hwnd, msg, mp1, mp2);
 | 
|---|
| 2453 | 
 | 
|---|
| 2454 |   case WM_SETFOCUS:
 | 
|---|
| 2455 |     if (mp2)
 | 
|---|
| 2456 |       PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
 | 
|---|
| 2457 |     break;
 | 
|---|
| 2458 | 
 | 
|---|
| 2459 |   case WM_PAINT:
 | 
|---|
| 2460 |     {
 | 
|---|
| 2461 |       SWP swp;
 | 
|---|
| 2462 |       POINTL ptl;
 | 
|---|
| 2463 |       HPS hps;
 | 
|---|
| 2464 | 
 | 
|---|
| 2465 |       PaintRecessedWindow(hwnd, (HPS) 0, FALSE, FALSE);
 | 
|---|
| 2466 |       hps = WinGetPS(WinQueryWindow(hwnd, QW_PARENT));
 | 
|---|
| 2467 |       if (hps) {
 | 
|---|
| 2468 |         WinQueryWindowPos(hwnd, &swp);
 | 
|---|
| 2469 |         ptl.x = swp.x - 1;
 | 
|---|
| 2470 |         ptl.y = swp.y + swp.cy + 2;
 | 
|---|
| 2471 |         GpiMove(hps, &ptl);
 | 
|---|
| 2472 |         GpiSetColor(hps, CLR_WHITE);
 | 
|---|
| 2473 |         ptl.x = swp.x + swp.cx;
 | 
|---|
| 2474 |         GpiLine(hps, &ptl);
 | 
|---|
| 2475 |         WinReleasePS(hps);
 | 
|---|
| 2476 |       }
 | 
|---|
| 2477 |     }
 | 
|---|
| 2478 |     break;
 | 
|---|
| 2479 | 
 | 
|---|
| 2480 |   case UM_FOCUSME:
 | 
|---|
| 2481 |     WinSetFocus(HWND_DESKTOP, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
| 2482 |                                               FID_CLIENT));
 | 
|---|
| 2483 |     return 0;
 | 
|---|
| 2484 |   }
 | 
|---|
| 2485 |   return PFNWPStatic(hwnd, msg, mp1, mp2);
 | 
|---|
| 2486 | }
 | 
|---|
| 2487 | 
 | 
|---|
| 2488 | MRESULT EXPENTRY SeeFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| 2489 | {
 | 
|---|
| 2490 |   PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 2491 | 
 | 
|---|
| 2492 |   switch (msg) {
 | 
|---|
| 2493 |   case WM_BUTTON1UP:
 | 
|---|
| 2494 |   case WM_BUTTON2UP:
 | 
|---|
| 2495 |   case WM_BUTTON3UP:
 | 
|---|
| 2496 |   case WM_MOUSEMOVE:
 | 
|---|
| 2497 |   case WM_CHORD:
 | 
|---|
| 2498 |     shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
 | 
|---|
| 2499 |     break;
 | 
|---|
| 2500 | 
 | 
|---|
| 2501 |   case WM_CHAR:
 | 
|---|
| 2502 |     shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
 | 
|---|
| 2503 |     break;
 | 
|---|
| 2504 | 
 | 
|---|
| 2505 |   case WM_CALCFRAMERECT:
 | 
|---|
| 2506 |     {
 | 
|---|
| 2507 |       MRESULT mr;
 | 
|---|
| 2508 |       PRECTL prectl;
 | 
|---|
| 2509 | 
 | 
|---|
| 2510 |       mr = oldproc(hwnd, msg, mp1, mp2);
 | 
|---|
| 2511 | 
 | 
|---|
| 2512 |       /**
 | 
|---|
| 2513 |        * Calculate the position of the client rectangle.
 | 
|---|
| 2514 |        * Otherwise,  we'll see a lot of redraw when we move the
 | 
|---|
| 2515 |        * client during WM_FORMATFRAME.
 | 
|---|
| 2516 |        */
 | 
|---|
| 2517 | 
 | 
|---|
| 2518 |       if (mr && mp2) {
 | 
|---|
| 2519 |         prectl = (PRECTL) mp1;
 | 
|---|
| 2520 |         prectl->yBottom += 22;
 | 
|---|
| 2521 |         prectl->yTop -= 24;
 | 
|---|
| 2522 |       }
 | 
|---|
| 2523 |       return mr;
 | 
|---|
| 2524 |     }
 | 
|---|
| 2525 | 
 | 
|---|
| 2526 |   case WM_FORMATFRAME:
 | 
|---|
| 2527 |     {
 | 
|---|
| 2528 |       SHORT sCount;
 | 
|---|
| 2529 |       PSWP pswp, pswpClient, pswpNew;
 | 
|---|
| 2530 | 
 | 
|---|
| 2531 |       sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
 | 
|---|
| 2532 | 
 | 
|---|
| 2533 |       /**
 | 
|---|
| 2534 |        * Reformat the frame to "squeeze" the client
 | 
|---|
| 2535 |        * and make room for status window sibling beneath
 | 
|---|
| 2536 |        */
 | 
|---|
| 2537 | 
 | 
|---|
| 2538 |       pswp = (PSWP) mp1;
 | 
|---|
| 2539 |       {
 | 
|---|
| 2540 |         SHORT x;
 | 
|---|
| 2541 | 
 | 
|---|
| 2542 |         for (x = 0; x < sCount; x++) {
 | 
|---|
| 2543 |           if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) {
 | 
|---|
| 2544 |             pswpClient = pswp;
 | 
|---|
| 2545 |             break;
 | 
|---|
| 2546 |           }
 | 
|---|
| 2547 |           pswp++;
 | 
|---|
| 2548 |         }
 | 
|---|
| 2549 |       }
 | 
|---|
| 2550 |       pswpNew = (PSWP) mp1 + sCount;
 | 
|---|
| 2551 |       *pswpNew = *pswpClient;
 | 
|---|
| 2552 |       pswpNew->hwnd = WinWindowFromID(hwnd, SEEALL_STATUS);
 | 
|---|
| 2553 |       pswpNew->x = pswpClient->x + 2;
 | 
|---|
| 2554 |       pswpNew->y = pswpClient->y + 2;
 | 
|---|
| 2555 |       pswpNew->cx = pswpClient->cx - 3;
 | 
|---|
| 2556 |       pswpNew->cy = 20;
 | 
|---|
| 2557 |       pswpClient->y = pswpNew->y + pswpNew->cy + 3;
 | 
|---|
| 2558 |       pswpClient->cy = (pswpClient->cy - pswpNew->cy) - 5;
 | 
|---|
| 2559 |       sCount++;
 | 
|---|
| 2560 |       return MRFROMSHORT(sCount);
 | 
|---|
| 2561 |     }
 | 
|---|
| 2562 | 
 | 
|---|
| 2563 |   case WM_QUERYFRAMECTLCOUNT:
 | 
|---|
| 2564 |     {
 | 
|---|
| 2565 |       SHORT sCount;
 | 
|---|
| 2566 | 
 | 
|---|
| 2567 |       sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
 | 
|---|
| 2568 |       sCount++;
 | 
|---|
| 2569 |       return MRFROMSHORT(sCount);
 | 
|---|
| 2570 |     }
 | 
|---|
| 2571 |   }
 | 
|---|
| 2572 |   return oldproc(hwnd, msg, mp1, mp2);
 | 
|---|
| 2573 | }
 | 
|---|
| 2574 | 
 | 
|---|
| 2575 | MRESULT EXPENTRY SeeAllWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| 2576 | {
 | 
|---|
| 2577 |   ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 2578 |   APIRET apiret;
 | 
|---|
| 2579 | 
 | 
|---|
| 2580 |   switch (msg) {
 | 
|---|
| 2581 |   case WM_CREATE:
 | 
|---|
| 2582 |     // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_CREATE");
 | 
|---|
| 2583 |     WinSetWindowPtr(hwnd, QWL_USER, NULL);
 | 
|---|
| 2584 | #   ifdef FORTIFY
 | 
|---|
| 2585 |     Fortify_EnterScope();
 | 
|---|
| 2586 | #    endif
 | 
|---|
| 2587 |     pAD = xmallocz(sizeof(ALLDATA), pszSrcFile, __LINE__);
 | 
|---|
| 2588 |     if (pAD) {
 | 
|---|
| 2589 |       HWND hwndFrame;
 | 
|---|
| 2590 | 
 | 
|---|
| 2591 |       pAD->size = sizeof(ALLDATA);
 | 
|---|
| 2592 |       hwndFrame = WinQueryWindow(hwnd, QW_PARENT);
 | 
|---|
| 2593 |       pAD->hwndFrame = hwndFrame;
 | 
|---|
| 2594 |       pAD->mask.attrFile = FILE_READONLY | FILE_HIDDEN |
 | 
|---|
| 2595 |         FILE_SYSTEM | FILE_ARCHIVED;
 | 
|---|
| 2596 |       pAD->mask.fNoDirs = TRUE;
 | 
|---|
| 2597 |       *(pAD->mask.prompt) = 0;
 | 
|---|
| 2598 |       WinSetWindowPtr(hwnd, QWL_USER, (PVOID) pAD);
 | 
|---|
| 2599 |       pAD->pfnCompare = comparenames;
 | 
|---|
| 2600 |       if (Firsttime) {
 | 
|---|
| 2601 | 
 | 
|---|
| 2602 |         ULONG size;
 | 
|---|
| 2603 | 
 | 
|---|
| 2604 |         size = sizeof(USHORT);
 | 
|---|
| 2605 |         PrfQueryProfileData(fmprof,
 | 
|---|
| 2606 |                             appname,
 | 
|---|
| 2607 |                             "Seeall.Codepage", (PVOID) & Codepage, &size);
 | 
|---|
| 2608 |         size = sizeof(BOOL);
 | 
|---|
| 2609 |         PrfQueryProfileData(fmprof,
 | 
|---|
| 2610 |                             appname,
 | 
|---|
| 2611 |                             "Seeall.Fullnames", (PVOID) & Fullnames, &size);
 | 
|---|
| 2612 |         size = sizeof(USHORT);
 | 
|---|
| 2613 |         PrfQueryProfileData(fmprof,
 | 
|---|
| 2614 |                             appname,
 | 
|---|
| 2615 |                             "Seeall.Sort", (PVOID) & SortType, &size);
 | 
|---|
| 2616 |         size = sizeof(BOOL);
 | 
|---|
| 2617 |         PrfQueryProfileData(fmprof,
 | 
|---|
| 2618 |                             appname,
 | 
|---|
| 2619 |                             "Seeall.SortReverse",
 | 
|---|
| 2620 |                             (PVOID) & SortReverse, &size);
 | 
|---|
| 2621 |         memset(&Fattrs, 0, sizeof(Fattrs));
 | 
|---|
| 2622 |         size = sizeof(Fattrs);
 | 
|---|
| 2623 |         Fattrs.usRecordLength = sizeof(Fattrs);
 | 
|---|
| 2624 |         Fattrs.lMaxBaselineExt = 16;
 | 
|---|
| 2625 |         Fattrs.lAveCharWidth = 8;
 | 
|---|
| 2626 |         Fattrs.usCodePage = Codepage;
 | 
|---|
| 2627 |         strcpy(Fattrs.szFacename, GetPString(IDS_SYSMONOTEXT));
 | 
|---|
| 2628 |         PrfQueryProfileData(fmprof,
 | 
|---|
| 2629 |                             appname,
 | 
|---|
| 2630 |                             "Seeall.Fattrs", (PVOID) & Fattrs, &size);
 | 
|---|
| 2631 |         size = sizeof(LONG) * COLORS_MAX;
 | 
|---|
| 2632 |         PrfQueryProfileData(fmprof,
 | 
|---|
| 2633 |                             appname, "Seeall.Colors", (PVOID) Colors, &size);
 | 
|---|
| 2634 |         Firsttime = FALSE;
 | 
|---|
| 2635 |       }
 | 
|---|
| 2636 |       switch (SortType) {
 | 
|---|
| 2637 |       case IDM_SORTEASIZE:
 | 
|---|
| 2638 |         pAD->pfnCompare = (PFNSORT) NULL;
 | 
|---|
| 2639 |         break;
 | 
|---|
| 2640 |       case IDM_SORTNAME:
 | 
|---|
| 2641 |         pAD->pfnCompare = comparefullnames;
 | 
|---|
| 2642 |         break;
 | 
|---|
| 2643 |       case IDM_SORTFILENAME:
 | 
|---|
| 2644 |         pAD->pfnCompare = comparenames;
 | 
|---|
| 2645 |         break;
 | 
|---|
| 2646 |       case IDM_SORTSIZE:
 | 
|---|
| 2647 |         pAD->pfnCompare = comparesizes;
 | 
|---|
| 2648 |         break;
 | 
|---|
| 2649 |       case IDM_SORTLWDATE:
 | 
|---|
| 2650 |         pAD->pfnCompare = comparedates;
 | 
|---|
| 2651 |         break;
 | 
|---|
| 2652 |       case IDM_SORTFIRST:
 | 
|---|
| 2653 |         pAD->pfnCompare = compareexts;
 | 
|---|
| 2654 |         break;
 | 
|---|
| 2655 |       }
 | 
|---|
| 2656 |       pAD->invertsort = SortReverse;
 | 
|---|
| 2657 |       pAD->fattrs = Fattrs;
 | 
|---|
| 2658 |       pAD->fullnames = Fullnames;
 | 
|---|
| 2659 |       pAD->stopflag = 0;
 | 
|---|
| 2660 |       pAD->cursored = pAD->topfile = 1;
 | 
|---|
| 2661 |       pAD->fattrs.usCodePage = Codepage;
 | 
|---|
| 2662 |       memcpy(pAD->aulColors, Colors, sizeof(LONG) * COLORS_MAX);
 | 
|---|
| 2663 |       pAD->hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
 | 
|---|
| 2664 |       SetConditionalCascade(pAD->hwndMenu, IDM_DELETESUBMENU,
 | 
|---|
| 2665 |                             (fDefaultDeletePerm) ?
 | 
|---|
| 2666 |                             IDM_PERMDELETE : IDM_DELETE);
 | 
|---|
| 2667 |       SetConditionalCascade(pAD->hwndMenu, IDM_MOVEMENU, IDM_MOVE);
 | 
|---|
| 2668 |       SetConditionalCascade(pAD->hwndMenu, IDM_COPYMENU, IDM_COPY);
 | 
|---|
| 2669 |       SetConditionalCascade(pAD->hwndMenu, IDM_OPENSUBMENU, IDM_OPENDEFAULT);
 | 
|---|
| 2670 |       SetConditionalCascade(pAD->hwndMenu, IDM_OBJECTSUBMENU, IDM_SHADOW);
 | 
|---|
| 2671 |       if (fWorkPlace) {
 | 
|---|
| 2672 |         WinSendMsg(pAD->hwndMenu, MM_DELETEITEM,
 | 
|---|
| 2673 |                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
 | 
|---|
| 2674 |         WinSendMsg(pAD->hwndMenu, MM_DELETEITEM,
 | 
|---|
| 2675 |                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
 | 
|---|
| 2676 |       }
 | 
|---|
| 2677 |       pAD->hwndClient = hwnd;
 | 
|---|
| 2678 |       pAD->hps = InitWindow(hwnd);
 | 
|---|
| 2679 |       pAD->hvscroll = WinWindowFromID(hwndFrame, FID_VERTSCROLL);
 | 
|---|
| 2680 |       pAD->hhscroll = WinWindowFromID(hwndFrame, FID_HORZSCROLL);
 | 
|---|
| 2681 |       pAD->multiplier = 1;
 | 
|---|
| 2682 |       if (xbeginthread(MakeSeeObjWinThread,
 | 
|---|
| 2683 |                        122880,
 | 
|---|
| 2684 |                        pAD,
 | 
|---|
| 2685 |                        pszSrcFile,
 | 
|---|
| 2686 |                        __LINE__) != -1)
 | 
|---|
| 2687 |       {
 | 
|---|
| 2688 |         if (!DosCreateMutexSem(NULL, &pAD->hmtxScan, 0, FALSE)) {
 | 
|---|
| 2689 |           pAD->hwndStatus = WinCreateWindow(hwndFrame,
 | 
|---|
| 2690 |                                             (CHAR *) WC_SEESTATUS,
 | 
|---|
| 2691 |                                             NullStr,
 | 
|---|
| 2692 |                                             WS_VISIBLE | SS_TEXT |
 | 
|---|
| 2693 |                                             DT_LEFT | DT_VCENTER,
 | 
|---|
| 2694 |                                             0,
 | 
|---|
| 2695 |                                             0,
 | 
|---|
| 2696 |                                             0,
 | 
|---|
| 2697 |                                             0,
 | 
|---|
| 2698 |                                             hwndFrame,
 | 
|---|
| 2699 |                                             HWND_TOP,
 | 
|---|
| 2700 |                                             SEEALL_STATUS, NULL, NULL);
 | 
|---|
| 2701 |           if (!pAD->hwndStatus)
 | 
|---|
| 2702 |             Win_Error(hwndFrame, hwnd, pszSrcFile, __LINE__,
 | 
|---|
| 2703 |                       PCSZ_WINCREATEWINDOW);
 | 
|---|
| 2704 |           else {
 | 
|---|
| 2705 |             PFNWP oldproc;
 | 
|---|
| 2706 | 
 | 
|---|
| 2707 |             oldproc = WinSubclassWindow(hwndFrame, SeeFrameWndProc);
 | 
|---|
| 2708 |             WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
 | 
|---|
| 2709 |           }
 | 
|---|
| 2710 |           break;
 | 
|---|
| 2711 |         }
 | 
|---|
| 2712 |       }
 | 
|---|
| 2713 |     }
 | 
|---|
| 2714 |     PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
| 2715 |     break;
 | 
|---|
| 2716 | 
 | 
|---|
| 2717 |   case UM_SETUP5:
 | 
|---|
| 2718 |     // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_SETUP5");
 | 
|---|
| 2719 |     if (pAD) {
 | 
|---|
| 2720 |       if (mp1 && *((CHAR *)mp1))
 | 
|---|
| 2721 |         strcpy(pAD->szFindPath, (CHAR *)mp1);
 | 
|---|
| 2722 |       else {
 | 
|---|
| 2723 |         if (!WinDlgBox(HWND_DESKTOP, hwnd, AFDrvsWndProc,
 | 
|---|
| 2724 |                        FM3ModHandle, DRVS_FRAME, (PVOID) pAD)) {
 | 
|---|
| 2725 |           PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
| 2726 |           return 0;
 | 
|---|
| 2727 |         }
 | 
|---|
| 2728 |       }
 | 
|---|
| 2729 |       if (xbeginthread(FindAllThread,
 | 
|---|
| 2730 |                        524288,
 | 
|---|
| 2731 |                        (PVOID)hwnd,
 | 
|---|
| 2732 |                        pszSrcFile,
 | 
|---|
| 2733 |                        __LINE__) == -1)
 | 
|---|
| 2734 |       {
 | 
|---|
| 2735 |         PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
| 2736 |       }
 | 
|---|
| 2737 |       else {
 | 
|---|
| 2738 |         DosSleep(50);//05 Aug 07 GKY 100
 | 
|---|
| 2739 |         PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
 | 
|---|
| 2740 |         PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
 | 
|---|
| 2741 |       }
 | 
|---|
| 2742 |     }
 | 
|---|
| 2743 |     else
 | 
|---|
| 2744 |       PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
| 2745 |     return 0;
 | 
|---|
| 2746 | 
 | 
|---|
| 2747 |   case UM_UPDATERECORDLIST:
 | 
|---|
| 2748 |     if (mp1) {
 | 
|---|
| 2749 | 
 | 
|---|
| 2750 |       APIRET rc;
 | 
|---|
| 2751 | 
 | 
|---|
| 2752 |       rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN);
 | 
|---|
| 2753 |       if (!rc) {
 | 
|---|
| 2754 |         WinSetPointer(HWND_DESKTOP, hptrBusy);
 | 
|---|
| 2755 |         if (UpdateList(hwnd, mp1)) {
 | 
|---|
| 2756 |           FreeList(mp1);
 | 
|---|
| 2757 |           RemoveDeleted(hwnd);
 | 
|---|
| 2758 |           ReSort(hwnd);
 | 
|---|
| 2759 |           WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 2760 |         }
 | 
|---|
| 2761 |         DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 2762 |         WinSetPointer(HWND_DESKTOP, hptrArrow);
 | 
|---|
| 2763 |       }
 | 
|---|
| 2764 |     }
 | 
|---|
| 2765 |     return 0;
 | 
|---|
| 2766 | 
 | 
|---|
| 2767 |   case UM_SETUP2:
 | 
|---|
| 2768 |     // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_SETUP2");
 | 
|---|
| 2769 |     if (pAD) {
 | 
|---|
| 2770 | 
 | 
|---|
| 2771 |       CHAR s[256];
 | 
|---|
| 2772 |       BOOL once = FALSE;
 | 
|---|
| 2773 |       ULONG x, ulDriveNum, ulDriveMap;
 | 
|---|
| 2774 | 
 | 
|---|
| 2775 |       strcpy(s, GetPString(IDS_SEEALLTITLETEXT));
 | 
|---|
| 2776 |       if (!*pAD->szFindPath) {
 | 
|---|
| 2777 |         DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 2778 |         if (!DosQCurDisk(&ulDriveNum, &ulDriveMap)) {
 | 
|---|
| 2779 |           for (x = 2; x < 26 && !pAD->stopflag; x++) {
 | 
|---|
| 2780 |             if ((ulDriveMap & (1 << x)) && pAD->abDrvFlags[x]) {
 | 
|---|
| 2781 |               sprintf(&s[strlen(s)], "%s%c:", (once) ? ", " : " (", x + 'A');
 | 
|---|
| 2782 |               once = TRUE;
 | 
|---|
| 2783 |             }
 | 
|---|
| 2784 |           }
 | 
|---|
| 2785 |           if (once)
 | 
|---|
| 2786 |             strcat(s, ")");
 | 
|---|
| 2787 |         }
 | 
|---|
| 2788 |       }
 | 
|---|
| 2789 |       else {
 | 
|---|
| 2790 |         strcat(s, " (");
 | 
|---|
| 2791 |         strcat(s, pAD->szFindPath);
 | 
|---|
| 2792 |         strcat(s, ")");
 | 
|---|
| 2793 |       }
 | 
|---|
| 2794 |       WinSetWindowText(WinQueryWindow(hwnd, QW_PARENT), s);
 | 
|---|
| 2795 |     }
 | 
|---|
| 2796 |     return 0;
 | 
|---|
| 2797 | 
 | 
|---|
| 2798 |   case UM_SETUP3:
 | 
|---|
| 2799 |     // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_SETUP3");
 | 
|---|
| 2800 |     if (pAD) {
 | 
|---|
| 2801 |       pAD->multiplier = pAD->afindexcnt / 32767;
 | 
|---|
| 2802 |       if (pAD->multiplier * 32767 != pAD->afindexcnt)
 | 
|---|
| 2803 |         pAD->multiplier++;
 | 
|---|
| 2804 |       if (!pAD->multiplier)
 | 
|---|
| 2805 |         pAD->multiplier++;
 | 
|---|
| 2806 |       {
 | 
|---|
| 2807 |         RECTL Rectl;
 | 
|---|
| 2808 |         ULONG numlines;
 | 
|---|
| 2809 | 
 | 
|---|
| 2810 |         WinQueryWindowRect(hwnd, &Rectl);
 | 
|---|
| 2811 |         numlines = NumLines(&Rectl, pAD);
 | 
|---|
| 2812 |         if (numlines) {
 | 
|---|
| 2813 |           WinSendMsg(pAD->hhscroll, SBM_SETTHUMBSIZE,
 | 
|---|
| 2814 |                      MPFROM2SHORT((SHORT) Rectl.xRight, (SHORT) pAD->maxx),
 | 
|---|
| 2815 |                      MPVOID);
 | 
|---|
| 2816 |           WinSendMsg(pAD->hvscroll, SBM_SETTHUMBSIZE,
 | 
|---|
| 2817 |                      MPFROM2SHORT((SHORT) numlines,
 | 
|---|
| 2818 |                                   (SHORT) min(pAD->afindexcnt, 32767)),
 | 
|---|
| 2819 |                      MPFROM2SHORT(1, pAD->afindexcnt + 1));
 | 
|---|
| 2820 |           WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR,
 | 
|---|
| 2821 |                      MPFROMSHORT((SHORT) abs(pAD->horzscroll)),
 | 
|---|
| 2822 |                      MPFROM2SHORT(0, (SHORT) (pAD->maxx - Rectl.xRight)));
 | 
|---|
| 2823 |           WinSendMsg(pAD->hvscroll, SBM_SETSCROLLBAR,
 | 
|---|
| 2824 |                      MPFROMSHORT((SHORT) (pAD->topfile / pAD->multiplier)),
 | 
|---|
| 2825 |                      MPFROM2SHORT(1,
 | 
|---|
| 2826 |                                   (SHORT) (pAD->afindexcnt / pAD->multiplier) -
 | 
|---|
| 2827 |                                   (numlines - 1)));
 | 
|---|
| 2828 |           if (pAD->afindexcnt - pAD->topfile < numlines) {
 | 
|---|
| 2829 |             pAD->topfile = ((pAD->afindexcnt - pAD->topfile) - numlines);
 | 
|---|
| 2830 |             WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 2831 |           }
 | 
|---|
| 2832 |         }
 | 
|---|
| 2833 |       }
 | 
|---|
| 2834 |     }
 | 
|---|
| 2835 |     return 0;
 | 
|---|
| 2836 | 
 | 
|---|
| 2837 |   case UM_SETUP4:
 | 
|---|
| 2838 |     // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_SETUP4");
 | 
|---|
| 2839 |     if (pAD)
 | 
|---|
| 2840 |       pAD->killme = TRUE;
 | 
|---|
| 2841 |     else
 | 
|---|
| 2842 |       PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
 | 
|---|
| 2843 |     return 0;
 | 
|---|
| 2844 | 
 | 
|---|
| 2845 |   case UM_RESCAN:
 | 
|---|
| 2846 |     // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_RESCAN");
 | 
|---|
| 2847 |     if (pAD && !pAD->stopflag) {
 | 
|---|
| 2848 |       if (DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) {
 | 
|---|
| 2849 |         // Assume still working - show progress
 | 
|---|
| 2850 |         CHAR s[CCHMAXPATH + 80], tm[34];
 | 
|---|
| 2851 | 
 | 
|---|
| 2852 |         if (mp1) {
 | 
|---|
| 2853 |           strcpy(s, GetPString(IDS_SORTINGTEXT));
 | 
|---|
| 2854 |           if (pAD->afindexcnt) {
 | 
|---|
| 2855 |             commafmt(tm, sizeof(tm), pAD->afindexcnt);
 | 
|---|
| 2856 |             strcat(s, tm);
 | 
|---|
| 2857 |           }
 | 
|---|
| 2858 |         }
 | 
|---|
| 2859 |         else {
 | 
|---|
| 2860 |           strcpy(s, GetPString(IDS_WORKINGTEXT));
 | 
|---|
| 2861 |           if (pAD->afheadcnt) {
 | 
|---|
| 2862 |             commafmt(tm, sizeof(tm), pAD->afheadcnt);
 | 
|---|
| 2863 |             strcat(s, tm);
 | 
|---|
| 2864 |           }
 | 
|---|
| 2865 |         }
 | 
|---|
| 2866 |         if (mp2) {
 | 
|---|
| 2867 |           strcat(s, " ");
 | 
|---|
| 2868 |           strcat(s, (CHAR *)mp2);
 | 
|---|
| 2869 |         }
 | 
|---|
| 2870 |         WinSetWindowText(pAD->hwndStatus, s);
 | 
|---|
| 2871 |       }
 | 
|---|
| 2872 |       else {
 | 
|---|
| 2873 |         // Assume scan done
 | 
|---|
| 2874 |         CHAR s[(CCHMAXPATH * 2) + 80], tm[34], ts[34], tb[34];
 | 
|---|
| 2875 |         ULONG y;
 | 
|---|
| 2876 | 
 | 
|---|
| 2877 |         if (mp1) {
 | 
|---|
| 2878 |           strcpy(s, GetPString(IDS_SORTINGTEXT));
 | 
|---|
| 2879 |           if (pAD->afindexcnt) {
 | 
|---|
| 2880 |             commafmt(tm, sizeof(tm), pAD->afindexcnt);
 | 
|---|
| 2881 |             strcat(s, tm);
 | 
|---|
| 2882 |           }
 | 
|---|
| 2883 |           if (mp2) {
 | 
|---|
| 2884 |             strcat(s, " ");
 | 
|---|
| 2885 |             strcat(s, (CHAR *)mp2);
 | 
|---|
| 2886 |           }
 | 
|---|
| 2887 |         }
 | 
|---|
| 2888 |         else if (pAD->afindexcnt) {
 | 
|---|
| 2889 |           y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - (pAD->cursored - 1) :
 | 
|---|
| 2890 |             pAD->cursored - 1;
 | 
|---|
| 2891 |           commafmt(tm, sizeof(tm), pAD->afindexcnt);
 | 
|---|
| 2892 |           commafmt(ts, sizeof(ts), pAD->selected);
 | 
|---|
| 2893 |           CommaFmtULL(tb, sizeof(tb), pAD->ullSelectedBytes, ' ');
 | 
|---|
| 2894 |           sprintf(s,
 | 
|---|
| 2895 |                   " %s %s%s%s  %s %s (%s)  %s %s",
 | 
|---|
| 2896 |                   tm,
 | 
|---|
| 2897 |                   GetPString(IDS_FILETEXT),
 | 
|---|
| 2898 |                   &"s"[pAD->afindexcnt == 1],
 | 
|---|
| 2899 |                   (*pAD->mask.szMask ||
 | 
|---|
| 2900 |                    (pAD->mask.attrFile & (~FILE_DIRECTORY)) !=
 | 
|---|
| 2901 |                    (ALLATTRS & (~FILE_DIRECTORY)) ||
 | 
|---|
| 2902 |                    pAD->mask.antiattr) ?
 | 
|---|
| 2903 |                   GetPString(IDS_FILTEREDTEXT) :
 | 
|---|
| 2904 |                   NullStr,
 | 
|---|
| 2905 |                   ts,
 | 
|---|
| 2906 |                   GetPString(IDS_SELECTEDTEXT),
 | 
|---|
| 2907 |                   tb, GetPString(IDS_CURRTEXT), pAD->afindex[y]->fullname);
 | 
|---|
| 2908 |         }
 | 
|---|
| 2909 |         else
 | 
|---|
| 2910 |           sprintf(s,
 | 
|---|
| 2911 |                   GetPString(IDS_NOFILESPSTEXT),
 | 
|---|
| 2912 |                   (*pAD->mask.szMask ||
 | 
|---|
| 2913 |                    (pAD->mask.attrFile & (~FILE_DIRECTORY)) !=
 | 
|---|
| 2914 |                    (ALLATTRS & (~FILE_DIRECTORY)) ||
 | 
|---|
| 2915 |                    pAD->mask.antiattr) ?
 | 
|---|
| 2916 |                   GetPString(IDS_FILTEREDTEXT) : NullStr);
 | 
|---|
| 2917 |         WinSetWindowText(pAD->hwndStatus, s);
 | 
|---|
| 2918 |         DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 2919 |       }
 | 
|---|
| 2920 |     }
 | 
|---|
| 2921 |     return 0;
 | 
|---|
| 2922 | 
 | 
|---|
| 2923 |   case UM_SETUP:
 | 
|---|
| 2924 |     // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_SETUP");
 | 
|---|
| 2925 |     if (pAD) {
 | 
|---|
| 2926 |       WinSendMsg(pAD->hvscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1), MPVOID);
 | 
|---|
| 2927 |       WinSendMsg(pAD->hhscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1), MPVOID);
 | 
|---|
| 2928 |       WinSetActiveWindow(HWND_DESKTOP, WinQueryWindow(hwnd, QW_PARENT));
 | 
|---|
| 2929 |     }
 | 
|---|
| 2930 |     return 0;
 | 
|---|
| 2931 | 
 | 
|---|
| 2932 |   case WM_CHAR:
 | 
|---|
| 2933 |     shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
 | 
|---|
| 2934 |     if (pAD && !(SHORT1FROMMP(mp1) & KC_KEYUP)) {
 | 
|---|
| 2935 | 
 | 
|---|
| 2936 |       register ULONG x;
 | 
|---|
| 2937 |       ULONG numlines, y, wascursored = pAD->cursored, thistime, len;
 | 
|---|
| 2938 |       BOOL found = FALSE;
 | 
|---|
| 2939 |       RECTL rcl;
 | 
|---|
| 2940 | 
 | 
|---|
| 2941 |       WinQueryWindowRect(hwnd, &rcl);
 | 
|---|
| 2942 |       numlines = NumLines(&rcl, pAD);
 | 
|---|
| 2943 |       if (numlines) {
 | 
|---|
| 2944 |         if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
 | 
|---|
| 2945 |           pAD->lasttime = 0;
 | 
|---|
| 2946 |           *pAD->szCommonName = 0;
 | 
|---|
| 2947 |           switch (SHORT2FROMMP(mp2)) {
 | 
|---|
| 2948 |           case VK_DELETE:
 | 
|---|
| 2949 |             if ((shiftstate & KC_CTRL) == KC_CTRL)
 | 
|---|
| 2950 |               PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PERMDELETE, 0),
 | 
|---|
| 2951 |                       MPVOID);
 | 
|---|
| 2952 |             else if ((shiftstate & KC_SHIFT) == KC_SHIFT)
 | 
|---|
| 2953 |               PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SAVETOCLIP, 0),
 | 
|---|
| 2954 |                       MPVOID);
 | 
|---|
| 2955 |             else
 | 
|---|
| 2956 |               PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID);
 | 
|---|
| 2957 |             break;
 | 
|---|
| 2958 |           case VK_LEFT:
 | 
|---|
| 2959 |             WinSendMsg(hwnd, WM_HSCROLL, MPFROM2SHORT(FID_HORZSCROLL, 0),
 | 
|---|
| 2960 |                        MPFROM2SHORT(0, SB_LINELEFT));
 | 
|---|
| 2961 |             break;
 | 
|---|
| 2962 |           case VK_RIGHT:
 | 
|---|
| 2963 |             WinSendMsg(hwnd, WM_HSCROLL, MPFROM2SHORT(FID_HORZSCROLL, 0),
 | 
|---|
| 2964 |                        MPFROM2SHORT(0, SB_LINERIGHT));
 | 
|---|
| 2965 |             break;
 | 
|---|
| 2966 |           case VK_PAGEUP:
 | 
|---|
| 2967 |             WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0),
 | 
|---|
| 2968 |                        MPFROM2SHORT(0, SB_PAGEUP));
 | 
|---|
| 2969 |             break;
 | 
|---|
| 2970 |           case VK_PAGEDOWN:
 | 
|---|
| 2971 |             WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0),
 | 
|---|
| 2972 |                        MPFROM2SHORT(0, SB_PAGEDOWN));
 | 
|---|
| 2973 |             break;
 | 
|---|
| 2974 |           case VK_UP:
 | 
|---|
| 2975 |             if (pAD->cursored > 1) {
 | 
|---|
| 2976 |               if (shiftstate & KC_SHIFT)
 | 
|---|
| 2977 |                 WinSendMsg(hwnd, WM_BUTTON1CLICK,
 | 
|---|
| 2978 |                            MPFROM2SHORT(pAD->fattrs.lAveCharWidth + 2,
 | 
|---|
| 2979 |                                         ((rcl.yTop - (pAD->lMaxHeight *
 | 
|---|
| 2980 |                                                       ((pAD->cursored) -
 | 
|---|
| 2981 |                                                        pAD->topfile))) -
 | 
|---|
| 2982 |                                          pAD->lMaxDescender) - 1),
 | 
|---|
| 2983 |                            MPFROM2SHORT(TRUE, 0));
 | 
|---|
| 2984 |               pAD->cursored--;
 | 
|---|
| 2985 |               if (pAD->cursored < pAD->topfile) {
 | 
|---|
| 2986 |                 PaintLine(hwnd, pAD->hps, pAD->cursored, pAD->topfile, &rcl);
 | 
|---|
| 2987 |                 WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0),
 | 
|---|
| 2988 |                            MPFROM2SHORT(0, SB_LINEUP));
 | 
|---|
| 2989 |               }
 | 
|---|
| 2990 |               else {
 | 
|---|
| 2991 |                 PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile,
 | 
|---|
| 2992 |                           &rcl);
 | 
|---|
| 2993 |                 PaintLine(hwnd, pAD->hps, pAD->cursored, pAD->topfile, &rcl);
 | 
|---|
| 2994 |               }
 | 
|---|
| 2995 |               PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| 2996 |             }
 | 
|---|
| 2997 |             break;
 | 
|---|
| 2998 |           case VK_DOWN:
 | 
|---|
| 2999 |             if (pAD->cursored < pAD->afindexcnt
 | 
|---|
| 3000 |                 && pAD->cursored < pAD->topfile + numlines) {
 | 
|---|
| 3001 |               if (shiftstate & KC_SHIFT)
 | 
|---|
| 3002 |                 WinSendMsg(hwnd, WM_BUTTON1CLICK,
 | 
|---|
| 3003 |                            MPFROM2SHORT(pAD->fattrs.lAveCharWidth + 2,
 | 
|---|
| 3004 |                                         ((rcl.yTop - (pAD->lMaxHeight *
 | 
|---|
| 3005 |                                                       ((pAD->cursored) -
 | 
|---|
| 3006 |                                                        pAD->topfile))) -
 | 
|---|
| 3007 |                                          pAD->lMaxDescender) - 1),
 | 
|---|
| 3008 |                            MPFROM2SHORT(TRUE, 0));
 | 
|---|
| 3009 |               pAD->cursored++;
 | 
|---|
| 3010 |               if (pAD->cursored >= pAD->topfile + numlines) {
 | 
|---|
| 3011 |                 PaintLine(hwnd, pAD->hps, pAD->cursored - 2, pAD->topfile,
 | 
|---|
| 3012 |                           &rcl);
 | 
|---|
| 3013 |                 WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0),
 | 
|---|
| 3014 |                            MPFROM2SHORT(0, SB_LINEDOWN));
 | 
|---|
| 3015 |               }
 | 
|---|
| 3016 |               else {
 | 
|---|
| 3017 |                 PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile,
 | 
|---|
| 3018 |                           &rcl);
 | 
|---|
| 3019 |                 PaintLine(hwnd, pAD->hps, pAD->cursored - 2, pAD->topfile,
 | 
|---|
| 3020 |                           &rcl);
 | 
|---|
| 3021 |               }
 | 
|---|
| 3022 |               PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| 3023 |             }
 | 
|---|
| 3024 |             break;
 | 
|---|
| 3025 |           case VK_END:
 | 
|---|
| 3026 |             if ((shiftstate & KC_CTRL) ||
 | 
|---|
| 3027 |                 pAD->cursored == (pAD->topfile - 1) + numlines) {
 | 
|---|
| 3028 |               pAD->cursored = pAD->afindexcnt;
 | 
|---|
| 3029 |               pAD->topfile = (pAD->afindexcnt + 1) - numlines;
 | 
|---|
| 3030 |               if (pAD->topfile > pAD->afindexcnt)
 | 
|---|
| 3031 |                 pAD->topfile = 1;
 | 
|---|
| 3032 |               WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 3033 |             }
 | 
|---|
| 3034 |             else {
 | 
|---|
| 3035 |               pAD->cursored = (pAD->topfile - 1) + numlines;
 | 
|---|
| 3036 |               if (pAD->cursored > pAD->afindexcnt)
 | 
|---|
| 3037 |                 pAD->cursored = pAD->afindexcnt;
 | 
|---|
| 3038 |               PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile,
 | 
|---|
| 3039 |                         &rcl);
 | 
|---|
| 3040 |               PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, &rcl);
 | 
|---|
| 3041 |               PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| 3042 |             }
 | 
|---|
| 3043 |             break;
 | 
|---|
| 3044 |           case VK_HOME:
 | 
|---|
| 3045 |             if ((shiftstate & KC_CTRL) || pAD->cursored == pAD->topfile) {
 | 
|---|
| 3046 |               pAD->topfile = 1;
 | 
|---|
| 3047 |               pAD->cursored = 1;
 | 
|---|
| 3048 |               WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 3049 |             }
 | 
|---|
| 3050 |             else {
 | 
|---|
| 3051 |               pAD->cursored = pAD->topfile;
 | 
|---|
| 3052 |               PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile,
 | 
|---|
| 3053 |                         &rcl);
 | 
|---|
| 3054 |               PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, &rcl);
 | 
|---|
| 3055 |               PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| 3056 |             }
 | 
|---|
| 3057 |             break;
 | 
|---|
| 3058 |           case VK_SPACE:
 | 
|---|
| 3059 |             WinSendMsg(hwnd, WM_BUTTON1CLICK,
 | 
|---|
| 3060 |                        MPFROM2SHORT(pAD->fattrs.lAveCharWidth + 2,
 | 
|---|
| 3061 |                                     ((rcl.yTop - (pAD->lMaxHeight *
 | 
|---|
| 3062 |                                                   ((pAD->cursored) -
 | 
|---|
| 3063 |                                                    pAD->topfile))) -
 | 
|---|
| 3064 |                                      pAD->lMaxDescender) - 1),
 | 
|---|
| 3065 |                        MPFROM2SHORT(TRUE, 0));
 | 
|---|
| 3066 |             break;
 | 
|---|
| 3067 |           case VK_NEWLINE:
 | 
|---|
| 3068 |           case VK_ENTER:
 | 
|---|
| 3069 |             WinSendMsg(hwnd, WM_BUTTON1DBLCLK,
 | 
|---|
| 3070 |                        MPFROM2SHORT(pAD->fattrs.lAveCharWidth + 2,
 | 
|---|
| 3071 |                                     ((rcl.yTop - (pAD->lMaxHeight *
 | 
|---|
| 3072 |                                                   ((pAD->cursored) -
 | 
|---|
| 3073 |                                                    pAD->topfile))) -
 | 
|---|
| 3074 |                                      pAD->lMaxDescender) - 1), MPFROM2SHORT(0,
 | 
|---|
| 3075 |                                                                             0));
 | 
|---|
| 3076 |             break;
 | 
|---|
| 3077 |           }
 | 
|---|
| 3078 |         }
 | 
|---|
| 3079 |         else if (SHORT1FROMMP(mp1) & KC_CHAR) {
 | 
|---|
| 3080 |           switch (SHORT1FROMMP(mp2)) {
 | 
|---|
| 3081 |           case '\x1b':
 | 
|---|
| 3082 |           case '\r':
 | 
|---|
| 3083 |           case '\n':
 | 
|---|
| 3084 |             WinSendMsg(hwnd, WM_BUTTON1DBLCLK,
 | 
|---|
| 3085 |                        MPFROM2SHORT(pAD->fattrs.lAveCharWidth + 2,
 | 
|---|
| 3086 |                                     (rcl.yTop - (pAD->lMaxHeight *
 | 
|---|
| 3087 |                                                  ((pAD->cursored) -
 | 
|---|
| 3088 |                                                   pAD->topfile))) - 1),
 | 
|---|
| 3089 |                        MPFROM2SHORT(0, 0));
 | 
|---|
| 3090 |             pAD->lasttime = 0;
 | 
|---|
| 3091 |             *pAD->szCommonName = 0;
 | 
|---|
| 3092 |             break;
 | 
|---|
| 3093 |           default:
 | 
|---|
| 3094 |             thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd));
 | 
|---|
| 3095 |             if (thistime > pAD->lasttime + 1000)
 | 
|---|
| 3096 |               *pAD->szCommonName = 0;
 | 
|---|
| 3097 |             pAD->lasttime = thistime;
 | 
|---|
| 3098 |           KbdRetry:
 | 
|---|
| 3099 |             len = strlen(pAD->szCommonName);
 | 
|---|
| 3100 |             if (len >= CCHMAXPATH - 1) {
 | 
|---|
| 3101 |               *pAD->szCommonName = 0;
 | 
|---|
| 3102 |               len = 0;
 | 
|---|
| 3103 |             }
 | 
|---|
| 3104 |             pAD->szCommonName[len] = toupper(SHORT1FROMMP(mp2));
 | 
|---|
| 3105 |             pAD->szCommonName[len + 1] = 0;
 | 
|---|
| 3106 |             for (x = pAD->cursored - (len > 0); x < pAD->afindexcnt; x++) {
 | 
|---|
| 3107 |               y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x;
 | 
|---|
| 3108 |               if (pAD->fullnames) {
 | 
|---|
| 3109 |                 if (!strnicmp(pAD->afindex[y]->fullname, pAD->szCommonName,
 | 
|---|
| 3110 |                               len + 1)) {
 | 
|---|
| 3111 |                   found = TRUE;
 | 
|---|
| 3112 |                   break;
 | 
|---|
| 3113 |                 }
 | 
|---|
| 3114 |               }
 | 
|---|
| 3115 |               else {
 | 
|---|
| 3116 |                 if (!strnicmp(pAD->afindex[y]->filename, pAD->szCommonName,
 | 
|---|
| 3117 |                               len + 1)) {
 | 
|---|
| 3118 |                   found = TRUE;
 | 
|---|
| 3119 |                   break;
 | 
|---|
| 3120 |                 }
 | 
|---|
| 3121 |               }
 | 
|---|
| 3122 |             }
 | 
|---|
| 3123 |             if (!found) {
 | 
|---|
| 3124 |               for (x = 0; x < pAD->cursored - (len > 0); x++) {
 | 
|---|
| 3125 |                 y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x;
 | 
|---|
| 3126 |                 if (pAD->fullnames) {
 | 
|---|
| 3127 |                   if (!strnicmp(pAD->afindex[y]->fullname, pAD->szCommonName,
 | 
|---|
| 3128 |                                 len + 1)) {
 | 
|---|
| 3129 |                     found = TRUE;
 | 
|---|
| 3130 |                     break;
 | 
|---|
| 3131 |                   }
 | 
|---|
| 3132 |                 }
 | 
|---|
| 3133 |                 else {
 | 
|---|
| 3134 |                   if (!strnicmp(pAD->afindex[y]->filename, pAD->szCommonName,
 | 
|---|
| 3135 |                                 len + 1)) {
 | 
|---|
| 3136 |                     found = TRUE;
 | 
|---|
| 3137 |                     break;
 | 
|---|
| 3138 |                   }
 | 
|---|
| 3139 |                 }
 | 
|---|
| 3140 |               }
 | 
|---|
| 3141 |             }
 | 
|---|
| 3142 |             if (found) {
 | 
|---|
| 3143 |               if (x + 1 != pAD->cursored) {
 | 
|---|
| 3144 |                 pAD->cursored = x + 1;
 | 
|---|
| 3145 |                 if (pAD->cursored >= pAD->topfile &&
 | 
|---|
| 3146 |                     pAD->cursored < pAD->topfile + numlines &&
 | 
|---|
| 3147 |                     wascursored != pAD->cursored) {
 | 
|---|
| 3148 |                   PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile,
 | 
|---|
| 3149 |                             &rcl);
 | 
|---|
| 3150 |                   PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile,
 | 
|---|
| 3151 |                             &rcl);
 | 
|---|
| 3152 |                 }
 | 
|---|
| 3153 |                 else {
 | 
|---|
| 3154 |                   if (pAD->cursored < numlines)
 | 
|---|
| 3155 |                     pAD->topfile = 1;
 | 
|---|
| 3156 |                   else if (pAD->cursored >
 | 
|---|
| 3157 |                            (pAD->afindexcnt + 1) - (numlines / 2))
 | 
|---|
| 3158 |                     pAD->topfile = (pAD->afindexcnt + 1) - numlines;
 | 
|---|
| 3159 |                   else
 | 
|---|
| 3160 |                     pAD->topfile = pAD->cursored - (numlines / 2);
 | 
|---|
| 3161 |                   WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 3162 |                 }
 | 
|---|
| 3163 |               }
 | 
|---|
| 3164 |             }
 | 
|---|
| 3165 |             else {
 | 
|---|
| 3166 |               *pAD->szCommonName = 0;
 | 
|---|
| 3167 |               pAD->lasttime = 0;
 | 
|---|
| 3168 |               if (len)                  // retry as first letter if no match
 | 
|---|
| 3169 |                 goto KbdRetry;
 | 
|---|
| 3170 |             }
 | 
|---|
| 3171 |             break;
 | 
|---|
| 3172 |           }
 | 
|---|
| 3173 |         }
 | 
|---|
| 3174 |       }
 | 
|---|
| 3175 |     }
 | 
|---|
| 3176 |     break;
 | 
|---|
| 3177 | 
 | 
|---|
| 3178 |   case DM_PRINTOBJECT:
 | 
|---|
| 3179 |     return MRFROMLONG(DRR_TARGET);
 | 
|---|
| 3180 | 
 | 
|---|
| 3181 |   case DM_DISCARDOBJECT:
 | 
|---|
| 3182 |     return MRFROMLONG(DRR_TARGET);
 | 
|---|
| 3183 | 
 | 
|---|
| 3184 |   case WM_BEGINDRAG:
 | 
|---|
| 3185 |     {
 | 
|---|
| 3186 |       CHAR **list;
 | 
|---|
| 3187 | 
 | 
|---|
| 3188 |       list = BuildAList(hwnd);
 | 
|---|
| 3189 |       if (!list)
 | 
|---|
| 3190 |         Runtime_Error(pszSrcFile, __LINE__, NULL);
 | 
|---|
| 3191 |       else {
 | 
|---|
| 3192 |         WinSetWindowText(pAD->hwndStatus, (CHAR *) GetPString(IDS_DRAGGINGFILESTEXT));
 | 
|---|
| 3193 |         DragList(hwnd, (HWND) 0, list, TRUE);
 | 
|---|
| 3194 |         FreeList(list);
 | 
|---|
| 3195 |         PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| 3196 |       }
 | 
|---|
| 3197 |     }
 | 
|---|
| 3198 |     break;
 | 
|---|
| 3199 | 
 | 
|---|
| 3200 |   case WM_BUTTON1MOTIONSTART:
 | 
|---|
| 3201 |     if (pAD && !pAD->stopflag &&
 | 
|---|
| 3202 |         !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) {
 | 
|---|
| 3203 |       pAD->mousecaptured = TRUE;
 | 
|---|
| 3204 |       pAD->lastselected = (ULONG) - 1;
 | 
|---|
| 3205 |       pAD->lastdirection = 0;
 | 
|---|
| 3206 |       WinSetCapture(HWND_DESKTOP, hwnd);
 | 
|---|
| 3207 |       DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 3208 |       WinSendMsg(hwnd, WM_BUTTON1CLICK, mp1, MPFROM2SHORT(TRUE, 0));
 | 
|---|
| 3209 |     }
 | 
|---|
| 3210 |     break;
 | 
|---|
| 3211 | 
 | 
|---|
| 3212 |   case WM_MOUSEMOVE:
 | 
|---|
| 3213 |     shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
 | 
|---|
| 3214 |     if (pAD && pAD->mousecaptured) {
 | 
|---|
| 3215 | 
 | 
|---|
| 3216 |       ULONG numlines, whichfile, y, x;
 | 
|---|
| 3217 |       LONG inc;
 | 
|---|
| 3218 |       RECTL Rectl;
 | 
|---|
| 3219 |       POINTS pts;
 | 
|---|
| 3220 |       BOOL outofwindow = FALSE;
 | 
|---|
| 3221 | 
 | 
|---|
| 3222 |       WinQueryWindowRect(hwnd, &Rectl);
 | 
|---|
| 3223 |       numlines = NumLines(&Rectl, pAD);
 | 
|---|
| 3224 |       if (numlines) {
 | 
|---|
| 3225 |         pts.x = SHORT1FROMMP(mp1);
 | 
|---|
| 3226 |         pts.y = SHORT2FROMMP(mp1);
 | 
|---|
| 3227 |         if (pts.y < 0) {
 | 
|---|
| 3228 |           WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0),
 | 
|---|
| 3229 |                      MPFROM2SHORT(0, SB_LINEDOWN));
 | 
|---|
| 3230 |           pts.y = 1;
 | 
|---|
| 3231 |           outofwindow = TRUE;
 | 
|---|
| 3232 |         }
 | 
|---|
| 3233 |         else if (pts.y > Rectl.yTop - Rectl.yBottom) {
 | 
|---|
| 3234 |           WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0),
 | 
|---|
| 3235 |                      MPFROM2SHORT(0, SB_LINEUP));
 | 
|---|
| 3236 |           pts.y = (SHORT) (Rectl.yTop - Rectl.yBottom) - 1;
 | 
|---|
| 3237 |           outofwindow = TRUE;
 | 
|---|
| 3238 |         }
 | 
|---|
| 3239 |         whichfile = ((Rectl.yTop - Rectl.yBottom) -
 | 
|---|
| 3240 |                      ((LONG) pts.y + pAD->lMaxDescender)) / pAD->lMaxHeight;
 | 
|---|
| 3241 |         if (whichfile > numlines - 1)
 | 
|---|
| 3242 |           whichfile = numlines - 1;
 | 
|---|
| 3243 |         whichfile += (pAD->topfile - 1);
 | 
|---|
| 3244 |         y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - whichfile : whichfile;
 | 
|---|
| 3245 |         if (y < pAD->afindexcnt && pAD->lastselected != whichfile) {
 | 
|---|
| 3246 |           if (pAD->lastselected != (ULONG) - 1) {
 | 
|---|
| 3247 |             inc = (pAD->lastselected < whichfile) ? 1 : -1;
 | 
|---|
| 3248 |             for (x = pAD->lastselected + inc;
 | 
|---|
| 3249 |                  x != whichfile && x < pAD->afindexcnt;
 | 
|---|
| 3250 |                  (pAD->lastselected < whichfile) ? x++ : x--) {
 | 
|---|
| 3251 |               y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x;
 | 
|---|
| 3252 |               if (pAD->afindex[y]->flags & AF_SELECTED) {
 | 
|---|
| 3253 |                 pAD->afindex[y]->flags &= ~AF_SELECTED;
 | 
|---|
| 3254 |                 pAD->selected--;
 | 
|---|
| 3255 |                 pAD->ullSelectedBytes -= pAD->afindex[y]->cbFile;
 | 
|---|
| 3256 |               }
 | 
|---|
| 3257 |               else {
 | 
|---|
| 3258 |                 pAD->afindex[y]->flags |= AF_SELECTED;
 | 
|---|
| 3259 |                 pAD->selected++;
 | 
|---|
| 3260 |                 pAD->ullSelectedBytes += pAD->afindex[y]->cbFile;
 | 
|---|
| 3261 |               }
 | 
|---|
| 3262 |               PaintLine(hwnd, pAD->hps, x, pAD->topfile, &Rectl);
 | 
|---|
| 3263 |             }
 | 
|---|
| 3264 |           }
 | 
|---|
| 3265 |           WinSendMsg(hwnd, WM_BUTTON1CLICK, MPFROM2SHORT(pts.x, pts.y),
 | 
|---|
| 3266 |                      MPFROM2SHORT(TRUE, 0));
 | 
|---|
| 3267 |         }
 | 
|---|
| 3268 |       }
 | 
|---|
| 3269 |       if (outofwindow) {
 | 
|---|
| 3270 | 
 | 
|---|
| 3271 |         POINTL ptl;
 | 
|---|
| 3272 | 
 | 
|---|
| 3273 |         WinQueryPointerPos(HWND_DESKTOP, &ptl);
 | 
|---|
| 3274 |         WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1);
 | 
|---|
| 3275 |         if ((SHORT) ptl.y == (SHORT) SHORT2FROMMP(mp1) &&
 | 
|---|
| 3276 |             (SHORT) ptl.x == (SHORT) SHORT1FROMMP(mp1) &&
 | 
|---|
| 3277 |             ((SHORT) ptl.y < 0 || ptl.y > (Rectl.yTop - Rectl.yBottom))) {
 | 
|---|
| 3278 |           PostMsg(hwnd, UM_MOUSEMOVE, mp1, MPVOID);
 | 
|---|
| 3279 |           DosSleep(1);
 | 
|---|
| 3280 |         }
 | 
|---|
| 3281 |       }
 | 
|---|
| 3282 |     }
 | 
|---|
| 3283 |     break;
 | 
|---|
| 3284 | 
 | 
|---|
| 3285 |   case UM_MOUSEMOVE:
 | 
|---|
| 3286 |     if (pAD && pAD->mousecaptured) {
 | 
|---|
| 3287 | 
 | 
|---|
| 3288 |       POINTL ptl;
 | 
|---|
| 3289 |       RECTL Rectl;
 | 
|---|
| 3290 | 
 | 
|---|
| 3291 |       WinQueryWindowRect(hwnd, &Rectl);
 | 
|---|
| 3292 |       WinQueryPointerPos(HWND_DESKTOP, &ptl);
 | 
|---|
| 3293 |       WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1);
 | 
|---|
| 3294 |       if ((SHORT) ptl.y == (SHORT) SHORT2FROMMP(mp1) &&
 | 
|---|
| 3295 |           (SHORT) ptl.x == (SHORT) SHORT1FROMMP(mp1) &&
 | 
|---|
| 3296 |           ((SHORT) ptl.y < 0 || ptl.y > (Rectl.yTop - Rectl.yBottom))) {
 | 
|---|
| 3297 |         DosSleep(1);
 | 
|---|
| 3298 |         PostMsg(hwnd, WM_MOUSEMOVE, mp1, MPFROM2SHORT(TRUE, 0));
 | 
|---|
| 3299 |       }
 | 
|---|
| 3300 |     }
 | 
|---|
| 3301 |     return 0;
 | 
|---|
| 3302 | 
 | 
|---|
| 3303 |   case WM_BUTTON1UP:
 | 
|---|
| 3304 |   case WM_BUTTON1MOTIONEND:
 | 
|---|
| 3305 |     if (pAD) {
 | 
|---|
| 3306 |       pAD->mousecaptured = FALSE;
 | 
|---|
| 3307 |       pAD->lastselected = (ULONG) - 1;
 | 
|---|
| 3308 |       pAD->lastdirection = 0;
 | 
|---|
| 3309 |       WinSetCapture(HWND_DESKTOP, NULLHANDLE);
 | 
|---|
| 3310 |     }
 | 
|---|
| 3311 |     break;
 | 
|---|
| 3312 | 
 | 
|---|
| 3313 |   case WM_BUTTON1CLICK:
 | 
|---|
| 3314 |   case WM_BUTTON1DBLCLK:
 | 
|---|
| 3315 |     shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
 | 
|---|
| 3316 |     if (pAD && !pAD->stopflag &&
 | 
|---|
| 3317 |         !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) {
 | 
|---|
| 3318 | 
 | 
|---|
| 3319 |       ULONG numlines, whichfile, y, wascursored;
 | 
|---|
| 3320 |       RECTL Rectl;
 | 
|---|
| 3321 |       POINTS pts;
 | 
|---|
| 3322 | 
 | 
|---|
| 3323 |       if (pAD->afindexcnt) {
 | 
|---|
| 3324 |         WinQueryWindowRect(hwnd, &Rectl);
 | 
|---|
| 3325 |         numlines = NumLines(&Rectl, pAD);
 | 
|---|
| 3326 |         if (numlines) {
 | 
|---|
| 3327 |           pts.x = SHORT1FROMMP(mp1);
 | 
|---|
| 3328 |           pts.y = SHORT2FROMMP(mp1);
 | 
|---|
| 3329 |           whichfile = ((Rectl.yTop - Rectl.yBottom) -
 | 
|---|
| 3330 |                        ((LONG) pts.y + pAD->lMaxDescender)) / pAD->lMaxHeight;
 | 
|---|
| 3331 |           if (whichfile > numlines - 1)
 | 
|---|
| 3332 |             whichfile = numlines - 1;
 | 
|---|
| 3333 |           whichfile += (pAD->topfile - 1);
 | 
|---|
| 3334 |           if (whichfile + 1 > pAD->afindexcnt)
 | 
|---|
| 3335 |             break;
 | 
|---|
| 3336 |           y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - whichfile : whichfile;
 | 
|---|
| 3337 |           wascursored = pAD->cursored;
 | 
|---|
| 3338 |           pAD->cursored = whichfile + 1;
 | 
|---|
| 3339 |           if (pAD->cursored != wascursored)
 | 
|---|
| 3340 |             PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, &Rectl);
 | 
|---|
| 3341 |           if (y < pAD->afindexcnt) {
 | 
|---|
| 3342 |             if (msg == WM_BUTTON1CLICK || fUnHilite) {
 | 
|---|
| 3343 |               if (pAD->afindex[y]->flags & AF_SELECTED) {
 | 
|---|
| 3344 |                 pAD->afindex[y]->flags &= ~AF_SELECTED;
 | 
|---|
| 3345 |                 pAD->selected--;
 | 
|---|
| 3346 |                 pAD->ullSelectedBytes -= pAD->afindex[y]->cbFile;
 | 
|---|
| 3347 |               }
 | 
|---|
| 3348 |               else {
 | 
|---|
| 3349 |                 pAD->afindex[y]->flags |= AF_SELECTED;
 | 
|---|
| 3350 |                 pAD->selected++;
 | 
|---|
| 3351 |                 pAD->ullSelectedBytes += pAD->afindex[y]->cbFile;
 | 
|---|
| 3352 |               }
 | 
|---|
| 3353 |               PaintLine(hwnd, pAD->hps, whichfile, pAD->topfile, &Rectl);
 | 
|---|
| 3354 |               PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| 3355 |             }
 | 
|---|
| 3356 |           }
 | 
|---|
| 3357 |           if (msg == WM_BUTTON1CLICK) {
 | 
|---|
| 3358 |             if (pAD->lastselected != (ULONG) - 1) {
 | 
|---|
| 3359 |               if (whichfile > pAD->lastselected)
 | 
|---|
| 3360 |                 pAD->lastdirection = 1;
 | 
|---|
| 3361 |               else
 | 
|---|
| 3362 |                 pAD->lastdirection = 2;
 | 
|---|
| 3363 |             }
 | 
|---|
| 3364 |             else
 | 
|---|
| 3365 |               pAD->lastdirection = 0;
 | 
|---|
| 3366 |             pAD->lastselected = whichfile;
 | 
|---|
| 3367 |           }
 | 
|---|
| 3368 |           else
 | 
|---|
| 3369 |             DefaultViewKeys(hwnd, pAD->hwndFrame, HWND_DESKTOP, NULL,
 | 
|---|
| 3370 |                             pAD->afindex[y]->fullname);
 | 
|---|
| 3371 |         }
 | 
|---|
| 3372 |       }
 | 
|---|
| 3373 |       DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 3374 |     }
 | 
|---|
| 3375 |     break;
 | 
|---|
| 3376 | 
 | 
|---|
| 3377 |   case WM_MENUEND:
 | 
|---|
| 3378 |     if (pAD && (HWND) mp2 == pAD->hwndPopup) {
 | 
|---|
| 3379 |       WinDestroyWindow(pAD->hwndPopup);
 | 
|---|
| 3380 |       pAD->hwndPopup = (HWND) 0;
 | 
|---|
| 3381 |     }
 | 
|---|
| 3382 |     break;
 | 
|---|
| 3383 | 
 | 
|---|
| 3384 |   case WM_CONTEXTMENU:
 | 
|---|
| 3385 |     if (pAD) {
 | 
|---|
| 3386 |       if (!pAD->hwndPopup) {
 | 
|---|
| 3387 |         pAD->hwndPopup =
 | 
|---|
| 3388 |           WinLoadMenu(HWND_DESKTOP, FM3ModHandle, SEEALL_POPUP);
 | 
|---|
| 3389 |         if (pAD->hwndPopup) {
 | 
|---|
| 3390 |           //fixme to allow user to change presparams 1-10-09 GKY
 | 
|---|
| 3391 |           WinSetPresParam(pAD->hwndPopup, PP_FONTNAMESIZE,
 | 
|---|
| 3392 |                           strlen(FNT_8HELVETICA) + 1,
 | 
|---|
| 3393 |                           (PVOID) FNT_8HELVETICA);
 | 
|---|
| 3394 |           SetConditionalCascade(pAD->hwndPopup,
 | 
|---|
| 3395 |                                 IDM_DELETESUBMENU,
 | 
|---|
| 3396 |                                 (fDefaultDeletePerm) ?
 | 
|---|
| 3397 |                                 IDM_PERMDELETE : IDM_DELETE);
 | 
|---|
| 3398 |           SetConditionalCascade(pAD->hwndPopup, IDM_MOVEMENU, IDM_MOVE);
 | 
|---|
| 3399 |           SetConditionalCascade(pAD->hwndPopup, IDM_COPYMENU, IDM_COPY);
 | 
|---|
| 3400 |           SetConditionalCascade(pAD->hwndPopup, IDM_OPENSUBMENU,
 | 
|---|
| 3401 |                                 IDM_OPENDEFAULT);
 | 
|---|
| 3402 |           SetConditionalCascade(pAD->hwndMenu, IDM_OBJECTSUBMENU, IDM_SHADOW);
 | 
|---|
| 3403 |           if (fWorkPlace) {
 | 
|---|
| 3404 |             WinSendMsg(pAD->hwndPopup, MM_DELETEITEM,
 | 
|---|
| 3405 |                        MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
 | 
|---|
| 3406 |             WinSendMsg(pAD->hwndPopup, MM_DELETEITEM,
 | 
|---|
| 3407 |                        MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
 | 
|---|
| 3408 |           }
 | 
|---|
| 3409 |         }
 | 
|---|
| 3410 |       }
 | 
|---|
| 3411 |       if (pAD->hwndPopup) {
 | 
|---|
| 3412 | 
 | 
|---|
| 3413 |         APIRET rc;
 | 
|---|
| 3414 | 
 | 
|---|
| 3415 |         rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN);
 | 
|---|
| 3416 |         WinEnableMenuItem(pAD->hwndPopup, IDM_EAS, (rc == 0 &&
 | 
|---|
| 3417 |                                                     pAD->selected != 0));
 | 
|---|
| 3418 |         WinEnableMenuItem(pAD->hwndPopup, IDM_UUDECODE, (rc == 0 &&
 | 
|---|
| 3419 |                                                          pAD->selected != 0));
 | 
|---|
| 3420 |         WinEnableMenuItem(pAD->hwndPopup, IDM_UNLOCKFILE, (rc == 0 && fUnlock &&
 | 
|---|
| 3421 |                                                          pAD->selected != 0));
 | 
|---|
| 3422 |         WinEnableMenuItem(pAD->hwndPopup, IDM_EXTRACT, (rc == 0 &&
 | 
|---|
| 3423 |                                                         pAD->selected != 0));
 | 
|---|
| 3424 |         WinEnableMenuItem(pAD->hwndPopup, IDM_ARCHIVE, (rc == 0 &&
 | 
|---|
| 3425 |                                                         pAD->selected != 0));
 | 
|---|
| 3426 |         WinEnableMenuItem(pAD->hwndPopup, IDM_MOVEMENU, (rc == 0 &&
 | 
|---|
| 3427 |                                                          pAD->selected != 0));
 | 
|---|
| 3428 |         WinEnableMenuItem(pAD->hwndPopup, IDM_COPYMENU, (rc == 0 &&
 | 
|---|
| 3429 |                                                          pAD->selected != 0));
 | 
|---|
| 3430 |         WinEnableMenuItem(pAD->hwndPopup, IDM_RENAME, (rc == 0 &&
 | 
|---|
| 3431 |                                                        pAD->selected != 0));
 | 
|---|
| 3432 |         WinEnableMenuItem(pAD->hwndPopup, IDM_PRINT, (rc == 0 &&
 | 
|---|
| 3433 |                                                       pAD->selected != 0));
 | 
|---|
| 3434 |         WinEnableMenuItem(pAD->hwndPopup, IDM_SUBJECT, (rc == 0 &&
 | 
|---|
| 3435 |                                                         pAD->selected != 0));
 | 
|---|
| 3436 |         WinEnableMenuItem(pAD->hwndPopup, IDM_OPENSUBMENU, (rc == 0 &&
 | 
|---|
| 3437 |                                                             pAD->selected !=
 | 
|---|
| 3438 |                                                             0));
 | 
|---|
| 3439 |         WinEnableMenuItem(pAD->hwndPopup, IDM_OBJECTSUBMENU,
 | 
|---|
| 3440 |                           (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3441 |         WinEnableMenuItem(pAD->hwndPopup, IDM_DELETESUBMENU,
 | 
|---|
| 3442 |                           (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3443 |         WinEnableMenuItem(pAD->hwndPopup, IDM_INFO,
 | 
|---|
| 3444 |                           (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3445 |         WinEnableMenuItem(pAD->hwndPopup, IDM_ATTRS,
 | 
|---|
| 3446 |                           (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3447 |         WinEnableMenuItem(pAD->hwndPopup, IDM_COLLECT,
 | 
|---|
| 3448 |                           (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3449 |         WinEnableMenuItem(pAD->hwndPopup, IDM_SAVETOCLIP,
 | 
|---|
| 3450 |                           (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3451 |         WinEnableMenuItem(pAD->hwndPopup, IDM_SAVETOCLIPFILENAME,
 | 
|---|
| 3452 |                           (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3453 |         WinEnableMenuItem(pAD->hwndPopup, IDM_APPENDTOCLIP,
 | 
|---|
| 3454 |                           (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3455 |         WinEnableMenuItem(pAD->hwndPopup, IDM_APPENDTOCLIPFILENAME,
 | 
|---|
| 3456 |                           (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3457 |         WinEnableMenuItem(pAD->hwndPopup, IDM_SAVETOLIST,
 | 
|---|
| 3458 |                           (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3459 |         WinEnableMenuItem(pAD->hwndPopup, IDM_REMOVE,
 | 
|---|
| 3460 |                           (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3461 |         WinEnableMenuItem(pAD->hwndPopup, IDM_HIDEALL,
 | 
|---|
| 3462 |                           (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3463 |         WinEnableMenuItem(pAD->hwndPopup, IDM_SELECTALL,
 | 
|---|
| 3464 |                           (rc == 0 && pAD->afindexcnt != 0));
 | 
|---|
| 3465 |         WinEnableMenuItem(pAD->hwndPopup, IDM_SELECTMASK,
 | 
|---|
| 3466 |                           (rc == 0 && pAD->afindexcnt != 0));
 | 
|---|
| 3467 |         WinEnableMenuItem(pAD->hwndPopup, IDM_DESELECTALL,
 | 
|---|
| 3468 |                           (rc == 0 && pAD->afindexcnt != 0));
 | 
|---|
| 3469 |         WinEnableMenuItem(pAD->hwndPopup, IDM_DESELECTMASK,
 | 
|---|
| 3470 |                           (rc == 0 && pAD->afindexcnt != 0));
 | 
|---|
| 3471 |         WinEnableMenuItem(pAD->hwndPopup, IDM_INVERT,
 | 
|---|
| 3472 |                           (rc == 0 && pAD->afindexcnt != 0));
 | 
|---|
| 3473 |         WinEnableMenuItem(pAD->hwndPopup, IDM_FILTER,
 | 
|---|
| 3474 |                           (rc == 0 && pAD->afheadcnt != 0));
 | 
|---|
| 3475 |         if (!rc)
 | 
|---|
| 3476 |           DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 3477 |         if (WinPopupMenu(hwnd, hwnd, pAD->hwndPopup, SHORT1FROMMP(mp1),
 | 
|---|
| 3478 |                          SHORT2FROMMP(mp1), 0,
 | 
|---|
| 3479 |                          PU_HCONSTRAIN | PU_VCONSTRAIN |
 | 
|---|
| 3480 |                          PU_KEYBOARD | PU_MOUSEBUTTON1))
 | 
|---|
| 3481 |           CenterOverWindow(pAD->hwndPopup);
 | 
|---|
| 3482 |       }
 | 
|---|
| 3483 |     }
 | 
|---|
| 3484 |     break;
 | 
|---|
| 3485 | 
 | 
|---|
| 3486 |   case UM_CONTAINER_FILLED:
 | 
|---|
| 3487 |     if (pAD) {
 | 
|---|
| 3488 |       pAD->stopflag = 0;
 | 
|---|
| 3489 |       pAD->topfile = 1;
 | 
|---|
| 3490 |       pAD->cursored = 1;
 | 
|---|
| 3491 |       pAD->multiplier = 1;
 | 
|---|
| 3492 |       if (!pAD->afindexcnt) {
 | 
|---|
| 3493 |         if (!fAlertBeepOff)
 | 
|---|
| 3494 |           DosBeep(250, 50);
 | 
|---|
| 3495 |         PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| 3496 |       }
 | 
|---|
| 3497 |       else {
 | 
|---|
| 3498 |         if (!fAlertBeepOff)
 | 
|---|
| 3499 |           DosBeep(1000, 25);
 | 
|---|
| 3500 |         WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 3501 |         PostMsg(hwnd, UM_SETUP3, MPVOID, MPVOID);
 | 
|---|
| 3502 |       }
 | 
|---|
| 3503 |       WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
 | 
|---|
| 3504 |                       SWP_SHOW | SWP_RESTORE | SWP_ACTIVATE | SWP_ZORDER);
 | 
|---|
| 3505 |     }
 | 
|---|
| 3506 |     return 0;
 | 
|---|
| 3507 | 
 | 
|---|
| 3508 |   case WM_ERASEBACKGROUND:
 | 
|---|
| 3509 |     WinFillRect((HPS) mp1, (PRECTL) mp2,
 | 
|---|
| 3510 |                 standardcolors[Colors[COLORS_NORMALBACK]]);
 | 
|---|
| 3511 |     return 0;
 | 
|---|
| 3512 | 
 | 
|---|
| 3513 |   case WM_PAINT:
 | 
|---|
| 3514 |     // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_PAINT");
 | 
|---|
| 3515 |     if (pAD) {
 | 
|---|
| 3516 | 
 | 
|---|
| 3517 |       HPS hpsp;
 | 
|---|
| 3518 |       RECTL Rectl;
 | 
|---|
| 3519 |       POINTL ptl;
 | 
|---|
| 3520 |       register ULONG x;
 | 
|---|
| 3521 |       ULONG y, len, numlines;
 | 
|---|
| 3522 |       CHAR szBuff[CCHMAXPATH + 80], szCmmaFmtFileSize[81], szDate[DATE_BUF_BYTES];
 | 
|---|
| 3523 |       BOOL inverted, hidsys, reado, wascursored;
 | 
|---|
| 3524 | 
 | 
|---|
| 3525 |       hpsp = WinBeginPaint(hwnd, pAD->hps, &Rectl);
 | 
|---|
| 3526 |       WinFillRect(hpsp, &Rectl, standardcolors[Colors[COLORS_NORMALBACK]]);
 | 
|---|
| 3527 |       if (!pAD->stopflag &&
 | 
|---|
| 3528 |           !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) {
 | 
|---|
| 3529 |         WinQueryWindowRect(hwnd, &Rectl);
 | 
|---|
| 3530 |         numlines = NumLines(&Rectl, pAD);
 | 
|---|
| 3531 |         if (pAD->afindexcnt && numlines) {
 | 
|---|
| 3532 |           if (pAD->topfile > (pAD->afindexcnt + 1) - numlines)
 | 
|---|
| 3533 |             pAD->topfile = (pAD->afindexcnt + 1) - numlines;
 | 
|---|
| 3534 |           if (pAD->topfile > pAD->afindexcnt)
 | 
|---|
| 3535 |             pAD->topfile = 1;
 | 
|---|
| 3536 |           if (!pAD->topfile)
 | 
|---|
| 3537 |             pAD->topfile = 1;
 | 
|---|
| 3538 |           if (pAD->cursored < pAD->topfile)
 | 
|---|
| 3539 |             pAD->cursored = pAD->topfile;
 | 
|---|
| 3540 |           else if (pAD->cursored > (pAD->topfile + numlines) - 1)
 | 
|---|
| 3541 |             pAD->cursored = (pAD->topfile + numlines) - 1;
 | 
|---|
| 3542 |           if (pAD->cursored > pAD->afindexcnt)
 | 
|---|
| 3543 |             pAD->cursored = pAD->afindexcnt;
 | 
|---|
| 3544 |         }
 | 
|---|
| 3545 |         else
 | 
|---|
| 3546 |           pAD->topfile = pAD->cursored = 1;
 | 
|---|
| 3547 |         if (numlines && pAD->afindexcnt) {
 | 
|---|
| 3548 |           GpiSetBackMix(hpsp, BM_OVERPAINT);
 | 
|---|
| 3549 |           wascursored = TRUE;
 | 
|---|
| 3550 |           for (x = pAD->topfile - 1; x < pAD->afindexcnt; x++) {
 | 
|---|
| 3551 |             ptl.x = pAD->horzscroll;
 | 
|---|
| 3552 |             if (wascursored) {          // reestablish normal colors
 | 
|---|
| 3553 |               GpiSetColor(pAD->hps,
 | 
|---|
| 3554 |                           standardcolors[Colors[COLORS_NORMALFORE]]);
 | 
|---|
| 3555 |               GpiSetBackColor(pAD->hps,
 | 
|---|
| 3556 |                               standardcolors[Colors[COLORS_NORMALBACK]]);
 | 
|---|
| 3557 |               wascursored = inverted = hidsys = reado = FALSE;
 | 
|---|
| 3558 |             }
 | 
|---|
| 3559 |             if (x == pAD->cursored - 1)
 | 
|---|
| 3560 |               wascursored = TRUE;
 | 
|---|
| 3561 |             y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x;
 | 
|---|
| 3562 |             ptl.y = (Rectl.yTop -
 | 
|---|
| 3563 |                      (pAD->lMaxHeight * (((x + 1) - pAD->topfile) + 1)));
 | 
|---|
| 3564 |             if (ptl.y - pAD->lMaxDescender <= 0)
 | 
|---|
| 3565 |               break;
 | 
|---|
| 3566 |             if (pAD->afindex[y]->flags & AF_SELECTED) {
 | 
|---|
| 3567 |               if (!inverted) {
 | 
|---|
| 3568 |                 GpiSetColor(pAD->hps,
 | 
|---|
| 3569 |                             standardcolors[Colors
 | 
|---|
| 3570 |                                            [COLORS_SELECTEDNORMALFORE]]);
 | 
|---|
| 3571 |                 GpiSetBackColor(pAD->hps,
 | 
|---|
| 3572 |                                 (wascursored) ?
 | 
|---|
| 3573 |                                 standardcolors[Colors
 | 
|---|
| 3574 |                                                [COLORS_CURSOREDSELECTEDBACK]]
 | 
|---|
| 3575 |                                 :
 | 
|---|
| 3576 |                                 standardcolors[Colors[COLORS_SELECTEDBACK]]);
 | 
|---|
| 3577 |                 inverted = TRUE;
 | 
|---|
| 3578 |               }
 | 
|---|
| 3579 |             }
 | 
|---|
| 3580 |             else if (inverted ||
 | 
|---|
| 3581 |                      ((pAD->afindex[y]->attrFile &
 | 
|---|
| 3582 |                        (FILE_SYSTEM | FILE_HIDDEN)) != 0) != hidsys ||
 | 
|---|
| 3583 |                      ((pAD->afindex[y]->attrFile & FILE_READONLY) != 0) !=
 | 
|---|
| 3584 |                      reado) {
 | 
|---|
| 3585 |               if (pAD->afindex[y]->attrFile & (FILE_SYSTEM | FILE_HIDDEN)) {
 | 
|---|
| 3586 |                 GpiSetColor(pAD->hps,
 | 
|---|
| 3587 |                             standardcolors[Colors[COLORS_SYSTEMFORE]]);
 | 
|---|
| 3588 |                 hidsys = TRUE;
 | 
|---|
| 3589 |               }
 | 
|---|
| 3590 |               else if ((pAD->afindex[y]->attrFile & FILE_READONLY) != 0) {
 | 
|---|
| 3591 |                 GpiSetColor(pAD->hps,
 | 
|---|
| 3592 |                             standardcolors[Colors[COLORS_READONLYFORE]]);
 | 
|---|
| 3593 |                 reado = TRUE;
 | 
|---|
| 3594 |               }
 | 
|---|
| 3595 |               else
 | 
|---|
| 3596 |                 GpiSetColor(pAD->hps,
 | 
|---|
| 3597 |                             standardcolors[Colors[COLORS_NORMALFORE]]);
 | 
|---|
| 3598 |               GpiSetBackColor(pAD->hps,
 | 
|---|
| 3599 |                               (wascursored) ?
 | 
|---|
| 3600 |                               standardcolors[Colors
 | 
|---|
| 3601 |                                              [COLORS_CURSOREDNORMALBACK]] :
 | 
|---|
| 3602 |                               standardcolors[Colors[COLORS_NORMALBACK]]);
 | 
|---|
| 3603 |               inverted = FALSE;
 | 
|---|
| 3604 |             }
 | 
|---|
| 3605 |             else if (wascursored)
 | 
|---|
| 3606 |               GpiSetBackColor(pAD->hps,
 | 
|---|
| 3607 |                               standardcolors[Colors
 | 
|---|
| 3608 |                                              [COLORS_CURSOREDNORMALBACK]]);
 | 
|---|
| 3609 |             CommaFmtULL(szCmmaFmtFileSize,
 | 
|---|
| 3610 |                         sizeof(szCmmaFmtFileSize), pAD->afindex[y]->cbFile, ' ');
 | 
|---|
| 3611 |             FDateFormat(szDate, pAD->afindex[y]->date);
 | 
|---|
| 3612 |             len =
 | 
|---|
| 3613 |               sprintf(szBuff,
 | 
|---|
| 3614 |                       "%c%-*.*s  %-12s  %c%c%c%c%c  %s %02u%s%02u%s%02u ",
 | 
|---|
| 3615 |                       wascursored ? '>' : ' ',
 | 
|---|
| 3616 |                       pAD->fullnames ? pAD->longestw : pAD->longest,
 | 
|---|
| 3617 |                       pAD->fullnames ? pAD->longestw : pAD->longest,
 | 
|---|
| 3618 |                       (pAD->fullnames) ? pAD->afindex[y]->fullname : pAD->
 | 
|---|
| 3619 |                       afindex[y]->filename, szCmmaFmtFileSize,
 | 
|---|
| 3620 |                       "-A"[((pAD->afindex[y]->attrFile & FILE_ARCHIVED) !=
 | 
|---|
| 3621 |                             0)],
 | 
|---|
| 3622 |                       "-R"[((pAD->afindex[y]->attrFile & FILE_READONLY) !=
 | 
|---|
| 3623 |                             0)],
 | 
|---|
| 3624 |                       "-H"[((pAD->afindex[y]->attrFile & FILE_HIDDEN) != 0)],
 | 
|---|
| 3625 |                       "-S"[((pAD->afindex[y]->attrFile & FILE_SYSTEM) != 0)],
 | 
|---|
| 3626 |                       "-D"[((pAD->afindex[y]->attrFile & FILE_DIRECTORY) != 0)],
 | 
|---|
| 3627 |                       szDate,
 | 
|---|
| 3628 |                       pAD->afindex[y]->time.hours, TimeSeparator,
 | 
|---|
| 3629 |                       pAD->afindex[y]->time.minutes, TimeSeparator,
 | 
|---|
| 3630 |                       pAD->afindex[y]->time.twosecs * 2);
 | 
|---|
| 3631 |             GpiCharStringAt(hpsp, &ptl, len, szBuff);
 | 
|---|
| 3632 |             GpiQueryCurrentPosition(hpsp, &ptl);
 | 
|---|
| 3633 |             if (ptl.x + abs(pAD->horzscroll) > pAD->maxx) {
 | 
|---|
| 3634 |               pAD->maxx = ptl.x + abs(pAD->horzscroll);
 | 
|---|
| 3635 |               WinSendMsg(pAD->hhscroll, SBM_SETTHUMBSIZE,
 | 
|---|
| 3636 |                          MPFROM2SHORT((SHORT) Rectl.xRight,
 | 
|---|
| 3637 |                                       (SHORT) pAD->maxx), MPVOID);
 | 
|---|
| 3638 |             }
 | 
|---|
| 3639 |           }
 | 
|---|
| 3640 |         }
 | 
|---|
| 3641 |         DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 3642 |       }
 | 
|---|
| 3643 |       WinEndPaint(hpsp);
 | 
|---|
| 3644 |       PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| 3645 |       if (!pAD->stopflag)
 | 
|---|
| 3646 |         WinSendMsg(pAD->hvscroll, SBM_SETSCROLLBAR,
 | 
|---|
| 3647 |                    MPFROMSHORT((SHORT) (pAD->topfile / pAD->multiplier)),
 | 
|---|
| 3648 |                    MPFROM2SHORT(1,
 | 
|---|
| 3649 |                                 (SHORT) (pAD->afindexcnt / pAD->multiplier) -
 | 
|---|
| 3650 |                                 (numlines - 1)));
 | 
|---|
| 3651 |       WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR,
 | 
|---|
| 3652 |                  MPFROMSHORT((SHORT) abs(pAD->horzscroll)),
 | 
|---|
| 3653 |                  MPFROM2SHORT(0, (SHORT) (pAD->maxx - Rectl.xRight)));
 | 
|---|
| 3654 |       WinSendMsg(pAD->hhscroll, SBM_SETTHUMBSIZE,
 | 
|---|
| 3655 |                  MPFROM2SHORT((SHORT) Rectl.xRight, (SHORT) pAD->maxx),
 | 
|---|
| 3656 |                  MPVOID);
 | 
|---|
| 3657 |     }
 | 
|---|
| 3658 |     break;
 | 
|---|
| 3659 | 
 | 
|---|
| 3660 |   case WM_HSCROLL:
 | 
|---|
| 3661 |     {
 | 
|---|
| 3662 |       RECTL rectl;
 | 
|---|
| 3663 |       BOOL invalidate = TRUE;
 | 
|---|
| 3664 | 
 | 
|---|
| 3665 |       WinQueryWindowRect(hwnd, &rectl);
 | 
|---|
| 3666 |       switch (SHORT2FROMMP(mp2)) {
 | 
|---|
| 3667 |       case SB_PAGERIGHT:
 | 
|---|
| 3668 |         if (abs(pAD->horzscroll) < pAD->maxx - rectl.xRight) {
 | 
|---|
| 3669 |           pAD->horzscroll -= rectl.xRight;
 | 
|---|
| 3670 |           if (abs(pAD->horzscroll) > pAD->maxx - rectl.xRight)
 | 
|---|
| 3671 |             pAD->horzscroll = -(pAD->maxx - rectl.xRight);
 | 
|---|
| 3672 |         }
 | 
|---|
| 3673 |         break;
 | 
|---|
| 3674 | 
 | 
|---|
| 3675 |       case SB_PAGELEFT:
 | 
|---|
| 3676 |         if (pAD->horzscroll < 0) {
 | 
|---|
| 3677 |           pAD->horzscroll += rectl.xRight;
 | 
|---|
| 3678 |           if (pAD->horzscroll > 0)
 | 
|---|
| 3679 |             pAD->horzscroll = 0;
 | 
|---|
| 3680 |         }
 | 
|---|
| 3681 |         break;
 | 
|---|
| 3682 | 
 | 
|---|
| 3683 |       case SB_LINERIGHT:
 | 
|---|
| 3684 |         if (abs(pAD->horzscroll) < pAD->maxx - rectl.xRight)
 | 
|---|
| 3685 |           pAD->horzscroll -= pAD->fattrs.lAveCharWidth;
 | 
|---|
| 3686 |         break;
 | 
|---|
| 3687 | 
 | 
|---|
| 3688 |       case SB_LINELEFT:
 | 
|---|
| 3689 |         if (pAD->horzscroll < 0)
 | 
|---|
| 3690 |           pAD->horzscroll += pAD->fattrs.lAveCharWidth;
 | 
|---|
| 3691 |         break;
 | 
|---|
| 3692 | 
 | 
|---|
| 3693 |       case SB_SLIDERTRACK:
 | 
|---|
| 3694 |         pAD->horzscroll = SHORT1FROMMP(mp2);
 | 
|---|
| 3695 |         pAD->horzscroll = -(pAD->horzscroll);
 | 
|---|
| 3696 |         if (pAD->horzscroll > 0)
 | 
|---|
| 3697 |           pAD->horzscroll = 0;
 | 
|---|
| 3698 |         if (abs(pAD->horzscroll) > pAD->maxx - rectl.xRight)
 | 
|---|
| 3699 |           pAD->horzscroll = -(pAD->maxx - rectl.xRight);
 | 
|---|
| 3700 |         break;
 | 
|---|
| 3701 | 
 | 
|---|
| 3702 |       default:
 | 
|---|
| 3703 |         invalidate = FALSE;
 | 
|---|
| 3704 |         break;
 | 
|---|
| 3705 |       }
 | 
|---|
| 3706 |       if (invalidate)
 | 
|---|
| 3707 |         WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 3708 |     }
 | 
|---|
| 3709 |     break;
 | 
|---|
| 3710 | 
 | 
|---|
| 3711 |   case WM_VSCROLL:
 | 
|---|
| 3712 |     // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_VSCROLL");
 | 
|---|
| 3713 |     if (pAD && !pAD->stopflag &&
 | 
|---|
| 3714 |         !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) {
 | 
|---|
| 3715 | 
 | 
|---|
| 3716 |       ULONG numlines, wascursored;
 | 
|---|
| 3717 |       RECTL rcl;
 | 
|---|
| 3718 | 
 | 
|---|
| 3719 |       if (pAD->afindexcnt) {
 | 
|---|
| 3720 |         WinQueryWindowRect(hwnd, &rcl);
 | 
|---|
| 3721 |         numlines = NumLines(&rcl, pAD);
 | 
|---|
| 3722 |         if (numlines) {
 | 
|---|
| 3723 |           wascursored = pAD->cursored;
 | 
|---|
| 3724 |           switch (SHORT2FROMMP(mp2)) {
 | 
|---|
| 3725 |           case SB_PAGEUP:
 | 
|---|
| 3726 |             if (pAD->topfile > 1) {
 | 
|---|
| 3727 |               pAD->topfile -= numlines;
 | 
|---|
| 3728 |               if (pAD->topfile > pAD->afindexcnt ||
 | 
|---|
| 3729 |                   pAD->topfile > (pAD->afindexcnt + 1) - numlines)
 | 
|---|
| 3730 |                 pAD->topfile = 1;
 | 
|---|
| 3731 |               if (pAD->cursored > pAD->topfile + numlines)
 | 
|---|
| 3732 |                 pAD->cursored = pAD->topfile + numlines;
 | 
|---|
| 3733 |               if (pAD->cursored > pAD->afindexcnt)
 | 
|---|
| 3734 |                 pAD->cursored = pAD->afindexcnt;
 | 
|---|
| 3735 |               WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 3736 |             }
 | 
|---|
| 3737 |             break;
 | 
|---|
| 3738 |           case SB_PAGEDOWN:
 | 
|---|
| 3739 |             if (pAD->topfile <= pAD->afindexcnt - numlines) {
 | 
|---|
| 3740 |               pAD->topfile += numlines;
 | 
|---|
| 3741 |               if (pAD->topfile > (pAD->afindexcnt + 1) - numlines)
 | 
|---|
| 3742 |                 pAD->topfile = (pAD->afindexcnt + 1) - numlines;
 | 
|---|
| 3743 |               if (pAD->cursored < pAD->topfile)
 | 
|---|
| 3744 |                 pAD->cursored = pAD->topfile;
 | 
|---|
| 3745 |               if (pAD->cursored > (pAD->topfile + numlines) - 1)
 | 
|---|
| 3746 |                 pAD->cursored = (pAD->topfile + numlines) - 1;
 | 
|---|
| 3747 |               if (pAD->cursored > pAD->afindexcnt)
 | 
|---|
| 3748 |                 pAD->cursored = pAD->afindexcnt;
 | 
|---|
| 3749 |               WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 3750 |             }
 | 
|---|
| 3751 |             break;
 | 
|---|
| 3752 |           case SB_LINEDOWN:
 | 
|---|
| 3753 |             if (pAD->topfile <= pAD->afindexcnt - numlines) {
 | 
|---|
| 3754 | 
 | 
|---|
| 3755 |               RECTL Rectl, iRectl;
 | 
|---|
| 3756 | 
 | 
|---|
| 3757 |               pAD->topfile++;
 | 
|---|
| 3758 |               if (pAD->cursored < pAD->topfile)
 | 
|---|
| 3759 |                 pAD->cursored = pAD->topfile;
 | 
|---|
| 3760 |               else if (pAD->cursored > (pAD->topfile + numlines) - 1)
 | 
|---|
| 3761 |                 pAD->cursored = (pAD->topfile + numlines) - 1;
 | 
|---|
| 3762 |               if (pAD->cursored > pAD->afindexcnt)
 | 
|---|
| 3763 |                 pAD->cursored = pAD->afindexcnt;
 | 
|---|
| 3764 |               WinQueryWindowRect(hwnd, &Rectl);
 | 
|---|
| 3765 |               WinScrollWindow(hwnd, 0, pAD->lMaxHeight,
 | 
|---|
| 3766 |                               NULL, NULL, NULLHANDLE, &iRectl, 0);
 | 
|---|
| 3767 |               WinFillRect(pAD->hps, &iRectl,
 | 
|---|
| 3768 |                           standardcolors[Colors[COLORS_NORMALBACK]]);
 | 
|---|
| 3769 |               PaintLine(hwnd, pAD->hps, (pAD->topfile + numlines) - 2,
 | 
|---|
| 3770 |                         pAD->topfile, &Rectl);
 | 
|---|
| 3771 |               if (pAD->cursored != pAD->topfile + numlines)
 | 
|---|
| 3772 |                 PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile,
 | 
|---|
| 3773 |                           &Rectl);
 | 
|---|
| 3774 |               if (wascursored != pAD->cursored
 | 
|---|
| 3775 |                   && wascursored < pAD->topfile + numlines
 | 
|---|
| 3776 |                   && wascursored >= pAD->topfile)
 | 
|---|
| 3777 |                 PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile,
 | 
|---|
| 3778 |                           &Rectl);
 | 
|---|
| 3779 |               if (wascursored != pAD->cursored)
 | 
|---|
| 3780 |                 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| 3781 |               WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR,
 | 
|---|
| 3782 |                          MPFROMSHORT((SHORT) abs(pAD->horzscroll)),
 | 
|---|
| 3783 |                          MPFROM2SHORT(0, (SHORT) (pAD->maxx - Rectl.xRight)));
 | 
|---|
| 3784 |               WinSendMsg(pAD->hvscroll, SBM_SETSCROLLBAR,
 | 
|---|
| 3785 |                          MPFROMSHORT((SHORT) (pAD->topfile /
 | 
|---|
| 3786 |                                               pAD->multiplier)),
 | 
|---|
| 3787 |                          MPFROM2SHORT(1, (SHORT) (pAD->afindexcnt /
 | 
|---|
| 3788 |                                                   pAD->multiplier) -
 | 
|---|
| 3789 |                                       (numlines - 1)));
 | 
|---|
| 3790 |             }
 | 
|---|
| 3791 |             break;
 | 
|---|
| 3792 |           case SB_LINEUP:
 | 
|---|
| 3793 |             if (pAD->topfile > 1) {
 | 
|---|
| 3794 | 
 | 
|---|
| 3795 |               RECTL Rectl, iRectl;
 | 
|---|
| 3796 | 
 | 
|---|
| 3797 |               pAD->topfile--;
 | 
|---|
| 3798 |               if (pAD->cursored < pAD->topfile)
 | 
|---|
| 3799 |                 pAD->cursored = pAD->topfile;
 | 
|---|
| 3800 |               else if (pAD->cursored > (pAD->topfile + numlines) - 1)
 | 
|---|
| 3801 |                 pAD->cursored = (pAD->topfile + numlines) - 1;
 | 
|---|
| 3802 |               if (pAD->cursored > pAD->afindexcnt)
 | 
|---|
| 3803 |                 pAD->cursored = pAD->afindexcnt;
 | 
|---|
| 3804 |               WinQueryWindowRect(hwnd, &Rectl);
 | 
|---|
| 3805 |               WinScrollWindow(hwnd, 0, -pAD->lMaxHeight,
 | 
|---|
| 3806 |                               NULL, NULL, NULLHANDLE, &iRectl, 0);
 | 
|---|
| 3807 |               WinFillRect(pAD->hps, &iRectl,
 | 
|---|
| 3808 |                           standardcolors[Colors[COLORS_NORMALBACK]]);
 | 
|---|
| 3809 |               iRectl = Rectl;
 | 
|---|
| 3810 |               iRectl.yTop -= ((numlines * pAD->lMaxHeight) +
 | 
|---|
| 3811 |                               pAD->lMaxDescender);
 | 
|---|
| 3812 |               WinFillRect(pAD->hps, &iRectl,
 | 
|---|
| 3813 |                           standardcolors[pAD->aulColors[COLORS_NORMALBACK]]);
 | 
|---|
| 3814 |               PaintLine(hwnd, pAD->hps, pAD->topfile - 1, pAD->topfile,
 | 
|---|
| 3815 |                         &Rectl);
 | 
|---|
| 3816 |               if (pAD->cursored != pAD->topfile)
 | 
|---|
| 3817 |                 PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile,
 | 
|---|
| 3818 |                           &Rectl);
 | 
|---|
| 3819 |               if (pAD->cursored != wascursored && wascursored >= pAD->topfile
 | 
|---|
| 3820 |                   && wascursored < pAD->topfile + numlines)
 | 
|---|
| 3821 |                 PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile,
 | 
|---|
| 3822 |                           &Rectl);
 | 
|---|
| 3823 |               if (pAD->cursored != wascursored)
 | 
|---|
| 3824 |                 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| 3825 |               WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR,
 | 
|---|
| 3826 |                          MPFROMSHORT((SHORT) abs(pAD->horzscroll)),
 | 
|---|
| 3827 |                          MPFROM2SHORT(0, (SHORT) (pAD->maxx - Rectl.xRight)));
 | 
|---|
| 3828 |               WinSendMsg(pAD->hvscroll, SBM_SETSCROLLBAR,
 | 
|---|
| 3829 |                          MPFROMSHORT((SHORT) (pAD->topfile /
 | 
|---|
| 3830 |                                               pAD->multiplier)),
 | 
|---|
| 3831 |                          MPFROM2SHORT(1, (SHORT) (pAD->afindexcnt /
 | 
|---|
| 3832 |                                                   pAD->multiplier) -
 | 
|---|
| 3833 |                                       (numlines - 1)));
 | 
|---|
| 3834 |             }
 | 
|---|
| 3835 |             break;
 | 
|---|
| 3836 |           case SB_SLIDERTRACK:
 | 
|---|
| 3837 |             if ((SHORT1FROMMP(mp2) >= 1) ||
 | 
|---|
| 3838 |                 (SHORT1FROMMP(mp2)) <= pAD->afindexcnt) {
 | 
|---|
| 3839 |               pAD->topfile = (ULONG) SHORT1FROMMP(mp2) * pAD->multiplier;
 | 
|---|
| 3840 |               if (pAD->topfile > (pAD->afindexcnt + 1) - numlines)
 | 
|---|
| 3841 |                 pAD->topfile = (pAD->afindexcnt + 1) - numlines;
 | 
|---|
| 3842 |               if (!pAD->topfile)
 | 
|---|
| 3843 |                 pAD->topfile = 1;
 | 
|---|
| 3844 |               if (pAD->cursored < pAD->topfile)
 | 
|---|
| 3845 |                 pAD->cursored = pAD->topfile;
 | 
|---|
| 3846 |               else if (pAD->cursored > pAD->topfile + numlines)
 | 
|---|
| 3847 |                 pAD->cursored = pAD->topfile + numlines;
 | 
|---|
| 3848 |               if (pAD->cursored > pAD->afindexcnt)
 | 
|---|
| 3849 |                 pAD->cursored = pAD->afindexcnt;
 | 
|---|
| 3850 |               WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 3851 |             }
 | 
|---|
| 3852 |             else
 | 
|---|
| 3853 |               WinAlarm(HWND_DESKTOP, WA_NOTE);
 | 
|---|
| 3854 |             break;
 | 
|---|
| 3855 |           }
 | 
|---|
| 3856 |         }
 | 
|---|
| 3857 |       }
 | 
|---|
| 3858 |       DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 3859 |     }
 | 
|---|
| 3860 |     break;
 | 
|---|
| 3861 | 
 | 
|---|
| 3862 |   case WM_INITMENU:
 | 
|---|
| 3863 |     if (pAD) {
 | 
|---|
| 3864 |       switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 3865 |       case IDM_FILESMENU:
 | 
|---|
| 3866 |         {
 | 
|---|
| 3867 |           APIRET rc;
 | 
|---|
| 3868 | 
 | 
|---|
| 3869 |           rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN);
 | 
|---|
| 3870 |           WinEnableMenuItem((HWND) mp2, IDM_DUPES, (rc == 0));
 | 
|---|
| 3871 |           WinEnableMenuItem((HWND) mp2, IDM_COLLECT, (rc == 0 &&
 | 
|---|
| 3872 |                                                       pAD->selected != 0));
 | 
|---|
| 3873 |           WinEnableMenuItem((HWND) mp2, IDM_SAVETOCLIP, (rc == 0 &&
 | 
|---|
| 3874 |                                                          pAD->selected != 0));
 | 
|---|
| 3875 |           WinEnableMenuItem((HWND) mp2, IDM_SAVETOCLIPFILENAME,
 | 
|---|
| 3876 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3877 |           WinEnableMenuItem((HWND) mp2, IDM_APPENDTOCLIP,
 | 
|---|
| 3878 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3879 |           WinEnableMenuItem((HWND) mp2, IDM_APPENDTOCLIPFILENAME,
 | 
|---|
| 3880 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3881 |           WinEnableMenuItem((HWND) mp2, IDM_SAVETOLIST,
 | 
|---|
| 3882 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3883 |           WinEnableMenuItem((HWND) mp2, IDM_REMOVE,
 | 
|---|
| 3884 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3885 |           WinEnableMenuItem((HWND) mp2, IDM_HIDEALL,
 | 
|---|
| 3886 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3887 |           WinEnableMenuItem((HWND) mp2, IDM_DELETESUBMENU,
 | 
|---|
| 3888 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3889 |           WinEnableMenuItem((HWND) mp2, IDM_INFO,
 | 
|---|
| 3890 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3891 |           WinEnableMenuItem((HWND) mp2, IDM_ATTRS,
 | 
|---|
| 3892 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3893 |           WinEnableMenuItem((HWND) mp2, IDM_EAS,
 | 
|---|
| 3894 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3895 |           WinEnableMenuItem((HWND) mp2, IDM_UUDECODE,
 | 
|---|
| 3896 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3897 |           WinEnableMenuItem((HWND) mp2, IDM_UNLOCKFILE,
 | 
|---|
| 3898 |                             (rc == 0 && fUnlock && pAD->selected != 0));
 | 
|---|
| 3899 |           WinEnableMenuItem((HWND) mp2, IDM_EXTRACT,
 | 
|---|
| 3900 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3901 |           WinEnableMenuItem((HWND) mp2, IDM_ARCHIVE,
 | 
|---|
| 3902 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3903 |           WinEnableMenuItem((HWND) mp2, IDM_MOVEMENU,
 | 
|---|
| 3904 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3905 |           WinEnableMenuItem((HWND) mp2, IDM_COPYMENU,
 | 
|---|
| 3906 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3907 |           WinEnableMenuItem((HWND) mp2, IDM_RENAME,
 | 
|---|
| 3908 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3909 |           WinEnableMenuItem((HWND) mp2, IDM_PRINT,
 | 
|---|
| 3910 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3911 |           WinEnableMenuItem((HWND) mp2, IDM_SUBJECT,
 | 
|---|
| 3912 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3913 |           WinEnableMenuItem((HWND) mp2, IDM_OPENSUBMENU,
 | 
|---|
| 3914 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3915 |           WinEnableMenuItem((HWND) mp2, IDM_OBJECTSUBMENU,
 | 
|---|
| 3916 |                             (rc == 0 && pAD->selected != 0));
 | 
|---|
| 3917 |           if (!rc)
 | 
|---|
| 3918 |             DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 3919 |         }
 | 
|---|
| 3920 |         break;
 | 
|---|
| 3921 | 
 | 
|---|
| 3922 |       case IDM_SELECTSUBMENU:
 | 
|---|
| 3923 |         {
 | 
|---|
| 3924 |           APIRET rc;
 | 
|---|
| 3925 | 
 | 
|---|
| 3926 |           rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN);
 | 
|---|
| 3927 |           WinEnableMenuItem((HWND) mp2, IDM_SELECTALL, (rc == 0 &&
 | 
|---|
| 3928 |                                                         pAD->afindexcnt != 0 &&
 | 
|---|
| 3929 |                                                         (pAD->afindexcnt !=
 | 
|---|
| 3930 |                                                          pAD->selected ||
 | 
|---|
| 3931 |                                                          !pAD->selected)));
 | 
|---|
| 3932 |           WinEnableMenuItem((HWND) mp2, IDM_SELECTMASK, (rc == 0 &&
 | 
|---|
| 3933 |                                                          pAD->afindexcnt != 0 &&
 | 
|---|
| 3934 |                                                          (pAD->afindexcnt !=
 | 
|---|
| 3935 |                                                           pAD->selected ||
 | 
|---|
| 3936 |                                                           !pAD->selected)));
 | 
|---|
| 3937 |           WinEnableMenuItem((HWND) mp2, IDM_DESELECTALL, (rc == 0 &&
 | 
|---|
| 3938 |                                                           pAD->afindexcnt != 0
 | 
|---|
| 3939 |                                                           && pAD->selected));
 | 
|---|
| 3940 |           WinEnableMenuItem((HWND) mp2, IDM_DESELECTMASK,
 | 
|---|
| 3941 |                             (rc == 0 && pAD->afindexcnt != 0) && pAD->selected);
 | 
|---|
| 3942 |           WinEnableMenuItem((HWND) mp2, IDM_INVERT,
 | 
|---|
| 3943 |                             (rc == 0 && pAD->afindexcnt != 0));
 | 
|---|
| 3944 |           if (!rc)
 | 
|---|
| 3945 |             DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 3946 |         }
 | 
|---|
| 3947 |         break;
 | 
|---|
| 3948 | 
 | 
|---|
| 3949 |       case IDM_SORTSUBMENU:
 | 
|---|
| 3950 |         {
 | 
|---|
| 3951 |           APIRET rc;
 | 
|---|
| 3952 | 
 | 
|---|
| 3953 |           rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN);
 | 
|---|
| 3954 |           WinEnableMenuItem((HWND) mp2, IDM_SORTNAME, (rc == 0));
 | 
|---|
| 3955 |           WinEnableMenuItem((HWND) mp2, IDM_SORTEASIZE, (rc == 0));
 | 
|---|
| 3956 |           WinEnableMenuItem((HWND) mp2, IDM_SORTSIZE, (rc == 0));
 | 
|---|
| 3957 |           WinEnableMenuItem((HWND) mp2, IDM_SORTLWDATE, (rc == 0));
 | 
|---|
| 3958 |           WinEnableMenuItem((HWND) mp2, IDM_SORTFILENAME, (rc == 0));
 | 
|---|
| 3959 |           WinEnableMenuItem((HWND) mp2, IDM_SORTFIRST, (rc == 0));
 | 
|---|
| 3960 |           if (!rc)
 | 
|---|
| 3961 |             DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 3962 |         }
 | 
|---|
| 3963 |         WinCheckMenuItem((HWND) mp2, IDM_SORTNAME,
 | 
|---|
| 3964 |                          (pAD->pfnCompare == comparefullnames));
 | 
|---|
| 3965 |         WinCheckMenuItem((HWND) mp2, IDM_SORTEASIZE,
 | 
|---|
| 3966 |                          (pAD->pfnCompare == (PFNSORT) NULL));
 | 
|---|
| 3967 |         WinCheckMenuItem((HWND) mp2, IDM_SORTSIZE,
 | 
|---|
| 3968 |                          (pAD->pfnCompare == comparesizes));
 | 
|---|
| 3969 |         WinCheckMenuItem((HWND) mp2, IDM_SORTLWDATE,
 | 
|---|
| 3970 |                          (pAD->pfnCompare == comparedates));
 | 
|---|
| 3971 |         WinCheckMenuItem((HWND) mp2, IDM_SORTFILENAME,
 | 
|---|
| 3972 |                          (pAD->pfnCompare == comparenames));
 | 
|---|
| 3973 |         WinCheckMenuItem((HWND) mp2, IDM_SORTREVERSE, pAD->invertsort);
 | 
|---|
| 3974 |         WinCheckMenuItem((HWND) mp2, IDM_SORTFIRST,
 | 
|---|
| 3975 |                          (pAD->pfnCompare == compareexts));
 | 
|---|
| 3976 |         break;
 | 
|---|
| 3977 | 
 | 
|---|
| 3978 |       case IDM_VIEWSMENU:
 | 
|---|
| 3979 |         {
 | 
|---|
| 3980 |           APIRET rc;
 | 
|---|
| 3981 | 
 | 
|---|
| 3982 |           rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN);
 | 
|---|
| 3983 |           WinEnableMenuItem((HWND) mp2, IDM_RESCAN, (rc == 0));
 | 
|---|
| 3984 |           WinEnableMenuItem((HWND) mp2, IDM_FILTER, (rc == 0 &&
 | 
|---|
| 3985 |                                                      pAD->afheadcnt != 0));
 | 
|---|
| 3986 |           if (!rc)
 | 
|---|
| 3987 |             DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 3988 |         }
 | 
|---|
| 3989 |         WinCheckMenuItem((HWND) mp2, IDM_SHOWLNAMES, pAD->fullnames);
 | 
|---|
| 3990 |         break;
 | 
|---|
| 3991 |       }
 | 
|---|
| 3992 |     }
 | 
|---|
| 3993 |     break;
 | 
|---|
| 3994 | 
 | 
|---|
| 3995 |   case WM_COMMAND:
 | 
|---|
| 3996 |     if (!pAD) {
 | 
|---|
| 3997 |       Runtime_Error(pszSrcFile, __LINE__, NULL);
 | 
|---|
| 3998 |       return 0;
 | 
|---|
| 3999 |     }
 | 
|---|
| 4000 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 4001 |     case IDM_SETTARGET:
 | 
|---|
| 4002 |       SetTargetDir(hwnd, FALSE, NULL);
 | 
|---|
| 4003 |       break;
 | 
|---|
| 4004 | 
 | 
|---|
| 4005 |     case IDM_DUPES:
 | 
|---|
| 4006 |       if (!pAD->stopflag &&
 | 
|---|
| 4007 |           !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) {
 | 
|---|
| 4008 |         pAD->dupeflags = (USHORT) WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 4009 |                                             hwnd,
 | 
|---|
| 4010 |                                             DupeDlgProc,
 | 
|---|
| 4011 |                                             FM3ModHandle,
 | 
|---|
| 4012 |                                             DUPE_FRAME,
 | 
|---|
| 4013 |                                             MPFROM2SHORT(pAD->dupeflags, 0));
 | 
|---|
| 4014 |         if (pAD->dupeflags) {
 | 
|---|
| 4015 |           xbeginthread(FindDupesThread,
 | 
|---|
| 4016 |                        65536,
 | 
|---|
| 4017 |                        (PVOID)hwnd,
 | 
|---|
| 4018 |                        pszSrcFile,
 | 
|---|
| 4019 |                        __LINE__);
 | 
|---|
| 4020 |         }
 | 
|---|
| 4021 |         DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 4022 |       }
 | 
|---|
| 4023 |       break;
 | 
|---|
| 4024 | 
 | 
|---|
| 4025 |     case IDM_COLORPALETTE:
 | 
|---|
| 4026 |       {
 | 
|---|
| 4027 |         COLORS co;
 | 
|---|
| 4028 |         LONG temp[COLORS_MAX];
 | 
|---|
| 4029 | 
 | 
|---|
| 4030 |         memset(&co, 0, sizeof(co));
 | 
|---|
| 4031 |         co.size = sizeof(co);
 | 
|---|
| 4032 |         co.numcolors = COLORS_MAX;
 | 
|---|
| 4033 |         co.colors = pAD->aulColors;
 | 
|---|
| 4034 |         co.descriptions = IDS_SACOLORS1TEXT;
 | 
|---|
| 4035 |         co.origs = temp;
 | 
|---|
| 4036 |         co.prompt = IDS_SACOLORSPROMPTTEXT;
 | 
|---|
| 4037 |         memcpy(temp, pAD->aulColors, sizeof(LONG) * COLORS_MAX);
 | 
|---|
| 4038 |         if (WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 4039 |                       hwnd,
 | 
|---|
| 4040 |                       ColorDlgProc,
 | 
|---|
| 4041 |                       FM3ModHandle, COLOR_FRAME, (PVOID) & co)) {
 | 
|---|
| 4042 |           memcpy(Colors, pAD->aulColors, sizeof(LONG) * COLORS_MAX);
 | 
|---|
| 4043 |           PrfWriteProfileData(fmprof,
 | 
|---|
| 4044 |                               appname,
 | 
|---|
| 4045 |                               "Seeall.Colors",
 | 
|---|
| 4046 |                               &pAD->aulColors, sizeof(LONG) * COLORS_MAX);
 | 
|---|
| 4047 |           WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 4048 |         }
 | 
|---|
| 4049 |       }
 | 
|---|
| 4050 |       break;
 | 
|---|
| 4051 | 
 | 
|---|
| 4052 |     case IDM_CODEPAGE:
 | 
|---|
| 4053 |       {
 | 
|---|
| 4054 |         INT cp;
 | 
|---|
| 4055 | 
 | 
|---|
| 4056 |         cp = PickCodepage(hwnd);
 | 
|---|
| 4057 |         if (cp != -1) {
 | 
|---|
| 4058 |           pAD->fattrs.usCodePage = (USHORT) cp;
 | 
|---|
| 4059 |           Codepage = pAD->fattrs.usCodePage;
 | 
|---|
| 4060 |           PrfWriteProfileData(fmprof,
 | 
|---|
| 4061 |                               appname,
 | 
|---|
| 4062 |                               "Seeall.Codepage",
 | 
|---|
| 4063 |                               &pAD->fattrs.usCodePage, sizeof(USHORT));
 | 
|---|
| 4064 |           GpiDeleteSetId(pAD->hps, SEEALLFILECNR_FONT_LCID);
 | 
|---|
| 4065 |           GpiAssociate(pAD->hps, 0);
 | 
|---|
| 4066 |           GpiDestroyPS(pAD->hps);
 | 
|---|
| 4067 |           pAD->hps = InitWindow(hwnd);
 | 
|---|
| 4068 |           pAD->maxx = pAD->horzscroll = 0;
 | 
|---|
| 4069 |           WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 4070 |         }
 | 
|---|
| 4071 |       }
 | 
|---|
| 4072 |       break;
 | 
|---|
| 4073 | 
 | 
|---|
| 4074 |     case IDM_FONTPALETTE:
 | 
|---|
| 4075 |       SetMLEFont(hwnd, &pAD->fattrs, 3);
 | 
|---|
| 4076 |       PrfWriteProfileData(fmprof,
 | 
|---|
| 4077 |                           appname,
 | 
|---|
| 4078 |                           "Seeall.Fattrs", &pAD->fattrs, sizeof(pAD->fattrs));
 | 
|---|
| 4079 |       Fattrs = pAD->fattrs;
 | 
|---|
| 4080 |       GpiDeleteSetId(pAD->hps, SEEALLFILECNR_FONT_LCID);
 | 
|---|
| 4081 |       GpiAssociate(pAD->hps, 0);
 | 
|---|
| 4082 |       GpiDestroyPS(pAD->hps);
 | 
|---|
| 4083 |       pAD->hps = InitWindow(hwnd);
 | 
|---|
| 4084 |       pAD->maxx = pAD->horzscroll = 0;
 | 
|---|
| 4085 |       WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 4086 |       break;
 | 
|---|
| 4087 | 
 | 
|---|
| 4088 |     case IDM_SHOWLNAMES:
 | 
|---|
| 4089 |       pAD->fullnames = (pAD->fullnames) ? FALSE : TRUE;
 | 
|---|
| 4090 |       PrfWriteProfileData(fmprof,
 | 
|---|
| 4091 |                           appname,
 | 
|---|
| 4092 |                           "Seeall.Fullnames", &pAD->fullnames, sizeof(BOOL));
 | 
|---|
| 4093 |       Fullnames = pAD->fullnames;
 | 
|---|
| 4094 |       pAD->maxx = pAD->horzscroll = 0;
 | 
|---|
| 4095 |       WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 4096 |       break;
 | 
|---|
| 4097 | 
 | 
|---|
| 4098 |     case IDM_SORTREVERSE:
 | 
|---|
| 4099 |       pAD->invertsort = (pAD->invertsort) ? FALSE : TRUE;
 | 
|---|
| 4100 |       SortReverse = pAD->invertsort;
 | 
|---|
| 4101 |       PrfWriteProfileData(fmprof,
 | 
|---|
| 4102 |                           appname,
 | 
|---|
| 4103 |                           "Seeall.SortReverse",
 | 
|---|
| 4104 |                           (PVOID) & pAD->invertsort, sizeof(BOOL));
 | 
|---|
| 4105 |       WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 4106 |       break;
 | 
|---|
| 4107 | 
 | 
|---|
| 4108 |     case IDM_SORTEASIZE:
 | 
|---|
| 4109 |     case IDM_SORTNAME:
 | 
|---|
| 4110 |     case IDM_SORTFILENAME:
 | 
|---|
| 4111 |     case IDM_SORTSIZE:
 | 
|---|
| 4112 |     case IDM_SORTLWDATE:
 | 
|---|
| 4113 |     case IDM_SORTFIRST:
 | 
|---|
| 4114 |       if (!pAD->stopflag &&
 | 
|---|
| 4115 |           !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) {
 | 
|---|
| 4116 |         {
 | 
|---|
| 4117 |           USHORT dummy = SHORT1FROMMP(mp1);
 | 
|---|
| 4118 | 
 | 
|---|
| 4119 |           PrfWriteProfileData(fmprof,
 | 
|---|
| 4120 |                               appname,
 | 
|---|
| 4121 |                               "Seeall.Sort", (PVOID) & dummy, sizeof(USHORT));
 | 
|---|
| 4122 |           SortType = SHORT1FROMMP(mp1);
 | 
|---|
| 4123 |         }
 | 
|---|
| 4124 |         WinSetPointer(HWND_DESKTOP, hptrBusy);
 | 
|---|
| 4125 |         WinSendMsg(hwnd, UM_RESCAN, MPFROMLONG(1), MPVOID);
 | 
|---|
| 4126 |         switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 4127 |         case IDM_SORTEASIZE:
 | 
|---|
| 4128 |           pAD->pfnCompare = (PFNSORT) NULL;
 | 
|---|
| 4129 |           ReSort(hwnd);
 | 
|---|
| 4130 |           break;
 | 
|---|
| 4131 | 
 | 
|---|
| 4132 |         case IDM_SORTNAME:
 | 
|---|
| 4133 |           pAD->pfnCompare = comparefullnames;
 | 
|---|
| 4134 |           ReSort(hwnd);
 | 
|---|
| 4135 |           break;
 | 
|---|
| 4136 | 
 | 
|---|
| 4137 |         case IDM_SORTFILENAME:
 | 
|---|
| 4138 |           pAD->pfnCompare = comparenames;
 | 
|---|
| 4139 |           ReSort(hwnd);
 | 
|---|
| 4140 |           break;
 | 
|---|
| 4141 | 
 | 
|---|
| 4142 |         case IDM_SORTSIZE:
 | 
|---|
| 4143 |           pAD->pfnCompare = comparesizes;
 | 
|---|
| 4144 |           ReSort(hwnd);
 | 
|---|
| 4145 |           break;
 | 
|---|
| 4146 | 
 | 
|---|
| 4147 |         case IDM_SORTLWDATE:
 | 
|---|
| 4148 |           pAD->pfnCompare = comparedates;
 | 
|---|
| 4149 |           ReSort(hwnd);
 | 
|---|
| 4150 |           break;
 | 
|---|
| 4151 | 
 | 
|---|
| 4152 |         case IDM_SORTFIRST:
 | 
|---|
| 4153 |           pAD->pfnCompare = compareexts;
 | 
|---|
| 4154 |           ReSort(hwnd);
 | 
|---|
| 4155 |           break;
 | 
|---|
| 4156 |         }
 | 
|---|
| 4157 |         WinSetPointer(HWND_DESKTOP, hptrArrow);
 | 
|---|
| 4158 |         DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 4159 |         WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 4160 |       }
 | 
|---|
| 4161 |       break;
 | 
|---|
| 4162 | 
 | 
|---|
| 4163 |     case IDM_FILTER:
 | 
|---|
| 4164 |       if (!pAD->stopflag &&
 | 
|---|
| 4165 |           !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) {
 | 
|---|
| 4166 |         FilterList(hwnd);
 | 
|---|
| 4167 |         DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 4168 |       }
 | 
|---|
| 4169 |       break;
 | 
|---|
| 4170 | 
 | 
|---|
| 4171 |     case IDM_RESCAN:
 | 
|---|
| 4172 |       if (!pAD->stopflag &&
 | 
|---|
| 4173 |           !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) {
 | 
|---|
| 4174 | 
 | 
|---|
| 4175 |         CHAR tempflags[26];
 | 
|---|
| 4176 | 
 | 
|---|
| 4177 |         memcpy(tempflags, pAD->abDrvFlags, sizeof(tempflags));
 | 
|---|
| 4178 |         if (!WinDlgBox(HWND_DESKTOP, hwnd, AFDrvsWndProc, FM3ModHandle,
 | 
|---|
| 4179 |                        DRVS_FRAME, (PVOID) pAD)) {
 | 
|---|
| 4180 |           memcpy(pAD->abDrvFlags, tempflags, sizeof(tempflags));
 | 
|---|
| 4181 |           *pAD->szFindPath = 0;
 | 
|---|
| 4182 |           DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 4183 |           break;
 | 
|---|
| 4184 |         }
 | 
|---|
| 4185 |         WinSendMsg(pAD->hhscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1),
 | 
|---|
| 4186 |                    MPVOID);
 | 
|---|
| 4187 |         WinSendMsg(pAD->hvscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1),
 | 
|---|
| 4188 |                    MPVOID);
 | 
|---|
| 4189 |         pAD->topfile = 1;
 | 
|---|
| 4190 |         pAD->cursored = 1;
 | 
|---|
| 4191 |         pAD->selected = 0;
 | 
|---|
| 4192 |         pAD->ullSelectedBytes = 0;
 | 
|---|
| 4193 |         pAD->maxx = pAD->horzscroll = 0;
 | 
|---|
| 4194 |         FreeAllFilesList(hwnd);
 | 
|---|
| 4195 |         pAD->stopflag = 0;
 | 
|---|
| 4196 |         if (xbeginthread(FindAllThread,
 | 
|---|
| 4197 |                          524288,
 | 
|---|
| 4198 |                          (PVOID)hwnd,
 | 
|---|
| 4199 |                          pszSrcFile,
 | 
|---|
| 4200 |                          __LINE__) == -1)
 | 
|---|
| 4201 |         {
 | 
|---|
| 4202 |           WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
 | 
|---|
| 4203 |           DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 4204 |         }
 | 
|---|
| 4205 |         else {
 | 
|---|
| 4206 |           DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 4207 |           DosSleep(50);//05 Aug 07 GKY 100
 | 
|---|
| 4208 |           WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 4209 |           PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
 | 
|---|
| 4210 |           PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| 4211 |         }
 | 
|---|
| 4212 |       }
 | 
|---|
| 4213 |       break;
 | 
|---|
| 4214 |     case IDM_UNHIDEALL:
 | 
|---|
| 4215 |       {
 | 
|---|
| 4216 |       ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| 4217 |       FilterAll(hwnd, ad);
 | 
|---|
| 4218 |       }
 | 
|---|
| 4219 |       break;
 | 
|---|
| 4220 | 
 | 
|---|
| 4221 |     case IDM_DELETE:
 | 
|---|
| 4222 |     case IDM_PERMDELETE:
 | 
|---|
| 4223 |     case IDM_SELECTALL:
 | 
|---|
| 4224 |     case IDM_DESELECTALL:
 | 
|---|
| 4225 |     case IDM_INVERT:
 | 
|---|
| 4226 |     case IDM_SELECTMASK:
 | 
|---|
| 4227 |     case IDM_DESELECTMASK:
 | 
|---|
| 4228 |     case IDM_REMOVE:
 | 
|---|
| 4229 |     case IDM_HIDEALL:
 | 
|---|
| 4230 |     case IDM_COLLECT:
 | 
|---|
| 4231 |     case IDM_COLLECTOR:
 | 
|---|
| 4232 |     case IDM_SAVETOCLIP:
 | 
|---|
| 4233 |     case IDM_SAVETOCLIPFILENAME:
 | 
|---|
| 4234 |     case IDM_APPENDTOCLIP:
 | 
|---|
| 4235 |     case IDM_APPENDTOCLIPFILENAME:
 | 
|---|
| 4236 |     case IDM_SAVETOLIST:
 | 
|---|
| 4237 |     case IDM_INFO:
 | 
|---|
| 4238 |     case IDM_ATTRS:
 | 
|---|
| 4239 |     case IDM_MOVE:
 | 
|---|
| 4240 |     case IDM_COPY:
 | 
|---|
| 4241 |     case IDM_RENAME:
 | 
|---|
| 4242 |     case IDM_MOVEPRESERVE:
 | 
|---|
| 4243 |     case IDM_COPYPRESERVE:
 | 
|---|
| 4244 |     case IDM_WILDMOVE:
 | 
|---|
| 4245 |     case IDM_WILDCOPY:
 | 
|---|
| 4246 |     case IDM_SUBJECT:
 | 
|---|
| 4247 |     case IDM_EAS:
 | 
|---|
| 4248 |     case IDM_PRINT:
 | 
|---|
| 4249 |     case IDM_ARCHIVE:
 | 
|---|
| 4250 |     case IDM_EXTRACT:
 | 
|---|
| 4251 |     case IDM_UUDECODE:
 | 
|---|
| 4252 |     case IDM_UNLOCKFILE:
 | 
|---|
| 4253 |     case IDM_SHADOW:
 | 
|---|
| 4254 |     case IDM_OBJECT:
 | 
|---|
| 4255 |     case IDM_JAVAEXE:
 | 
|---|
| 4256 |     case IDM_OPENSETTINGS:
 | 
|---|
| 4257 |     case IDM_OPENDEFAULT:
 | 
|---|
| 4258 |       if (!pAD->stopflag &&
 | 
|---|
| 4259 |           !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) {
 | 
|---|
| 4260 |         switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 4261 |         case IDM_SELECTALL:
 | 
|---|
| 4262 |         case IDM_DESELECTALL:
 | 
|---|
| 4263 |         case IDM_INVERT:
 | 
|---|
| 4264 |         case IDM_HIDEALL:
 | 
|---|
| 4265 |         case IDM_REMOVE:
 | 
|---|
| 4266 |           Mark(hwnd, (SHORT1FROMMP(mp1) == IDM_DESELECTALL) ?
 | 
|---|
| 4267 |                AFM_UNMARK : (SHORT1FROMMP(mp1) == IDM_INVERT) ?
 | 
|---|
| 4268 |                AFM_INVERT : (SHORT1FROMMP(mp1) == IDM_HIDEALL) ?
 | 
|---|
| 4269 |                AFM_FILTER : (SHORT1FROMMP(mp1) == IDM_REMOVE) ?
 | 
|---|
| 4270 |                AFM_MARKDELETED : 0, NULL);
 | 
|---|
| 4271 |           if (SHORT1FROMMP(mp1) == IDM_REMOVE ||
 | 
|---|
| 4272 |               SHORT1FROMMP(mp1) == IDM_HIDEALL) {
 | 
|---|
| 4273 |             if (SHORT1FROMMP(mp1) == IDM_REMOVE)
 | 
|---|
| 4274 |               RemoveDeleted(hwnd);
 | 
|---|
| 4275 |             else
 | 
|---|
| 4276 |               ReSort(hwnd);
 | 
|---|
| 4277 |           }
 | 
|---|
| 4278 |           WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 4279 |           break;
 | 
|---|
| 4280 | 
 | 
|---|
| 4281 |         case IDM_SELECTMASK:
 | 
|---|
| 4282 |         case IDM_DESELECTMASK:
 | 
|---|
| 4283 |           SelectMask(hwnd, (SHORT1FROMMP(mp1) == IDM_DESELECTMASK));
 | 
|---|
| 4284 |           WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 4285 |           break;
 | 
|---|
| 4286 | 
 | 
|---|
| 4287 |         case IDM_DELETE:
 | 
|---|
| 4288 |         case IDM_PERMDELETE:
 | 
|---|
| 4289 |         case IDM_APPENDTOCLIP:
 | 
|---|
| 4290 |         case IDM_APPENDTOCLIPFILENAME:
 | 
|---|
| 4291 |         case IDM_SAVETOCLIP:
 | 
|---|
| 4292 |         case IDM_SAVETOCLIPFILENAME:
 | 
|---|
| 4293 |         case IDM_SAVETOLIST:
 | 
|---|
| 4294 |         case IDM_COLLECT:
 | 
|---|
| 4295 |         case IDM_INFO:
 | 
|---|
| 4296 |         case IDM_ATTRS:
 | 
|---|
| 4297 |         case IDM_MOVE:
 | 
|---|
| 4298 |         case IDM_COPY:
 | 
|---|
| 4299 |         case IDM_RENAME:
 | 
|---|
| 4300 |         case IDM_MOVEPRESERVE:
 | 
|---|
| 4301 |         case IDM_COPYPRESERVE:
 | 
|---|
| 4302 |         case IDM_WILDMOVE:
 | 
|---|
| 4303 |         case IDM_WILDCOPY:
 | 
|---|
| 4304 |         case IDM_SUBJECT:
 | 
|---|
| 4305 |         case IDM_PRINT:
 | 
|---|
| 4306 |         case IDM_EAS:
 | 
|---|
| 4307 |         case IDM_ARCHIVE:
 | 
|---|
| 4308 |         case IDM_EXTRACT:
 | 
|---|
| 4309 |         case IDM_SHADOW:
 | 
|---|
| 4310 |         case IDM_OBJECT:
 | 
|---|
| 4311 |         case IDM_JAVAEXE:
 | 
|---|
| 4312 |         case IDM_OPENSETTINGS:
 | 
|---|
| 4313 |         case IDM_OPENDEFAULT:
 | 
|---|
| 4314 |         case IDM_UUDECODE:
 | 
|---|
| 4315 |         case IDM_UNLOCKFILE:
 | 
|---|
| 4316 |           {
 | 
|---|
| 4317 |             CHAR **list = BuildAList(hwnd);
 | 
|---|
| 4318 | 
 | 
|---|
| 4319 |             if (!list)
 | 
|---|
| 4320 |               Runtime_Error(pszSrcFile, __LINE__, NULL);
 | 
|---|
| 4321 |             else {
 | 
|---|
| 4322 |               switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| 4323 |               case IDM_COLLECT:
 | 
|---|
| 4324 |                 CollectList(hwnd, list);
 | 
|---|
| 4325 |                 break;
 | 
|---|
| 4326 |               case IDM_DELETE:
 | 
|---|
| 4327 |               case IDM_PERMDELETE:
 | 
|---|
| 4328 |               case IDM_APPENDTOCLIP:
 | 
|---|
| 4329 |               case IDM_APPENDTOCLIPFILENAME:
 | 
|---|
| 4330 |               case IDM_SAVETOCLIP:
 | 
|---|
| 4331 |               case IDM_SAVETOCLIPFILENAME:
 | 
|---|
| 4332 |               case IDM_SAVETOLIST:
 | 
|---|
| 4333 |               case IDM_INFO:
 | 
|---|
| 4334 |               case IDM_ATTRS:
 | 
|---|
| 4335 |               case IDM_MOVE:
 | 
|---|
| 4336 |               case IDM_COPY:
 | 
|---|
| 4337 |               case IDM_RENAME:
 | 
|---|
| 4338 |               case IDM_MOVEPRESERVE:
 | 
|---|
| 4339 |               case IDM_COPYPRESERVE:
 | 
|---|
| 4340 |               case IDM_WILDMOVE:
 | 
|---|
| 4341 |               case IDM_WILDCOPY:
 | 
|---|
| 4342 |               case IDM_SUBJECT:
 | 
|---|
| 4343 |               case IDM_PRINT:
 | 
|---|
| 4344 |               case IDM_EAS:
 | 
|---|
| 4345 |               case IDM_ARCHIVE:
 | 
|---|
| 4346 |               case IDM_EXTRACT:
 | 
|---|
| 4347 |               case IDM_UUDECODE:
 | 
|---|
| 4348 |               case IDM_UNLOCKFILE:
 | 
|---|
| 4349 |               case IDM_OBJECT:
 | 
|---|
| 4350 |               case IDM_SHADOW:
 | 
|---|
| 4351 |               case IDM_JAVAEXE:
 | 
|---|
| 4352 |               case IDM_OPENSETTINGS:
 | 
|---|
| 4353 |               case IDM_OPENDEFAULT:
 | 
|---|
| 4354 |                 if (SHORT1FROMMP(mp1) == IDM_DELETE)
 | 
|---|
| 4355 |                   ignorereadonly = FALSE;
 | 
|---|
| 4356 |                 if (!PostMsg(pAD->hwndObj, UM_MASSACTION, mp1, MPFROMP(list)))
 | 
|---|
| 4357 |                   FreeList(list);
 | 
|---|
| 4358 |                 break;
 | 
|---|
| 4359 |               }
 | 
|---|
| 4360 |               if (fUnHilite) {
 | 
|---|
| 4361 |                 Mark(hwnd, AFM_UNMARK, NULL);
 | 
|---|
| 4362 |                 WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 4363 |               }
 | 
|---|
| 4364 |             }
 | 
|---|
| 4365 |           }
 | 
|---|
| 4366 |           break;
 | 
|---|
| 4367 | 
 | 
|---|
| 4368 |         case IDM_COLLECTOR:
 | 
|---|
| 4369 |           if (mp2) {
 | 
|---|
| 4370 | 
 | 
|---|
| 4371 |             CHAR **list = mp2;
 | 
|---|
| 4372 | 
 | 
|---|
| 4373 |             if (Collector) {
 | 
|---|
| 4374 |               if (!PostMsg(Collector, WM_COMMAND,
 | 
|---|
| 4375 |                            MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(list)))
 | 
|---|
| 4376 |                 FreeList(list);
 | 
|---|
| 4377 |               else if (fUnHilite) {
 | 
|---|
| 4378 |                 Mark(hwnd, AFM_UNMARK, NULL);
 | 
|---|
| 4379 |                 WinInvalidateRect(hwnd, NULL, FALSE);
 | 
|---|
| 4380 |               }
 | 
|---|
| 4381 |             }
 | 
|---|
| 4382 |             else
 | 
|---|
| 4383 |               FreeList(list);
 | 
|---|
| 4384 |           }
 | 
|---|
| 4385 |           break;
 | 
|---|
| 4386 |         }
 | 
|---|
| 4387 |         DosReleaseMutexSem(pAD->hmtxScan);
 | 
|---|
| 4388 |       }
 | 
|---|
| 4389 |       else if (SHORT1FROMMP(mp1) == IDM_COLLECTOR) {
 | 
|---|
| 4390 |         DosSleep(50);//05 Aug 07 GKY 100
 | 
|---|
| 4391 |         if (!PostMsg(hwnd, msg, mp1, mp2))
 | 
|---|
| 4392 |           WinSendMsg(hwnd, msg, mp1, mp2);
 | 
|---|
| 4393 |       }
 | 
|---|
| 4394 |       break;
 | 
|---|
| 4395 | 
 | 
|---|
| 4396 |     case IDM_HELP:
 | 
|---|
| 4397 |       if (hwndHelp)
 | 
|---|
| 4398 |         WinSendMsg(hwndHelp,
 | 
|---|
| 4399 |                    HM_DISPLAY_HELP,
 | 
|---|
| 4400 |                    MPFROM2SHORT(HELP_SEEALL, 0), MPFROMSHORT(HM_RESOURCEID));
 | 
|---|
| 4401 |       break;
 | 
|---|
| 4402 |     }
 | 
|---|
| 4403 |     return 0;
 | 
|---|
| 4404 | 
 | 
|---|
| 4405 |   case WM_SIZE:
 | 
|---|
| 4406 |     // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_SIZE");
 | 
|---|
| 4407 |     PostMsg(hwnd, UM_SETUP3, MPVOID, MPVOID);
 | 
|---|
| 4408 |     break;
 | 
|---|
| 4409 | 
 | 
|---|
| 4410 |   case WM_CLOSE:
 | 
|---|
| 4411 |     // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_CLOSE");
 | 
|---|
| 4412 |     if (pAD)
 | 
|---|
| 4413 |       pAD->stopflag = 1;
 | 
|---|
| 4414 |     WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
 | 
|---|
| 4415 |     return 0;
 | 
|---|
| 4416 | 
 | 
|---|
| 4417 |   case WM_DESTROY:
 | 
|---|
| 4418 |     // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_DESTROY");
 | 
|---|
| 4419 |     if (pAD) {
 | 
|---|
| 4420 |       pAD->stopflag = 1;
 | 
|---|
| 4421 |       if (pAD->hmtxScan) {
 | 
|---|
| 4422 |         apiret = DosRequestMutexSem(pAD->hmtxScan, 2000);
 | 
|---|
| 4423 |         if (apiret != NO_ERROR)
 | 
|---|
| 4424 |           Dos_Error(MB_CANCEL, apiret, hwnd, pszSrcFile, __LINE__, "DosRequestMutexSem");
 | 
|---|
| 4425 |         DosCloseMutexSem(pAD->hmtxScan);        // Are probably going to die anyway
 | 
|---|
| 4426 |       }
 | 
|---|
| 4427 |       if (pAD->hwndPopup)
 | 
|---|
| 4428 |         WinDestroyWindow(pAD->hwndPopup);
 | 
|---|
| 4429 |       if (pAD->hwndObj) {
 | 
|---|
| 4430 |         if (!PostMsg(pAD->hwndObj, WM_CLOSE, MPVOID, MPVOID))
 | 
|---|
| 4431 |           WinSendMsg(pAD->hwndObj, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
| 4432 |       }
 | 
|---|
| 4433 |       if (pAD->hps) {
 | 
|---|
| 4434 |         GpiDeleteSetId(pAD->hps, SEEALLFILECNR_FONT_LCID);
 | 
|---|
| 4435 |         GpiAssociate(pAD->hps, 0);
 | 
|---|
| 4436 |         GpiDestroyPS(pAD->hps);
 | 
|---|
| 4437 |       }
 | 
|---|
| 4438 |       if (pAD->killme) {
 | 
|---|
| 4439 |         if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
 | 
|---|
| 4440 |           WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
 | 
|---|
| 4441 |       }
 | 
|---|
| 4442 |       FreeAllFilesList(hwnd);
 | 
|---|
| 4443 |       free(pAD);
 | 
|---|
| 4444 |     }
 | 
|---|
| 4445 | #   ifdef FORTIFY
 | 
|---|
| 4446 |     Fortify_LeaveScope();
 | 
|---|
| 4447 | #    endif
 | 
|---|
| 4448 |     break;
 | 
|---|
| 4449 |   }
 | 
|---|
| 4450 | 
 | 
|---|
| 4451 |   return WinDefWindowProc(hwnd, msg, mp1, mp2);
 | 
|---|
| 4452 | }
 | 
|---|
| 4453 | 
 | 
|---|
| 4454 | HWND StartSeeAll(HWND hwndParent, BOOL standalone,      // called by applet
 | 
|---|
| 4455 |                  CHAR * pszStartPath)   // pathname or NULL
 | 
|---|
| 4456 | {
 | 
|---|
| 4457 |   HWND hwndFrame = (HWND) 0, hwndClient;
 | 
|---|
| 4458 |   ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
 | 
|---|
| 4459 |     FCF_SIZEBORDER | FCF_MINMAX |
 | 
|---|
| 4460 |     FCF_NOBYTEALIGN | FCF_VERTSCROLL |
 | 
|---|
| 4461 |     FCF_MENU | FCF_ICON | FCF_ACCELTABLE | FCF_HORZSCROLL;
 | 
|---|
| 4462 | 
 | 
|---|
| 4463 |   if (ParentIsDesktop(hwndParent, hwndParent))
 | 
|---|
| 4464 |     FrameFlags |= (FCF_TASKLIST | FCF_SHELLPOSITION);
 | 
|---|
| 4465 |   hwndFrame = WinCreateStdWindow(hwndParent,
 | 
|---|
| 4466 |                                  WS_VISIBLE,
 | 
|---|
| 4467 |                                  &FrameFlags,
 | 
|---|
| 4468 |                                  (CHAR *) WC_SEEALL,
 | 
|---|
| 4469 |                                  (CHAR *) GetPString(IDS_SEEALLTITLETEXT),
 | 
|---|
| 4470 |                                  WS_VISIBLE | fwsAnimate,
 | 
|---|
| 4471 |                                  FM3ModHandle, SEEALL_FRAME, &hwndClient);
 | 
|---|
| 4472 |   if (hwndFrame) {
 | 
|---|
| 4473 |     static CHAR *pszDir;
 | 
|---|
| 4474 | 
 | 
|---|
| 4475 |     if (standalone) {
 | 
|---|
| 4476 |       if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT),
 | 
|---|
| 4477 |                    UM_SETUP4, MPVOID, MPVOID)) {
 | 
|---|
| 4478 |         PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
 | 
|---|
| 4479 |         return (HWND) 0;
 | 
|---|
| 4480 |       }
 | 
|---|
| 4481 |     }
 | 
|---|
| 4482 |     if (pszStartPath) {
 | 
|---|
| 4483 |       // Needs to be static for other thread
 | 
|---|
| 4484 |       if (!pszDir)
 | 
|---|
| 4485 |         pszDir = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__);
 | 
|---|
| 4486 |       if (pszDir) {
 | 
|---|
| 4487 |         strcpy(pszDir, pszStartPath);
 | 
|---|
| 4488 |         pszStartPath = pszDir;
 | 
|---|
| 4489 |       }
 | 
|---|
| 4490 |     }
 | 
|---|
| 4491 |     PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT),
 | 
|---|
| 4492 |             UM_SETUP5, MPFROMP(pszStartPath), MPVOID);
 | 
|---|
| 4493 |   }
 | 
|---|
| 4494 |   else if (standalone)
 | 
|---|
| 4495 |     PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
 | 
|---|
| 4496 |   return hwndFrame;
 | 
|---|
| 4497 | }
 | 
|---|
| 4498 | 
 | 
|---|
| 4499 | #pragma alloc_text(SEEALL,comparefullnames,comparenames,comparesizes)
 | 
|---|
| 4500 | #pragma alloc_text(SEEALL,comparedates,compareexts,SeeStatusProc)
 | 
|---|
| 4501 | #pragma alloc_text(SEEALL,InitWindow,PaintLine,SeeAllWndProc)
 | 
|---|
| 4502 | #pragma alloc_text(SEEALL,UpdateList,CollectList,ReSort,Mark)
 | 
|---|
| 4503 | #pragma alloc_text(SEEALL,BuildAList,RemoveDeleted,SeeFrameWndProc,FilterList,FilterAll)
 | 
|---|
| 4504 | #pragma alloc_text(SEEALL2,SeeObjWndProc,MakeSeeObjWinThread,FindDupesThread,DupeDlgProc)
 | 
|---|
| 4505 | #pragma alloc_text(SEEALL3,FreeAllFilesList,DoADir,FindAllThread,AFDrvsWndProc)
 | 
|---|
| 4506 | #pragma alloc_text(SEEALL3,StartSeeAll)
 | 
|---|
| 4507 | 
 | 
|---|