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