https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a71f3a70d84d1079ca49cbc81622f1ddec97065a

commit a71f3a70d84d1079ca49cbc81622f1ddec97065a
Author:     Thomas Faber <[email protected]>
AuthorDate: Sat Feb 2 21:37:08 2019 +0100
Commit:     Thomas Faber <[email protected]>
CommitDate: Sat Feb 2 22:50:19 2019 +0100

    [NTDLL_APITEST] Add tests for zero and negative information class values. 
CORE-15651
---
 modules/rostests/apitests/ntdll/CMakeLists.txt     |  4 ++++
 .../apitests/ntdll/NtQueryInformationFile.c        | 23 ++++++++++++++++++++++
 .../apitests/ntdll/NtQuerySystemInformation.c      | 19 ++++++++++++++++++
 .../apitests/ntdll/NtQueryVolumeInformationFile.c  |  3 +++
 .../rostests/apitests/ntdll/NtSetInformationFile.c | 19 ++++++++++++++++++
 .../apitests/ntdll/NtSetVolumeInformationFile.c    | 19 ++++++++++++++++++
 modules/rostests/apitests/ntdll/testlist.c         |  8 ++++++++
 7 files changed, 95 insertions(+)

diff --git a/modules/rostests/apitests/ntdll/CMakeLists.txt 
b/modules/rostests/apitests/ntdll/CMakeLists.txt
index 768a522f4a..4860cd225a 100644
--- a/modules/rostests/apitests/ntdll/CMakeLists.txt
+++ b/modules/rostests/apitests/ntdll/CMakeLists.txt
@@ -23,13 +23,17 @@ list(APPEND SOURCE
     NtOpenProcessToken.c
     NtOpenThreadToken.c
     NtProtectVirtualMemory.c
+    NtQueryInformationFile.c
     NtQueryInformationProcess.c
     NtQueryKey.c
     NtQuerySystemEnvironmentValue.c
+    NtQuerySystemInformation.c
     NtQueryVolumeInformationFile.c
     NtReadFile.c
     NtSaveKey.c
+    NtSetInformationFile.c
     NtSetValueKey.c
+    NtSetVolumeInformationFile.c
     NtWriteFile.c
     RtlAllocateHeap.c
     RtlBitmap.c
diff --git a/modules/rostests/apitests/ntdll/NtQueryInformationFile.c 
b/modules/rostests/apitests/ntdll/NtQueryInformationFile.c
new file mode 100644
index 0000000000..74739bb390
--- /dev/null
+++ b/modules/rostests/apitests/ntdll/NtQueryInformationFile.c
@@ -0,0 +1,23 @@
+/*
+ * PROJECT:     ReactOS Kernel
+ * LICENSE:     LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
+ * PURPOSE:     Test for NtQueryInformationFile
+ * COPYRIGHT:   Copyright 2019 Thomas Faber ([email protected])
+ */
+
+#include "precomp.h"
+
+#define ntv6(x) (LOBYTE(LOWORD(GetVersion())) >= 6 ? (x) : 0)
+
+START_TEST(NtQueryInformationFile)
+{
+    NTSTATUS Status;
+
+    Status = NtQueryInformationFile(NULL, NULL, NULL, 0, 0);
+    ok(Status == STATUS_INVALID_INFO_CLASS ||
+       ntv6(Status == STATUS_NOT_IMPLEMENTED), "Status = %lx\n", Status);
+
+    Status = NtQueryInformationFile(NULL, NULL, NULL, 0, 0x80000000);
+    ok(Status == STATUS_INVALID_INFO_CLASS ||
+       ntv6(Status == STATUS_NOT_IMPLEMENTED), "Status = %lx\n", Status);
+}
diff --git a/modules/rostests/apitests/ntdll/NtQuerySystemInformation.c 
b/modules/rostests/apitests/ntdll/NtQuerySystemInformation.c
new file mode 100644
index 0000000000..0ecd91d668
--- /dev/null
+++ b/modules/rostests/apitests/ntdll/NtQuerySystemInformation.c
@@ -0,0 +1,19 @@
+/*
+ * PROJECT:     ReactOS Kernel
+ * LICENSE:     LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
+ * PURPOSE:     Test for NtQuerySystemInformation
+ * COPYRIGHT:   Copyright 2019 Thomas Faber ([email protected])
+ */
+
+#include "precomp.h"
+
+START_TEST(NtQuerySystemInformation)
+{
+    NTSTATUS Status;
+
+    Status = NtQuerySystemInformation(0, NULL, 0, NULL);
+    ok_hex(Status, STATUS_INFO_LENGTH_MISMATCH);
+    
+    Status = NtQuerySystemInformation(0x80000000, NULL, 0, NULL);
+    ok_hex(Status, STATUS_INVALID_INFO_CLASS);
+}
diff --git a/modules/rostests/apitests/ntdll/NtQueryVolumeInformationFile.c 
b/modules/rostests/apitests/ntdll/NtQueryVolumeInformationFile.c
index b361d26681..c6fb6eb260 100644
--- a/modules/rostests/apitests/ntdll/NtQueryVolumeInformationFile.c
+++ b/modules/rostests/apitests/ntdll/NtQueryVolumeInformationFile.c
@@ -278,6 +278,9 @@ START_TEST(NtQueryVolumeInformationFile)
     ok(status == STATUS_INVALID_INFO_CLASS, "Expected 
STATUS_INVALID_INFO_CLASS, got 0x%lx\n", status);
     ok(GetLastError() == 0xcacacaca, "Expected 0xcacacaca, got %lx\n", 
GetLastError());
 
+    status = NtQueryVolumeInformationFile(NULL, NULL, NULL, 0, 0x80000000);
+    ok(status == STATUS_INVALID_INFO_CLASS, "Expected 
STATUS_INVALID_INFO_CLASS, got 0x%lx\n", status);
+
     TestFileFsDeviceInformation(handle);
     TestFileFsVolumeInformation(handle);
     TestFileFsAttributeInformation(handle);
diff --git a/modules/rostests/apitests/ntdll/NtSetInformationFile.c 
b/modules/rostests/apitests/ntdll/NtSetInformationFile.c
new file mode 100644
index 0000000000..27afa45b4d
--- /dev/null
+++ b/modules/rostests/apitests/ntdll/NtSetInformationFile.c
@@ -0,0 +1,19 @@
+/*
+ * PROJECT:     ReactOS Kernel
+ * LICENSE:     LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
+ * PURPOSE:     Test for NtSetInformationFile
+ * COPYRIGHT:   Copyright 2019 Thomas Faber ([email protected])
+ */
+
+#include "precomp.h"
+
+START_TEST(NtSetInformationFile)
+{
+    NTSTATUS Status;
+
+    Status = NtSetInformationFile(NULL, NULL, NULL, 0, 0);
+    ok(Status == STATUS_INVALID_INFO_CLASS, "Status = %lx\n", Status);
+
+    Status = NtSetInformationFile(NULL, NULL, NULL, 0, 0x80000000);
+    ok(Status == STATUS_INVALID_INFO_CLASS, "Status = %lx\n", Status);
+}
diff --git a/modules/rostests/apitests/ntdll/NtSetVolumeInformationFile.c 
b/modules/rostests/apitests/ntdll/NtSetVolumeInformationFile.c
new file mode 100644
index 0000000000..7d75367067
--- /dev/null
+++ b/modules/rostests/apitests/ntdll/NtSetVolumeInformationFile.c
@@ -0,0 +1,19 @@
+/*
+ * PROJECT:     ReactOS Kernel
+ * LICENSE:     LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
+ * PURPOSE:     Test for NtSetVolumeInformationFile
+ * COPYRIGHT:   Copyright 2019 Thomas Faber ([email protected])
+ */
+
+#include "precomp.h"
+
+START_TEST(NtSetVolumeInformationFile)
+{
+    NTSTATUS Status;
+
+    Status = NtSetVolumeInformationFile(NULL, NULL, NULL, 0, 0);
+    ok(Status == STATUS_INVALID_INFO_CLASS, "Status = %lx\n", Status);
+
+    Status = NtSetVolumeInformationFile(NULL, NULL, NULL, 0, 0x80000000);
+    ok(Status == STATUS_INVALID_INFO_CLASS, "Status = %lx\n", Status);
+}
diff --git a/modules/rostests/apitests/ntdll/testlist.c 
b/modules/rostests/apitests/ntdll/testlist.c
index cd96ef8142..e627634de8 100644
--- a/modules/rostests/apitests/ntdll/testlist.c
+++ b/modules/rostests/apitests/ntdll/testlist.c
@@ -21,13 +21,17 @@ extern void func_NtOpenKey(void);
 extern void func_NtOpenProcessToken(void);
 extern void func_NtOpenThreadToken(void);
 extern void func_NtProtectVirtualMemory(void);
+extern void func_NtQueryInformationFile(void);
 extern void func_NtQueryInformationProcess(void);
 extern void func_NtQueryKey(void);
 extern void func_NtQuerySystemEnvironmentValue(void);
+extern void func_NtQuerySystemInformation(void);
 extern void func_NtQueryVolumeInformationFile(void);
 extern void func_NtReadFile(void);
 extern void func_NtSaveKey(void);
+extern void func_NtSetInformationFile(void);
 extern void func_NtSetValueKey(void);
+extern void func_NtSetVolumeInformationFile(void);
 extern void func_NtSystemInformation(void);
 extern void func_NtWriteFile(void);
 extern void func_RtlAllocateHeap(void);
@@ -81,13 +85,17 @@ const struct test winetest_testlist[] =
     { "NtOpenProcessToken",             func_NtOpenProcessToken },
     { "NtOpenThreadToken",              func_NtOpenThreadToken },
     { "NtProtectVirtualMemory",         func_NtProtectVirtualMemory },
+    { "NtQueryInformationFile",         func_NtQueryInformationFile },
     { "NtQueryInformationProcess",      func_NtQueryInformationProcess },
     { "NtQueryKey",                     func_NtQueryKey },
     { "NtQuerySystemEnvironmentValue",  func_NtQuerySystemEnvironmentValue },
+    { "NtQuerySystemInformation",       func_NtQuerySystemInformation },
     { "NtQueryVolumeInformationFile",   func_NtQueryVolumeInformationFile },
     { "NtReadFile",                     func_NtReadFile },
     { "NtSaveKey",                      func_NtSaveKey},
+    { "NtSetInformationFile",           func_NtSetInformationFile },
     { "NtSetValueKey",                  func_NtSetValueKey},
+    { "NtSetVolumeInformationFile",     func_NtSetVolumeInformationFile },
     { "NtSystemInformation",            func_NtSystemInformation },
     { "NtWriteFile",                    func_NtWriteFile },
     { "RtlAllocateHeap",                func_RtlAllocateHeap },

Reply via email to