Commit ee6a477c authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

ntdll: Return failure in NtProtectVirtualMemory when last argument is omitted.

parent 38775875
......@@ -2492,27 +2492,22 @@ static void test_VirtualProtect(void)
SetLastError(0xdeadbeef);
ret = VirtualProtect(base, si.dwPageSize, PAGE_READONLY, NULL);
todo_wine
ok(!ret, "VirtualProtect should fail\n");
todo_wine
ok(GetLastError() == ERROR_NOACCESS, "expected ERROR_NOACCESS, got %d\n", GetLastError());
old_prot = 0xdeadbeef;
ret = VirtualProtect(base, si.dwPageSize, PAGE_NOACCESS, &old_prot);
ok(ret, "VirtualProtect failed %d\n", GetLastError());
todo_wine
ok(old_prot == PAGE_NOACCESS, "got %#x != expected PAGE_NOACCESS\n", old_prot);
addr = base;
size = si.dwPageSize;
status = pNtProtectVirtualMemory(GetCurrentProcess(), &addr, &size, PAGE_READONLY, NULL);
todo_wine
ok(status == STATUS_ACCESS_VIOLATION, "NtProtectVirtualMemory should fail, got %08x\n", status);
addr = base;
size = si.dwPageSize;
old_prot = 0xdeadbeef;
status = pNtProtectVirtualMemory(GetCurrentProcess(), &addr, &size, PAGE_NOACCESS, &old_prot);
ok(status == STATUS_SUCCESS, "NtProtectVirtualMemory should succeed, got %08x\n", status);
todo_wine
ok(old_prot == PAGE_NOACCESS, "got %#x != expected PAGE_NOACCESS\n", old_prot);
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
......
......@@ -2164,6 +2164,9 @@ NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T
TRACE("%p %p %08lx %08x\n", process, addr, size, new_prot );
if (!old_prot)
return STATUS_ACCESS_VIOLATION;
if (process != NtCurrentProcess())
{
apc_call_t call;
......
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