[FORMAT] Handle unformatted volumes

This commit is contained in:
Adam Słaboń 2024-03-03 10:53:24 +01:00 committed by Hermès BÉLUSCA - MAÏTO
parent c5a9f22d4e
commit 358fecdcf0

View file

@ -364,7 +364,7 @@ int wmain(int argc, WCHAR *argv[])
FMIFS_MEDIA_FLAG media = FMIFS_HARDDISK;
DWORD driveType;
WCHAR fileSystem[1024];
WCHAR volumeName[1024];
WCHAR volumeName[1024] = {0};
WCHAR input[1024];
DWORD serialNumber;
DWORD flags, maxComponent;
@ -474,11 +474,18 @@ int wmain(int argc, WCHAR *argv[])
volumeName, ARRAYSIZE(volumeName),
&serialNumber, &maxComponent, &flags,
fileSystem, ARRAYSIZE(fileSystem)))
{
if (GetLastError() == ERROR_UNRECOGNIZED_VOLUME)
{
wcscpy(fileSystem, L"RAW");
}
else
{
K32LoadStringW(GetModuleHandle(NULL), STRING_NO_VOLUME, szMsg, ARRAYSIZE(szMsg));
PrintWin32Error(szMsg, GetLastError());
return -1;
}
}
if (QueryDeviceInformation(RootDirectory,
&DeviceInformation,