diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index c54fb16ba15..a023104ad88 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -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 ); diff --git a/server/process.c b/server/process.c index b6c21d15752..349aa87be3d 100644 --- a/server/process.c +++ b/server/process.c @@ -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 ); } }