| [36] | 1 | 
 | 
|---|
 | 2 | /***********************************************************************
 | 
|---|
 | 3 | 
 | 
|---|
 | 4 |   $Id: info.c 1749 2014-02-28 16:46:26Z jbs $
 | 
|---|
 | 5 | 
 | 
|---|
| [576] | 6 |   Info windows
 | 
|---|
| [36] | 7 | 
 | 
|---|
 | 8 |   Copyright (c) 1993-98 M. Kimes
 | 
|---|
| [1498] | 9 |   Copyright (c) 2001, 2010 Steven H. Levine
 | 
|---|
| [36] | 10 | 
 | 
|---|
| [131] | 11 |   16 Oct 02 SHL Handle large partitions
 | 
|---|
 | 12 |   12 Feb 03 SHL FileInfoProc: standardize EA math
 | 
|---|
 | 13 |   01 Aug 04 SHL Rework lstrip/rstrip usage
 | 
|---|
| [130] | 14 |   23 May 05 SHL Use QWL_USER
 | 
|---|
| [162] | 15 |   25 May 05 SHL Use ULONGLONG and CommaFmtULL
 | 
|---|
| [186] | 16 |   05 Jun 05 SHL Use QWL_USER
 | 
|---|
| [336] | 17 |   14 Jul 06 SHL Use Runtime_Error
 | 
|---|
| [575] | 18 |   24 Mar 07 SHL Correct FileInfoProc binary file detect
 | 
|---|
 | 19 |   24 Mar 07 SHL Correct FileInfoProc/IconProc race crash
 | 
|---|
| [618] | 20 |   19 Apr 07 SHL Sync with AcceptOneDrop GetOneDrop mods
 | 
|---|
| [793] | 21 |   20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
 | 
|---|
| [805] | 22 |   25 Aug 07 SHL Drop list from FILESTUF - data not static
 | 
|---|
 | 23 |   25 Aug 07 SHL IconProc: do not use freed memory - random bad things happen
 | 
|---|
| [846] | 24 |   27 Sep 07 SHL Correct ULONGLONG size formatting
 | 
|---|
| [897] | 25 |   30 Dec 07 GKY Use CommaFmtULL
 | 
|---|
| [985] | 26 |   29 Feb 08 GKY Use xfree where appropriate
 | 
|---|
| [1358] | 27 |   25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis
 | 
|---|
 | 28 |   25 Dec 08 GKY Add DRIVE_RSCANNED flag to monitor for the first recursive drive scan per session
 | 
|---|
 | 29 |                 to prevent duplicate directory names in tree following a copy before initial scan.
 | 
|---|
| [1391] | 30 |   11 Jan 08 GKY Add Write verify off and recures scan to drive info display when appropriate.
 | 
|---|
| [1395] | 31 |   07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook.
 | 
|---|
 | 32 |   07 Feb 09 GKY Add *DateFormat functions to format dates based on locale
 | 
|---|
| [1400] | 33 |   08 Mar 09 GKY Renamed commafmt.h i18nutil.h
 | 
|---|
| [1439] | 34 |   12 Jul 09 GKY Remove code to update recursive scan setting which isn't user setable
 | 
|---|
| [1444] | 35 |   22 Jul 09 GKY Check if drives support EAs add driveflag for this
 | 
|---|
 | 36 |   22 Jul 09 GKY Add LocalHD driveflag
 | 
|---|
| [1687] | 37 |   17 Jan 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
 | 
|---|
 | 38 |   20 Apr 13 GKY Double click on directory in Info listbox opens directory object instead of
 | 
|---|
 | 39 |                 causing an error message from DefaultView
 | 
|---|
| [1749] | 40 |   28 Apr 14 JBS Ticket #522: Ensure use of wrapper functions where needed
 | 
|---|
| [36] | 41 | 
 | 
|---|
 | 42 | ***********************************************************************/
 | 
|---|
 | 43 | 
 | 
|---|
| [907] | 44 | #include <stdlib.h>
 | 
|---|
 | 45 | #include <string.h>
 | 
|---|
 | 46 | #include <ctype.h>
 | 
|---|
 | 47 | #include <share.h>
 | 
|---|
 | 48 | 
 | 
|---|
| [2] | 49 | #define INCL_DOS
 | 
|---|
 | 50 | #define INCL_WIN
 | 
|---|
 | 51 | #define INCL_GPI
 | 
|---|
| [162] | 52 | #define INCL_LONGLONG
 | 
|---|
| [2] | 53 | 
 | 
|---|
| [1183] | 54 | #include "fm3dll.h"
 | 
|---|
| [1223] | 55 | #include "fm3dll2.h"                    // #define's for UM_*, control id's, etc.
 | 
|---|
| [1208] | 56 | #include "draglist.h"                   // Data declaration(s)
 | 
|---|
 | 57 | #include "notebook.h"                   // Data declaration(s)
 | 
|---|
 | 58 | #include "inis.h"                       // Data declaration(s)
 | 
|---|
 | 59 | #include "init.h"                       // Data declaration(s)
 | 
|---|
 | 60 | #include "mainwnd.h"                    // Data declaration(s)
 | 
|---|
| [2] | 61 | #include "fm3dlg.h"
 | 
|---|
 | 62 | #include "fm3str.h"
 | 
|---|
| [907] | 63 | #include "makelist.h"                   // AddToList
 | 
|---|
 | 64 | #include "errutil.h"                    // Dos_Error...
 | 
|---|
 | 65 | #include "strutil.h"                    // GetPString
 | 
|---|
| [1160] | 66 | #include "attribs.h"                    // AttrListDlgProc
 | 
|---|
 | 67 | #include "defview.h"                    // DefaultView
 | 
|---|
 | 68 | #include "info.h"
 | 
|---|
| [1183] | 69 | #include "valid.h"                      // CheckDrive, IsBinary
 | 
|---|
| [1160] | 70 | #include "seticon.h"                    // SetIconDlgProc
 | 
|---|
| [1183] | 71 | #include "droplist.h"                   // AcceptOneDrop, DropHelp, GetOneDrop
 | 
|---|
 | 72 | #include "eas.h"                        // DisplayEAsProc
 | 
|---|
 | 73 | #include "misc.h"                       // DrawTargetEmphasis
 | 
|---|
 | 74 | #include "notify.h"                     // Notify
 | 
|---|
 | 75 | #include "shadow.h"                     // OpenObject
 | 
|---|
 | 76 | #include "chklist.h"                    // PopupMenu
 | 
|---|
 | 77 | #include "presparm.h"                   // SetPresParams
 | 
|---|
 | 78 | #include "strips.h"                     // bstrip
 | 
|---|
| [1400] | 79 | #include "i18nutil.h"                   // CommaFmtULL
 | 
|---|
| [1183] | 80 | #include "wrappers.h"                   // xDosFindFirst
 | 
|---|
| [1039] | 81 | #include "fortify.h"
 | 
|---|
| [2] | 82 | 
 | 
|---|
| [1208] | 83 | // Data definitions
 | 
|---|
| [2] | 84 | #pragma data_seg(DATA1)
 | 
|---|
| [336] | 85 | static PSZ pszSrcFile = __FILE__;
 | 
|---|
 | 86 | 
 | 
|---|
| [1208] | 87 | #pragma data_seg(GLOBAL1)
 | 
|---|
 | 88 | INT driveflags[26];
 | 
|---|
 | 89 | 
 | 
|---|
| [551] | 90 | CHAR *FlagMsg(CHAR drive, CHAR * buffer)
 | 
|---|
| [336] | 91 | {
 | 
|---|
| [551] | 92 |   ULONG x;
 | 
|---|
 | 93 |   BOOL once = FALSE;
 | 
|---|
 | 94 |   register CHAR *p;
 | 
|---|
| [2] | 95 | 
 | 
|---|
| [551] | 96 |   if (buffer) {
 | 
|---|
| [2] | 97 |     *buffer = 0;
 | 
|---|
 | 98 |     p = buffer;
 | 
|---|
| [551] | 99 |     if (isalpha(drive)) {
 | 
|---|
 | 100 |       if (driveflags[toupper(drive) - 'A']) {
 | 
|---|
| [1391] | 101 |         for (x = IDS_FLREMOVABLETEXT; x < IDS_FLRECURSESCANDONETEXT + 1; x++) {
 | 
|---|
| [551] | 102 |           if (driveflags[toupper(drive) - 'A'] &
 | 
|---|
 | 103 |               (1 << (x - IDS_FLREMOVABLETEXT))) {
 | 
|---|
 | 104 |             if (once) {
 | 
|---|
 | 105 |               *p = ' ';
 | 
|---|
 | 106 |               p++;
 | 
|---|
 | 107 |             }
 | 
|---|
 | 108 |             else
 | 
|---|
 | 109 |               once = TRUE;
 | 
|---|
 | 110 |             *p = '[';
 | 
|---|
 | 111 |             p++;
 | 
|---|
 | 112 |             strcpy(p, GetPString(x));
 | 
|---|
 | 113 |             p += strlen(p);
 | 
|---|
 | 114 |             *p = ']';
 | 
|---|
 | 115 |             p++;
 | 
|---|
 | 116 |             *p = 0;
 | 
|---|
 | 117 |           }
 | 
|---|
 | 118 |         }
 | 
|---|
| [2] | 119 |       }
 | 
|---|
 | 120 |       else
 | 
|---|
| [551] | 121 |         strcpy(buffer, "[None]");
 | 
|---|
| [2] | 122 |     }
 | 
|---|
 | 123 |   }
 | 
|---|
 | 124 |   return buffer;
 | 
|---|
 | 125 | }
 | 
|---|
 | 126 | 
 | 
