mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 20:03:12 +00:00
[FLTMC] Implement 'fltmc volumes'
This commit is contained in:
parent
5617ba9841
commit
0231c8baec
3 changed files with 120 additions and 1 deletions
|
@ -202,6 +202,64 @@ PrintFilterInfo(_In_ PVOID Buffer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PrintVolumeInfo(_In_ PVOID Buffer)
|
||||||
|
{
|
||||||
|
PFILTER_VOLUME_STANDARD_INFORMATION FilterVolInfo;
|
||||||
|
WCHAR DosName[16] = { 0 };
|
||||||
|
WCHAR VolName[128] = { 0 };
|
||||||
|
WCHAR FileSystem[32] = { 0 };
|
||||||
|
|
||||||
|
FilterVolInfo = (PFILTER_VOLUME_STANDARD_INFORMATION)Buffer;
|
||||||
|
|
||||||
|
if (FilterVolInfo->FilterVolumeNameLength < 128)
|
||||||
|
{
|
||||||
|
CopyMemory(VolName,
|
||||||
|
(PCHAR)FilterVolInfo->FilterVolumeName,
|
||||||
|
FilterVolInfo->FilterVolumeNameLength);
|
||||||
|
VolName[FilterVolInfo->FilterVolumeNameLength] = UNICODE_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
(void)FilterGetDosName(VolName, DosName, 16);
|
||||||
|
|
||||||
|
switch (FilterVolInfo->FileSystemType)
|
||||||
|
{
|
||||||
|
case FLT_FSTYPE_MUP:
|
||||||
|
StringCchCopyW(FileSystem, 32, L"Remote");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FLT_FSTYPE_NTFS:
|
||||||
|
StringCchCopyW(FileSystem, 32, L"NTFS");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FLT_FSTYPE_FAT:
|
||||||
|
StringCchCopyW(FileSystem, 32, L"FAT");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FLT_FSTYPE_EXFAT:
|
||||||
|
StringCchCopyW(FileSystem, 32, L"exFAT");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FLT_FSTYPE_NPFS:
|
||||||
|
StringCchCopyW(FileSystem, 32, L"NamedPipe");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FLT_FSTYPE_MSFS:
|
||||||
|
StringCchCopyW(FileSystem, 32, L"Mailslot");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FLT_FSTYPE_UNKNOWN:
|
||||||
|
default:
|
||||||
|
StringCchCopyW(FileSystem, 32, L"<Unknown>");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
wprintf(L"%-31s %-40s %-10s\n",
|
||||||
|
DosName,
|
||||||
|
VolName,
|
||||||
|
FileSystem);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ListFilters()
|
ListFilters()
|
||||||
{
|
{
|
||||||
|
@ -260,7 +318,51 @@ ListFilters()
|
||||||
|
|
||||||
if (!SUCCEEDED(hr) && hr != HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS))
|
if (!SUCCEEDED(hr) && hr != HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS))
|
||||||
{
|
{
|
||||||
LoadAndPrintString(IDS_ERROR_PRIV, hr);
|
LoadAndPrintString(IDS_ERROR_FILTERS, hr);
|
||||||
|
PrintErrorText(hr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ListVolumes()
|
||||||
|
{
|
||||||
|
HANDLE FindHandle;
|
||||||
|
BYTE Buffer[1024];
|
||||||
|
ULONG BytesReturned;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = FilterVolumeFindFirst(FilterVolumeStandardInformation,
|
||||||
|
Buffer,
|
||||||
|
1024,
|
||||||
|
&BytesReturned,
|
||||||
|
&FindHandle);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
LoadAndPrintString(IDS_DISPLAY_VOLUMES);
|
||||||
|
wprintf(L"------------------------------ --------------------------------------- ---------- --------\n");
|
||||||
|
|
||||||
|
PrintVolumeInfo(Buffer);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
hr = FilterVolumeFindNext(FindHandle,
|
||||||
|
FilterVolumeStandardInformation,
|
||||||
|
Buffer,
|
||||||
|
1024,
|
||||||
|
&BytesReturned);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
PrintVolumeInfo(Buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
} while (SUCCEEDED(hr));
|
||||||
|
|
||||||
|
FilterVolumeFindClose(FindHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SUCCEEDED(hr) && hr != HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS))
|
||||||
|
{
|
||||||
|
LoadAndPrintString(IDS_ERROR_VOLUMES, hr);
|
||||||
PrintErrorText(hr);
|
PrintErrorText(hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,6 +411,18 @@ int wmain(int argc, WCHAR *argv[])
|
||||||
wprintf(L"fltmc.exe unload [name]\n\n");
|
wprintf(L"fltmc.exe unload [name]\n\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!_wcsicmp(argv[1], L"volumes"))
|
||||||
|
{
|
||||||
|
if (argc == 2)
|
||||||
|
{
|
||||||
|
ListVolumes();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LoadAndPrintString(IDS_USAGE_VOLUMES);
|
||||||
|
wprintf(L"fltmc.exe volumes [name]\n\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_DISPLAY_FILTERS1 "Filter Name Num Instances Altitude Frame\n"
|
IDS_DISPLAY_FILTERS1 "Filter Name Num Instances Altitude Frame\n"
|
||||||
IDS_DISPLAY_FILTERS2 "Filter Name Num Instances Frame\n"
|
IDS_DISPLAY_FILTERS2 "Filter Name Num Instances Frame\n"
|
||||||
|
IDS_DISPLAY_VOLUMES "Dos Name Volume Name FileSystem Status\n"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE
|
STRINGTABLE
|
||||||
|
@ -24,4 +25,5 @@ BEGIN
|
||||||
IDS_ERROR_FILTERS "Failed to list the filters (0x%X)\n"
|
IDS_ERROR_FILTERS "Failed to list the filters (0x%X)\n"
|
||||||
IDS_ERROR_LOAD "Failed to load the filter (0x%X)\n"
|
IDS_ERROR_LOAD "Failed to load the filter (0x%X)\n"
|
||||||
IDS_ERROR_UNLOAD "Failed to unload the filter (0x%X)\n"
|
IDS_ERROR_UNLOAD "Failed to unload the filter (0x%X)\n"
|
||||||
|
IDS_ERROR_VOLUMES "Failed to list the volumes (0x%X)\n"
|
||||||
END
|
END
|
||||||
|
|
|
@ -4,11 +4,14 @@
|
||||||
#define IDS_USAGE_LOAD 1
|
#define IDS_USAGE_LOAD 1
|
||||||
#define IDS_USAGE_UNLOAD 2
|
#define IDS_USAGE_UNLOAD 2
|
||||||
#define IDS_USAGE_FILTERS 3
|
#define IDS_USAGE_FILTERS 3
|
||||||
|
#define IDS_USAGE_VOLUMES 4
|
||||||
|
|
||||||
#define IDS_DISPLAY_FILTERS1 10
|
#define IDS_DISPLAY_FILTERS1 10
|
||||||
#define IDS_DISPLAY_FILTERS2 11
|
#define IDS_DISPLAY_FILTERS2 11
|
||||||
|
#define IDS_DISPLAY_VOLUMES 12
|
||||||
|
|
||||||
#define IDS_ERROR_PRIV 20
|
#define IDS_ERROR_PRIV 20
|
||||||
#define IDS_ERROR_FILTERS 21
|
#define IDS_ERROR_FILTERS 21
|
||||||
#define IDS_ERROR_LOAD 22
|
#define IDS_ERROR_LOAD 22
|
||||||
#define IDS_ERROR_UNLOAD 23
|
#define IDS_ERROR_UNLOAD 23
|
||||||
|
#define IDS_ERROR_VOLUMES 24
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue