ReactOS 0.4.15-dev-7934-g1dc8d80
filesystems.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS DiskPart
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/system/diskpart/filesystems.c
5 * PURPOSE: Manages all the partitions of the OS in an interactive way.
6 * PROGRAMMERS: Lee Schroeder
7 */
8
9#include "diskpart.h"
10
11#define NDEBUG
12#include <debug.h>
13
14static
15BOOL
17 PVOLENTRY VolumeEntry)
18{
19 WCHAR VolumeNameBuffer[MAX_PATH];
24 ULONG ulSize, ulClusterSize = 0;
27 PFILE_FS_ATTRIBUTE_INFORMATION pAttributeInfo = NULL;
29
30 wcscpy(VolumeNameBuffer, VolumeEntry->DeviceName);
31 wcscat(VolumeNameBuffer, L"\\");
32
33 RtlInitUnicodeString(&VolumeName, VolumeNameBuffer);
34
37 0,
38 NULL,
39 NULL);
40
45 0,
47 if (!NT_SUCCESS(Status))
48 {
50 {
52 return FALSE;
53 }
55 {
57 ConPuts(StdOut, L"\n");
60 }
61
62 return TRUE;
63 }
64
65 ulSize = sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 255 * sizeof(WCHAR);
66 pAttributeInfo = RtlAllocateHeap(RtlGetProcessHeap(),
68 ulSize);
69
72 pAttributeInfo,
73 ulSize,
75
78 &FullSizeInfo,
81 if (NT_SUCCESS(Status))
82 {
83 ulClusterSize = FullSizeInfo.BytesPerSector * FullSizeInfo.SectorsPerAllocationUnit;
84 }
85 else
86 {
89 &SizeInfo,
92 if (NT_SUCCESS(Status))
93 {
94 ulClusterSize = SizeInfo.BytesPerSector * SizeInfo.SectorsPerAllocationUnit;
95 }
96 }
97
98
100 ConPuts(StdOut, L"\n");
101
104
105 if (pAttributeInfo)
106 RtlFreeHeap(RtlGetProcessHeap(), 0, pAttributeInfo);
107
109
110 return TRUE;
111}
112
113BOOL
115 _In_ INT argc,
116 _In_ PWSTR *argv)
117{
118 if (CurrentVolume == NULL)
119 {
121 return TRUE;
122 }
123
124 ConPuts(StdOut, L"\n");
125
127 {
128 ConPuts(StdOut, L"\n");
130
131 /* FIXME: List available file systems */
132
133 }
134
135 ConPuts(StdOut, L"\n");
136
137 return TRUE;
138}
static int argc
Definition: ServiceArgs.c:12
void ConPuts(FILE *fp, LPCWSTR psz)
Definition: fc.c:16
#define StdOut
Definition: fc.c:14
void ConResPrintf(FILE *fp, UINT nID,...)
Definition: fc.c:33
void ConResPuts(FILE *fp, UINT nID)
Definition: fc.c:27
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
#define IDS_SELECT_NO_VOLUME
Definition: resource.h:92
#define IDS_FILESYSTEMS_FORMATTING
Definition: resource.h:60
#define IDS_FILESYSTEMS_CURRENT
Definition: resource.h:59
#define IDS_ERROR_NO_MEDIUM
Definition: resource.h:188
#define IDS_FILESYSTEMS_CLUSTERSIZE
Definition: resource.h:62
#define IDS_FILESYSTEMS_TYPE
Definition: resource.h:61
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
PVOLENTRY CurrentVolume
Definition: partlist.c:76
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:34
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL GetFileSystemInfo(PVOLENTRY VolumeEntry)
Definition: filesystems.c:16
BOOL filesystems_main(_In_ INT argc, _In_ PWSTR *argv)
Definition: filesystems.c:114
_Must_inspect_result_ _Inout_opt_ PUNICODE_STRING VolumeName
Definition: fltkernel.h:1117
_Must_inspect_result_ _Out_ PHANDLE VolumeHandle
Definition: fltkernel.h:2283
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
struct _FILE_FS_ATTRIBUTE_INFORMATION FILE_FS_ATTRIBUTE_INFORMATION
@ FileFsAttributeInformation
Definition: from_kernel.h:223
@ FileFsSizeInformation
Definition: from_kernel.h:221
#define FILE_OPEN_FOR_BACKUP_INTENT
Definition: from_kernel.h:42
Status
Definition: gdiplustypes.h:25
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define argv
Definition: mplay32.c:18
#define _In_
Definition: ms_sal.h:308
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3952
#define SYNCHRONIZE
Definition: nt_native.h:61
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define FileFsFullSizeInformation
Definition: ntifs_ex.h:389
#define L(x)
Definition: ntvdm.h:50
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
NTSTATUS NTAPI NtQueryVolumeInformationFile(HANDLE FileHandle, PIO_STATUS_BLOCK IoStatusBlock, PVOID FsInformation, ULONG Length, FS_INFORMATION_CLASS FsInformationClass)
WCHAR DeviceName[MAX_PATH]
Definition: diskpart.h:193
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_UNRECOGNIZED_VOLUME
Definition: udferr_usr.h:173
#define STATUS_NO_MEDIA_IN_DEVICE
Definition: udferr_usr.h:141
__wchar_t WCHAR
Definition: xmlstorage.h:180