https://git.reactos.org/?p=reactos.git;a=commitdiff;h=358fecdcf00d8f91cfeb1…
commit 358fecdcf00d8f91cfeb1735b79f0aaef9d0c118
Author: Adam Słaboń <asaillen(a)protonmail.com>
AuthorDate: Sun Mar 3 10:53:24 2024 +0100
Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org>
CommitDate: Mon Oct 7 11:16:03 2024 +0200
[FORMAT] Handle unformatted volumes
---
base/system/format/format.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/base/system/format/format.c b/base/system/format/format.c
index c8805af5e69..29b22f9a27d 100644
--- a/base/system/format/format.c
+++ b/base/system/format/format.c
@@ -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;
@@ -475,9 +475,16 @@ int wmain(int argc, WCHAR *argv[])
&serialNumber, &maxComponent, &flags,
fileSystem, ARRAYSIZE(fileSystem)))
{
- K32LoadStringW(GetModuleHandle(NULL), STRING_NO_VOLUME, szMsg,
ARRAYSIZE(szMsg));
- PrintWin32Error(szMsg, GetLastError());
- return -1;
+ 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,