[2/2] ntdll: Make the VirtualProtect test pass under Wine.
Dmitry Timoshkov
dmitry at baikal.ru
Sun Sep 25 23:17:24 CDT 2011
If this patch is not considered a proper fix it shouldn't prevent
a test case from being accepted.
---
dlls/kernel32/tests/virtual.c | 14 --------------
dlls/ntdll/virtual.c | 3 +++
2 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 51a689c..7dcf286 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -1444,16 +1444,8 @@ static void test_VirtualProtect(void)
}
else
{
- /* FIXME: remove the condition below once Wine is fixed */
- if (td[i].prot_set == PAGE_WRITECOPY || td[i].prot_set == PAGE_EXECUTE_WRITECOPY)
- todo_wine {
ok(!ret, "%d: VirtualProtect should fail\n", i);
ok(GetLastError() == ERROR_INVALID_PARAMETER, "%d: expected ERROR_INVALID_PARAMETER, got %d\n", i, GetLastError());
- }
- else {
- ok(!ret, "%d: VirtualProtect should fail\n", i);
- ok(GetLastError() == ERROR_INVALID_PARAMETER, "%d: expected ERROR_INVALID_PARAMETER, got %d\n", i, GetLastError());
- }
}
old_prot = 0xdeadbeef;
@@ -1463,13 +1455,7 @@ static void test_VirtualProtect(void)
if (td[i].prot_get)
ok(old_prot == td[i].prot_get, "%d: got %#x != expected %#x\n", i, old_prot, td[i].prot_get);
else
- {
- /* FIXME: remove the condition below once Wine is fixed */
- if (td[i].prot_set == PAGE_WRITECOPY || td[i].prot_set == PAGE_EXECUTE_WRITECOPY)
- todo_wine ok(old_prot == PAGE_NOACCESS, "%d: got %#x != expected PAGE_NOACCESS\n", i, old_prot);
- else
ok(old_prot == PAGE_NOACCESS, "%d: got %#x != expected PAGE_NOACCESS\n", i, old_prot);
- }
}
VirtualFree(base, 0, MEM_FREE);
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 10fba17..8673a22 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -2056,6 +2056,9 @@ NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T
TRACE("%p %p %08lx %08x\n", process, addr, size, new_prot );
+ if (new_prot == PAGE_WRITECOPY || new_prot == PAGE_EXECUTE_WRITECOPY)
+ return STATUS_INVALID_PAGE_PROTECTION;
+
if (process != NtCurrentProcess())
{
apc_call_t call;
--
1.7.5.1
More information about the wine-patches
mailing list