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

Adapt to Win >= 10 behavior.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56357
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
Eric Pouech 2024-02-26 12:12:50 +01:00 committed by Alexandre Julliard
parent 2aee2990c0
commit 9897719562
2 changed files with 8 additions and 1 deletions

View file

@ -114,6 +114,14 @@ static void test_VirtualAllocEx(void)
ok(b && (bytes_read == alloc_size), "%Iu bytes read\n", bytes_read);
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 */
b = VirtualProtect( src + 0x2000, 0x2000, PAGE_NOACCESS, &old_prot );

View file

@ -1659,7 +1659,6 @@ DECL_HANDLER(write_process_memory)
{
data_size_t len = get_req_data_size();
if (len) write_process_memory( process, req->addr, len, get_req_data() );
else set_error( STATUS_INVALID_PARAMETER );
release_object( process );
}
}