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