=?UTF-8?Q?Michael=20M=C3=BCller=20?=: kernel32: In Win9x mode UnmapViewOfFile requires base address of a mapping.

Alexandre Julliard julliard at winehq.org
Tue Jul 19 10:34:22 CDT 2016


Module: wine
Branch: master
Commit: 1b26d38095e7d710375657b64db80c7c858ebea6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1b26d38095e7d710375657b64db80c7c858ebea6

Author: Michael Müller <michael at fds-team.de>
Date:   Tue Jul 19 13:00:30 2016 +0200

kernel32: In Win9x mode UnmapViewOfFile requires base address of a mapping.

Signed-off-by: Michael Müller <michael at fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/virtual.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/dlls/kernel32/virtual.c b/dlls/kernel32/virtual.c
index 37ab264..5733a42 100644
--- a/dlls/kernel32/virtual.c
+++ b/dlls/kernel32/virtual.c
@@ -576,7 +576,19 @@ LPVOID WINAPI MapViewOfFileEx( HANDLE handle, DWORD access,
  */
 BOOL WINAPI UnmapViewOfFile( LPCVOID addr )
 {
-    NTSTATUS status = NtUnmapViewOfSection( GetCurrentProcess(), (void *)addr );
+    NTSTATUS status;
+
+    if (GetVersion() & 0x80000000)
+    {
+        MEMORY_BASIC_INFORMATION info;
+        if (!VirtualQuery( addr, &info, sizeof(info) ) || info.AllocationBase != addr)
+        {
+            SetLastError( ERROR_INVALID_ADDRESS );
+            return FALSE;
+        }
+    }
+
+    status = NtUnmapViewOfSection( GetCurrentProcess(), (void *)addr );
     if (status) SetLastError( RtlNtStatusToDosError(status) );
     return !status;
 }




More information about the wine-cvs mailing list