|---|
| [551] | 127 | MRESULT EXPENTRY DrvInfoProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| [162] | 128 | {
 | 
|---|
 | 129 |   CHAR *pszFileName;
 | 
|---|
| [551] | 130 |   CHAR szMB[20];
 | 
|---|
 | 131 |   CHAR szKB[20];
 | 
|---|
 | 132 |   CHAR szUnits[20];
 | 
|---|
| [336] | 133 |   APIRET rc;
 | 
|---|
| [2] | 134 | 
 | 
|---|
| [551] | 135 |   switch (msg) {
 | 
|---|
 | 136 |   case WM_INITDLG:
 | 
|---|
 | 137 |     if (mp2) {
 | 
|---|
| [2] | 138 | 
 | 
|---|
| [551] | 139 |       CHAR s[CCHMAXPATH * 2];
 | 
|---|
 | 140 |       ULONG type;
 | 
|---|
| [2] | 141 | 
 | 
|---|
| [1009] | 142 |       pszFileName = (CHAR *)mp2;
 | 
|---|
| [551] | 143 |       WinSetWindowPtr(hwnd, QWL_USER, (PVOID) pszFileName);
 | 
|---|
 | 144 |       WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 145 |                         INFO_LABEL,
 | 
|---|
 | 146 |                         EM_SETTEXTLIMIT,
 | 
|---|
 | 147 |                         MPFROM2SHORT(CCHMAXPATHCOMP, 0), MPVOID);
 | 
|---|
| [552] | 148 |       if (!(driveflags[toupper(*pszFileName) - 'A'] & DRIVE_NOSTATS)){
 | 
|---|
| [551] | 149 |       WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 150 |                         INFO_FREE,
 | 
|---|
 | 151 |                         SLM_SETSLIDERINFO,
 | 
|---|
 | 152 |                         MPFROM2SHORT(SMA_SLIDERARMDIMENSIONS, 0),
 | 
|---|
 | 153 |                         MPFROM2SHORT(0, 0));
 | 
|---|
 | 154 |       WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 155 |                         INFO_USED,
 | 
|---|
 | 156 |                         SLM_SETSLIDERINFO,
 | 
|---|
 | 157 |                         MPFROM2SHORT(SMA_SLIDERARMDIMENSIONS, 0),
 | 
|---|
 | 158 |                         MPFROM2SHORT(0, 0));
 | 
|---|
| [552] | 159 |       }
 | 
|---|
| [551] | 160 |       if (driveflags[toupper(*pszFileName) - 'A'] & DRIVE_NOTWRITEABLE) {
 | 
|---|
 | 161 |         WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 162 |                           INFO_LABEL,
 | 
|---|
 | 163 |                           EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
 | 
|---|
 | 164 |         WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, DID_OK));
 | 
|---|
 | 165 |       }
 | 
|---|
 | 166 |       if (IsFullName(pszFileName)) {
 | 
|---|
| [2] | 167 | 
 | 
|---|
| [551] | 168 |         CHAR FileSystem[CCHMAXPATH * 2];
 | 
|---|
| [2] | 169 | 
 | 
|---|
| [551] | 170 |         sprintf(FileSystem,
 | 
|---|
 | 171 |                 GetPString(IDS_DRIVEINFOTITLETEXT), toupper(*pszFileName));
 | 
|---|
 | 172 |         WinSetWindowText(hwnd, FileSystem);
 | 
|---|
| [575] | 173 |         if (CheckDrive(toupper(*pszFileName), FileSystem, &type) != -1){
 | 
|---|
| [2] | 174 | 
 | 
|---|
| [551] | 175 |           FSALLOCATE fsa;
 | 
|---|
| [2] | 176 | 
 | 
|---|
| [552] | 177 |           if (type & (DRIVE_REMOTE | DRIVE_ZIPSTREAM | DRIVE_VIRTUAL)) {
 | 
|---|
| [2] | 178 | 
 | 
|---|
| [551] | 179 |             CHAR Path[3], *pfsn, *pfsd;
 | 
|---|
 | 180 |             ULONG Size;
 | 
|---|
 | 181 |             APIRET rc;
 | 
|---|
 | 182 |             PFSQBUFFER2 pfsq;
 | 
|---|
| [2] | 183 | 
 | 
|---|
| [551] | 184 |             Path[0] = toupper(*pszFileName);
 | 
|---|
 | 185 |             Path[1] = ':';
 | 
|---|
 | 186 |             Path[2] = 0;
 | 
|---|
 | 187 |             Size = sizeof(s);
 | 
|---|
 | 188 |             DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 189 |             rc = DosQueryFSAttach(Path,
 | 
|---|
 | 190 |                                   0, FSAIL_QUERYNAME, (PFSQBUFFER2) s, &Size);
 | 
|---|
 | 191 |             if (!rc) {
 | 
|---|
 | 192 |               pfsq = (PFSQBUFFER2) s;
 | 
|---|
| [689] | 193 |               pfsn = (PCHAR)(pfsq->szName) + pfsq->cbName + 1;
 | 
|---|
| [551] | 194 |               pfsd = pfsn + pfsq->cbFSDName + 1;
 | 
|---|
 | 195 |               if (pfsq->cbFSAData && pfsd && *pfsd) {
 | 
|---|
 | 196 |                 sprintf(s, " (%s)", pfsd);
 | 
|---|
 | 197 |                 WinSetDlgItemText(hwnd, INFO_REALPATH, s);
 | 
|---|
 | 198 |               }
 | 
|---|
 | 199 |             }
 | 
|---|
 | 200 |           }
 | 
|---|
| [2] | 201 | 
 | 
|---|
| [551] | 202 |           DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 203 |           if (!DosQueryFSInfo(toupper(*pszFileName) - '@',
 | 
|---|
 | 204 |                               FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) {
 | 
|---|
| [2] | 205 | 
 | 
|---|
| [551] | 206 |             struct
 | 
|---|
 | 207 |             {
 | 
|---|
 | 208 |               ULONG serial;
 | 
|---|
 | 209 |               CHAR volumelength;
 | 
|---|
 | 210 |               CHAR volumelabel[CCHMAXPATH];
 | 
|---|
 | 211 |             }
 | 
|---|
 | 212 |             volser;
 | 
|---|
| [1543] | 213 |             ULONG percentfree, percentused;
 | 
|---|
| [2] | 214 | 
 | 
|---|
| [551] | 215 |             memset(&volser, 0, sizeof(volser));
 | 
|---|
 | 216 |             DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 217 |             if (!DosQueryFSInfo(toupper(*pszFileName) - '@',
 | 
|---|
 | 218 |                                 FSIL_VOLSER,
 | 
|---|
 | 219 |                                 &volser, (ULONG) sizeof(volser))) {
 | 
|---|
 | 220 |               WinSetDlgItemText(hwnd, INFO_FS, FileSystem);
 | 
|---|
 | 221 |               WinSetDlgItemText(hwnd, INFO_LABEL, volser.volumelabel);
 | 
|---|
 | 222 |               sprintf(s, "%lx", volser.serial);
 | 
|---|
| [575] | 223 |               WinSetDlgItemText(hwnd, INFO_SERIAL, s);
 | 
|---|
 | 224 |               FlagMsg(*pszFileName, s);
 | 
|---|
| [552] | 225 |               WinSetDlgItemText(hwnd, INFO_FLAGS, s);
 | 
|---|
| [575] | 226 |               if (!(driveflags[toupper(*pszFileName) - 'A'] & DRIVE_NOSTATS)){
 | 
|---|
| [551] | 227 |               CommaFmtULL(szMB, sizeof(szMB),
 | 
|---|
 | 228 |                           (ULONGLONG) fsa.cUnit *
 | 
|---|
 | 229 |                           (fsa.cSectorUnit * fsa.cbSector), 'M');
 | 
|---|
 | 230 |               CommaFmtULL(szKB, sizeof(szKB),
 | 
|---|
 | 231 |                           (ULONGLONG) fsa.cUnit *
 | 
|---|
 | 232 |                           (fsa.cSectorUnit * fsa.cbSector), 'K');
 | 
|---|
 | 233 |               CommaFmtULL(szUnits, sizeof(szUnits),
 | 
|---|
 | 234 |                           (ULONGLONG) fsa.cUnit, ' ');
 | 
|---|
 | 235 |               sprintf(s, "%s, %s, %s %s%s", szMB, szKB, szUnits, GetPString(IDS_UNITTEXT), &"s"[fsa.cUnit == 1L]);      // hack cough
 | 
|---|
 | 236 |               WinSetDlgItemText(hwnd, INFO_TOTAL, s);
 | 
|---|
| [162] | 237 | 
 | 
|---|
| [551] | 238 |               CommaFmtULL(szMB, sizeof(szMB),
 | 
|---|
 | 239 |                           (ULONGLONG) fsa.cUnitAvail *
 | 
|---|
 | 240 |                           (fsa.cSectorUnit * fsa.cbSector), 'M');
 | 
|---|
 | 241 |               CommaFmtULL(szKB, sizeof(szKB),
 | 
|---|
 | 242 |                           (ULONGLONG) fsa.cUnitAvail *
 | 
|---|
 | 243 |                           (fsa.cSectorUnit * fsa.cbSector), 'K');
 | 
|---|
 | 244 |               CommaFmtULL(szUnits, sizeof(szUnits),
 | 
|---|
 | 245 |                           (ULONGLONG) fsa.cUnitAvail, ' ');
 | 
|---|
| [1402] | 246 |               sprintf(s, "%s, %s, %s %s%s",
 | 
|---|
 | 247 |                       szMB, szKB, szUnits,
 | 
|---|
 | 248 |                       GetPString(IDS_UNITTEXT), &"s"[fsa.cUnitAvail == 1L]);
 | 
|---|
| [551] | 249 |               WinSetDlgItemText(hwnd, INFO_AVAILABLE, s);
 | 
|---|
 | 250 |               sprintf(s,
 | 
|---|
| [1402] | 251 |                       GetPString(IDS_SECTORSTEXT),
 | 
|---|
 | 252 |                       fsa.cbSector,
 | 
|---|
 | 253 |                       fsa.cSectorUnit, &"s"[fsa.cSectorUnit == 1L]);
 | 
|---|
| [551] | 254 |               WinSetDlgItemText(hwnd, INFO_ALLOCUNITS, s);
 | 
|---|
| [552] | 255 | 
 | 
|---|
| [551] | 256 |               percentfree = (fsa.cUnitAvail && fsa.cUnit) ?
 | 
|---|
| [1543] | 257 |                 ((ULONG) fsa.cUnitAvail * 100) / (ULONG) fsa.cUnit : 0;
 | 
|---|
| [551] | 258 |               if (!percentfree && fsa.cUnitAvail)
 | 
|---|
 | 259 |                 percentfree = 1;
 | 
|---|
 | 260 |               percentused = 100 - percentfree;
 | 
|---|
 | 261 |               WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 262 |                                 INFO_USED,
 | 
|---|
 | 263 |                                 SLM_SETSLIDERINFO,
 | 
|---|
 | 264 |                                 MPFROM2SHORT(SMA_SLIDERARMPOSITION,
 | 
|---|
 | 265 |                                              SMA_INCREMENTVALUE),
 | 
|---|
 | 266 |                                 MPFROMSHORT(percentused));
 | 
|---|
 | 267 |               WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 268 |                                 INFO_FREE,
 | 
|---|
 | 269 |                                 SLM_SETSLIDERINFO,
 | 
|---|
 | 270 |                                 MPFROM2SHORT(SMA_SLIDERARMPOSITION,
 | 
|---|
 | 271 |                                              SMA_INCREMENTVALUE),
 | 
|---|
 | 272 |                                 MPFROMSHORT(percentfree));
 | 
|---|
 | 273 |               sprintf(s, "%u%%", percentused);
 | 
|---|
 | 274 |               WinSetDlgItemText(hwnd, INFO_USEDPERCENT, s);
 | 
|---|
 | 275 |               sprintf(s, "%u%%", percentfree);
 | 
|---|
| [575] | 276 |               WinSetDlgItemText(hwnd, INFO_FREEPERCENT, s);
 | 
|---|
 | 277 |               }
 | 
|---|
 | 278 |               else
 | 
|---|
| [1498] | 279 |                  WinSetDlgItemText(hwnd, INFO_AVAILABLE, (CHAR *) GetPString(IDS_STATSMEANINGLESSTEXT));
 | 
|---|
| [551] | 280 |             }
 | 
|---|
 | 281 |             else {
 | 
|---|
 | 282 |               sprintf(FileSystem,
 | 
|---|
| [1402] | 283 |                       GetPString(IDS_CANTQUERYVOLTEXT),
 | 
|---|
 | 284 |                       toupper(*pszFileName));
 | 
|---|
| [551] | 285 |               Notify(FileSystem);
 | 
|---|
 | 286 |               WinDismissDlg(hwnd, 0);
 | 
|---|
 | 287 |             }
 | 
|---|
 | 288 |           }
 | 
|---|
 | 289 |           else {
 | 
|---|
 | 290 |             sprintf(FileSystem,
 | 
|---|
| [1402] | 291 |                     GetPString(IDS_CANTQUERYALLOCTEXT),
 | 
|---|
 | 292 |                     toupper(*pszFileName));
 | 
|---|
| [551] | 293 |             Notify(FileSystem);
 | 
|---|
 | 294 |             WinDismissDlg(hwnd, 0);
 | 
|---|
 | 295 |           }
 | 
|---|
 | 296 |         }
 | 
