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
Line 
1
2/***********************************************************************
3
4 $Id: info.c 1687 2013-04-21 22:31:36Z 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 20 Apr 13 GKY Double click on directory in Info listbox opens directory object instead of
39 causing an error message from DefaultView
40
41***********************************************************************/
42
43#include <stdlib.h>
44#include <string.h>
45#include <ctype.h>
46#include <share.h>
47
48#define INCL_DOS
49#define INCL_WIN
50#define INCL_GPI
51#define INCL_LONGLONG
52
53#include "fm3dll.h"
54#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
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)
60#include "fm3dlg.h"
61#include "fm3str.h"
62#include "makelist.h" // AddToList
63#include "errutil.h" // Dos_Error...
64#include "strutil.h" // GetPString
65#include "attribs.h" // AttrListDlgProc
66#include "defview.h" // DefaultView
67#include "info.h"
68#include "valid.h" // CheckDrive, IsBinary
69#include "seticon.h" // SetIconDlgProc
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
78#include "i18nutil.h" // CommaFmtULL
79#include "wrappers.h" // xDosFindFirst
80#include "fortify.h"
81
82// Data definitions
83#pragma data_seg(DATA1)
84static PSZ pszSrcFile = __FILE__;
85
86#pragma data_seg(GLOBAL1)
87INT driveflags[26];
88
89CHAR *FlagMsg(CHAR drive, CHAR * buffer)
90{
91 ULONG x;
92 BOOL once = FALSE;
93 register CHAR *p;
94
95 if (buffer) {
96 *buffer = 0;
97 p = buffer;
98 if (isalpha(drive)) {
99 if (driveflags[toupper(drive) - 'A']) {
100 for (x = IDS_FLREMOVABLETEXT; x < IDS_FLRECURSESCANDONETEXT + 1; x++) {
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 }
118 }
119 else
120 strcpy(buffer, "[None]");
121 }
122 }
123 return buffer;
124}
125
126MRESULT EXPENTRY DrvInfoProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
127{
128 CHAR *pszFileName;
129 CHAR szMB[20];
130 CHAR szKB[20];
131 CHAR szUnits[20];
132 APIRET rc;
133
134 switch (msg) {
135 case WM_INITDLG:
136 if (mp2) {
137
138 CHAR s[CCHMAXPATH * 2];
139 ULONG type;
140
141 pszFileName = (CHAR *)mp2;
142 WinSetWindowPtr(hwnd, QWL_USER, (PVOID) pszFileName);
143 WinSendDlgItemMsg(hwnd,
144 INFO_LABEL,
145 EM_SETTEXTLIMIT,
146 MPFROM2SHORT(CCHMAXPATHCOMP, 0), MPVOID);
147 if (!(driveflags[toupper(*pszFileName) - 'A'] & DRIVE_NOSTATS)){
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));
158 }
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)) {
166
167 CHAR FileSystem[CCHMAXPATH * 2];
168
169 sprintf(FileSystem,
170 GetPString(IDS_DRIVEINFOTITLETEXT), toupper(*pszFileName));
171 WinSetWindowText(hwnd, FileSystem);
172 if (CheckDrive(toupper(*pszFileName), FileSystem, &type) != -1){
173
174 FSALLOCATE fsa;
175
176 if (type & (DRIVE_REMOTE | DRIVE_ZIPSTREAM | DRIVE_VIRTUAL)) {
177
178 CHAR Path[3], *pfsn, *pfsd;
179 ULONG Size;
180 APIRET rc;
181 PFSQBUFFER2 pfsq;
182
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;
192 pfsn = (PCHAR)(pfsq->szName) + pfsq->cbName + 1;
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 }
200
201 DosError(FERR_DISABLEHARDERR);
202 if (!DosQueryFSInfo(toupper(*pszFileName) - '@',
203 FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) {
204
205 struct
206 {
207 ULONG serial;
208 CHAR volumelength;
209 CHAR volumelabel[CCHMAXPATH];
210 }
211 volser;
212 ULONG percentfree, percentused;
213
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);
222 WinSetDlgItemText(hwnd, INFO_SERIAL, s);
223 FlagMsg(*pszFileName, s);
224 WinSetDlgItemText(hwnd, INFO_FLAGS, s);
225 if (!(driveflags[toupper(*pszFileName) - 'A'] & DRIVE_NOSTATS)){
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);
236
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, ' ');
245 sprintf(s, "%s, %s, %s %s%s",
246 szMB, szKB, szUnits,
247 GetPString(IDS_UNITTEXT), &"s"[fsa.cUnitAvail == 1L]);
248 WinSetDlgItemText(hwnd, INFO_AVAILABLE, s);
249 sprintf(s,
250 GetPString(IDS_SECTORSTEXT),
251 fsa.cbSector,
252 fsa.cSectorUnit, &"s"[fsa.cSectorUnit == 1L]);
253 WinSetDlgItemText(hwnd, INFO_ALLOCUNITS, s);
254
255 percentfree = (fsa.cUnitAvail && fsa.cUnit) ?
256 ((ULONG) fsa.cUnitAvail * 100) / (ULONG) fsa.cUnit : 0;
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);
275 WinSetDlgItemText(hwnd, INFO_FREEPERCENT, s);
276 }
277 else
278 WinSetDlgItemText(hwnd, INFO_AVAILABLE, (CHAR *) GetPString(IDS_STATSMEANINGLESSTEXT));
279 }
280 else {
281 sprintf(FileSystem,
282 GetPString(IDS_CANTQUERYVOLTEXT),
283 toupper(*pszFileName));
284 Notify(FileSystem);
285 WinDismissDlg(hwnd, 0);
286 }
287 }
288 else {
289 sprintf(FileSystem,
290 GetPString(IDS_CANTQUERYALLOCTEXT),
291 toupper(*pszFileName));
292 Notify(FileSystem);
293 WinDismissDlg(hwnd, 0);
294 }
295 }
296 else {
297 FlagMsg(*pszFileName, s);
298 sprintf(FileSystem,
299 GetPString(IDS_DRIVEINACCESSIBLETEXT),
300 toupper(*pszFileName), s);
301 Notify(FileSystem);
302 WinDismissDlg(hwnd, 0);
303 }
304 }
305 else {
306 WinDismissDlg(hwnd, 0);
307 }
308 }
309 else
310 WinDismissDlg(hwnd, 0);
311 break;
312
313 case WM_CONTROL:
314 return 0;
315
316 case WM_COMMAND:
317 switch (SHORT1FROMMP(mp1)) {
318 case DID_CANCEL:
319 WinDismissDlg(hwnd, 0);
320 break;
321
322 case IDM_HELP:
323 if (hwndHelp)
324 WinSendMsg(hwndHelp,
325 HM_DISPLAY_HELP,
326 MPFROM2SHORT(HELP_DRVINFO, 0), MPFROMSHORT(HM_RESOURCEID));
327 break;
328
329 case DID_OK:
330 pszFileName = INSTDATA(hwnd);
331 if (!(driveflags[toupper(*pszFileName) - 'A'] & DRIVE_NOTWRITEABLE)) {
332
333 CHAR s[CCHMAXPATHCOMP + 3];
334
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;
346
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 }
365 }
366 WinDismissDlg(hwnd, 1);
367 break;
368 }
369 return 0;
370 }
371 return WinDefDlgProc(hwnd, msg, mp1, mp2);
372}
373
374typedef struct {
375 USHORT size;
376 CHAR szFileName[CCHMAXPATH];
377 BOOL madechanges;
378} FILESTUF;
379
380typedef struct {
381 USHORT size;
382 PFNWP oldproc;
383 FILESTUF *pfs;
384 HWND lasthwndMenu;
385} ICONSTUF;
386
387/**
388 * subclass routine to allow changing a program's icon
389 */
390
391MRESULT EXPENTRY IconProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
392{
393 ICONSTUF *pis = (ICONSTUF *)WinQueryWindowPtr(hwnd, QWL_USER);
394 MRESULT mr;
395 CHAR *p;
396
397 static BOOL emphasized = FALSE;
398
399 if (!pis) {
400 Runtime_Error(pszSrcFile, __LINE__, NULL);
401 if (msg != WM_DESTROY)
402 return WinDefWindowProc(hwnd, msg, mp1, mp2);
403 }
404
405 switch (msg) {
406 case DM_DRAGOVER:
407 if (!emphasized) {
408 emphasized = TRUE;
409 DrawTargetEmphasis(hwnd, emphasized);
410 }
411 if (AcceptOneDrop(hwnd, mp1, mp2))
412 return MRFROM2SHORT(DOR_DROP, DO_MOVE);
413 return MRFROM2SHORT(DOR_NEVERDROP, 0);
414
415 case DM_DRAGLEAVE:
416 emphasized = FALSE;
417 DrawTargetEmphasis(hwnd, emphasized);
418 break;
419
420 case DM_DROPHELP:
421 DropHelp(mp1, mp2, hwnd, GetPString(IDS_DROPCHGICONHELPTEXT));
422 return 0;
423
424 case DM_DROP:
425 {
426 HPOINTER hptr;
427 CHAR szFrom[CCHMAXPATH + 2];
428 ICONINFO ici;
429
430 emphasized = FALSE;
431 DrawTargetEmphasis(hwnd, emphasized);
432 if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
433 memset(&ici, 0, sizeof(ICONINFO));
434 ici.cb = sizeof(ICONINFO);
435 ici.fFormat = ICON_FILE;
436 ici.pszFileName = szFrom;
437 if (!WinSetFileIcon((PSZ) pis->pfs->szFileName, (PICONINFO) & ici)) {
438 ici.fFormat = ICON_CLEAR;
439 WinSetFileIcon((PSZ) pis->pfs->szFileName, (PICONINFO) & ici);
440 }
441 hptr = WinLoadFileIcon(pis->pfs->szFileName, FALSE);
442 if (!hptr)
443 hptr = (!IsFile(pis->pfs->szFileName)) ? hptrDir : hptrFile;
444 if (pis && pis->oldproc) {
445 WinShowWindow(hwnd, FALSE);
446 pis->oldproc(hwnd, SM_SETHANDLE, MPFROMLONG(hptr), MPVOID);
447 WinShowWindow(hwnd, TRUE);
448 WinInvalidateRect(WinQueryWindow(hwnd, QW_PARENT), NULL, TRUE);
449 }
450 }
451 }
452 return 0;
453
454 case WM_PAINT:
455 mr = pis->oldproc(hwnd, msg, mp1, mp2);
456 PaintRecessedWindow(hwnd, (HPS) 0, FALSE, FALSE);
457 return mr;
458 break;
459
460 case WM_MENUEND:
461 if (pis->lasthwndMenu == (HWND)mp2)
462 WinDestroyWindow(pis->lasthwndMenu);
463 pis->lasthwndMenu = (HWND) 0;
464 break;
465
466 case WM_CONTEXTMENU:
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, '.');
472 if (!p || (stricmp(p, PCSZ_DOTICO) && stricmp(p, PCSZ_DOTPTR)))
473 WinSendMsg(pis->lasthwndMenu,
474 MM_DELETEITEM,
475 MPFROM2SHORT(IDM_SELECTALL, TRUE), MPVOID);
476 PopupMenu(hwnd, hwnd, pis->lasthwndMenu);
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) ?
490 pis->pfs->szFileName : NULL));
491 break;
492 }
493 return 0;
494
495 case WM_DESTROY:
496 emphasized = FALSE;
497 if (!pis)
498 return WinDefWindowProc(hwnd, msg, mp1, mp2);
499 else {
500 PFNWP oldproc = pis->oldproc;
501 if (pis->lasthwndMenu)
502 WinDestroyWindow(pis->lasthwndMenu);
503 free(pis);
504 return oldproc(hwnd, msg, mp1, mp2);
505 }
506 break;
507 }
508
509 return pis->oldproc(hwnd, msg, mp1, mp2);
510}
511
512MRESULT EXPENTRY FileInfoProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
513{
514 FILESTUF *pfs;
515 ICONSTUF *pis;
516 CHAR **ppsz;
517
518 switch (msg) {
519 case WM_INITDLG:
520 if (!mp2) {
521 WinDismissDlg(hwnd, 1);
522 break;
523 }
524 pfs = xmallocz(sizeof(FILESTUF), pszSrcFile, __LINE__);
525 if (!pfs) {
526 WinDismissDlg(hwnd, 1);
527 break;
528 }
529 pfs->size = sizeof(FILESTUF);
530 WinSetWindowPtr(hwnd, QWL_USER, pfs);
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
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]);
542 WinSendDlgItemMsg(hwnd,
543 FLE_NAME,
544 LM_INSERTITEM,
545 MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(s));
546 }
547 if (!x) {
548 WinDismissDlg(hwnd, 1);
549 break;
550 }
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 }
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),
567 IconProc);
568 break;
569
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:
578 pfs = WinQueryWindowPtr(hwnd, QWL_USER);
579 if (pfs && *pfs->szFileName) {
580
581 LISTINFO li;
582 UINT numfiles = 0, numalloc = 0;
583
584 memset(&li, 0, sizeof(LISTINFO));
585 if (!AddToList(pfs->szFileName, &li.list, &numfiles, &numalloc)) {
586 if (WinDlgBox(HWND_DESKTOP,
587 hwnd,
588 AttrListDlgProc,
589 FM3ModHandle,
590 ATR_FRAME, MPFROMP(&li)) && li.list && li.list[0]) {
591 pfs->madechanges = TRUE;
592 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
593 }
594 FreeList(li.list);
595 }
596 }
597 break;
598 } // switch
599 break;
600 case FLE_NAME:
601 switch (SHORT2FROMMP(mp1)) {
602 case LN_ENTER:
603 case LN_SELECT:
604 pfs = WinQueryWindowPtr(hwnd, QWL_USER);
605 if (!pfs) {
606 Runtime_Error(pszSrcFile, __LINE__, NULL);
607 WinDismissDlg(hwnd, 1);
608 }
609 else {
610
611 SHORT sSelect;
612
613 sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
614 FLE_NAME,
615 LM_QUERYSELECTION,
616 MPFROMSHORT(LIT_FIRST), MPVOID);
617 if (sSelect >= 0) {
618 *pfs->szFileName = 0;
619 WinSendDlgItemMsg(hwnd,
620 FLE_NAME,
621 LM_QUERYITEMTEXT,
622 MPFROM2SHORT(sSelect, CCHMAXPATH),
623 MPFROMP(pfs->szFileName));
624 if (*pfs->szFileName) {
625 if (SHORT2FROMMP(mp1) == LN_SELECT)
626 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
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);
631 }
632 }
633 }
634 break;
635 }
636 break;
637 }
638 return 0;
639
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);
664 pfs = WinQueryWindowPtr(hwnd, QWL_USER);
665 if (pfs && *pfs->szFileName) {
666 CHAR s[97];
667 CHAR szCmmaFmtFileSize[81], szCmmaFmtEASize[81];
668 CHAR szCmmaFmtFileEASize[81], szCmmaFmtFileEASizeK[81], szDate[DATE_BUF_BYTES];
669 FILEFINDBUF4L fs;
670 HDIR hdir = HDIR_CREATE;
671 ULONG apptype = 1;
672 FILE *fp;
673 HPOINTER hptr;
674 ARC_TYPE *info;
675 CHAR *mode;
676
677 DosError(FERR_DISABLEHARDERR);
678 if (xDosFindFirst(pfs->szFileName,
679 &hdir,
680 FILE_NORMAL | FILE_ARCHIVED |
681 FILE_DIRECTORY | FILE_READONLY | FILE_HIDDEN |
682 FILE_SYSTEM,
683 &fs, sizeof(fs), &apptype, FIL_QUERYEASIZEL)) {
684 // Not found
685 SHORT sSelect, numitems;
686
687 if (!fAlertBeepOff)
688 DosBeep(250, 100); // Wake up user
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 }
707 }
708 else {
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);
715 WinSetDlgItemText(hwnd, FLE_LASTWRITE, s);
716 if (fs.fdateCreation.year &&
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);
723 WinSetDlgItemText(hwnd, FLE_CREATE, s);
724 }
725 if (fs.fdateLastAccess.year &&
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);
732 WinSetDlgItemText(hwnd, FLE_LASTACCESS, s);
733 }
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');
746 sprintf(s,
747 GetPString(IDS_SIZEINCLEASTEXT),
748 szCmmaFmtFileSize,
749 szCmmaFmtEASize,
750 szCmmaFmtFileEASize,
751 szCmmaFmtFileEASizeK);
752 WinSetDlgItemText(hwnd, FLE_SIZES, s);
753 CommaFmtULL(szCmmaFmtFileSize,
754 sizeof(szCmmaFmtFileSize), fs.cbFileAlloc - fs.cbFile, ' ');
755 sprintf(s, "%s", szCmmaFmtFileSize);
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);
766 if (!DosQueryAppType(pfs->szFileName, &apptype)) {
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 }
820 hptr = WinLoadFileIcon(pfs->szFileName, FALSE);
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);
833 WinEnableWindow(WinWindowFromID(hwnd, FLE_BINARY), TRUE);
834 mode = "rb";
835 fp = xfsopen(pfs->szFileName, mode, SH_DENYNO, pszSrcFile, __LINE__, TRUE);
836 if (fp) {
837 char buff[4096]; // 06 Oct 07 SHL protect against NTFS defect
838 ULONG len;
839 APIRET rc;
840
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);
848 info = find_type(pfs->szFileName, NULL);
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);
858 }
859 mode = "ab";
860 fp = xfsopen(pfs->szFileName, mode, SH_DENYNO, pszSrcFile, __LINE__, TRUE);
861 if (fp) {
862 WinCheckButton(hwnd, FLE_WRITEABLE, TRUE);
863 fclose(fp);
864 }
865 mode = "rb";
866 fp = xfsopen(pfs->szFileName, mode, SH_DENYRW, pszSrcFile, __LINE__, TRUE);
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 }
879 }
880 }
881 return 0;
882
883 case WM_COMMAND:
884 switch (SHORT1FROMMP(mp1)) {
885 case DID_OK:
886 pfs = WinQueryWindowPtr(hwnd, QWL_USER);
887 WinDismissDlg(hwnd, (pfs && pfs->madechanges) ? 2 : 1);
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:
896 pfs = WinQueryWindowPtr(hwnd, QWL_USER);
897 if (pfs && *pfs->szFileName)
898 OpenObject(pfs->szFileName, Settings, hwnd);
899 break;
900 case FLE_EAS:
901 pfs = WinQueryWindowPtr(hwnd, QWL_USER);
902 if (pfs && *pfs->szFileName) {
903
904 CHAR *list[2];
905
906 list[0] = pfs->szFileName;
907 list[1] = NULL;
908 WinDlgBox(HWND_DESKTOP,
909 hwnd, DisplayEAsProc, FM3ModHandle, EA_FRAME, (PVOID) list);
910 }
911 break;
912 case DID_CANCEL:
913 pfs = WinQueryWindowPtr(hwnd, QWL_USER);
914 WinDismissDlg(hwnd, (pfs && pfs->madechanges) ? 2 : 0);
915 break;
916 }
917 return 0;
918
919 case WM_DESTROY:
920 pfs = WinQueryWindowPtr(hwnd, QWL_USER);
921 xfree(pfs, pszSrcFile, __LINE__);
922 break;
923 }
924 return WinDefDlgProc(hwnd, msg, mp1, mp2);
925}
926
927MRESULT EXPENTRY SetDrvProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
928{
929 switch (msg) {
930 case WM_INITDLG:
931 if (!mp2 || !isalpha(*(CHAR *)mp2))
932 WinDismissDlg(hwnd, 0);
933 else {
934
935 CHAR s[80];
936
937 WinSetWindowULong(hwnd, QWL_USER, (toupper(*(CHAR *)mp2) - 'A'));
938 sprintf(s, GetPString(IDS_DRIVEFLAGSTITLETEXT), toupper(*(CHAR *)mp2));
939 WinSetWindowText(hwnd, s);
940 PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
941 }
942 break;
943
944 case UM_UNDO:
945 {
946 ULONG drive = WinQueryWindowULong(hwnd, QWL_USER);
947
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));
960 WinCheckButton(hwnd,DVS_VIRTUAL,
961 ((driveflags[drive] & DRIVE_VIRTUAL) != 0));
962 WinCheckButton(hwnd,DVS_RAMDISK,
963 ((driveflags[drive] & DRIVE_RAMDISK) != 0));
964 WinCheckButton(hwnd, DVS_BOOT,
965 ((driveflags[drive] & DRIVE_BOOT) != 0));
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));
981 WinCheckButton(hwnd,DVS_NOSTATS,
982 ((driveflags[drive] & DRIVE_NOSTATS) != 0));
983 WinCheckButton(hwnd,DVS_WRITEVERIFYOFF,
984 ((driveflags[drive] & DRIVE_WRITEVERIFYOFF) != 0));
985 WinCheckButton(hwnd,DVS_RSCANNED,
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));
991 }
992 return 0;
993
994 case WM_CONTROL:
995 return 0;
996
997 case WM_COMMAND:
998 switch (SHORT1FROMMP(mp1)) {
999 case DID_OK:
1000 {
1001 ULONG drive = WinQueryWindowULong(hwnd, QWL_USER);
1002
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);
1027 if (WinQueryButtonCheckstate(hwnd,DVS_NOSTATS))
1028 driveflags[drive] |= DRIVE_NOSTATS;
1029 else
1030 driveflags[drive] &= (~DRIVE_NOSTATS);
1031 if (WinQueryButtonCheckstate(hwnd,DVS_WRITEVERIFYOFF))
1032 driveflags[drive] |= DRIVE_WRITEVERIFYOFF;
1033 else
1034 driveflags[drive] &= (~DRIVE_WRITEVERIFYOFF);
1035 {
1036 ULONG flags;
1037 CHAR FlagKey[80];
1038
1039 sprintf(FlagKey, "%c.DriveFlags", (CHAR) (drive + 'A'));
1040 flags = driveflags[drive];
1041 flags &= (~(DRIVE_REMOVABLE | DRIVE_NOTWRITEABLE |
1042 DRIVE_IGNORE | DRIVE_CDROM |
1043 DRIVE_REMOTE | DRIVE_RSCANNED |
1044 DRIVE_BOOT | DRIVE_INVALID | DRIVE_ZIPSTREAM |
1045 DRIVE_VIRTUAL | DRIVE_RAMDISK));
1046 PrfWriteProfileData(fmprof, appname, FlagKey, &flags, sizeof(ULONG));
1047 }
1048 }
1049 WinDismissDlg(hwnd, 1);
1050 break;
1051
1052 case DID_CANCEL:
1053 WinDismissDlg(hwnd, 0);
1054 break;
1055
1056 case IDM_UNDO:
1057 PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
1058 break;
1059
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;
1068 }
1069 return WinDefDlgProc(hwnd, msg, mp1, mp2);
1070}
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.