[NTDLL_APITEST] Add tests for zero and negative information class values. CORE-15651

This commit is contained in:
Thomas Faber 2019-02-02 21:37:08 +01:00
parent 63977328b1
commit a71f3a70d8
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
7 changed files with 95 additions and 0 deletions

View file

@ -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

View file

@ -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 (thomas.faber@reactos.org)
*/
#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);
}

View file

@ -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 (thomas.faber@reactos.org)
*/
#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);
}

View file

@ -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);

View file

@ -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 (thomas.faber@reactos.org)
*/
#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);
}

View file

@ -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 (thomas.faber@reactos.org)
*/
#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);
}

View file

@ -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 },