source: trunk/dll/info.c@ 1687

Last change on this file since 1687 was 1687, checked in by Gregg Young, 12 years ago

Fix error message on attempt to open a directory from the object information dialog. Some HELPTABLE updates.

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