- improve drive property dialog a bit

svn path=/trunk/; revision=29349
This commit is contained in:
Johannes Anderwald 2007-10-02 00:07:22 +00:00
parent fb4bacbb5f
commit 2ec6c16001
3 changed files with 115 additions and 4 deletions

View file

@ -20,7 +20,7 @@
#include "config.h" #include "config.h"
#include "wine/port.h" #include "wine/port.h"
#define YDEBUG
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
@ -40,9 +40,86 @@
#include "shresdef.h" #include "shresdef.h"
#include "undocshell.h" #include "undocshell.h"
#include <prsht.h> #include <prsht.h>
#include <initguid.h>
#include <devguid.h>
#include <winioctl.h>
typedef enum
{
HWPD_STANDARDLIST = 0,
HWPD_LARGELIST,
HWPD_MAX = HWPD_LARGELIST
} HWPAGE_DISPLAYMODE, *PHWPAGE_DISPLAYMODE;
HWND WINAPI
DeviceCreateHardwarePageEx(HWND hWndParent,
LPGUID lpGuids,
UINT uNumberOfGuids,
HWPAGE_DISPLAYMODE DisplayMode);
#define DRIVE_PROPERTY_PAGES (3) #define DRIVE_PROPERTY_PAGES (3)
static
void
InitializeGeneralDriveDialog(HWND hwndDlg, WCHAR * szDrive)
{
WCHAR szVolumeName[MAX_PATH+1] = {0};
DWORD MaxComponentLength = 0;
DWORD FileSystemFlags = 0;
WCHAR FileSystemName[MAX_PATH+1] = {0};
BOOL ret;
UINT DriveType;
ULARGE_INTEGER FreeBytesAvailable;
ULARGE_INTEGER TotalNumberOfBytes;
ULARGE_INTEGER TotalNumberOfFreeBytes;
ret = GetVolumeInformationW(szDrive, szVolumeName, MAX_PATH+1, NULL, &MaxComponentLength, &FileSystemFlags, FileSystemName, MAX_PATH+1);
if (ret)
{
/* set volume label */
SendDlgItemMessageW(hwndDlg, 14001, WM_SETTEXT, (WPARAM)NULL, (LPARAM)szVolumeName);
/* set filesystem type */
SendDlgItemMessageW(hwndDlg, 14003, WM_SETTEXT, (WPARAM)NULL, (LPARAM)FileSystemName);
}
DriveType = GetDriveTypeW(szDrive);
if (DriveType == DRIVE_FIXED)
{
if(GetDiskFreeSpaceExW(szDrive, &FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes))
{
WCHAR szResult[128];
HANDLE hVolume;
DWORD BytesReturned = 0;
GET_LENGTH_INFORMATION LengthInformation;
if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart - FreeBytesAvailable.QuadPart, szResult, sizeof(szResult) / sizeof(WCHAR)))
SendDlgItemMessageW(hwndDlg, 14004, WM_SETTEXT, (WPARAM)NULL, (LPARAM)szResult);
if (StrFormatByteSizeW(FreeBytesAvailable.QuadPart, szResult, sizeof(szResult) / sizeof(WCHAR)))
SendDlgItemMessageW(hwndDlg, 14006, WM_SETTEXT, (WPARAM)NULL, (LPARAM)szResult);
#if 0
sprintfW(szResult, L"\\\\.\\%c:", towupper(szDrive[0]));
hVolume = CreateFileW(szResult, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hVolume != INVALID_HANDLE_VALUE)
{
RtlZeroMemory(&LengthInformation, sizeof(GET_LENGTH_INFORMATION));
ret = DeviceIoControl(hVolume, IOCTL_DISK_GET_LENGTH_INFO, NULL, 0, (LPVOID)&LengthInformation, sizeof(GET_LENGTH_INFORMATION), &BytesReturned, NULL);
if (ret && StrFormatByteSizeW(LengthInformation.Length.QuadPart, szResult, sizeof(szResult) / sizeof(WCHAR)))
SendDlgItemMessageW(hwndDlg, 14008, WM_SETTEXT, (WPARAM)NULL, (LPARAM)szResult);
CloseHandle(hVolume);
}
TRACE("szResult %s hVOlume %p ret %d LengthInformation %ul Bytesreturned %d\n", debugstr_w(szResult), hVolume, ret, LengthInformation.Length.QuadPart, BytesReturned);
#else
if (ret && StrFormatByteSizeW(TotalNumberOfBytes.QuadPart, szResult, sizeof(szResult) / sizeof(WCHAR)))
SendDlgItemMessageW(hwndDlg, 14008, WM_SETTEXT, (WPARAM)NULL, (LPARAM)szResult);
#endif
}
}
}
INT_PTR INT_PTR
CALLBACK CALLBACK
DriveGeneralDlg( DriveGeneralDlg(
@ -52,7 +129,21 @@ DriveGeneralDlg(
LPARAM lParam LPARAM lParam
) )
{ {
LPPROPSHEETPAGEW ppsp;
WCHAR * lpstr;
switch(uMsg)
{
case WM_INITDIALOG:
ppsp = (LPPROPSHEETPAGEW)lParam;
if (ppsp == NULL)
break;
TRACE("WM_INITDIALOG hwnd %p lParam %p ppsplParam %S\n",hwndDlg, lParam, ppsp->lParam);
lpstr = (WCHAR *)ppsp->lParam;
InitializeGeneralDriveDialog(hwndDlg, lpstr);
return TRUE;
}
return FALSE; return FALSE;
@ -80,9 +171,24 @@ DriveHardwareDlg(
LPARAM lParam LPARAM lParam
) )
{ {
GUID Guids[1];
Guids[0] = GUID_DEVCLASS_DISKDRIVE;
UNREFERENCED_PARAMETER(lParam);
UNREFERENCED_PARAMETER(wParam);
return FALSE; switch(uMsg)
{
case WM_INITDIALOG:
/* create the hardware page */
DeviceCreateHardwarePageEx(hwndDlg,
Guids,
sizeof(Guids) / sizeof(Guids[0]),
0);
break;
}
return FALSE;
} }
static static

View file

@ -21,6 +21,7 @@
<library>shlwapi</library> <library>shlwapi</library>
<library>ole32</library> <library>ole32</library>
<library>version</library> <library>version</library>
<library>devmgr</library>
<file>authors.c</file> <file>authors.c</file>
<file>autocomplete.c</file> <file>autocomplete.c</file>
<file>brsfolder.c</file> <file>brsfolder.c</file>

View file

@ -225,18 +225,22 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0
EDITTEXT 14001, 40, 20, 190, 10, ES_LEFT|WS_BORDER|WS_GROUP EDITTEXT 14001, 40, 20, 190, 10, ES_LEFT|WS_BORDER|WS_GROUP
LTEXT "Typ:", -1, 15, 55, 40, 10 LTEXT "Typ:", -1, 15, 55, 40, 10
LTEXT "", 14002, 40, 55, 100, 10 LTEXT "", 14002, 40, 55, 100, 10
LTEXT "Dateisystem:",-1, 15, 70, 100, 10
LTEXT "", 14003, 40, 70, 100, 10 LTEXT "Dateisystem:", -1, 15, 70, 100, 10
LTEXT "", 14003, 110, 70, 100, 10
LTEXT "Belegter Speicher:", -1, 25, 90, 120, 10 LTEXT "Belegter Speicher:", -1, 25, 90, 120, 10
LTEXT "", 14004, 110, 90, 120, 10 LTEXT "", 14004, 110, 90, 120, 10
LTEXT "", 14005, 200, 90, 40, 10 LTEXT "", 14005, 200, 90, 40, 10
LTEXT "Freier Speicher:", -1, 25, 105, 70, 10 LTEXT "Freier Speicher:", -1, 25, 105, 70, 10
LTEXT "", 14006, 110, 105, 120, 10 LTEXT "", 14006, 110, 105, 120, 10
LTEXT "", 14007, 200, 105, 40, 10 LTEXT "", 14007, 200, 105, 40, 10
LTEXT "Speicherkapazität:", -1, 25, 125, 80, 10 LTEXT "Speicherkapazität:", -1, 25, 125, 80, 10
LTEXT "", 14008, 110, 125, 120, 10 LTEXT "", 14008, 110, 125, 120, 10
LTEXT "", 14009, 200, 125, 40, 10 LTEXT "", 14009, 200, 125, 40, 10
LTEXT "", 14010, 150, 160, 40, 10 LTEXT "", 14010, 150, 160, 40, 10
PUSHBUTTON "Bereinigen", 14011, 190, 145, 50, 15, WS_DISABLED PUSHBUTTON "Bereinigen", 14011, 190, 145, 50, 15, WS_DISABLED
CHECKBOX "Laufwerk komprimieren, um Speicherplatz zu sparen", 14012, 15, 205, 165, 10, WS_DISABLED CHECKBOX "Laufwerk komprimieren, um Speicherplatz zu sparen", 14012, 15, 205, 165, 10, WS_DISABLED