Commit 98977195 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

server: Allow 0-write length in WriteProcessMemory().

Adapt to Win >= 10 behavior. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56357Signed-off-by: 's avatarEric Pouech <epouech@codeweavers.com>
parent 2aee2990
...@@ -114,6 +114,14 @@ static void test_VirtualAllocEx(void) ...@@ -114,6 +114,14 @@ static void test_VirtualAllocEx(void)
ok(b && (bytes_read == alloc_size), "%Iu bytes read\n", bytes_read); ok(b && (bytes_read == alloc_size), "%Iu bytes read\n", bytes_read);
ok(!memcmp(src, dst, alloc_size), "Data from remote process differs\n"); ok(!memcmp(src, dst, alloc_size), "Data from remote process differs\n");
/* test 0 length */
bytes_written = 0xdeadbeef;
b = WriteProcessMemory(hProcess, addr1, src, 0, &bytes_written);
ok((b && !bytes_written) || broken(!b && GetLastError() == ERROR_INVALID_PARAMETER), "write failed: %lu\n", GetLastError());
bytes_read = 0xdeadbeef;
b = ReadProcessMemory(hProcess, addr1, src, 0, &bytes_read);
ok(b && !bytes_read, "read failed: %lu\n", GetLastError());
/* test invalid source buffers */ /* test invalid source buffers */
b = VirtualProtect( src + 0x2000, 0x2000, PAGE_NOACCESS, &old_prot ); b = VirtualProtect( src + 0x2000, 0x2000, PAGE_NOACCESS, &old_prot );
......
...@@ -1659,7 +1659,6 @@ DECL_HANDLER(write_process_memory) ...@@ -1659,7 +1659,6 @@ DECL_HANDLER(write_process_memory)
{ {
data_size_t len = get_req_data_size(); data_size_t len = get_req_data_size();
if (len) write_process_memory( process, req->addr, len, get_req_data() ); if (len) write_process_memory( process, req->addr, len, get_req_data() );
else set_error( STATUS_INVALID_PARAMETER );
release_object( process ); release_object( process );
} }
} }
......
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