Author: pschweitzer
Date: Sat Apr 12 12:06:47 2014
New Revision: 62717
URL:
http://svn.reactos.org/svn/reactos?rev=62717&view=rev
Log:
[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
Added:
trunk/rostests/kmtests/npfs/NpfsVolumeInfo.c (with props)
Modified:
trunk/rostests/kmtests/CMakeLists.txt
trunk/rostests/kmtests/kmtest_drv/testlist.c
Modified: trunk/rostests/kmtests/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/CMakeLists.txt?re…
==============================================================================
--- trunk/rostests/kmtests/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/kmtests/CMakeLists.txt [iso-8859-1] Sat Apr 12 12:06:47 2014
@@ -32,6 +32,7 @@
npfs/NpfsCreate.c
npfs/NpfsHelpers.c
npfs/NpfsReadWrite.c
+ npfs/NpfsVolumeInfo.c
ntos_ex/ExCallback.c
ntos_ex/ExDoubleList.c
ntos_ex/ExFastMutex.c
Modified: trunk/rostests/kmtests/kmtest_drv/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/testli…
==============================================================================
--- trunk/rostests/kmtests/kmtest_drv/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/kmtest_drv/testlist.c [iso-8859-1] Sat Apr 12 12:06:47 2014
@@ -41,6 +41,7 @@
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 @@
{ "NpfsConnect", Test_NpfsConnect },
{ "NpfsCreate", Test_NpfsCreate },
{ "NpfsReadWrite", Test_NpfsReadWrite },
+ { "NpfsVolumeInfo", Test_NpfsVolumeInfo },
{ "ObReference", Test_ObReference },
{ "ObType", Test_ObType },
{ "-ObTypeClean", Test_ObTypeClean },
Added: trunk/rostests/kmtests/npfs/NpfsVolumeInfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/npfs/NpfsVolumeIn…
==============================================================================
--- trunk/rostests/kmtests/npfs/NpfsVolumeInfo.c (added)
+++ trunk/rostests/kmtests/npfs/NpfsVolumeInfo.c [iso-8859-1] Sat Apr 12 12:06:47 2014
@@ -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(a)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);
+}
Propchange: trunk/rostests/kmtests/npfs/NpfsVolumeInfo.c
------------------------------------------------------------------------------
svn:eol-style = native