|---|
 | 297 |         else {
 | 
|---|
 | 298 |           FlagMsg(*pszFileName, s);
 | 
|---|
 | 299 |           sprintf(FileSystem,
 | 
|---|
| [1402] | 300 |                   GetPString(IDS_DRIVEINACCESSIBLETEXT),
 | 
|---|
 | 301 |                   toupper(*pszFileName), s);
 | 
|---|
| [551] | 302 |           Notify(FileSystem);
 | 
|---|
 | 303 |           WinDismissDlg(hwnd, 0);
 | 
|---|
 | 304 |         }
 | 
|---|
| [2] | 305 |       }
 | 
|---|
| [551] | 306 |       else {
 | 
|---|
 | 307 |         WinDismissDlg(hwnd, 0);
 | 
|---|
 | 308 |       }
 | 
|---|
 | 309 |     }
 | 
|---|
 | 310 |     else
 | 
|---|
 | 311 |       WinDismissDlg(hwnd, 0);
 | 
|---|
 | 312 |     break;
 | 
|---|
| [2] | 313 | 
 | 
|---|
| [551] | 314 |   case WM_CONTROL:
 | 
|---|
 | 315 |     return 0;
 | 
|---|
| [2] | 316 | 
 | 
|---|
| [551] | 317 |   case WM_COMMAND:
 | 
|---|
 | 318 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
 | 319 |     case DID_CANCEL:
 | 
|---|
 | 320 |       WinDismissDlg(hwnd, 0);
 | 
|---|
 | 321 |       break;
 | 
|---|
| [2] | 322 | 
 | 
|---|
| [551] | 323 |     case IDM_HELP:
 | 
|---|
 | 324 |       if (hwndHelp)
 | 
|---|
 | 325 |         WinSendMsg(hwndHelp,
 | 
|---|
 | 326 |                    HM_DISPLAY_HELP,
 | 
|---|
 | 327 |                    MPFROM2SHORT(HELP_DRVINFO, 0), MPFROMSHORT(HM_RESOURCEID));
 | 
|---|
 | 328 |       break;
 | 
|---|
| [2] | 329 | 
 | 
|---|
| [551] | 330 |     case DID_OK:
 | 
|---|
 | 331 |       pszFileName = INSTDATA(hwnd);
 | 
|---|
 | 332 |       if (!(driveflags[toupper(*pszFileName) - 'A'] & DRIVE_NOTWRITEABLE)) {
 | 
|---|
| [2] | 333 | 
 | 
|---|
| [551] | 334 |         CHAR s[CCHMAXPATHCOMP + 3];
 | 
|---|
| [2] | 335 | 
 | 
|---|
| [551] | 336 |         *s = 0;
 | 
|---|
 | 337 |         WinQueryDlgItemText(hwnd, INFO_LABEL, CCHMAXPATHCOMP, s);
 | 
|---|
 | 338 |         bstrip(s);
 | 
|---|
 | 339 |         if (*s) {
 | 
|---|
 | 340 |           struct
 | 
|---|
 | 341 |           {
 | 
|---|
 | 342 |             ULONG serial;
 | 
|---|
 | 343 |             CHAR volumelength;
 | 
|---|
 | 344 |             CHAR volumelabel[CCHMAXPATH];
 | 
|---|
 | 345 |           }
 | 
|---|
 | 346 |           volser;
 | 
|---|
| [2] | 347 | 
 | 
|---|
| [551] | 348 |           memset(&volser, 0, sizeof(volser));
 | 
|---|
 | 349 |           DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 350 |           if (!DosQueryFSInfo(toupper(*pszFileName) - '@',
 | 
|---|
 | 351 |                               FSIL_VOLSER,
 | 
|---|
 | 352 |                               &volser,
 | 
|---|
 | 353 |                               (ULONG) sizeof(volser)) &&
 | 
|---|
 | 354 |               stricmp(s, volser.volumelabel)) {
 | 
|---|
 | 355 |             memmove(s + 1, s, strlen(s) + 1);
 | 
|---|
 | 356 |             *s = strlen(s + 1);
 | 
|---|
 | 357 |             DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 358 |             rc = DosSetFSInfo(toupper(*pszFileName) - '@',
 | 
|---|
 | 359 |                               2L, (PVOID) s, (ULONG) sizeof(s));
 | 
|---|
 | 360 |             if (rc) {
 | 
|---|
 | 361 |               Dos_Error(MB_CANCEL, rc, hwnd, __FILE__, __LINE__,
 | 
|---|
 | 362 |                         "DosSetFSInfo failed");
 | 
|---|
 | 363 |             }
 | 
|---|
 | 364 |           }
 | 
|---|
 | 365 |         }
 | 
|---|
| [2] | 366 |       }
 | 
|---|
| [551] | 367 |       WinDismissDlg(hwnd, 1);
 | 
|---|
 | 368 |       break;
 | 
|---|
 | 369 |     }
 | 
|---|
 | 370 |     return 0;
 | 
|---|
| [2] | 371 |   }
 | 
|---|
| [551] | 372 |   return WinDefDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 373 | }
 | 
|---|
 | 374 | 
 | 
|---|
| [575] | 375 | typedef struct {
 | 
|---|
| [2] | 376 |   USHORT size;
 | 
|---|
| [551] | 377 |   CHAR szFileName[CCHMAXPATH];
 | 
|---|
 | 378 |   BOOL madechanges;
 | 
|---|
| [575] | 379 | } FILESTUF;
 | 
|---|
| [2] | 380 | 
 | 
|---|
| [575] | 381 | typedef struct {
 | 
|---|
 | 382 |   USHORT size;
 | 
|---|
 | 383 |   PFNWP oldproc;
 | 
|---|
 | 384 |   FILESTUF *pfs;
 | 
|---|
 | 385 |   HWND lasthwndMenu;
 | 
|---|
 | 386 | } ICONSTUF;
 | 
|---|
 | 387 | 
 | 
|---|
| [1673] | 388 | /**
 | 
|---|
| [2] | 389 |  * subclass routine to allow changing a program's icon
 | 
|---|
 | 390 |  */
 | 
|---|
 | 391 | 
 | 
