Rebase against a455ff61b40ff73b48d0ccc9c1f14679bb65ab8d.

This commit is contained in:
Zebediah Figura
2020-07-20 19:55:28 -05:00
parent 26d3815d8c
commit 4373a1011e
16 changed files with 278 additions and 368 deletions

View File

@@ -1,18 +1,18 @@
From a100b0b789c767230ef98eb2201e5ae5a272e907 Mon Sep 17 00:00:00 2001
From 8ea8ef48ce50b357f04664c70c3c86ea40c654ec Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Sun, 28 May 2017 10:30:43 +0200
Subject: [PATCH] ntdll/tests: Add tests for
NtQueryVirtualMemory(MemorySectionName).
---
dlls/ntdll/tests/info.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
dlls/ntdll/tests/info.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index 7a641f8b84e..e335e758175 100644
index e5137ef5a45..e06a229e6cd 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -2182,6 +2182,8 @@ static void test_queryvirtualmemory(void)
@@ -2092,6 +2092,8 @@ static void test_queryvirtualmemory(void)
char stackbuf[42];
HMODULE module;
void *user_shared_data = (void *)0x7ffe0000;
@@ -20,13 +20,12 @@ index 7a641f8b84e..e335e758175 100644
+ MEMORY_SECTION_NAME *msn = (MEMORY_SECTION_NAME *)buffer_name;
module = GetModuleHandleA( "ntdll.dll" );
trace("Check flags of the PE header of NTDLL.DLL at %p\n", module);
@@ -2274,6 +2276,39 @@ static void test_queryvirtualmemory(void)
status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
@@ -2174,6 +2176,34 @@ static void test_queryvirtualmemory(void)
/* check error code when len is less than MEMORY_BASIC_INFORMATION size */
status = pNtQueryVirtualMemory(NtCurrentProcess(), GetProcessHeap(), MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION) - 1, &readcount);
ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
+
+ trace("Check section name of NTDLL.DLL with invalid size\n");
+ module = GetModuleHandleA( "ntdll.dll" );
+ memset(msn, 0, sizeof(*msn));
+ readcount = 0;
@@ -34,7 +33,6 @@ index 7a641f8b84e..e335e758175 100644
+ ok( status == STATUS_BUFFER_OVERFLOW, "Expected STATUS_BUFFER_OVERFLOW, got %08x\n", status);
+ ok( readcount > 0, "Expected readcount to be > 0\n");
+
+ trace("Check section name of NTDLL.DLL with invalid size\n");
+ module = GetModuleHandleA( "ntdll.dll" );
+ memset(msn, 0, sizeof(*msn));
+ readcount = 0;
@@ -42,7 +40,6 @@ index 7a641f8b84e..e335e758175 100644
+ ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
+ ok( readcount > 0, "Expected readcount to be > 0\n");
+
+ trace("Check section name of NTDLL.DLL\n");
+ module = GetModuleHandleA( "ntdll.dll" );
+ memset(msn, 0x55, sizeof(*msn));
+ memset(buffer_name, 0x77, sizeof(buffer_name));
@@ -50,9 +47,7 @@ index 7a641f8b84e..e335e758175 100644
+ status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemorySectionName, msn, sizeof(buffer_name), &readcount);
+ ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
+ ok( readcount > 0, "Expected readcount to be > 0\n");
+ trace ("Section Name: %s\n", wine_dbgstr_w(msn->SectionFileName.Buffer));
+
+ trace("Check section name of non mapped memory\n");
+ memset(msn, 0, sizeof(*msn));
+ readcount = 0;
+ status = pNtQueryVirtualMemory(NtCurrentProcess(), &buffer_name, MemorySectionName, msn, sizeof(buffer_name), &readcount);
@@ -62,5 +57,5 @@ index 7a641f8b84e..e335e758175 100644
static void test_affinity(void)
--
2.26.2
2.27.0

View File

@@ -1,4 +1,4 @@
From 951b3002db9c9277a01d965da4d0996a328ec9db Mon Sep 17 00:00:00 2001
From 451efee77500173d36ddd16f39cf3ee2df498a93 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 28 May 2017 10:33:40 +0200
Subject: [PATCH] ntdll/tests: Add test to ensure section name is full path.
@@ -8,7 +8,7 @@ Subject: [PATCH] ntdll/tests: Add test to ensure section name is full path.
1 file changed, 9 insertions(+)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index 766ca086c76..c953740d050 100644
index e06a229e6cd..02538e6f49a 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -22,6 +22,7 @@
@@ -19,15 +19,15 @@ index 766ca086c76..c953740d050 100644
static NTSTATUS (WINAPI * pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
static NTSTATUS (WINAPI * pNtSetSystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG);
static NTSTATUS (WINAPI * pRtlGetNativeSystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
@@ -76,6 +77,7 @@ static BOOL InitFunctionPtrs(void)
return FALSE;
}
@@ -70,6 +71,7 @@ static BOOL InitFunctionPtrs(void)
HMODULE hntdll = GetModuleHandleA("ntdll");
HMODULE hkernel32 = GetModuleHandleA("kernel32");
+ NTDLL_GET_PROC(RtlDowncaseUnicodeString);
NTDLL_GET_PROC(NtQuerySystemInformation);
NTDLL_GET_PROC(NtSetSystemInformation);
NTDLL_GET_PROC(RtlGetNativeSystemInformation);
@@ -2211,6 +2213,7 @@ static void test_queryvirtualmemory(void)
@@ -2085,6 +2087,7 @@ static void test_queryvirtualmemory(void)
{
NTSTATUS status;
SIZE_T readcount;
@@ -35,7 +35,7 @@ index 766ca086c76..c953740d050 100644
static const char teststring[] = "test string";
static char datatestbuf[42] = "abc";
static char rwtestbuf[42];
@@ -2220,6 +2223,8 @@ static void test_queryvirtualmemory(void)
@@ -2094,6 +2097,8 @@ static void test_queryvirtualmemory(void)
void *user_shared_data = (void *)0x7ffe0000;
char buffer_name[sizeof(MEMORY_SECTION_NAME) + MAX_PATH * sizeof(WCHAR)];
MEMORY_SECTION_NAME *msn = (MEMORY_SECTION_NAME *)buffer_name;
@@ -43,18 +43,18 @@ index 766ca086c76..c953740d050 100644
+ int i;
module = GetModuleHandleA( "ntdll.dll" );
trace("Check flags of the PE header of NTDLL.DLL at %p\n", module);
@@ -2337,6 +2342,10 @@ static void test_queryvirtualmemory(void)
status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
@@ -2198,6 +2203,10 @@ static void test_queryvirtualmemory(void)
status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemorySectionName, msn, sizeof(buffer_name), &readcount);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
ok( readcount > 0, "Expected readcount to be > 0\n");
trace ("Section Name: %s\n", wine_dbgstr_w(msn->SectionFileName.Buffer));
+ pRtlDowncaseUnicodeString( &msn->SectionFileName, &msn->SectionFileName, FALSE );
+ for (found = FALSE, i = (msn->SectionFileName.Length - sizeof(windowsW)) / sizeof(WCHAR); i >= 0; i--)
+ found |= !memcmp( &msn->SectionFileName.Buffer[i], windowsW, sizeof(windowsW) );
+ ok( found, "Section name does not contain \"Windows\"\n");
trace("Check section name of non mapped memory\n");
memset(msn, 0, sizeof(*msn));
readcount = 0;
--
2.26.2
2.27.0