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