|---|
| [551] | 392 | MRESULT EXPENTRY IconProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| [162] | 393 | {
 | 
|---|
| [575] | 394 |   ICONSTUF *pis = (ICONSTUF *)WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
 | 395 |   MRESULT mr;
 | 
|---|
 | 396 |   CHAR *p;
 | 
|---|
 | 397 | 
 | 
|---|
| [2] | 398 |   static BOOL emphasized = FALSE;
 | 
|---|
 | 399 | 
 | 
|---|
| [575] | 400 |   if (!pis) {
 | 
|---|
| [1398] | 401 |     Runtime_Error(pszSrcFile, __LINE__, NULL);
 | 
|---|
| [575] | 402 |     if (msg != WM_DESTROY)
 | 
|---|
 | 403 |       return WinDefWindowProc(hwnd, msg, mp1, mp2);
 | 
|---|
 | 404 |   }
 | 
|---|
| [2] | 405 | 
 | 
|---|
| [551] | 406 |   switch (msg) {
 | 
|---|
 | 407 |   case DM_DRAGOVER:
 | 
|---|
 | 408 |     if (!emphasized) {
 | 
|---|
 | 409 |       emphasized = TRUE;
 | 
|---|
 | 410 |       DrawTargetEmphasis(hwnd, emphasized);
 | 
|---|
 | 411 |     }
 | 
|---|
| [618] | 412 |     if (AcceptOneDrop(hwnd, mp1, mp2))
 | 
|---|
| [551] | 413 |       return MRFROM2SHORT(DOR_DROP, DO_MOVE);
 | 
|---|
 | 414 |     return MRFROM2SHORT(DOR_NEVERDROP, 0);
 | 
|---|
| [2] | 415 | 
 | 
|---|
| [551] | 416 |   case DM_DRAGLEAVE:
 | 
|---|
 | 417 |     emphasized = FALSE;
 | 
|---|
 | 418 |     DrawTargetEmphasis(hwnd, emphasized);
 | 
|---|
 | 419 |     break;
 | 
|---|
| [2] | 420 | 
 | 
|---|
| [551] | 421 |   case DM_DROPHELP:
 | 
|---|
 | 422 |     DropHelp(mp1, mp2, hwnd, GetPString(IDS_DROPCHGICONHELPTEXT));
 | 
|---|
 | 423 |     return 0;
 | 
|---|
| [2] | 424 | 
 | 
|---|
| [551] | 425 |   case DM_DROP:
 | 
|---|
 | 426 |     {
 | 
|---|
 | 427 |       HPOINTER hptr;
 | 
|---|
 | 428 |       CHAR szFrom[CCHMAXPATH + 2];
 | 
|---|
 | 429 |       ICONINFO ici;
 | 
|---|
| [2] | 430 | 
 | 
|---|
| [551] | 431 |       emphasized = FALSE;
 | 
|---|
 | 432 |       DrawTargetEmphasis(hwnd, emphasized);
 | 
|---|
| [618] | 433 |       if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
 | 
|---|
| [551] | 434 |         memset(&ici, 0, sizeof(ICONINFO));
 | 
|---|
 | 435 |         ici.cb = sizeof(ICONINFO);
 | 
|---|
 | 436 |         ici.fFormat = ICON_FILE;
 | 
|---|
 | 437 |         ici.pszFileName = szFrom;
 | 
|---|
| [575] | 438 |         if (!WinSetFileIcon((PSZ) pis->pfs->szFileName, (PICONINFO) & ici)) {
 | 
|---|
| [551] | 439 |           ici.fFormat = ICON_CLEAR;
 | 
|---|
| [575] | 440 |           WinSetFileIcon((PSZ) pis->pfs->szFileName, (PICONINFO) & ici);
 | 
|---|
| [551] | 441 |         }
 | 
|---|
| [575] | 442 |         hptr = WinLoadFileIcon(pis->pfs->szFileName, FALSE);
 | 
|---|
| [551] | 443 |         if (!hptr)
 | 
|---|
| [575] | 444 |           hptr = (!IsFile(pis->pfs->szFileName)) ? hptrDir : hptrFile;
 | 
|---|
 | 445 |         if (pis && pis->oldproc) {
 | 
|---|
| [551] | 446 |           WinShowWindow(hwnd, FALSE);
 | 
|---|
| [575] | 447 |           pis->oldproc(hwnd, SM_SETHANDLE, MPFROMLONG(hptr), MPVOID);
 | 
|---|
| [551] | 448 |           WinShowWindow(hwnd, TRUE);
 | 
|---|
 | 449 |           WinInvalidateRect(WinQueryWindow(hwnd, QW_PARENT), NULL, TRUE);
 | 
|---|
 | 450 |         }
 | 
|---|
| [2] | 451 |       }
 | 
|---|
| [551] | 452 |     }
 | 
|---|
 | 453 |     return 0;
 | 
|---|
| [2] | 454 | 
 | 
|---|
| [551] | 455 |   case WM_PAINT:
 | 
|---|
| [575] | 456 |     mr = pis->oldproc(hwnd, msg, mp1, mp2);
 | 
|---|
 | 457 |     PaintRecessedWindow(hwnd, (HPS) 0, FALSE, FALSE);
 | 
|---|
 | 458 |     return mr;
 | 
|---|
| [551] | 459 |     break;
 | 
|---|
| [2] | 460 | 
 | 
|---|
| [551] | 461 |   case WM_MENUEND:
 | 
|---|
| [575] | 462 |     if (pis->lasthwndMenu == (HWND)mp2)
 | 
|---|
 | 463 |       WinDestroyWindow(pis->lasthwndMenu);
 | 
|---|
 | 464 |     pis->lasthwndMenu = (HWND) 0;
 | 
|---|
| [551] | 465 |     break;
 | 
|---|
| [2] | 466 | 
 | 
|---|
| [551] | 467 |   case WM_CONTEXTMENU:
 | 
|---|
| [575] | 468 |     if (pis->lasthwndMenu)
 | 
|---|
 | 469 |       WinDestroyWindow(pis->lasthwndMenu);
 | 
|---|
 | 470 |     pis->lasthwndMenu = WinLoadMenu(hwnd, FM3ModHandle, FLE_FRAME);
 | 
|---|
 | 471 |     if (pis->lasthwndMenu) {
 | 
|---|
 | 472 |       p = strrchr(pis->pfs->szFileName, '.');
 | 
|---|
| [1398] | 473 |       if (!p || (stricmp(p, PCSZ_DOTICO) && stricmp(p, PCSZ_DOTPTR)))
 | 
|---|
| [575] | 474 |         WinSendMsg(pis->lasthwndMenu,
 | 
|---|
 | 475 |                    MM_DELETEITEM,
 | 
|---|
 | 476 |                    MPFROM2SHORT(IDM_SELECTALL, TRUE), MPVOID);
 | 
|---|
 | 477 |       PopupMenu(hwnd, hwnd, pis->lasthwndMenu);
 | 
|---|
| [551] | 478 |     }
 | 
|---|
 | 479 |     break;
 | 
|---|
 | 480 | 
 | 
|---|
 | 481 |   case WM_COMMAND:
 | 
|---|
 | 482 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
 | 483 |     case IDM_SELECTALL:
 | 
|---|
 | 484 |     case IDM_DESELECTALL:
 | 
|---|
 | 485 |       WinDlgBox(HWND_DESKTOP,
 | 
|---|
 | 486 |                 hwnd,
 | 
|---|
 | 487 |                 SetIconDlgProc,
 | 
|---|
 | 488 |                 FM3ModHandle,
 | 
|---|
 | 489 |                 SETICON_FRAME,
 | 
|---|
 | 490 |                 (PVOID) ((SHORT1FROMMP(mp1) == IDM_SELECTALL) ?
 | 
|---|
| [575] | 491 |                          pis->pfs->szFileName : NULL));
 | 
|---|
| [2] | 492 |       break;
 | 
|---|
| [551] | 493 |     }
 | 
|---|
 | 494 |     return 0;
 | 
|---|
| [2] | 495 | 
 | 
|---|
| [551] | 496 |   case WM_DESTROY:
 | 
|---|
 | 497 |     emphasized = FALSE;
 | 
|---|
| [575] | 498 |     if (!pis)
 | 
|---|
 | 499 |       return WinDefWindowProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [576] | 500 |     else {
 | 
|---|
| [805] | 501 |       PFNWP oldproc = pis->oldproc;
 | 
|---|
| [576] | 502 |       if (pis->lasthwndMenu)
 | 
|---|
| [805] | 503 |         WinDestroyWindow(pis->lasthwndMenu);
 | 
|---|
| [1039] | 504 |       free(pis);
 | 
|---|
| [805] | 505 |       return oldproc(hwnd, msg, mp1, mp2);
 | 
|---|
| [576] | 506 |     }
 | 
|---|
| [551] | 507 |     break;
 | 
|---|
| [2] | 508 |   }
 | 
|---|
 | 509 | 
 | 
|---|
| [575] | 510 |   return pis->oldproc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 511 | }
 | 
|---|
 | 512 | 
 | 
|---|
| [551] | 513 | MRESULT EXPENTRY FileInfoProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| [336] | 514 | {
 | 
|---|
| [575] | 515 |   FILESTUF *pfs;
 | 
|---|
 | 516 |   ICONSTUF *pis;
 | 
|---|
| [805] | 517 |   CHAR **ppsz;
 | 
|---|
| [2] | 518 | 
 | 
|---|
| [551] | 519 |   switch (msg) {
 | 
|---|
 | 520 |   case WM_INITDLG:
 | 
|---|
 | 521 |     if (!mp2) {
 | 
|---|
 | 522 |       WinDismissDlg(hwnd, 1);
 | 
|---|
 | 523 |       break;
 | 
|---|
 | 524 |     }
 | 
|---|
| [575] | 525 |     pfs = xmallocz(sizeof(FILESTUF), pszSrcFile, __LINE__);
 | 
|---|
 | 526 |     if (!pfs) {
 | 
|---|
| [551] | 527 |       WinDismissDlg(hwnd, 1);
 | 
|---|
 | 528 |       break;
 | 
|---|
 | 529 |     }
 | 
|---|
| [575] | 530 |     pfs->size = sizeof(FILESTUF);
 | 
|---|
 | 531 |     WinSetWindowPtr(hwnd, QWL_USER, pfs);
 | 
|---|
| [551] | 532 |     {
 | 
|---|
 | 533 |       USHORT ids[] = { FLE_SIZES, FLE_SLACK, FLE_LASTWRITE, FLE_CREATE,
 | 
|---|
 | 534 |         FLE_LASTACCESS, 0
 | 
|---|
 | 535 |       };
 | 
|---|
 | 536 |       INT x;
 | 
|---|
 | 537 |       CHAR s[CCHMAXPATH];
 | 
|---|
 | 538 | 
 | 
|---|
| [805] | 539 |       ppsz = (CHAR **)mp2;
 | 
|---|
 | 540 |       for (x = 0; ppsz[x]; x++) {
 | 
|---|
 | 541 |         if (DosQueryPathInfo(ppsz[x], FIL_QUERYFULLNAME, s, sizeof(s)))
 | 
|---|
 | 542 |           strcpy(s, ppsz[x]);
 | 
|---|
| [551] | 543 |         WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 544 |                           FLE_NAME,
 | 
|---|
 | 545 |                           LM_INSERTITEM,
 | 
|---|
 | 546 |                           MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(s));
 | 
|---|
| [2] | 547 |       }
 | 
|---|
| [551] | 548 |       if (!x) {
 | 
|---|
 | 549 |         WinDismissDlg(hwnd, 1);
 | 
|---|
 | 550 |         break;
 | 
|---|
| [2] | 551 |       }
 | 
|---|
| [551] | 552 |       WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 553 |                         FLE_NAME,
 | 
|---|
 | 554 |                         LM_SELECTITEM, MPFROM2SHORT(0, 0), MPFROMSHORT(TRUE));
 | 
|---|
 | 555 |       for (x = 0; ids[x]; x++)
 | 
|---|
 | 556 |         SetPresParams(WinWindowFromID(hwnd, ids[x]),
 | 
|---|
 | 557 |                       &RGBGREY, &RGBBLACK, &RGBBLACK, NULL);
 | 
|---|
 | 558 |     }
 | 
|---|
| [575] | 559 |     pis = xmallocz(sizeof(ICONSTUF), pszSrcFile, __LINE__);
 | 
|---|
 | 560 |     if (!pis) {
 | 
|---|
 | 561 |       WinDismissDlg(hwnd, 1);
 | 
|---|
 | 562 |       break;
 | 
|---|
 | 563 |     }
 | 
|---|
 | 564 |     WinSetWindowPtr(WinWindowFromID(hwnd, FLE_ICON), QWL_USER, (PVOID) pis);
 | 
|---|
 | 565 |     pis->size = sizeof(ICONSTUF);
 | 
