2022-03-11 16:27:46 -08:00
|
|
|
From 8671f494a85acab0f8620bb4462d641f6fd97111 Mon Sep 17 00:00:00 2001
|
2020-04-28 04:07:19 -07:00
|
|
|
From: Andrew Wesie <awesie@gmail.com>
|
|
|
|
Date: Mon, 27 Apr 2020 15:32:22 +0300
|
|
|
|
Subject: [PATCH] kernel32/tests, psapi/tests: Update tests.
|
|
|
|
|
|
|
|
---
|
2022-03-11 16:27:46 -08:00
|
|
|
dlls/kernel32/tests/virtual.c | 25 +++++--------------------
|
2020-07-23 16:56:26 -07:00
|
|
|
dlls/psapi/tests/psapi_main.c | 5 +++++
|
2022-03-11 16:27:46 -08:00
|
|
|
2 files changed, 10 insertions(+), 20 deletions(-)
|
2020-04-28 04:07:19 -07:00
|
|
|
|
|
|
|
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
|
2022-03-11 16:27:46 -08:00
|
|
|
index 365194b9065..6c5d6991737 100644
|
2020-04-28 04:07:19 -07:00
|
|
|
--- a/dlls/kernel32/tests/virtual.c
|
|
|
|
+++ b/dlls/kernel32/tests/virtual.c
|
2022-03-03 16:02:37 -08:00
|
|
|
@@ -3604,9 +3604,7 @@ static void test_CreateFileMapping_protection(void)
|
2020-04-28 04:07:19 -07:00
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
ret = VirtualQuery(base, &info, sizeof(info));
|
2022-03-11 16:27:46 -08:00
|
|
|
ok(ret, "VirtualQuery failed %ld\n", GetLastError());
|
2020-04-28 04:07:19 -07:00
|
|
|
- /* FIXME: remove the condition below once Wine is fixed */
|
|
|
|
- todo_wine_if (td[i].prot == PAGE_WRITECOPY || td[i].prot == PAGE_EXECUTE_WRITECOPY)
|
2022-03-11 16:27:46 -08:00
|
|
|
- ok(info.Protect == td[i].prot_after_write, "%ld: got %#lx != expected %#lx\n", i, info.Protect, td[i].prot_after_write);
|
|
|
|
+ ok(info.Protect == td[i].prot_after_write, "%ld: got %#lx != expected %#lx\n", i, info.Protect, td[i].prot_after_write);
|
2020-04-28 04:07:19 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2022-03-03 16:02:37 -08:00
|
|
|
@@ -3620,9 +3618,7 @@ static void test_CreateFileMapping_protection(void)
|
2020-04-28 04:07:19 -07:00
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
ret = VirtualProtect(base, si.dwPageSize, PAGE_NOACCESS, &old_prot);
|
2022-03-11 16:27:46 -08:00
|
|
|
ok(ret, "%ld: VirtualProtect error %ld\n", i, GetLastError());
|
2020-04-28 04:07:19 -07:00
|
|
|
- /* FIXME: remove the condition below once Wine is fixed */
|
|
|
|
- todo_wine_if (td[i].prot == PAGE_WRITECOPY || td[i].prot == PAGE_EXECUTE_WRITECOPY)
|
2022-03-11 16:27:46 -08:00
|
|
|
- ok(old_prot == td[i].prot_after_write, "%ld: got %#lx != expected %#lx\n", i, old_prot, td[i].prot_after_write);
|
|
|
|
+ ok(old_prot == td[i].prot_after_write, "%ld: got %#lx != expected %#lx\n", i, old_prot, td[i].prot_after_write);
|
2020-04-28 04:07:19 -07:00
|
|
|
|
|
|
|
UnmapViewOfFile(base);
|
|
|
|
}
|
2022-03-03 16:02:37 -08:00
|
|
|
@@ -3975,15 +3971,12 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
|
2020-04-28 04:07:19 -07:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
- todo_wine_if(readonly && page_prot[k] == PAGE_WRITECOPY && view[j].prot != PAGE_WRITECOPY)
|
2022-03-11 16:27:46 -08:00
|
|
|
ok(ret, "VirtualProtect error %ld, map %#lx, view %#lx, requested prot %#lx\n", GetLastError(), page_prot[i], view[j].prot, page_prot[k]);
|
2020-04-28 04:07:19 -07:00
|
|
|
- todo_wine_if(readonly && page_prot[k] == PAGE_WRITECOPY && view[j].prot != PAGE_WRITECOPY)
|
2022-03-11 16:27:46 -08:00
|
|
|
ok(old_prot == prev_prot, "got %#lx, expected %#lx\n", old_prot, prev_prot);
|
2020-04-28 04:07:19 -07:00
|
|
|
prev_prot = actual_prot;
|
|
|
|
|
|
|
|
ret = VirtualQuery(base, &info, sizeof(info));
|
2022-03-11 16:27:46 -08:00
|
|
|
- ok(ret, "%ld: VirtualQuery failed %ld\n", j, GetLastError());
|
2020-04-28 04:07:19 -07:00
|
|
|
- todo_wine_if(readonly && page_prot[k] == PAGE_WRITECOPY && view[j].prot != PAGE_WRITECOPY)
|
2022-03-11 16:27:46 -08:00
|
|
|
+ ok(ret, "%d: VirtualQuery failed %ld\n", j, GetLastError());
|
2020-04-28 04:07:19 -07:00
|
|
|
ok(info.Protect == actual_prot,
|
2022-03-11 16:27:46 -08:00
|
|
|
"VirtualProtect wrong prot, map %#lx, view %#lx, requested prot %#lx got %#lx\n",
|
2020-04-28 04:07:19 -07:00
|
|
|
page_prot[i], view[j].prot, page_prot[k], info.Protect );
|
2022-03-03 16:02:37 -08:00
|
|
|
@@ -4038,15 +4031,12 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
|
2020-04-28 04:07:19 -07:00
|
|
|
if (!anon_mapping && is_compatible_protection(alloc_prot, PAGE_WRITECOPY))
|
|
|
|
{
|
|
|
|
ret = VirtualProtect(base, sec_flags & SEC_IMAGE ? si.dwPageSize : 2*si.dwPageSize, PAGE_WRITECOPY, &old_prot);
|
|
|
|
- todo_wine_if(readonly && view[j].prot != PAGE_WRITECOPY)
|
2022-03-11 16:27:46 -08:00
|
|
|
ok(ret, "VirtualProtect error %ld, map %#lx, view %#lx\n", GetLastError(), page_prot[i], view[j].prot);
|
2020-04-28 04:07:19 -07:00
|
|
|
if (ret) *(DWORD*)base = 0xdeadbeef;
|
|
|
|
ret = VirtualQuery(base, &info, sizeof(info));
|
2022-03-11 16:27:46 -08:00
|
|
|
- ok(ret, "%ld: VirtualQuery failed %ld\n", j, GetLastError());
|
2020-04-28 04:07:19 -07:00
|
|
|
- todo_wine
|
2022-03-11 16:27:46 -08:00
|
|
|
+ ok(ret, "%d: VirtualQuery failed %ld\n", j, GetLastError());
|
|
|
|
ok(info.Protect == PAGE_READWRITE, "VirtualProtect wrong prot, map %#lx, view %#lx got %#lx\n",
|
2020-04-28 04:07:19 -07:00
|
|
|
page_prot[i], view[j].prot, info.Protect );
|
|
|
|
- todo_wine_if (!(sec_flags & SEC_IMAGE))
|
2022-03-11 16:27:46 -08:00
|
|
|
ok(info.RegionSize == si.dwPageSize, "wrong region size %#Ix after write, map %#lx, view %#lx got %#lx\n",
|
2020-04-28 04:07:19 -07:00
|
|
|
info.RegionSize, page_prot[i], view[j].prot, info.Protect );
|
|
|
|
|
2022-03-03 16:02:37 -08:00
|
|
|
@@ -4057,7 +4047,6 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
|
2020-04-28 04:07:19 -07:00
|
|
|
{
|
|
|
|
ret = VirtualQuery((char*)base + si.dwPageSize, &info, sizeof(info));
|
2022-03-11 16:27:46 -08:00
|
|
|
ok(ret, "%ld: VirtualQuery failed %ld\n", j, GetLastError());
|
2020-04-28 04:07:19 -07:00
|
|
|
- todo_wine_if(readonly && view[j].prot != PAGE_WRITECOPY)
|
2022-03-11 16:27:46 -08:00
|
|
|
ok(info.Protect == PAGE_WRITECOPY, "wrong prot, map %#lx, view %#lx got %#lx\n",
|
2020-04-28 04:07:19 -07:00
|
|
|
page_prot[i], view[j].prot, info.Protect);
|
|
|
|
}
|
2022-03-03 16:02:37 -08:00
|
|
|
@@ -4077,14 +4066,11 @@ static void test_mapping( HANDLE hfile, DWORD sec_flags, BOOL readonly )
|
2020-04-28 04:07:19 -07:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
- todo_wine_if(readonly && page_prot[k] == PAGE_WRITECOPY && view[j].prot != PAGE_WRITECOPY)
|
2022-03-11 16:27:46 -08:00
|
|
|
ok(ret, "VirtualProtect error %ld, map %#lx, view %#lx, requested prot %#lx\n", GetLastError(), page_prot[i], view[j].prot, page_prot[k]);
|
2020-04-28 04:07:19 -07:00
|
|
|
- todo_wine_if(readonly && page_prot[k] == PAGE_WRITECOPY && view[j].prot != PAGE_WRITECOPY)
|
2022-03-11 16:27:46 -08:00
|
|
|
ok(old_prot == prev_prot, "got %#lx, expected %#lx\n", old_prot, prev_prot);
|
2020-04-28 04:07:19 -07:00
|
|
|
|
|
|
|
ret = VirtualQuery(base, &info, sizeof(info));
|
2022-03-11 16:27:46 -08:00
|
|
|
- ok(ret, "%ld: VirtualQuery failed %ld\n", j, GetLastError());
|
2020-04-28 04:07:19 -07:00
|
|
|
- todo_wine_if( map_prot_written( page_prot[k] ) != actual_prot )
|
2022-03-11 16:27:46 -08:00
|
|
|
+ ok(ret, "%d: VirtualQuery failed %ld\n", j, GetLastError());
|
2020-04-28 04:07:19 -07:00
|
|
|
ok(info.Protect == map_prot_written( page_prot[k] ),
|
2022-03-11 16:27:46 -08:00
|
|
|
"VirtualProtect wrong prot, map %#lx, view %#lx, requested prot %#lx got %#lx\n",
|
2020-04-28 04:07:19 -07:00
|
|
|
page_prot[i], view[j].prot, page_prot[k], info.Protect );
|
2022-03-03 16:02:37 -08:00
|
|
|
@@ -4125,7 +4111,6 @@ static void test_mappings(void)
|
2020-04-28 04:07:19 -07:00
|
|
|
SetFilePointer(hfile, 0, NULL, FILE_BEGIN);
|
|
|
|
ok(ReadFile(hfile, &data, sizeof(data), &num_bytes, NULL), "ReadFile failed\n");
|
2022-03-11 16:27:46 -08:00
|
|
|
ok(num_bytes == sizeof(data), "num_bytes = %ld\n", num_bytes);
|
2020-04-28 04:07:19 -07:00
|
|
|
- todo_wine
|
2022-03-11 16:27:46 -08:00
|
|
|
ok(!data, "data = %lx\n", data);
|
2020-04-28 04:07:19 -07:00
|
|
|
|
|
|
|
CloseHandle( hfile );
|
|
|
|
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
|
2022-03-03 16:02:37 -08:00
|
|
|
index 185a4062092..519e39c3df0 100644
|
2020-04-28 04:07:19 -07:00
|
|
|
--- a/dlls/psapi/tests/psapi_main.c
|
|
|
|
+++ b/dlls/psapi/tests/psapi_main.c
|
2022-03-03 16:02:37 -08:00
|
|
|
@@ -803,6 +803,8 @@ static void test_QueryWorkingSetEx(void)
|
2020-04-28 04:07:19 -07:00
|
|
|
DWORD prot;
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
+ static char tmp_data[0x2000] = { 0x41 };
|
|
|
|
+
|
|
|
|
if (pQueryWorkingSetEx == NULL)
|
|
|
|
{
|
|
|
|
win_skip("QueryWorkingSetEx not found, skipping tests\n");
|
2022-03-03 16:02:37 -08:00
|
|
|
@@ -821,6 +823,9 @@ static void test_QueryWorkingSetEx(void)
|
2020-07-23 16:56:26 -07:00
|
|
|
check_QueryWorkingSetEx(addr, "exe,readonly1", 0, 0, 1, TRUE);
|
2020-04-28 04:07:19 -07:00
|
|
|
|
|
|
|
*(volatile char *)addr;
|
|
|
|
+ check_QueryWorkingSetEx(addr, "exe,readonly2", 1, PAGE_READONLY, 1, FALSE);
|
|
|
|
+
|
|
|
|
+ ret = VirtualProtect(addr, 0x1000, PAGE_EXECUTE_READWRITE, &prot);
|
2022-03-03 16:02:37 -08:00
|
|
|
ok(ret, "VirtualProtect failed with %ld\n", GetLastError());
|
2020-07-23 16:56:26 -07:00
|
|
|
check_QueryWorkingSetEx(addr, "exe,readonly2", 1, PAGE_READONLY, 1, FALSE);
|
2020-04-28 04:07:19 -07:00
|
|
|
|
|
|
|
--
|
2022-03-11 16:27:46 -08:00
|
|
|
2.35.1
|
2020-04-28 04:07:19 -07:00
|
|
|
|