mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 13:10:39 +00:00
[SHELL32]
- Display free and used space and capacity in bytes and gigabytes for all drives in drive properties dialog - Format date and time in file properties according to system locale - Initialize checkboxes in file properties dialog - Improve polish translation svn path=/trunk/; revision=54936
This commit is contained in:
parent
c5c4832280
commit
6041e7f0e9
5 changed files with 175 additions and 169 deletions
|
@ -39,6 +39,7 @@ DeviceCreateHardwarePageEx(HWND hWndParent,
|
|||
LPGUID lpGuids,
|
||||
UINT uNumberOfGuids,
|
||||
HWPAGE_DISPLAYMODE DisplayMode);
|
||||
UINT SH_FormatByteSize(LONGLONG cbSize, LPWSTR pwszResult, UINT cchResultMax);
|
||||
|
||||
static VOID
|
||||
GetDriveNameWithLetter(LPWSTR pwszText, UINT cchTextMax, LPCWSTR pwszDrive)
|
||||
|
@ -211,19 +212,15 @@ CDrvDefExt::PaintStaticControls(HWND hwndDlg, LPDRAWITEMSTRUCT pDrawItem)
|
|||
HPEN hDarkBluePen = CreatePen(PS_SOLID, 1, RGB(0, 0, 128));
|
||||
HPEN hDarkMagPen = CreatePen(PS_SOLID, 1, RGB(128, 0, 128));
|
||||
|
||||
WCHAR wszBuf[20];
|
||||
GetDlgItemTextW(hwndDlg, 14006, wszBuf, _countof(wszBuf));
|
||||
UINT cFreeSpace = _wtoi(wszBuf);
|
||||
|
||||
INT xCenter = (pDrawItem->rcItem.left + pDrawItem->rcItem.right)/2;
|
||||
INT yCenter = (pDrawItem->rcItem.top + pDrawItem->rcItem.bottom - 10)/2;
|
||||
INT cx = pDrawItem->rcItem.right - pDrawItem->rcItem.left;
|
||||
INT cy = pDrawItem->rcItem.bottom - pDrawItem->rcItem.top - 10;
|
||||
TRACE("FreeSpace %u a %f cx %d\n", cFreeSpace, M_PI+cFreeSpace/100.0f*M_PI*2.0f, cx);
|
||||
TRACE("FreeSpace %u a %f cx %d\n", m_FreeSpacePerc, M_PI+m_FreeSpacePerc/100.0f*M_PI*2.0f, cx);
|
||||
|
||||
HBRUSH hbrOld = (HBRUSH)SelectObject(pDrawItem->hDC, hMagBrush);
|
||||
INT xRadial = xCenter + (INT)(cosf(M_PI+cFreeSpace/100.0f*M_PI*2.0f)*cx/2);
|
||||
INT yRadial = yCenter - (INT)(sinf(M_PI+cFreeSpace/100.0f*M_PI*2.0f)*cy/2);
|
||||
INT xRadial = xCenter + (INT)(cosf(M_PI+m_FreeSpacePerc/100.0f*M_PI*2.0f)*cx/2);
|
||||
INT yRadial = yCenter - (INT)(sinf(M_PI+m_FreeSpacePerc/100.0f*M_PI*2.0f)*cy/2);
|
||||
Pie(pDrawItem->hDC,
|
||||
pDrawItem->rcItem.left, pDrawItem->rcItem.top,
|
||||
pDrawItem->rcItem.right, pDrawItem->rcItem.bottom - 10,
|
||||
|
@ -241,7 +238,7 @@ CDrvDefExt::PaintStaticControls(HWND hwndDlg, LPDRAWITEMSTRUCT pDrawItem)
|
|||
HPEN hOldPen = (HPEN)SelectObject(pDrawItem->hDC, hDarkBluePen);
|
||||
for (INT x = pDrawItem->rcItem.left; x < pDrawItem->rcItem.right; ++x)
|
||||
{
|
||||
if (cFreeSpace < 50 && x == xRadial)
|
||||
if (m_FreeSpacePerc < 50 && x == xRadial)
|
||||
SelectObject(pDrawItem->hDC, hDarkMagPen);
|
||||
|
||||
float cos_val = (x - xCenter)*2.0f/cx;
|
||||
|
@ -269,61 +266,53 @@ CDrvDefExt::InitGeneralPage(HWND hwndDlg)
|
|||
bRet = GetVolumeInformationW(m_wszDrive, wszVolumeName, _countof(wszVolumeName), NULL, NULL, NULL, wszFileSystem, _countof(wszFileSystem));
|
||||
if (bRet)
|
||||
{
|
||||
/* set volume label */
|
||||
/* Set volume label and filesystem */
|
||||
SetDlgItemTextW(hwndDlg, 14000, wszVolumeName);
|
||||
|
||||
/* set filesystem type */
|
||||
SetDlgItemTextW(hwndDlg, 14002, wszFileSystem);
|
||||
}
|
||||
|
||||
/* Set drive type and icon */
|
||||
UINT DriveType = GetDriveTypeW(m_wszDrive);
|
||||
if (DriveType == DRIVE_FIXED || DriveType == DRIVE_CDROM)
|
||||
UINT IconId, TypeStrId = 0;
|
||||
switch (DriveType)
|
||||
{
|
||||
ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes, TotalNumberOfFreeBytes;
|
||||
if(GetDiskFreeSpaceExW(m_wszDrive, &FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes))
|
||||
{
|
||||
ULONG SpacePercent;
|
||||
HANDLE hVolume;
|
||||
DWORD BytesReturned = 0;
|
||||
|
||||
swprintf(wszBuf, L"\\\\.\\%c:", towupper(m_wszDrive[0]));
|
||||
hVolume = CreateFileW(wszBuf, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (hVolume != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
bRet = DeviceIoControl(hVolume, IOCTL_DISK_GET_LENGTH_INFO, NULL, 0, (LPVOID)&TotalNumberOfBytes, sizeof(ULARGE_INTEGER), &BytesReturned, NULL);
|
||||
if (bRet && StrFormatByteSizeW(TotalNumberOfBytes.QuadPart, wszBuf, sizeof(wszBuf) / sizeof(WCHAR)))
|
||||
SetDlgItemTextW(hwndDlg, 14007, wszBuf);
|
||||
|
||||
CloseHandle(hVolume);
|
||||
case DRIVE_CDROM: IconId = IDI_SHELL_CDROM; TypeStrId = IDS_DRIVE_CDROM; break;
|
||||
case DRIVE_REMOVABLE: IconId = IDI_SHELL_FLOPPY; break;
|
||||
case DRIVE_RAMDISK: IconId = IDI_SHELL_RAMDISK; break;
|
||||
default: IconId = IDI_SHELL_DRIVE; TypeStrId = IDS_DRIVE_FIXED;
|
||||
}
|
||||
HICON hIcon = (HICON)LoadImage(shell32_hInstance, MAKEINTRESOURCE(IconId), IMAGE_ICON, 32, 32, LR_SHARED);
|
||||
if (hIcon)
|
||||
SendDlgItemMessageW(hwndDlg, 14016, STM_SETICON, (WPARAM)hIcon, 0);
|
||||
if (TypeStrId && LoadStringW(shell32_hInstance, TypeStrId, wszBuf, _countof(wszBuf)))
|
||||
SetDlgItemTextW(hwndDlg, 14001, wszBuf);
|
||||
|
||||
TRACE("wszBuf %s hVolume %p bRet %d LengthInformation %ul BytesReturned %d\n", debugstr_w(wszBuf), hVolume, bRet, TotalNumberOfBytes.QuadPart, BytesReturned);
|
||||
ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes;
|
||||
if(GetDiskFreeSpaceExW(m_wszDrive, &FreeBytesAvailable, &TotalNumberOfBytes, NULL))
|
||||
{
|
||||
/* Init free space percentage used for drawing piechart */
|
||||
m_FreeSpacePerc = (UINT)(FreeBytesAvailable.QuadPart * 100ull / TotalNumberOfBytes.QuadPart);
|
||||
|
||||
if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart - FreeBytesAvailable.QuadPart, wszBuf, sizeof(wszBuf) / sizeof(WCHAR)))
|
||||
/* Used space */
|
||||
if (SH_FormatByteSize(TotalNumberOfBytes.QuadPart - FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
|
||||
SetDlgItemTextW(hwndDlg, 14003, wszBuf);
|
||||
|
||||
if (StrFormatByteSizeW(FreeBytesAvailable.QuadPart, wszBuf, sizeof(wszBuf) / sizeof(WCHAR)))
|
||||
if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart - FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
|
||||
SetDlgItemTextW(hwndDlg, 14004, wszBuf);
|
||||
|
||||
/* Free space */
|
||||
if (SH_FormatByteSize(FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
|
||||
SetDlgItemTextW(hwndDlg, 14005, wszBuf);
|
||||
|
||||
SpacePercent = (ULONG)(TotalNumberOfFreeBytes.QuadPart*100ull/TotalNumberOfBytes.QuadPart);
|
||||
/* set free bytes percentage */
|
||||
swprintf(wszBuf, L"%u%%", SpacePercent);
|
||||
if (StrFormatByteSizeW(FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
|
||||
SetDlgItemTextW(hwndDlg, 14006, wszBuf);
|
||||
/* store used share amount */
|
||||
SpacePercent = 100 - SpacePercent;
|
||||
swprintf(wszBuf, L"%u%%", SpacePercent);
|
||||
SetDlgItemTextW(hwndDlg, 14004, wszBuf);
|
||||
if (DriveType == DRIVE_FIXED)
|
||||
{
|
||||
if (LoadStringW(shell32_hInstance, IDS_DRIVE_FIXED, wszBuf, sizeof(wszBuf) / sizeof(WCHAR)))
|
||||
SetDlgItemTextW(hwndDlg, 14001, wszBuf);
|
||||
}
|
||||
else /* DriveType == DRIVE_CDROM) */
|
||||
{
|
||||
if (LoadStringW(shell32_hInstance, IDS_DRIVE_CDROM, wszBuf, sizeof(wszBuf) / sizeof(WCHAR)))
|
||||
SetDlgItemTextW(hwndDlg, 14001, wszBuf);
|
||||
}
|
||||
}
|
||||
|
||||
/* Total space */
|
||||
if (SH_FormatByteSize(FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf)))
|
||||
SetDlgItemTextW(hwndDlg, 14007, wszBuf);
|
||||
|
||||
if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart, wszBuf, _countof(wszBuf)))
|
||||
SetDlgItemTextW(hwndDlg, 14008, wszBuf);
|
||||
}
|
||||
|
||||
/* Set drive description */
|
||||
|
@ -331,18 +320,6 @@ CDrvDefExt::InitGeneralPage(HWND hwndDlg)
|
|||
GetDlgItemTextW(hwndDlg, 14009, wszFormat, _countof(wszFormat));
|
||||
swprintf(wszBuf, wszFormat, m_wszDrive[0]);
|
||||
SetDlgItemTextW(hwndDlg, 14009, wszBuf);
|
||||
|
||||
/* Set drive icon */
|
||||
UINT IconId;
|
||||
switch (DriveType)
|
||||
{
|
||||
case DRIVE_CDROM: IconId = IDI_SHELL_CDROM; break;
|
||||
case DRIVE_REMOVABLE: IconId = IDI_SHELL_FLOPPY; break;
|
||||
case DRIVE_RAMDISK: IconId = IDI_SHELL_RAMDISK; break;
|
||||
default: IconId = IDI_SHELL_DRIVE;
|
||||
}
|
||||
HICON hIcon = (HICON)LoadImage(shell32_hInstance, MAKEINTRESOURCE(IconId), IMAGE_ICON, 32, 32, LR_SHARED);
|
||||
SendDlgItemMessageW(hwndDlg, 14016, STM_SETICON, (WPARAM)hIcon, 0);
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK
|
||||
|
@ -371,7 +348,8 @@ CDrvDefExt::GeneralPageProc(
|
|||
|
||||
if (pDrawItem->CtlID >= 14013 && pDrawItem->CtlID <= 14015)
|
||||
{
|
||||
CDrvDefExt::PaintStaticControls(hwndDlg, pDrawItem);
|
||||
CDrvDefExt *pDrvDefExt = (CDrvDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
||||
pDrvDefExt->PaintStaticControls(hwndDlg, pDrawItem);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -30,13 +30,14 @@ class CDrvDefExt :
|
|||
public IObjectWithSite
|
||||
{
|
||||
private:
|
||||
static VOID PaintStaticControls(HWND hwndDlg, LPDRAWITEMSTRUCT pDrawItem);
|
||||
VOID PaintStaticControls(HWND hwndDlg, LPDRAWITEMSTRUCT pDrawItem);
|
||||
VOID InitGeneralPage(HWND hwndDlg);
|
||||
static INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static INT_PTR CALLBACK ExtraPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static INT_PTR CALLBACK HardwarePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
WCHAR m_wszDrive[MAX_PATH];
|
||||
UINT m_FreeSpacePerc;
|
||||
|
||||
public:
|
||||
CDrvDefExt();
|
||||
|
|
|
@ -122,6 +122,80 @@ LPCWSTR CFileVersionInfo::GetLangName()
|
|||
return m_wszLang;
|
||||
}
|
||||
|
||||
UINT
|
||||
SH_FormatInteger(LONGLONG Num, LPWSTR pwszResult, UINT cchResultMax)
|
||||
{
|
||||
// Print the number in uniform mode
|
||||
WCHAR wszNumber[24];
|
||||
swprintf(wszNumber, L"%I64u", Num);
|
||||
|
||||
// Get system strings for decimal and thousand separators.
|
||||
WCHAR wszDecimalSep[8], wszThousandSep[8];
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, wszDecimalSep, _countof(wszDecimalSep));
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, wszThousandSep, _countof(wszThousandSep));
|
||||
|
||||
// Initialize format for printing the number in bytes
|
||||
NUMBERFMTW nf;
|
||||
ZeroMemory(&nf, sizeof(nf));
|
||||
nf.lpDecimalSep = wszDecimalSep;
|
||||
nf.lpThousandSep = wszThousandSep;
|
||||
|
||||
// Get system string for groups separator
|
||||
WCHAR wszGrouping[12];
|
||||
INT cchGrouping = GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SGROUPING,
|
||||
wszGrouping,
|
||||
_countof(wszGrouping));
|
||||
|
||||
// Convert grouping specs from string to integer
|
||||
for (INT i = 0; i < cchGrouping; i++)
|
||||
{
|
||||
WCHAR wch = wszGrouping[i];
|
||||
|
||||
if (wch >= L'0' && wch <= L'9')
|
||||
nf.Grouping = nf.Grouping * 10 + (wch - L'0');
|
||||
else if (wch != L';')
|
||||
break;
|
||||
}
|
||||
|
||||
if ((nf.Grouping % 10) == 0)
|
||||
nf.Grouping /= 10;
|
||||
else
|
||||
nf.Grouping *= 10;
|
||||
|
||||
// Format the number
|
||||
INT cchResult = GetNumberFormatW(LOCALE_USER_DEFAULT,
|
||||
0,
|
||||
wszNumber,
|
||||
&nf,
|
||||
pwszResult,
|
||||
cchResultMax);
|
||||
|
||||
if (!cchResult)
|
||||
return 0;
|
||||
|
||||
// GetNumberFormatW returns number of characters including UNICODE_NULL
|
||||
return cchResult - 1;
|
||||
}
|
||||
|
||||
UINT
|
||||
SH_FormatByteSize(LONGLONG cbSize, LPWSTR pwszResult, UINT cchResultMax)
|
||||
{
|
||||
/* Write formated bytes count */
|
||||
INT cchWritten = SH_FormatInteger(cbSize, pwszResult, cchResultMax);
|
||||
if (!cchWritten)
|
||||
return 0;
|
||||
|
||||
/* Copy " bytes" to buffer */
|
||||
LPWSTR pwszEnd = pwszResult + cchWritten;
|
||||
size_t cchRemaining = cchResultMax - cchWritten;
|
||||
StringCchCopyExW(pwszEnd, cchRemaining, L" ", &pwszEnd, &cchRemaining, NULL);
|
||||
cchWritten = LoadStringW(shell32_hInstance, IDS_BYTES_FORMAT, pwszEnd, cchRemaining);
|
||||
cchRemaining -= cchWritten;
|
||||
|
||||
return cchResultMax - cchRemaining;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* SH_FormatFileSizeWithBytes
|
||||
|
@ -135,95 +209,31 @@ LPCWSTR CFileVersionInfo::GetLangName()
|
|||
*/
|
||||
|
||||
LPWSTR
|
||||
SH_FormatFileSizeWithBytes(PULARGE_INTEGER lpQwSize, LPWSTR pszBuf, UINT cchBuf)
|
||||
SH_FormatFileSizeWithBytes(const PULARGE_INTEGER lpQwSize, LPWSTR pwszResult, UINT cchResultMax)
|
||||
{
|
||||
NUMBERFMTW nf;
|
||||
WCHAR szNumber[24];
|
||||
WCHAR szDecimalSep[8];
|
||||
WCHAR szThousandSep[8];
|
||||
WCHAR szGrouping[12];
|
||||
int Len, cchFormatted, i;
|
||||
size_t cchRemaining;
|
||||
LPWSTR Ptr;
|
||||
|
||||
// Try to build first Format byte string
|
||||
if (StrFormatByteSizeW(lpQwSize->QuadPart, pszBuf, cchBuf) == NULL)
|
||||
/* Format bytes in KBs, MBs etc */
|
||||
if (StrFormatByteSizeW(lpQwSize->QuadPart, pwszResult, cchResultMax) == NULL)
|
||||
return NULL;
|
||||
|
||||
// If there is less bytes than 1KB, we have nothing to do
|
||||
/* If there is less bytes than 1KB, we have nothing to do */
|
||||
if (lpQwSize->QuadPart < 1024)
|
||||
return pszBuf;
|
||||
return pwszResult;
|
||||
|
||||
// Print the number in uniform mode
|
||||
swprintf(szNumber, L"%I64u", lpQwSize->QuadPart);
|
||||
/* Concate " (" */
|
||||
UINT cchWritten = wcslen(pwszResult);
|
||||
LPWSTR pwszEnd = pwszResult + cchWritten;
|
||||
size_t cchRemaining = cchResultMax - cchWritten;
|
||||
StringCchCopyExW(pwszEnd, cchRemaining, L" (", &pwszEnd, &cchRemaining, 0);
|
||||
|
||||
// Get system strings for decimal and thousand separators.
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, szDecimalSep, sizeof(szDecimalSep) / sizeof(*szDecimalSep));
|
||||
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, szThousandSep, sizeof(szThousandSep) / sizeof(*szThousandSep));
|
||||
/* Write formated bytes count */
|
||||
cchWritten = SH_FormatByteSize(lpQwSize->QuadPart, pwszEnd, cchRemaining);
|
||||
pwszEnd += cchWritten;
|
||||
cchRemaining -= cchWritten;
|
||||
|
||||
// Initialize format for printing the number in bytes
|
||||
ZeroMemory(&nf, sizeof(nf));
|
||||
nf.NumDigits = 0;
|
||||
nf.LeadingZero = 0;
|
||||
nf.Grouping = 0;
|
||||
nf.lpDecimalSep = szDecimalSep;
|
||||
nf.lpThousandSep = szThousandSep;
|
||||
nf.NegativeOrder = 0;
|
||||
/* Copy ")" to the buffer */
|
||||
StringCchCopyW(pwszEnd, cchRemaining, L")");
|
||||
|
||||
// Get system string for groups separator
|
||||
Len = GetLocaleInfoW(LOCALE_USER_DEFAULT,
|
||||
LOCALE_SGROUPING,
|
||||
szGrouping,
|
||||
sizeof(szGrouping) / sizeof(*szGrouping));
|
||||
|
||||
// Convert grouping specs from string to integer
|
||||
for (i = 0; i < Len; i++)
|
||||
{
|
||||
WCHAR wch = szGrouping[i];
|
||||
|
||||
if (wch >= L'0' && wch <= L'9')
|
||||
nf.Grouping = nf.Grouping * 10 + (wch - L'0');
|
||||
else if (wch != L';')
|
||||
break;
|
||||
}
|
||||
|
||||
if ((nf.Grouping % 10) == 0)
|
||||
nf.Grouping /= 10;
|
||||
else
|
||||
nf.Grouping *= 10;
|
||||
|
||||
// Concate " (" at the end of buffer
|
||||
Len = wcslen(pszBuf);
|
||||
Ptr = pszBuf + Len;
|
||||
cchRemaining = cchBuf - Len;
|
||||
StringCchCopyExW(Ptr, cchRemaining, L" (", &Ptr, &cchRemaining, 0);
|
||||
|
||||
// Save formatted number of bytes in buffer
|
||||
cchFormatted = GetNumberFormatW(LOCALE_USER_DEFAULT,
|
||||
0,
|
||||
szNumber,
|
||||
&nf,
|
||||
Ptr,
|
||||
cchRemaining);
|
||||
|
||||
if (cchFormatted == 0)
|
||||
return NULL;
|
||||
|
||||
// cchFormatted is number of characters including NULL - make it a real length
|
||||
--cchFormatted;
|
||||
|
||||
// Copy ' ' to buffer
|
||||
Ptr += cchFormatted;
|
||||
cchRemaining -= cchFormatted;
|
||||
StringCchCopyExW(Ptr, cchRemaining, L" ", &Ptr, &cchRemaining, 0);
|
||||
|
||||
// Copy 'bytes' string and remaining ')'
|
||||
Len = LoadStringW(shell32_hInstance, IDS_BYTES_FORMAT, Ptr, cchRemaining);
|
||||
Ptr += Len;
|
||||
cchRemaining -= Len;
|
||||
StringCchCopy(Ptr, cchRemaining, L")");
|
||||
|
||||
return pszBuf;
|
||||
return pwszResult;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
|
@ -412,23 +422,32 @@ CFileDefExt::InitFileType(HWND hwndDlg)
|
|||
*/
|
||||
|
||||
BOOL
|
||||
CFileDefExt::GetFileTimeString(LPFILETIME lpFileTime, WCHAR *lpResult)
|
||||
CFileDefExt::GetFileTimeString(LPFILETIME lpFileTime, LPWSTR pwszResult, UINT cchResult)
|
||||
{
|
||||
FILETIME ft;
|
||||
SYSTEMTIME st;
|
||||
|
||||
if (lpFileTime == NULL || lpResult == NULL)
|
||||
if (!FileTimeToLocalFileTime(lpFileTime, &ft) || !FileTimeToSystemTime(&ft, &st))
|
||||
return FALSE;
|
||||
|
||||
if (!FileTimeToLocalFileTime(lpFileTime, &ft))
|
||||
return FALSE;
|
||||
size_t cchRemaining = cchResult;
|
||||
LPWSTR pwszEnd = pwszResult;
|
||||
int cchWritten = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &st, NULL, pwszEnd, cchRemaining);
|
||||
if (cchWritten)
|
||||
--cchWritten; // GetDateFormatW returns count with terminating zero
|
||||
else
|
||||
ERR("GetDateFormatW failed\n");
|
||||
cchRemaining -= cchWritten;
|
||||
pwszEnd += cchWritten;
|
||||
|
||||
FileTimeToSystemTime(&ft, &st);
|
||||
StringCchCopyExW(pwszEnd, cchRemaining, L", ", &pwszEnd, &cchRemaining, 0);
|
||||
|
||||
/* ddmmyy */
|
||||
swprintf(lpResult, L"%02hu/%02hu/%04hu %02hu:%02hu", st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute);
|
||||
|
||||
TRACE("result %s\n", debugstr_w(lpResult));
|
||||
cchWritten = GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL, pwszEnd, cchRemaining);
|
||||
if (cchWritten)
|
||||
--cchWritten; // GetTimeFormatW returns count with terminating zero
|
||||
else
|
||||
ERR("GetTimeFormatW failed\n");
|
||||
TRACE("result %s\n", debugstr_w(pwszResult));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -509,13 +528,13 @@ CFileDefExt::InitFileSizeTime(HWND hwndDlg)
|
|||
|
||||
CloseHandle(hFile);
|
||||
|
||||
if (GetFileTimeString(&CreateTime, wszBuf))
|
||||
if (GetFileTimeString(&CreateTime, wszBuf, _countof(wszBuf)))
|
||||
SetDlgItemTextW(hwndDlg, 14015, wszBuf);
|
||||
|
||||
if (GetFileTimeString(&AccessedTime, wszBuf))
|
||||
if (GetFileTimeString(&AccessedTime, wszBuf, _countof(wszBuf)))
|
||||
SetDlgItemTextW(hwndDlg, 14019, wszBuf);
|
||||
|
||||
if (GetFileTimeString(&WriteTime, wszBuf))
|
||||
if (GetFileTimeString(&WriteTime, wszBuf, _countof(wszBuf)))
|
||||
SetDlgItemTextW(hwndDlg, 14017, wszBuf);
|
||||
|
||||
if (SH_FormatFileSizeWithBytes((PULARGE_INTEGER)&FileSize,
|
||||
|
@ -567,6 +586,14 @@ CFileDefExt::InitGeneralPage(HWND hwndDlg)
|
|||
/* Set file created/modfied/accessed time */
|
||||
InitFileSizeTime(hwndDlg);
|
||||
|
||||
DWORD dwAttr = GetFileAttributesW(m_wszPath);
|
||||
if (dwAttr & FILE_ATTRIBUTE_READONLY)
|
||||
SendDlgItemMessage(hwndDlg, 14021, BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwAttr & FILE_ATTRIBUTE_HIDDEN)
|
||||
SendDlgItemMessage(hwndDlg, 14022, BM_SETCHECK, BST_CHECKED, 0);
|
||||
if (dwAttr & FILE_ATTRIBUTE_ARCHIVE)
|
||||
SendDlgItemMessage(hwndDlg, 14023, BM_SETCHECK, BST_CHECKED, 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ class CFileDefExt :
|
|||
private:
|
||||
VOID InitOpensWithField(HWND hwndDlg);
|
||||
BOOL InitFileType(HWND hwndDlg);
|
||||
static BOOL GetFileTimeString(LPFILETIME lpFileTime, WCHAR *lpResult);
|
||||
static BOOL GetFileTimeString(LPFILETIME lpFileTime, LPWSTR pwszResult, UINT cchResult);
|
||||
BOOL InitFilePath(HWND hwndDlg);
|
||||
BOOL InitFileSizeTime(HWND hwndDlg);
|
||||
BOOL InitGeneralPage(HWND hwndDlg);
|
||||
|
|
|
@ -312,9 +312,9 @@ BEGIN
|
|||
CONTROL "", 14015, "Static", SS_OWNERDRAW, 70, 135, 100, 30
|
||||
|
||||
LTEXT "Napęd %c", 14009, 100, 170, 40, 10
|
||||
PUSHBUTTON "Czyszczenie dysku", 14010, 180, 175, 50, 15, WS_TABSTOP
|
||||
CHECKBOX "Kompresja danych na dysku", 14011, 15, 205, 180, 10, WS_DISABLED
|
||||
CHECKBOX "Zezwól Usłudze Indeksowania na zaindeksowanie tego dysku (szybkie przeszukiwanie plików)", 14012, 15, 220, 200, 10, WS_DISABLED
|
||||
PUSHBUTTON "Oczyszczanie dysku", 14010, 170, 175, 60, 15, WS_TABSTOP
|
||||
CHECKBOX "Kompresuj dysk, aby zaoszczędzić miejsce na dysku", 14011, 15, 205, 180, 10, WS_DISABLED
|
||||
CHECKBOX "Zezwalaj na indeksowanie tego dysku, aby przyśpieszyć wyszukiwanie plików", 14012, 15, 220, 200, 10, WS_DISABLED
|
||||
END
|
||||
|
||||
DRIVE_EXTRA_DLG DIALOGEX 0, 0, 240, 230
|
||||
|
@ -324,13 +324,13 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
|||
BEGIN
|
||||
GROUPBOX "Sprawdzanie błędów", -1, 5, 5, 230, 60
|
||||
LTEXT "Ta opcja sprawdzi wolumin w poszukiwaniu błędów.", -1, 40, 25, 160, 20
|
||||
PUSHBUTTON "Sprawdź", 14000, 130, 45, 90, 15, WS_TABSTOP
|
||||
PUSHBUTTON "Sprawdź...", 14000, 130, 45, 90, 15, WS_TABSTOP
|
||||
GROUPBOX "Defragmentacja", -1, 5, 65, 230, 60
|
||||
LTEXT "Ta opcja zdefragmentuje pliki na woluminie", -1, 40, 85, 160, 20
|
||||
PUSHBUTTON "Defragmentuj", 14001, 130, 105, 90, 15, WS_TABSTOP
|
||||
LTEXT "Ta opcja dokona defragmentacji plików woluminu.", -1, 40, 85, 160, 20
|
||||
PUSHBUTTON "Defragmentuj...", 14001, 130, 105, 90, 15, WS_TABSTOP
|
||||
GROUPBOX "Kopia zapasowa", -1, 5, 130, 230, 60
|
||||
LTEXT "Ta opcja wykona kopię zapasową plików na woluminie.", -1, 40, 150, 160, 20
|
||||
PUSHBUTTON "Stwórz kopię", 14002, 130, 170, 90, 15, WS_TABSTOP
|
||||
LTEXT "Ta opcja wykona kopię zapasową plików tego woluminu.", -1, 40, 150, 160, 20
|
||||
PUSHBUTTON "Wykonaj kopię zapasową...", 14002, 130, 170, 90, 15, WS_TABSTOP
|
||||
END
|
||||
|
||||
DRIVE_HARDWARE_DLG DIALOGEX 0, 0, 240, 230
|
||||
|
|
Loading…
Reference in a new issue