|---|
 | 566 |     pis->pfs = pfs;
 | 
|---|
 | 567 |     pis->oldproc = WinSubclassWindow(WinWindowFromID(hwnd, FLE_ICON),
 | 
|---|
| [551] | 568 |                                     IconProc);
 | 
|---|
 | 569 |     break;
 | 
|---|
| [2] | 570 | 
 | 
|---|
| [551] | 571 |   case WM_CONTROL:
 | 
|---|
 | 572 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
 | 573 |     case FLE_READONLY:
 | 
|---|
 | 574 |     case FLE_ARCHIVED:
 | 
|---|
 | 575 |     case FLE_SYSTEM:
 | 
|---|
 | 576 |     case FLE_HIDDEN:
 | 
|---|
 | 577 |       switch (SHORT2FROMMP(mp1)) {
 | 
|---|
 | 578 |       case BN_CLICKED:
 | 
|---|
| [575] | 579 |         pfs = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
 | 580 |         if (pfs && *pfs->szFileName) {
 | 
|---|
| [551] | 581 | 
 | 
|---|
 | 582 |           LISTINFO li;
 | 
|---|
| [907] | 583 |           UINT numfiles = 0, numalloc = 0;
 | 
|---|
| [551] | 584 | 
 | 
|---|
 | 585 |           memset(&li, 0, sizeof(LISTINFO));
 | 
|---|
| [575] | 586 |           if (!AddToList(pfs->szFileName, &li.list, &numfiles, &numalloc)) {
 | 
|---|
| [551] | 587 |             if (WinDlgBox(HWND_DESKTOP,
 | 
|---|
 | 588 |                           hwnd,
 | 
|---|
 | 589 |                           AttrListDlgProc,
 | 
|---|
 | 590 |                           FM3ModHandle,
 | 
|---|
 | 591 |                           ATR_FRAME, MPFROMP(&li)) && li.list && li.list[0]) {
 | 
|---|
| [575] | 592 |               pfs->madechanges = TRUE;
 | 
|---|
| [551] | 593 |               WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
 | 
|---|
 | 594 |             }
 | 
|---|
 | 595 |             FreeList(li.list);
 | 
|---|
 | 596 |           }
 | 
|---|
 | 597 |         }
 | 
|---|
 | 598 |         break;
 | 
|---|
| [805] | 599 |       } // switch
 | 
|---|
| [2] | 600 |       break;
 | 
|---|
| [551] | 601 |     case FLE_NAME:
 | 
|---|
 | 602 |       switch (SHORT2FROMMP(mp1)) {
 | 
|---|
 | 603 |       case LN_ENTER:
 | 
|---|
 | 604 |       case LN_SELECT:
 | 
|---|
| [575] | 605 |         pfs = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
 | 606 |         if (!pfs) {
 | 
|---|
| [1398] | 607 |           Runtime_Error(pszSrcFile, __LINE__, NULL);
 | 
|---|
| [551] | 608 |           WinDismissDlg(hwnd, 1);
 | 
|---|
 | 609 |         }
 | 
|---|
 | 610 |         else {
 | 
|---|
| [2] | 611 | 
 | 
|---|
| [551] | 612 |           SHORT sSelect;
 | 
|---|
| [2] | 613 | 
 | 
|---|
| [551] | 614 |           sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 615 |                                               FLE_NAME,
 | 
|---|
 | 616 |                                               LM_QUERYSELECTION,
 | 
|---|
 | 617 |                                               MPFROMSHORT(LIT_FIRST), MPVOID);
 | 
|---|
 | 618 |           if (sSelect >= 0) {
 | 
|---|
| [575] | 619 |             *pfs->szFileName = 0;
 | 
|---|
| [551] | 620 |             WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 621 |                               FLE_NAME,
 | 
|---|
 | 622 |                               LM_QUERYITEMTEXT,
 | 
|---|
 | 623 |                               MPFROM2SHORT(sSelect, CCHMAXPATH),
 | 
|---|
| [575] | 624 |                               MPFROMP(pfs->szFileName));
 | 
|---|
 | 625 |             if (*pfs->szFileName) {
 | 
|---|
| [551] | 626 |               if (SHORT2FROMMP(mp1) == LN_SELECT)
 | 
|---|
 | 627 |                 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
 | 
|---|
| [1687] | 628 |               else if (IsFile(pfs->szFileName))
 | 
|---|
 | 629 |                 DefaultView(hwnd,(HWND) 0, (HWND) 0, NULL, 32, pfs->szFileName);
 | 
|---|
 | 630 |               else
 | 
|---|
 | 631 |                 DefaultView(hwnd,(HWND) 0, (HWND) 0, NULL, 2, pfs->szFileName);
 | 
|---|
| [551] | 632 |             }
 | 
|---|
 | 633 |           }
 | 
|---|
 | 634 |         }
 | 
|---|
 | 635 |         break;
 | 
|---|
 | 636 |       }
 | 
|---|
 | 637 |       break;
 | 
|---|
 | 638 |     }
 | 
|---|
 | 639 |     return 0;
 | 
|---|
| [2] | 640 | 
 | 
|---|
| [551] | 641 |   case UM_SETDIR:
 | 
|---|
 | 642 |     WinCheckButton(hwnd, FLE_READONLY, FALSE);
 | 
|---|
 | 643 |     WinCheckButton(hwnd, FLE_ARCHIVED, FALSE);
 | 
|---|
 | 644 |     WinCheckButton(hwnd, FLE_SYSTEM, FALSE);
 | 
|---|
 | 645 |     WinCheckButton(hwnd, FLE_HIDDEN, FALSE);
 | 
|---|
 | 646 |     WinCheckButton(hwnd, FLE_DIRECTORY, FALSE);
 | 
|---|
 | 647 |     WinCheckButton(hwnd, FLE_READABLE, FALSE);
 | 
|---|
 | 648 |     WinCheckButton(hwnd, FLE_WRITEABLE, FALSE);
 | 
|---|
 | 649 |     WinCheckButton(hwnd, FLE_OPEN, FALSE);
 | 
|---|
 | 650 |     WinCheckButton(hwnd, FLE_BINARY, FALSE);
 | 
|---|
 | 651 |     WinCheckButton(hwnd, FLE_ISARCHIVE, FALSE);
 | 
|---|
 | 652 |     WinSetDlgItemText(hwnd, FLE_ARCNAME, NullStr);
 | 
|---|
 | 653 |     WinCheckButton(hwnd, FLE_OS2FS, FALSE);
 | 
|---|
 | 654 |     WinCheckButton(hwnd, FLE_OS2WIN, FALSE);
 | 
|---|
 | 655 |     WinCheckButton(hwnd, FLE_OS2PM, FALSE);
 | 
|---|
 | 656 |     WinCheckButton(hwnd, FLE_DOS, FALSE);
 | 
|---|
 | 657 |     WinCheckButton(hwnd, FLE_32BIT, FALSE);
 | 
|---|
 | 658 |     WinCheckButton(hwnd, FLE_WINREAL, FALSE);
 | 
|---|
 | 659 |     WinCheckButton(hwnd, FLE_WINPROT, FALSE);
 | 
|---|
 | 660 |     WinCheckButton(hwnd, FLE_WINENH, FALSE);
 | 
|---|
 | 661 |     WinCheckButton(hwnd, FLE_DLL, FALSE);
 | 
|---|
 | 662 |     WinCheckButton(hwnd, FLE_PHYSDRV, FALSE);
 | 
|---|
 | 663 |     WinCheckButton(hwnd, FLE_VIRTDRV, FALSE);
 | 
|---|
 | 664 |     WinCheckButton(hwnd, FLE_PROTDLL, FALSE);
 | 
|---|
| [575] | 665 |     pfs = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
 | 666 |     if (pfs && *pfs->szFileName) {
 | 
|---|
| [551] | 667 |       CHAR s[97];
 | 
|---|
| [897] | 668 |       CHAR szCmmaFmtFileSize[81], szCmmaFmtEASize[81];
 | 
|---|
| [1397] | 669 |       CHAR szCmmaFmtFileEASize[81], szCmmaFmtFileEASizeK[81], szDate[DATE_BUF_BYTES];
 | 
|---|
| [841] | 670 |       FILEFINDBUF4L fs;
 | 
|---|
| [551] | 671 |       HDIR hdir = HDIR_CREATE;
 | 
|---|
| [841] | 672 |       ULONG apptype = 1;
 | 
|---|
| [551] | 673 |       FILE *fp;
 | 
|---|
 | 674 |       HPOINTER hptr;
 | 
|---|
 | 675 |       ARC_TYPE *info;
 | 
|---|
| [1544] | 676 |       CHAR *mode;
 | 
|---|
| [2] | 677 | 
 | 
|---|
| [551] | 678 |       DosError(FERR_DISABLEHARDERR);
 | 
|---|
| [838] | 679 |       if (xDosFindFirst(pfs->szFileName,
 | 
|---|
 | 680 |                         &hdir,
 | 
|---|
 | 681 |                         FILE_NORMAL | FILE_ARCHIVED |
 | 
|---|
 | 682 |                         FILE_DIRECTORY | FILE_READONLY | FILE_HIDDEN |
 | 
|---|
 | 683 |                         FILE_SYSTEM,
 | 
|---|
| [841] | 684 |                         &fs, sizeof(fs), &apptype, FIL_QUERYEASIZEL)) {
 | 
|---|
| [551] | 685 |         // Not found
 | 
|---|
 | 686 |         SHORT sSelect, numitems;
 | 
|---|
| [2] | 687 | 
 | 
|---|
| [1395] | 688 |         if (!fAlertBeepOff)
 | 
|---|
 | 689 |           DosBeep(250, 100);            // Wake up user
 | 
|---|
| [551] | 690 |         sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 691 |                                             FLE_NAME,
 | 
|---|
 | 692 |                                             LM_QUERYSELECTION,
 | 
|---|
 | 693 |                                             MPFROMSHORT(LIT_FIRST), MPVOID);
 | 
|---|
 | 694 |         if (sSelect >= 0) {
 | 
|---|
 | 695 |           WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 696 |                             FLE_NAME,
 | 
|---|
 | 697 |                             LM_DELETEITEM, MPFROMSHORT(sSelect), MPVOID);
 | 
|---|
 | 698 |           numitems = (SHORT) WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 699 |                                                FLE_NAME,
 | 
|---|
 | 700 |                                                LM_QUERYITEMCOUNT,
 | 
|---|
 | 701 |                                                MPVOID, MPVOID);
 | 
|---|
 | 702 |           if (numitems)
 | 
