[FORMAT] wmain(): Clean GetDiskFreeSpaceExW() calls up

This commit is contained in:
Serge Gautherie 2024-10-17 00:45:29 +02:00 committed by Mark Jansen
parent 982cf2be5e
commit 421dd31d49

View file

@ -367,7 +367,7 @@ int wmain(int argc, WCHAR *argv[])
WCHAR volumeName[1024] = {0}; WCHAR volumeName[1024] = {0};
WCHAR input[1024]; WCHAR input[1024];
DWORD serialNumber; DWORD serialNumber;
ULARGE_INTEGER freeBytesAvailableToCaller, totalNumberOfBytes, totalNumberOfFreeBytes; ULARGE_INTEGER totalNumberOfBytes, totalNumberOfFreeBytes;
WCHAR szMsg[RC_STRING_MAX_SIZE]; WCHAR szMsg[RC_STRING_MAX_SIZE];
/* Initialize the Console Standard Streams */ /* Initialize the Console Standard Streams */
@ -501,9 +501,9 @@ int wmain(int argc, WCHAR *argv[])
* Fallback to GetFreeDiskSpaceExW if we did not get any volume length. */ * Fallback to GetFreeDiskSpaceExW if we did not get any volume length. */
if (totalNumberOfBytes.QuadPart == 0 && if (totalNumberOfBytes.QuadPart == 0 &&
!GetDiskFreeSpaceExW(RootDirectory, !GetDiskFreeSpaceExW(RootDirectory,
&freeBytesAvailableToCaller, NULL,
&totalNumberOfBytes, &totalNumberOfBytes,
&totalNumberOfFreeBytes)) NULL))
{ {
K32LoadStringW(GetModuleHandle(NULL), STRING_NO_VOLUME_SIZE, szMsg, ARRAYSIZE(szMsg)); K32LoadStringW(GetModuleHandle(NULL), STRING_NO_VOLUME_SIZE, szMsg, ARRAYSIZE(szMsg));
PrintWin32Error(szMsg, GetLastError()); PrintWin32Error(szMsg, GetLastError());
@ -612,10 +612,10 @@ int wmain(int argc, WCHAR *argv[])
} }
// //
// Print out some stuff including the formatted size // Get and print out some stuff including the formatted size
// //
if (!GetDiskFreeSpaceExW(RootDirectory, if (!GetDiskFreeSpaceExW(RootDirectory,
&freeBytesAvailableToCaller, NULL,
&totalNumberOfBytes, &totalNumberOfBytes,
&totalNumberOfFreeBytes)) &totalNumberOfFreeBytes))
{ {