mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
[KMTESTS:NPFS]
Add tests for volume information query. Could be completed for size, device, full size and attributes query. This is used to validate changes made in r62663. Tested by Thomas. CORE-7451 svn path=/trunk/; revision=62717
This commit is contained in:
parent
417fb8210e
commit
77ef29ad79
3 changed files with 99 additions and 0 deletions
|
@ -32,6 +32,7 @@ list(APPEND KMTEST_DRV_SOURCE
|
|||
npfs/NpfsCreate.c
|
||||
npfs/NpfsHelpers.c
|
||||
npfs/NpfsReadWrite.c
|
||||
npfs/NpfsVolumeInfo.c
|
||||
ntos_ex/ExCallback.c
|
||||
ntos_ex/ExDoubleList.c
|
||||
ntos_ex/ExFastMutex.c
|
||||
|
|
|
@ -41,6 +41,7 @@ KMT_TESTFUNC Test_MmSection;
|
|||
KMT_TESTFUNC Test_NpfsConnect;
|
||||
KMT_TESTFUNC Test_NpfsCreate;
|
||||
KMT_TESTFUNC Test_NpfsReadWrite;
|
||||
KMT_TESTFUNC Test_NpfsVolumeInfo;
|
||||
KMT_TESTFUNC Test_ObReference;
|
||||
KMT_TESTFUNC Test_ObType;
|
||||
KMT_TESTFUNC Test_ObTypeClean;
|
||||
|
@ -95,6 +96,7 @@ const KMT_TEST TestList[] =
|
|||
{ "NpfsConnect", Test_NpfsConnect },
|
||||
{ "NpfsCreate", Test_NpfsCreate },
|
||||
{ "NpfsReadWrite", Test_NpfsReadWrite },
|
||||
{ "NpfsVolumeInfo", Test_NpfsVolumeInfo },
|
||||
{ "ObReference", Test_ObReference },
|
||||
{ "ObType", Test_ObType },
|
||||
{ "-ObTypeClean", Test_ObTypeClean },
|
||||
|
|
96
rostests/kmtests/npfs/NpfsVolumeInfo.c
Normal file
96
rostests/kmtests/npfs/NpfsVolumeInfo.c
Normal file
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* PROJECT: ReactOS kernel-mode tests
|
||||
* LICENSE: LGPLv2+ - See COPYING.LIB in the top level directory
|
||||
* PURPOSE: Kernel-Mode Test Suite NPFS volume information test
|
||||
* PROGRAMMER: Pierre Schweitzer <pierre@reactos.org>
|
||||
*/
|
||||
|
||||
#include <kmt_test.h>
|
||||
#include "npfs.h"
|
||||
|
||||
#define MAX_INSTANCES 1
|
||||
#define IN_QUOTA 4096
|
||||
#define OUT_QUOTA 4096
|
||||
|
||||
static
|
||||
VOID
|
||||
TestVolumeInfo(
|
||||
IN HANDLE ServerHandle)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
struct {
|
||||
FILE_FS_VOLUME_INFORMATION;
|
||||
WCHAR PartialName[2];
|
||||
} PartialInfo;
|
||||
struct {
|
||||
FILE_FS_VOLUME_INFORMATION;
|
||||
WCHAR PartialName[10];
|
||||
} CompleteInfo;
|
||||
|
||||
Status = ZwQueryVolumeInformationFile(ServerHandle,
|
||||
&IoStatusBlock,
|
||||
&CompleteInfo,
|
||||
sizeof(CompleteInfo),
|
||||
FileFsVolumeInformation);
|
||||
ok_eq_hex(Status, STATUS_SUCCESS);
|
||||
ok_eq_hex(IoStatusBlock.Status, STATUS_SUCCESS);
|
||||
ok_eq_long(CompleteInfo.VolumeCreationTime.LowPart, 0);
|
||||
ok_eq_long(CompleteInfo.VolumeCreationTime.HighPart, 0);
|
||||
ok_eq_ulong(CompleteInfo.VolumeSerialNumber, 0);
|
||||
ok_bool_false(CompleteInfo.SupportsObjects, "CompleteInfo.SupportsObjects");
|
||||
ok_eq_ulong(CompleteInfo.VolumeLabelLength, 18);
|
||||
ok_eq_ulong(IoStatusBlock.Information, 36);
|
||||
ok_eq_ulong(RtlCompareMemory(CompleteInfo.VolumeLabel, L"NamedPipe", 18), 18);
|
||||
|
||||
Status = ZwQueryVolumeInformationFile(ServerHandle,
|
||||
&IoStatusBlock,
|
||||
&PartialInfo,
|
||||
sizeof(PartialInfo),
|
||||
FileFsVolumeInformation);
|
||||
ok_eq_hex(Status, STATUS_BUFFER_OVERFLOW);
|
||||
ok_eq_hex(IoStatusBlock.Status, STATUS_BUFFER_OVERFLOW);
|
||||
ok_eq_long(CompleteInfo.VolumeCreationTime.LowPart, 0);
|
||||
ok_eq_long(CompleteInfo.VolumeCreationTime.HighPart, 0);
|
||||
ok_eq_ulong(CompleteInfo.VolumeSerialNumber, 0);
|
||||
ok_bool_false(CompleteInfo.SupportsObjects, "CompleteInfo.SupportsObjects");
|
||||
ok_eq_ulong(CompleteInfo.VolumeLabelLength, 18);
|
||||
ok_eq_ulong(IoStatusBlock.Information, 32);
|
||||
ok_eq_ulong(RtlCompareMemory(CompleteInfo.VolumeLabel, L"Na", 4), 4);
|
||||
}
|
||||
|
||||
static KSTART_ROUTINE RunTest;
|
||||
static
|
||||
VOID
|
||||
NTAPI
|
||||
RunTest(
|
||||
IN PVOID Context)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
HANDLE ServerHandle;
|
||||
|
||||
UNREFERENCED_PARAMETER(Context);
|
||||
|
||||
ServerHandle = INVALID_HANDLE_VALUE;
|
||||
Status = NpCreatePipe(&ServerHandle,
|
||||
DEVICE_NAMED_PIPE L"\\KmtestNpfsVolumeInfoTestPipe",
|
||||
BYTE_STREAM, QUEUE, BYTE_STREAM, DUPLEX,
|
||||
MAX_INSTANCES,
|
||||
IN_QUOTA,
|
||||
OUT_QUOTA);
|
||||
ok_eq_hex(Status, STATUS_SUCCESS);
|
||||
ok(ServerHandle != NULL && ServerHandle != INVALID_HANDLE_VALUE, "ServerHandle = %p\n", ServerHandle);
|
||||
if (!skip(NT_SUCCESS(Status) && ServerHandle != NULL && ServerHandle != INVALID_HANDLE_VALUE, "No pipe\n"))
|
||||
{
|
||||
TestVolumeInfo(ServerHandle);
|
||||
ObCloseHandle(ServerHandle, KernelMode);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(NpfsVolumeInfo)
|
||||
{
|
||||
PKTHREAD Thread;
|
||||
|
||||
Thread = KmtStartThread(RunTest, NULL);
|
||||
KmtFinishThread(Thread, NULL);
|
||||
}
|
Loading…
Reference in a new issue