|---|
 | 703 |             PostMsg(WinWindowFromID(hwnd, FLE_NAME),
 | 
|---|
 | 704 |                     LM_SELECTITEM,
 | 
|---|
 | 705 |                     MPFROMSHORT(((sSelect) ? sSelect - 1 : 0)),
 | 
|---|
 | 706 |                     MPFROMSHORT(TRUE));
 | 
|---|
 | 707 |         }
 | 
|---|
| [2] | 708 |       }
 | 
|---|
| [551] | 709 |       else {
 | 
|---|
| [1395] | 710 |         DosFindClose(hdir);
 | 
|---|
 | 711 |         FDateFormat(szDate, fs.fdateLastWrite);
 | 
|---|
 | 712 |         sprintf(s, "%s  %02u%s%02u%s%02u",
 | 
|---|
 | 713 |                 szDate,
 | 
|---|
 | 714 |                 fs.ftimeLastWrite.hours, TimeSeparator,
 | 
|---|
 | 715 |                 fs.ftimeLastWrite.minutes, TimeSeparator, fs.ftimeLastWrite.twosecs * 2);
 | 
|---|
| [551] | 716 |         WinSetDlgItemText(hwnd, FLE_LASTWRITE, s);
 | 
|---|
 | 717 |         if (fs.fdateCreation.year &&
 | 
|---|
| [1395] | 718 |             fs.fdateCreation.month && fs.fdateCreation.day) {
 | 
|---|
 | 719 |           FDateFormat(szDate, fs.fdateCreation);
 | 
|---|
 | 720 |           sprintf(s, "%s  %02u%s%02u%s%02u",
 | 
|---|
 | 721 |                   szDate,
 | 
|---|
 | 722 |                   fs.ftimeCreation.hours, TimeSeparator,
 | 
|---|
 | 723 |                   fs.ftimeCreation.minutes, TimeSeparator, fs.ftimeCreation.twosecs * 2);
 | 
|---|
| [551] | 724 |           WinSetDlgItemText(hwnd, FLE_CREATE, s);
 | 
|---|
 | 725 |         }
 | 
|---|
 | 726 |         if (fs.fdateLastAccess.year &&
 | 
|---|
| [1395] | 727 |             fs.fdateLastAccess.month && fs.fdateLastAccess.day) {
 | 
|---|
 | 728 |           FDateFormat(szDate, fs.fdateLastAccess);
 | 
|---|
 | 729 |           sprintf(s, "%s  %02u%s%02u%s%02u",
 | 
|---|
 | 730 |                   szDate,
 | 
|---|
 | 731 |                   fs.ftimeLastAccess.hours, TimeSeparator,
 | 
|---|
 | 732 |                   fs.ftimeLastAccess.minutes, TimeSeparator, fs.ftimeLastAccess.twosecs * 2);
 | 
|---|
| [551] | 733 |           WinSetDlgItemText(hwnd, FLE_LASTACCESS, s);
 | 
|---|
 | 734 |         }
 | 
|---|
| [897] | 735 |         CommaFmtULL(szCmmaFmtFileSize,
 | 
|---|
 | 736 |                     sizeof(szCmmaFmtFileSize), fs.cbFile, ' ');
 | 
|---|
 | 737 |         CommaFmtULL(szCmmaFmtEASize,
 | 
|---|
 | 738 |                     sizeof(szCmmaFmtEASize), CBLIST_TO_EASIZE(fs.cbList), ' ');
 | 
|---|
 | 739 |         CommaFmtULL(szCmmaFmtFileEASize,
 | 
|---|
 | 740 |                     sizeof(szCmmaFmtFileEASize),
 | 
|---|
 | 741 |                     fs.cbFile + CBLIST_TO_EASIZE(fs.cbList),
 | 
|---|
 | 742 |                     ' ');
 | 
|---|
 | 743 |         CommaFmtULL(szCmmaFmtFileEASizeK,
 | 
|---|
 | 744 |                     sizeof(szCmmaFmtFileEASizeK),
 | 
|---|
 | 745 |                     fs.cbFile + CBLIST_TO_EASIZE(fs.cbList),
 | 
|---|
 | 746 |                     'K');
 | 
|---|
| [551] | 747 |         sprintf(s,
 | 
|---|
 | 748 |                 GetPString(IDS_SIZEINCLEASTEXT),
 | 
|---|
| [897] | 749 |                 szCmmaFmtFileSize,
 | 
|---|
 | 750 |                 szCmmaFmtEASize,
 | 
|---|
 | 751 |                 szCmmaFmtFileEASize,
 | 
|---|
 | 752 |                 szCmmaFmtFileEASizeK);
 | 
|---|
| [551] | 753 |         WinSetDlgItemText(hwnd, FLE_SIZES, s);
 | 
|---|
| [897] | 754 |         CommaFmtULL(szCmmaFmtFileSize,
 | 
|---|
 | 755 |                     sizeof(szCmmaFmtFileSize), fs.cbFileAlloc - fs.cbFile, ' ');
 | 
|---|
 | 756 |         sprintf(s, "%s", szCmmaFmtFileSize);
 | 
|---|
| [551] | 757 |         WinSetDlgItemText(hwnd, FLE_SLACK, s);
 | 
|---|
 | 758 |         WinCheckButton(hwnd,
 | 
|---|
 | 759 |                        FLE_READONLY, ((fs.attrFile & FILE_READONLY) != 0));
 | 
|---|
 | 760 |         WinCheckButton(hwnd,
 | 
|---|
 | 761 |                        FLE_ARCHIVED, ((fs.attrFile & FILE_ARCHIVED) != 0));
 | 
|---|
 | 762 |         WinCheckButton(hwnd,
 | 
|---|
 | 763 |                        FLE_DIRECTORY, ((fs.attrFile & FILE_DIRECTORY) != 0));
 | 
|---|
 | 764 |         WinCheckButton(hwnd, FLE_HIDDEN, ((fs.attrFile & FILE_HIDDEN) != 0));
 | 
|---|
 | 765 |         WinCheckButton(hwnd, FLE_SYSTEM, ((fs.attrFile & FILE_SYSTEM) != 0));
 | 
|---|
 | 766 |         DosError(FERR_DISABLEHARDERR);
 | 
|---|
| [1749] | 767 |         if (!xDosQueryAppType(pfs->szFileName, &apptype)) {
 | 
|---|
| [551] | 768 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_OS2FS), TRUE);
 | 
|---|
 | 769 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_OS2WIN), TRUE);
 | 
|---|
 | 770 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_OS2PM), TRUE);
 | 
|---|
 | 771 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_BOUND), TRUE);
 | 
|---|
 | 772 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_32BIT), TRUE);
 | 
|---|
 | 773 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_DOS), TRUE);
 | 
|---|
 | 774 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_WINPROT), TRUE);
 | 
|---|
 | 775 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_WINREAL), TRUE);
 | 
|---|
 | 776 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_WINENH), TRUE);
 | 
|---|
 | 777 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_DLL), TRUE);
 | 
|---|
 | 778 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_PHYSDRV), TRUE);
 | 
|---|
 | 779 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_VIRTDRV), TRUE);
 | 
|---|
 | 780 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_PROTDLL), TRUE);
 | 
|---|
 | 781 |           WinCheckButton(hwnd, FLE_OS2FS,
 | 
|---|
 | 782 |                          ((apptype & FAPPTYP_NOTWINDOWCOMPAT) &&
 | 
|---|
 | 783 |                           !(apptype & FAPPTYP_WINDOWCOMPAT)));
 | 
|---|
 | 784 |           WinCheckButton(hwnd, FLE_OS2WIN,
 | 
|---|
 | 785 |                          ((apptype & FAPPTYP_WINDOWCOMPAT) &&
 | 
|---|
 | 786 |                           !(apptype & FAPPTYP_NOTWINDOWCOMPAT)));
 | 
|---|
 | 787 |           WinCheckButton(hwnd, FLE_OS2PM,
 | 
|---|
 | 788 |                          ((apptype & FAPPTYP_WINDOWAPI) ==
 | 
|---|
 | 789 |                           FAPPTYP_WINDOWAPI));
 | 
|---|
 | 790 |           WinCheckButton(hwnd, FLE_BOUND, ((apptype & FAPPTYP_BOUND) != 0));
 | 
|---|
 | 791 |           WinCheckButton(hwnd, FLE_DLL, ((apptype & FAPPTYP_DLL) != 0));
 | 
|---|
 | 792 |           WinCheckButton(hwnd, FLE_DOS, ((apptype & FAPPTYP_DOS) != 0));
 | 
|---|
 | 793 |           WinCheckButton(hwnd, FLE_PHYSDRV,
 | 
|---|
 | 794 |                          ((apptype & FAPPTYP_PHYSDRV) != 0));
 | 
|---|
 | 795 |           WinCheckButton(hwnd, FLE_VIRTDRV,
 | 
|---|
 | 796 |                          ((apptype & FAPPTYP_VIRTDRV) != 0));
 | 
|---|
 | 797 |           WinCheckButton(hwnd, FLE_PROTDLL,
 | 
|---|
 | 798 |                          ((apptype & FAPPTYP_PROTDLL) != 0));
 | 
|---|
 | 799 |           WinCheckButton(hwnd, FLE_WINREAL,
 | 
|---|
 | 800 |                          ((apptype & FAPPTYP_WINDOWSREAL) != 0));
 | 
|---|
 | 801 |           WinCheckButton(hwnd, FLE_WINPROT,
 | 
|---|
 | 802 |                          ((apptype & FAPPTYP_WINDOWSPROT) != 0));
 | 
|---|
 | 803 |           WinCheckButton(hwnd, FLE_32BIT, ((apptype & FAPPTYP_32BIT) != 0));
 | 
|---|
 | 804 |           WinCheckButton(hwnd, FLE_WINENH, ((apptype & 0x1000) != 0));
 | 
|---|
 | 805 |         }
 | 
|---|
 | 806 |         else {
 | 
|---|
 | 807 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_OS2FS), FALSE);
 | 
|---|
 | 808 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_OS2WIN), FALSE);
 | 
|---|
 | 809 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_OS2PM), FALSE);
 | 
|---|
 | 810 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_BOUND), FALSE);
 | 
|---|
 | 811 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_32BIT), FALSE);
 | 
|---|
 | 812 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_DOS), FALSE);
 | 
|---|
 | 813 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_WINPROT), FALSE);
 | 
|---|
 | 814 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_WINREAL), FALSE);
 | 
|---|
 | 815 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_WINENH), FALSE);
 | 
|---|
 | 816 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_DLL), FALSE);
 | 
|---|
 | 817 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_PHYSDRV), FALSE);
 | 
|---|
 | 818 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_VIRTDRV), FALSE);
 | 
|---|
 | 819 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_PROTDLL), FALSE);
 | 
|---|
 | 820 |         }
 | 
|---|
| [575] | 821 |         hptr = WinLoadFileIcon(pfs->szFileName, FALSE);
 | 
|---|
| [551] | 822 |         WinShowWindow(WinWindowFromID(hwnd, FLE_ICON), FALSE);
 | 
|---|
 | 823 |         if (hptr) {
 | 
|---|
 | 824 |           WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 825 |                             FLE_ICON, SM_SETHANDLE, MPFROMLONG(hptr), MPVOID);
 | 
|---|
 | 826 |           WinShowWindow(WinWindowFromID(hwnd, FLE_ICON), TRUE);
 | 
|---|
 | 827 |         }
 | 
|---|
 | 828 |         WinShowWindow(WinWindowFromID(hwnd, FLE_EAS), fs.cbList > 4);
 | 
|---|
 | 829 |         if (!(fs.attrFile & FILE_DIRECTORY)) {
 | 
|---|
 | 830 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_READABLE), TRUE);
 | 
|---|
 | 831 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_WRITEABLE), TRUE);
 | 
|---|
 | 832 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_OPEN), TRUE);
 | 
|---|
 | 833 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_ISARCHIVE), TRUE);
 | 
|---|
| [1544] | 834 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_BINARY), TRUE);
 | 
|---|
 | 835 |           mode = "rb";
 | 
|---|
 | 836 |           fp = xfsopen(pfs->szFileName, mode, SH_DENYNO, pszSrcFile, __LINE__, TRUE);
 | 
|---|
| [551] | 837 |           if (fp) {
 | 
|---|
| [850] | 838 |             char buff[4096];            // 06 Oct 07 SHL protect against NTFS defect
 | 
|---|
| [551] | 839 |             ULONG len;
 | 
|---|
 | 840 |             APIRET rc;
 | 
|---|
| [2] | 841 | 
 | 
|---|
| [551] | 842 |             len = 512;
 | 
|---|
 | 843 |             rc = DosRead(fileno(fp), buff, len, &len);
 | 
|---|
 | 844 |             fclose(fp);
 | 
|---|
 | 845 |             WinCheckButton(hwnd,
 | 
|---|
 | 846 |                            FLE_BINARY,
 | 
|---|
 | 847 |                            ((len && rc) ? IsBinary(buff, len) : 2));
 | 
|---|
 | 848 |             WinCheckButton(hwnd, FLE_READABLE, TRUE);
 | 
|---|
| [575] | 849 |             info = find_type(pfs->szFileName, NULL);
 | 
|---|
| [551] | 850 |             if (info) {
 | 
|---|
 | 851 |               WinCheckButton(hwnd, FLE_ISARCHIVE, 1);
 | 
|---|
 | 852 |               if (info->id)
 | 
|---|
 | 853 |                 WinSetDlgItemText(hwnd, FLE_ARCNAME, info->id);
 | 
|---|
 | 854 |             }
 | 
|---|
 | 855 |           }
 | 
|---|
 | 856 |           else {
 | 
|---|
 | 857 |             WinCheckButton(hwnd, FLE_ISARCHIVE, 2);
 | 
|---|
 | 858 |             WinCheckButton(hwnd, FLE_BINARY, 2);
 | 
|---|
| [1544] | 859 |           }
 | 
|---|
 | 860 |           mode = "ab";
 | 
|---|
 | 861 |           fp = xfsopen(pfs->szFileName, mode, SH_DENYNO, pszSrcFile, __LINE__, TRUE);
 | 
|---|
| [551] | 862 |           if (fp) {
 | 
|---|
 | 863 |             WinCheckButton(hwnd, FLE_WRITEABLE, TRUE);
 | 
|---|
 | 864 |             fclose(fp);
 | 
|---|
| [1544] | 865 |           }
 | 
|---|
 | 866 |           mode = "rb";
 | 
|---|
 | 867 |           fp = xfsopen(pfs->szFileName, mode, SH_DENYRW, pszSrcFile, __LINE__, TRUE);
 | 
|---|
| [551] | 868 |           if (!fp)
 | 
|---|
 | 869 |             WinCheckButton(hwnd, FLE_OPEN, TRUE);
 | 
|---|
 | 870 |           else
 | 
|---|
 | 871 |             fclose(fp);
 | 
|---|
 | 872 |         }
 | 
|---|
 | 873 |         else {
 | 
|---|
 | 874 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_READABLE), FALSE);
 | 
|---|
 | 875 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_WRITEABLE), FALSE);
 | 
|---|
 | 876 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_OPEN), FALSE);
 | 
|---|
 | 877 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_ISARCHIVE), FALSE);
 | 
|---|
 | 878 |           WinEnableWindow(WinWindowFromID(hwnd, FLE_BINARY), FALSE);
 | 
|---|
 | 879 |         }
 | 
|---|
| [2] | 880 |       }
 | 
|---|
| [551] | 881 |     }
 | 
|---|
 | 882 |     return 0;
 | 
|---|
| [2] | 883 | 
 | 
|---|
| [551] | 884 |   case WM_COMMAND:
 | 
|---|
 | 885 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
 | 886 |     case DID_OK:
 | 
|---|
| [575] | 887 |       pfs = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
 | 888 |       WinDismissDlg(hwnd, (pfs && pfs->madechanges) ? 2 : 1);
 | 
|---|
| [551] | 889 |       break;
 | 
|---|
 | 890 |     case IDM_HELP:
 | 
|---|
 | 891 |       if (hwndHelp)
 | 
|---|
 | 892 |         WinSendMsg(hwndHelp,
 | 
|---|
 | 893 |                    HM_DISPLAY_HELP,
 | 
|---|
 | 894 |                    MPFROM2SHORT(HELP_INFO, 0), MPFROMSHORT(HM_RESOURCEID));
 | 
|---|
 | 895 |       break;
 | 
|---|
 | 896 |     case FLE_SETTINGS:
 | 
|---|
| [575] | 897 |       pfs = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
 | 898 |       if (pfs && *pfs->szFileName)
 | 
|---|
 | 899 |         OpenObject(pfs->szFileName, Settings, hwnd);
 | 
|---|
| [551] | 900 |       break;
 | 
|---|
 | 901 |     case FLE_EAS:
 | 
|---|
| [575] | 902 |       pfs = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
 | 903 |       if (pfs && *pfs->szFileName) {
 | 
|---|
| [2] | 904 | 
 | 
|---|
| [551] | 905 |         CHAR *list[2];
 | 
|---|
| [2] | 906 | 
 | 
|---|
| [575] | 907 |         list[0] = pfs->szFileName;
 | 
|---|
| [551] | 908 |         list[1] = NULL;
 | 
|---|
 | 909 |         WinDlgBox(HWND_DESKTOP,
 | 
|---|
 | 910 |                   hwnd, DisplayEAsProc, FM3ModHandle, EA_FRAME, (PVOID) list);
 | 
|---|
| [2] | 911 |       }
 | 
|---|
| [551] | 912 |       break;
 | 
|---|
 | 913 |     case DID_CANCEL:
 | 
|---|
| [575] | 914 |       pfs = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
 | 915 |       WinDismissDlg(hwnd, (pfs && pfs->madechanges) ? 2 : 0);
 | 
|---|
| [551] | 916 |       break;
 | 
|---|
 | 917 |     }
 | 
|---|
 | 918 |     return 0;
 | 
|---|
| [2] | 919 | 
 | 
|---|
| [551] | 920 |   case WM_DESTROY:
 | 
|---|
| [575] | 921 |     pfs = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| [1009] | 922 |     xfree(pfs, pszSrcFile, __LINE__);
 | 
|---|
| [551] | 923 |     break;
 | 
|---|
| [2] | 924 |   }
 | 
|---|
| [551] | 925 |   return WinDefDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 926 | }
 | 
|---|
 | 927 | 
 | 
