Alexandre Julliard : server: Make the mapping base address a client_ptr_t instead of a void pointer.

Alexandre Julliard julliard at winehq.org
Wed Dec 31 07:44:57 CST 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Dec 30 14:18:21 2008 +0100

server: Make the mapping base address a client_ptr_t instead of a void pointer.

---

 dlls/ntdll/virtual.c           |    3 ++-
 include/wine/server_protocol.h |    4 ++--
 server/mapping.c               |   10 +++++-----
 server/protocol.def            |    2 +-
 server/trace.c                 |    4 +++-
 5 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 5b3ca77..7d57af9 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -2285,11 +2285,12 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
         req->access = access;
         res = wine_server_call( req );
         map_vprot   = reply->protect;
-        base        = reply->base;
+        base        = wine_server_get_ptr( reply->base );
         full_size   = reply->size;
         header_size = reply->header_size;
         dup_mapping = wine_server_ptr_handle( reply->mapping );
         shared_file = wine_server_ptr_handle( reply->shared_file );
+        if ((ULONG_PTR)base != reply->base) base = NULL;
     }
     SERVER_END_REQ;
     if (res) return res;
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index bc9ea96..434d52a 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -1737,7 +1737,7 @@ struct get_mapping_info_reply
     mem_size_t   size;
     int          protect;
     int          header_size;
-    void*        base;
+    client_ptr_t base;
     obj_handle_t mapping;
     obj_handle_t shared_file;
 };
@@ -5052,6 +5052,6 @@ union generic_reply
     struct set_window_layered_info_reply set_window_layered_info_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 365
+#define SERVER_PROTOCOL_VERSION 366
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/mapping.c b/server/mapping.c
index 0982b86..81c5096 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -58,7 +58,7 @@ struct mapping
     int             protect;         /* protection flags */
     struct file    *file;            /* file mapped */
     int             header_size;     /* size of headers (for PE image mapping) */
-    void           *base;            /* default base addr (for PE image mapping) */
+    client_ptr_t    base;            /* default base addr (for PE image mapping) */
     struct ranges  *committed;       /* list of committed ranges in this mapping */
     struct file    *shared_file;     /* temp file for shared PE mapping */
     struct list     shared_entry;    /* entry in global shared PE mappings list */
@@ -341,7 +341,7 @@ static int get_image_params( struct mapping *mapping )
     if (mapping->shared_file) list_add_head( &shared_list, &mapping->shared_entry );
 
     mapping->size        = ROUND_SIZE( nt.OptionalHeader.SizeOfImage );
-    mapping->base        = (void *)nt.OptionalHeader.ImageBase;
+    mapping->base        = nt.OptionalHeader.ImageBase;
     mapping->header_size = max( pos + size, nt.OptionalHeader.SizeOfHeaders );
     mapping->protect     = VPROT_IMAGE;
 
@@ -389,7 +389,7 @@ static struct object *create_mapping( struct directory *root, const struct unico
                                                DACL_SECURITY_INFORMATION|
                                                SACL_SECURITY_INFORMATION );
     mapping->header_size = 0;
-    mapping->base        = NULL;
+    mapping->base        = 0;
     mapping->file        = NULL;
     mapping->shared_file = NULL;
     mapping->committed   = NULL;
@@ -453,11 +453,11 @@ static void mapping_dump( struct object *obj, int verbose )
 {
     struct mapping *mapping = (struct mapping *)obj;
     assert( obj->ops == &mapping_ops );
-    fprintf( stderr, "Mapping size=%08x%08x prot=%08x file=%p header_size=%08x base=%p "
+    fprintf( stderr, "Mapping size=%08x%08x prot=%08x file=%p header_size=%08x base=%08lx "
              "shared_file=%p ",
              (unsigned int)(mapping->size >> 32), (unsigned int)mapping->size,
              mapping->protect, mapping->file, mapping->header_size,
-             mapping->base, mapping->shared_file );
+             (unsigned long)mapping->base, mapping->shared_file );
     dump_object_name( &mapping->obj );
     fputc( '\n', stderr );
 }
diff --git a/server/protocol.def b/server/protocol.def
index 962446a..25dc626 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -1369,7 +1369,7 @@ enum char_info_mode
     mem_size_t   size;          /* mapping size */
     int          protect;       /* protection flags */
     int          header_size;   /* header size (for VPROT_IMAGE mapping) */
-    void*        base;          /* default base addr (for VPROT_IMAGE mapping) */
+    client_ptr_t base;          /* default base addr (for VPROT_IMAGE mapping) */
     obj_handle_t mapping;       /* duplicate mapping handle unless removable */
     obj_handle_t shared_file;   /* shared mapping file handle */
 @END
diff --git a/server/trace.c b/server/trace.c
index 391f65c..fb8c867 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -1813,7 +1813,9 @@ static void dump_get_mapping_info_reply( const struct get_mapping_info_reply *re
     fprintf( stderr, "," );
     fprintf( stderr, " protect=%d,", req->protect );
     fprintf( stderr, " header_size=%d,", req->header_size );
-    fprintf( stderr, " base=%p,", req->base );
+    fprintf( stderr, " base=" );
+    dump_uint64( &req->base );
+    fprintf( stderr, "," );
     fprintf( stderr, " mapping=%04x,", req->mapping );
     fprintf( stderr, " shared_file=%04x", req->shared_file );
 }




More information about the wine-cvs mailing list