mirror of
https://github.com/reactos/reactos.git
synced 2025-05-18 16:51:18 +00:00
[FORMAT] wmain(): Clean GetVolumeInformationW() calls up
and immediately print file system out
This commit is contained in:
parent
d69a80fad7
commit
982cf2be5e
1 changed files with 9 additions and 18 deletions
|
@ -367,7 +367,6 @@ int wmain(int argc, WCHAR *argv[])
|
|||
WCHAR volumeName[1024] = {0};
|
||||
WCHAR input[1024];
|
||||
DWORD serialNumber;
|
||||
DWORD flags, maxComponent;
|
||||
ULARGE_INTEGER freeBytesAvailableToCaller, totalNumberOfBytes, totalNumberOfFreeBytes;
|
||||
WCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
|
@ -468,11 +467,11 @@ int wmain(int argc, WCHAR *argv[])
|
|||
}
|
||||
|
||||
//
|
||||
// Determine the drive's file system format
|
||||
// Get the existing name and file system, and print out the latter
|
||||
//
|
||||
if (!GetVolumeInformationW(RootDirectory,
|
||||
volumeName, ARRAYSIZE(volumeName),
|
||||
&serialNumber, &maxComponent, &flags,
|
||||
NULL, NULL, NULL,
|
||||
fileSystem, ARRAYSIZE(fileSystem)))
|
||||
{
|
||||
if (GetLastError() == ERROR_UNRECOGNIZED_VOLUME)
|
||||
|
@ -487,6 +486,8 @@ int wmain(int argc, WCHAR *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
ConResPrintf(StdOut, STRING_FILESYSTEM, fileSystem);
|
||||
|
||||
if (QueryDeviceInformation(RootDirectory,
|
||||
&DeviceInformation,
|
||||
sizeof(DeviceInformation)))
|
||||
|
@ -508,7 +509,6 @@ int wmain(int argc, WCHAR *argv[])
|
|||
PrintWin32Error(szMsg, GetLastError());
|
||||
return -1;
|
||||
}
|
||||
ConResPrintf(StdOut, STRING_FILESYSTEM, fileSystem);
|
||||
|
||||
//
|
||||
// Make sure they want to do this
|
||||
|
@ -611,16 +611,6 @@ int wmain(int argc, WCHAR *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if (!GetVolumeInformationW(RootDirectory,
|
||||
volumeName, ARRAYSIZE(volumeName),
|
||||
&serialNumber, &maxComponent, &flags,
|
||||
fileSystem, ARRAYSIZE(fileSystem)))
|
||||
{
|
||||
K32LoadStringW(GetModuleHandle(NULL), STRING_NO_VOLUME, szMsg, ARRAYSIZE(szMsg));
|
||||
PrintWin32Error(szMsg, GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
//
|
||||
// Print out some stuff including the formatted size
|
||||
//
|
||||
|
@ -638,17 +628,18 @@ int wmain(int argc, WCHAR *argv[])
|
|||
totalNumberOfFreeBytes.QuadPart);
|
||||
|
||||
//
|
||||
// Get the drive's serial number
|
||||
// Get and print out the new serial number
|
||||
//
|
||||
if (!GetVolumeInformationW(RootDirectory,
|
||||
volumeName, ARRAYSIZE(volumeName),
|
||||
&serialNumber, &maxComponent, &flags,
|
||||
fileSystem, ARRAYSIZE(fileSystem)))
|
||||
NULL, 0,
|
||||
&serialNumber, NULL, NULL,
|
||||
NULL, 0))
|
||||
{
|
||||
K32LoadStringW(GetModuleHandle(NULL), STRING_NO_VOLUME, szMsg, ARRAYSIZE(szMsg));
|
||||
PrintWin32Error(szMsg, GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
ConResPrintf(StdOut, STRING_SERIAL_NUMBER,
|
||||
(unsigned int)(serialNumber >> 16),
|
||||
(unsigned int)(serialNumber & 0xFFFF));
|
||||
|
|
Loading…
Reference in a new issue