|---|
| [551] | 928 | MRESULT EXPENTRY SetDrvProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| [336] | 929 | {
 | 
|---|
| [551] | 930 |   switch (msg) {
 | 
|---|
 | 931 |   case WM_INITDLG:
 | 
|---|
| [1009] | 932 |     if (!mp2 || !isalpha(*(CHAR *)mp2))
 | 
|---|
| [551] | 933 |       WinDismissDlg(hwnd, 0);
 | 
|---|
 | 934 |     else {
 | 
|---|
| [2] | 935 | 
 | 
|---|
| [551] | 936 |       CHAR s[80];
 | 
|---|
| [2] | 937 | 
 | 
|---|
| [1009] | 938 |       WinSetWindowULong(hwnd, QWL_USER, (toupper(*(CHAR *)mp2) - 'A'));
 | 
|---|
 | 939 |       sprintf(s, GetPString(IDS_DRIVEFLAGSTITLETEXT), toupper(*(CHAR *)mp2));
 | 
|---|
| [551] | 940 |       WinSetWindowText(hwnd, s);
 | 
|---|
 | 941 |       PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
 | 
|---|
 | 942 |     }
 | 
|---|
 | 943 |     break;
 | 
|---|
| [2] | 944 | 
 | 
|---|
| [551] | 945 |   case UM_UNDO:
 | 
|---|
 | 946 |     {
 | 
|---|
 | 947 |       ULONG drive = WinQueryWindowULong(hwnd, QWL_USER);
 | 
|---|
| [2] | 948 | 
 | 
|---|
| [551] | 949 |       WinCheckButton(hwnd, DVS_REMOVABLE,
 | 
|---|
 | 950 |                      ((driveflags[drive] & DRIVE_REMOVABLE) != 0));
 | 
|---|
 | 951 |       WinCheckButton(hwnd, DVS_NOTWRITEABLE,
 | 
|---|
 | 952 |                      ((driveflags[drive] & DRIVE_NOTWRITEABLE) != 0));
 | 
|---|
 | 953 |       WinCheckButton(hwnd, DVS_IGNORE,
 | 
|---|
 | 954 |                      ((driveflags[drive] & DRIVE_IGNORE) != 0));
 | 
|---|
 | 955 |       WinCheckButton(hwnd, DVS_CDROM,
 | 
|---|
 | 956 |                      ((driveflags[drive] & DRIVE_CDROM) != 0));
 | 
|---|
 | 957 |       WinCheckButton(hwnd, DVS_NOLONGNAMES,
 | 
|---|
 | 958 |                      ((driveflags[drive] & DRIVE_NOLONGNAMES) != 0));
 | 
|---|
 | 959 |       WinCheckButton(hwnd, DVS_REMOTE,
 | 
|---|
 | 960 |                      ((driveflags[drive] & DRIVE_REMOTE) != 0));
 | 
|---|
| [552] | 961 |       WinCheckButton(hwnd,DVS_VIRTUAL,
 | 
|---|
| [575] | 962 |                      ((driveflags[drive] & DRIVE_VIRTUAL) != 0));
 | 
|---|
| [552] | 963 |       WinCheckButton(hwnd,DVS_RAMDISK,
 | 
|---|
| [575] | 964 |                      ((driveflags[drive] & DRIVE_RAMDISK) != 0));
 | 
|---|
| [552] | 965 |       WinCheckButton(hwnd, DVS_BOOT,
 | 
|---|
| [575] | 966 |                      ((driveflags[drive] & DRIVE_BOOT) != 0));
 | 
|---|
| [551] | 967 |       WinCheckButton(hwnd, DVS_INVALID,
 | 
|---|
 | 968 |                      ((driveflags[drive] & DRIVE_INVALID) != 0));
 | 
|---|
 | 969 |       WinCheckButton(hwnd, DVS_NOPRESCAN,
 | 
|---|
 | 970 |                      ((driveflags[drive] & DRIVE_NOPRESCAN) != 0));
 | 
|---|
 | 971 |       WinCheckButton(hwnd, DVS_ZIPSTREAM,
 | 
|---|
 | 972 |                      ((driveflags[drive] & DRIVE_ZIPSTREAM) != 0));
 | 
|---|
 | 973 |       WinCheckButton(hwnd, DVS_NOLOADICONS,
 | 
|---|
 | 974 |                      ((driveflags[drive] & DRIVE_NOLOADICONS) != 0));
 | 
|---|
 | 975 |       WinCheckButton(hwnd, DVS_NOLOADSUBJS,
 | 
|---|
 | 976 |                      ((driveflags[drive] & DRIVE_NOLOADSUBJS) != 0));
 | 
|---|
 | 977 |       WinCheckButton(hwnd, DVS_NOLOADLONGS,
 | 
|---|
 | 978 |                      ((driveflags[drive] & DRIVE_NOLOADLONGS) != 0));
 | 
|---|
 | 979 |       WinCheckButton(hwnd, DVS_SLOW, ((driveflags[drive] & DRIVE_SLOW) != 0));
 | 
|---|
 | 980 |       WinCheckButton(hwnd, DVS_INCLUDEFILES,
 | 
|---|
 | 981 |                      ((driveflags[drive] & DRIVE_INCLUDEFILES) != 0));
 | 
|---|
| [552] | 982 |       WinCheckButton(hwnd,DVS_NOSTATS,
 | 
|---|
| [1354] | 983 |                      ((driveflags[drive] & DRIVE_NOSTATS) != 0));
 | 
|---|
 | 984 |       WinCheckButton(hwnd,DVS_WRITEVERIFYOFF,
 | 
|---|
 | 985 |                      ((driveflags[drive] & DRIVE_WRITEVERIFYOFF) != 0));
 | 
|---|
 | 986 |       WinCheckButton(hwnd,DVS_RSCANNED,
 | 
|---|
| [1444] | 987 |                      ((driveflags[drive] & DRIVE_RSCANNED) != 0));
 | 
|---|
 | 988 |       WinCheckButton(hwnd,DVS_LOCALHD,
 | 
|---|
 | 989 |                      ((driveflags[drive] & DRIVE_LOCALHD) != 0));
 | 
|---|
 | 990 |       WinCheckButton(hwnd,DVS_NOEASUPPORT,
 | 
|---|
 | 991 |                      ((driveflags[drive] & DRIVE_NOEASUPPORT) != 0));
 | 
|---|
| [551] | 992 |     }
 | 
|---|
 | 993 |     return 0;
 | 
|---|
| [2] | 994 | 
 | 
|---|
| [551] | 995 |   case WM_CONTROL:
 | 
|---|
 | 996 |     return 0;
 | 
|---|
| [2] | 997 | 
 | 
|---|
| [551] | 998 |   case WM_COMMAND:
 | 
|---|
 | 999 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
 | 1000 |     case DID_OK:
 | 
|---|
 | 1001 |       {
 | 
|---|
 | 1002 |         ULONG drive = WinQueryWindowULong(hwnd, QWL_USER);
 | 
|---|
| [2] | 1003 | 
 | 
|---|
| [551] | 1004 |         if (WinQueryButtonCheckstate(hwnd, DVS_NOPRESCAN))
 | 
|---|
 | 1005 |           driveflags[drive] |= DRIVE_NOPRESCAN;
 | 
|---|
 | 1006 |         else
 | 
|---|
 | 1007 |           driveflags[drive] &= (~DRIVE_NOPRESCAN);
 | 
|---|
 | 1008 |         if (WinQueryButtonCheckstate(hwnd, DVS_NOLOADICONS))
 | 
|---|
 | 1009 |           driveflags[drive] |= DRIVE_NOLOADICONS;
 | 
|---|
 | 1010 |         else
 | 
|---|
 | 1011 |           driveflags[drive] &= (~DRIVE_NOLOADICONS);
 | 
|---|
 | 1012 |         if (WinQueryButtonCheckstate(hwnd, DVS_NOLOADSUBJS))
 | 
|---|
 | 1013 |           driveflags[drive] |= DRIVE_NOLOADSUBJS;
 | 
|---|
 | 1014 |         else
 | 
|---|
 | 1015 |           driveflags[drive] &= (~DRIVE_NOLOADSUBJS);
 | 
|---|
 | 1016 |         if (WinQueryButtonCheckstate(hwnd, DVS_NOLOADLONGS))
 | 
|---|
 | 1017 |           driveflags[drive] |= DRIVE_NOLOADLONGS;
 | 
|---|
 | 1018 |         else
 | 
|---|
 | 1019 |           driveflags[drive] &= (~DRIVE_NOLOADLONGS);
 | 
|---|
 | 1020 |         if (WinQueryButtonCheckstate(hwnd, DVS_SLOW))
 | 
|---|
 | 1021 |           driveflags[drive] |= DRIVE_SLOW;
 | 
|---|
 | 1022 |         else
 | 
|---|
 | 1023 |           driveflags[drive] &= (~DRIVE_SLOW);
 | 
|---|
 | 1024 |         if (WinQueryButtonCheckstate(hwnd, DVS_INCLUDEFILES))
 | 
|---|
 | 1025 |           driveflags[drive] |= DRIVE_INCLUDEFILES;
 | 
|---|
 | 1026 |         else
 | 
|---|
 | 1027 |           driveflags[drive] &= (~DRIVE_INCLUDEFILES);
 | 
|---|
| [575] | 1028 |         if (WinQueryButtonCheckstate(hwnd,DVS_NOSTATS))
 | 
|---|
 | 1029 |           driveflags[drive] |= DRIVE_NOSTATS;
 | 
|---|
 | 1030 |         else
 | 
|---|
| [1354] | 1031 |           driveflags[drive] &= (~DRIVE_NOSTATS);
 | 
|---|
 | 1032 |         if (WinQueryButtonCheckstate(hwnd,DVS_WRITEVERIFYOFF))
 | 
|---|
 | 1033 |           driveflags[drive] |= DRIVE_WRITEVERIFYOFF;
 | 
|---|
 | 1034 |         else
 | 
|---|
 | 1035 |           driveflags[drive] &= (~DRIVE_WRITEVERIFYOFF);
 | 
|---|
| [551] | 1036 |         {
 | 
|---|
 | 1037 |           ULONG flags;
 | 
|---|
| [1354] | 1038 |           CHAR FlagKey[80];
 | 
|---|
| [2] | 1039 | 
 | 
|---|
| [1354] | 1040 |           sprintf(FlagKey, "%c.DriveFlags", (CHAR) (drive + 'A'));
 | 
|---|
| [551] | 1041 |           flags = driveflags[drive];
 | 
|---|
 | 1042 |           flags &= (~(DRIVE_REMOVABLE | DRIVE_NOTWRITEABLE |
 | 
|---|
 | 1043 |                       DRIVE_IGNORE | DRIVE_CDROM |
 | 
|---|
| [1354] | 1044 |                       DRIVE_REMOTE | DRIVE_RSCANNED |
 | 
|---|
| [575] | 1045 |                       DRIVE_BOOT | DRIVE_INVALID | DRIVE_ZIPSTREAM |
 | 
|---|
 | 1046 |                       DRIVE_VIRTUAL  | DRIVE_RAMDISK));
 | 
|---|
| [1354] | 1047 |           PrfWriteProfileData(fmprof, appname, FlagKey, &flags, sizeof(ULONG));
 | 
|---|
| [551] | 1048 |         }
 | 
|---|
 | 1049 |       }
 | 
|---|
 | 1050 |       WinDismissDlg(hwnd, 1);
 | 
|---|
 | 1051 |       break;
 | 
|---|
| [2] | 1052 | 
 | 
|---|
| [551] | 1053 |     case DID_CANCEL:
 | 
|---|
 | 1054 |       WinDismissDlg(hwnd, 0);
 | 
|---|
 | 1055 |       break;
 | 
|---|
| [2] | 1056 | 
 | 
|---|
| [551] | 1057 |     case IDM_UNDO:
 | 
|---|
 | 1058 |       PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
 | 
|---|
 | 1059 |       break;
 | 
|---|
| [2] | 1060 | 
 | 
|---|
| [551] | 1061 |     case IDM_HELP:
 | 
|---|
 | 1062 |       if (hwndHelp)
 | 
|---|
 | 1063 |         WinSendMsg(hwndHelp,
 | 
|---|
 | 1064 |                    HM_DISPLAY_HELP,
 | 
|---|
 | 1065 |                    MPFROM2SHORT(HELP_FLAGS, 0), MPFROMSHORT(HM_RESOURCEID));
 | 
|---|
 | 1066 |       break;
 | 
|---|
 | 1067 |     }
 | 
|---|
 | 1068 |     return 0;
 | 
|---|
| [2] | 1069 |   }
 | 
|---|
| [551] | 1070 |   return WinDefDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 1071 | }
 | 
|---|
| [793] | 1072 | 
 | 
|---|
 | 1073 | #pragma alloc_text(FMINFO,FileInfoProc,IconProc)
 | 
|---|
 | 1074 | #pragma alloc_text(FMINFO2,SetDrvProc,DrvInfoProc)
 | 
|---|