Commit 33255ee6 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

ntdll: Make the VirtualProtect tests pass under Wine.

parent df9a0868
...@@ -1472,16 +1472,8 @@ static void test_VirtualProtect(void) ...@@ -1472,16 +1472,8 @@ static void test_VirtualProtect(void)
} }
else 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(!ret, "%d: VirtualProtect should fail\n", i);
ok(GetLastError() == ERROR_INVALID_PARAMETER, "%d: expected ERROR_INVALID_PARAMETER, got %d\n", i, GetLastError()); 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; old_prot = 0xdeadbeef;
...@@ -1491,13 +1483,7 @@ static void test_VirtualProtect(void) ...@@ -1491,13 +1483,7 @@ static void test_VirtualProtect(void)
if (td[i].prot_get) 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); ok(old_prot == td[i].prot_get, "%d: got %#x != expected %#x\n", i, old_prot, td[i].prot_get);
else 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); ok(old_prot == PAGE_NOACCESS, "%d: got %#x != expected PAGE_NOACCESS\n", i, old_prot);
}
} }
exec_prot = 0; exec_prot = 0;
...@@ -1521,10 +1507,8 @@ static void test_VirtualProtect(void) ...@@ -1521,10 +1507,8 @@ static void test_VirtualProtect(void)
{ {
if (prot & (PAGE_WRITECOPY | PAGE_EXECUTE_WRITECOPY)) if (prot & (PAGE_WRITECOPY | PAGE_EXECUTE_WRITECOPY))
{ {
todo_wine {
ok(!ret, "VirtualProtect(%02x) should fail\n", prot); ok(!ret, "VirtualProtect(%02x) should fail\n", prot);
ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
}
} }
else else
ok(ret, "VirtualProtect(%02x) error %d\n", prot, GetLastError()); ok(ret, "VirtualProtect(%02x) error %d\n", prot, GetLastError());
......
...@@ -2088,6 +2088,7 @@ NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T ...@@ -2088,6 +2088,7 @@ NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T
size = ROUND_SIZE( addr, size ); size = ROUND_SIZE( addr, size );
base = ROUND_ADDR( addr, page_mask ); base = ROUND_ADDR( addr, page_mask );
if ((status = get_vprot_flags( new_prot, &new_vprot ))) return status; if ((status = get_vprot_flags( new_prot, &new_vprot ))) return status;
if (new_vprot & VPROT_WRITECOPY) return STATUS_INVALID_PAGE_PROTECTION;
new_vprot |= VPROT_COMMITTED; new_vprot |= VPROT_COMMITTED;
server_enter_uninterrupted_section( &csVirtual, &sigset ); server_enter_uninterrupted_section( &csVirtual, &sigset );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment