=?UTF-8?Q?Michael=20M=C3=BCller=20?=: ntdll: Fix error code when querying too large memory address.

Alexandre Julliard julliard at winehq.org
Wed Feb 28 15:39:33 CST 2018


Module: wine
Branch: master
Commit: 556ba38dd177198dba7cd8554302536d2e31ff10
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=556ba38dd177198dba7cd8554302536d2e31ff10

Author: Michael Müller <michael at fds-team.de>
Date:   Tue Feb 27 17:31:23 2018 -0600

ntdll: Fix error code when querying too large memory address.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/tests/info.c | 4 ++++
 dlls/ntdll/virtual.c    | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index b62e035..1f1c675 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -1868,6 +1868,10 @@ static void test_queryvirtualmemory(void)
             "mbi.Protect is 0x%x\n", mbi.Protect);
     }
     else skip( "bss is outside of module\n" );  /* this can happen on Mac OS */
+
+    /* check error code when addr is higher than working set limit */
+    status = pNtQueryVirtualMemory(NtCurrentProcess(), (void *)~0, MemoryBasicInformation, &mbi, sizeof(mbi), &readcount);
+    ok(status == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08x\n", status);
 }
 
 static void test_affinity(void)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 106dab2..befb59c 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -2845,7 +2845,7 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
 
     base = ROUND_ADDR( addr, page_mask );
 
-    if (is_beyond_limit( base, 1, working_set_limit )) return STATUS_WORKING_SET_LIMIT_RANGE;
+    if (is_beyond_limit( base, 1, working_set_limit )) return STATUS_INVALID_PARAMETER;
 
     /* Find the view containing the address */
 




More information about the wine-cvs mailing list