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