As per title, the size columns in My Computer are not showing correct values.
MR changes them as follows:
![](/uploads/055ff7ed1a4c95524ca108985acb4ee1/changes.png)
The D: to H: here are card adapter drives and DVD drive. Turns out they shouldn't show any size at all, and were probably showing whatever uninitialized memory was in `ULARGE_INTEGER`.
From: Vladislav Timonin timoninvlad@yandex.ru
--- dlls/shell32/shfldr_mycomp.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-)
diff --git a/dlls/shell32/shfldr_mycomp.c b/dlls/shell32/shfldr_mycomp.c index 2f4ebd580c1..7083ea18763 100644 --- a/dlls/shell32/shfldr_mycomp.c +++ b/dlls/shell32/shfldr_mycomp.c @@ -790,13 +790,12 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDetailsEx (IShellFolder2 * iface, return E_NOTIMPL; }
-/* FIXME: drive size >4GB is rolling over */ static HRESULT WINAPI ISF_MyComputer_fnGetDetailsOf (IShellFolder2 *iface, LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS *psd) { IMyComputerFolderImpl *This = impl_from_IShellFolder2(iface); - char szPath[MAX_PATH]; - ULARGE_INTEGER ulBytes; + WCHAR path[MAX_PATH]; + ULARGE_INTEGER bytes; HRESULT hr = S_OK;
TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd); @@ -813,22 +812,27 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDetailsOf (IShellFolder2 *iface, switch (iColumn) { case 2: /* total size */ - if (_ILIsDrive (pidl)) - { - _ILSimpleGetText (pidl, szPath, MAX_PATH); - GetDiskFreeSpaceExA (szPath, NULL, &ulBytes, NULL); - StrFormatByteSizeA (ulBytes.u.LowPart, psd->str.u.cStr, MAX_PATH); - } + if (!_ILIsDrive (pidl)) + break; + + _ILSimpleGetTextW(pidl, path, MAX_PATH); + GetDiskFreeSpaceExW(path, NULL, &bytes, NULL); + + psd->str.uType = STRRET_WSTR; + psd->str.u.pOleStr = CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR)); + StrFormatByteSizeW(bytes.QuadPart, psd->str.u.pOleStr, MAX_PATH); break; case 3: /* free size */ - if (_ILIsDrive (pidl)) - { - _ILSimpleGetText (pidl, szPath, MAX_PATH); - GetDiskFreeSpaceExA (szPath, &ulBytes, NULL, NULL); - StrFormatByteSizeA (ulBytes.u.LowPart, psd->str.u.cStr, MAX_PATH); - } - break; + if (!_ILIsDrive (pidl)) + break;
+ _ILSimpleGetTextW(pidl, path, MAX_PATH); + GetDiskFreeSpaceExW(path, &bytes, NULL, NULL); + + psd->str.uType = STRRET_WSTR; + psd->str.u.pOleStr = CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR)); + StrFormatByteSizeW(bytes.QuadPart, psd->str.u.pOleStr, MAX_PATH); + break; default: return shellfolder_get_file_details( iface, pidl, mycomputer_header, iColumn, psd ); }
From: Vladislav Timonin timoninvlad@yandex.ru
--- dlls/shell32/shfldr_mycomp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/shfldr_mycomp.c b/dlls/shell32/shfldr_mycomp.c index 7083ea18763..5aa540c9376 100644 --- a/dlls/shell32/shfldr_mycomp.c +++ b/dlls/shell32/shfldr_mycomp.c @@ -816,7 +816,8 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDetailsOf (IShellFolder2 *iface, break;
_ILSimpleGetTextW(pidl, path, MAX_PATH); - GetDiskFreeSpaceExW(path, NULL, &bytes, NULL); + if (!GetDiskFreeSpaceExW(path, NULL, &bytes, NULL)) + break;
psd->str.uType = STRRET_WSTR; psd->str.u.pOleStr = CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR)); @@ -827,7 +828,8 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDetailsOf (IShellFolder2 *iface, break;
_ILSimpleGetTextW(pidl, path, MAX_PATH); - GetDiskFreeSpaceExW(path, &bytes, NULL, NULL); + if (!GetDiskFreeSpaceExW(path, &bytes, NULL, NULL)) + break;
psd->str.uType = STRRET_WSTR; psd->str.u.pOleStr = CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));