mirror of
https://github.com/reactos/reactos.git
synced 2024-11-09 16:20:37 +00:00
[DISKPART] List all available file systems in the FILESYSTEMS command
This commit is contained in:
parent
0574987b20
commit
cb582efdd2
3 changed files with 49 additions and 11 deletions
|
@ -1,5 +1,6 @@
|
|||
|
||||
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/conutils)
|
||||
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/fmifs)
|
||||
|
||||
list(APPEND SOURCE
|
||||
active.c
|
||||
|
@ -52,7 +53,7 @@ add_dependencies(diskpart diskpart_msg)
|
|||
|
||||
set_module_type(diskpart win32cui UNICODE)
|
||||
target_link_libraries(diskpart conutils ${PSEH_LIB})
|
||||
add_importlibs(diskpart advapi32 msvcrt kernel32 ntdll)
|
||||
add_importlibs(diskpart fmifs advapi32 msvcrt kernel32 ntdll)
|
||||
|
||||
if(MSVC)
|
||||
add_importlibs(diskpart ntdll)
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
#include <ndk/setypes.h>
|
||||
#include <ndk/umfuncs.h>
|
||||
|
||||
#include <fmifs/fmifs.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
/* DEFINES *******************************************************************/
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
static
|
||||
BOOL
|
||||
GetFileSystemInfo(
|
||||
ShowFileSystemInfo(
|
||||
PVOLENTRY VolumeEntry)
|
||||
{
|
||||
WCHAR VolumeNameBuffer[MAX_PATH];
|
||||
|
@ -26,6 +26,7 @@ GetFileSystemInfo(
|
|||
FILE_FS_FULL_SIZE_INFORMATION FullSizeInfo;
|
||||
PFILE_FS_ATTRIBUTE_INFORMATION pAttributeInfo = NULL;
|
||||
NTSTATUS Status;
|
||||
BOOL Result = TRUE;
|
||||
|
||||
wcscpy(VolumeNameBuffer, VolumeEntry->DeviceName);
|
||||
wcscat(VolumeNameBuffer, L"\\");
|
||||
|
@ -66,12 +67,22 @@ GetFileSystemInfo(
|
|||
pAttributeInfo = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
ulSize);
|
||||
if (pAttributeInfo == NULL)
|
||||
{
|
||||
Result = FALSE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
Status = NtQueryVolumeInformationFile(VolumeHandle,
|
||||
&IoStatusBlock,
|
||||
pAttributeInfo,
|
||||
ulSize,
|
||||
FileFsAttributeInformation);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
Result = FALSE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
Status = NtQueryVolumeInformationFile(VolumeHandle,
|
||||
&IoStatusBlock,
|
||||
|
@ -101,13 +112,43 @@ GetFileSystemInfo(
|
|||
|
||||
ConResPrintf(StdOut, IDS_FILESYSTEMS_TYPE, pAttributeInfo->FileSystemName);
|
||||
ConResPrintf(StdOut, IDS_FILESYSTEMS_CLUSTERSIZE, ulClusterSize);
|
||||
ConPuts(StdOut, L"\n");
|
||||
|
||||
done:
|
||||
if (pAttributeInfo)
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, pAttributeInfo);
|
||||
|
||||
NtClose(VolumeHandle);
|
||||
|
||||
return TRUE;
|
||||
return Result;
|
||||
}
|
||||
|
||||
static
|
||||
VOID
|
||||
ShowInstalledFileSystems(VOID)
|
||||
{
|
||||
WCHAR szBuffer[256];
|
||||
BOOLEAN ret;
|
||||
DWORD dwIndex;
|
||||
UCHAR uMajor, uMinor;
|
||||
BOOLEAN bLatest;
|
||||
|
||||
ConResPuts(StdOut, IDS_FILESYSTEMS_FORMATTING);
|
||||
|
||||
for (dwIndex = 0; ; dwIndex++)
|
||||
{
|
||||
ret = QueryAvailableFileSystemFormat(dwIndex,
|
||||
szBuffer,
|
||||
&uMajor,
|
||||
&uMinor,
|
||||
&bLatest);
|
||||
if (ret == FALSE)
|
||||
break;
|
||||
|
||||
ConPrintf(StdOut, L" %s\n", szBuffer);
|
||||
}
|
||||
|
||||
ConPuts(StdOut, L"\n");
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
@ -123,16 +164,10 @@ filesystems_main(
|
|||
|
||||
ConPuts(StdOut, L"\n");
|
||||
|
||||
if (GetFileSystemInfo(CurrentVolume))
|
||||
if (ShowFileSystemInfo(CurrentVolume))
|
||||
{
|
||||
ConPuts(StdOut, L"\n");
|
||||
ConResPuts(StdOut, IDS_FILESYSTEMS_FORMATTING);
|
||||
|
||||
/* FIXME: List available file systems */
|
||||
|
||||
ShowInstalledFileSystems();
|
||||
}
|
||||
|
||||
ConPuts(StdOut, L"\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue