Alexandre Julliard : server: Make a couple of fields smaller in the apc_call_t/apc_result_t structures.

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


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Dec 30 15:22:45 2008 +0100

server: Make a couple of fields smaller in the apc_call_t/apc_result_t structures.

---

 dlls/ntdll/sync.c              |    4 +-
 dlls/ntdll/virtual.c           |   44 ++++++++++++++++++++--------------------
 include/wine/server_protocol.h |   14 ++++++------
 server/protocol.def            |   12 +++++-----
 tools/make_requests            |    4 +-
 5 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index 86a80bd..ecfe6f7 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -916,10 +916,10 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
             result->virtual_query.base       = wine_server_client_ptr( info.BaseAddress );
             result->virtual_query.alloc_base = wine_server_client_ptr( info.AllocationBase );
             result->virtual_query.size       = info.RegionSize;
-            result->virtual_query.state      = info.State;
             result->virtual_query.prot       = info.Protect;
             result->virtual_query.alloc_prot = info.AllocationProtect;
-            result->virtual_query.alloc_type = info.Type;
+            result->virtual_query.state      = info.State >> 12;
+            result->virtual_query.alloc_type = info.Type >> 16;
         }
         break;
     }
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index f804eba..d2610e9 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1963,10 +1963,10 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
             info->BaseAddress       = wine_server_get_ptr( result.virtual_query.base );
             info->AllocationBase    = wine_server_get_ptr( result.virtual_query.alloc_base );
             info->RegionSize        = result.virtual_query.size;
-            info->State             = result.virtual_query.state;
             info->Protect           = result.virtual_query.prot;
             info->AllocationProtect = result.virtual_query.alloc_prot;
-            info->Type              = result.virtual_query.alloc_type;
+            info->State             = (DWORD)result.virtual_query.state << 12;
+            info->Type              = (DWORD)result.virtual_query.alloc_type << 16;
             if (info->RegionSize != result.virtual_query.size)  /* truncated */
                 return STATUS_INVALID_PARAMETER;  /* FIXME */
             if (res_len) *res_len = sizeof(*info);
@@ -2233,6 +2233,26 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
     if ((offset.u.LowPart & mask) || (*addr_ptr && ((UINT_PTR)*addr_ptr & mask)))
         return STATUS_INVALID_PARAMETER;
 
+    switch(protect)
+    {
+    case PAGE_NOACCESS:
+        access = SECTION_QUERY;
+        break;
+    case PAGE_READWRITE:
+    case PAGE_EXECUTE_READWRITE:
+        access = SECTION_QUERY | SECTION_MAP_WRITE;
+        break;
+    case PAGE_READONLY:
+    case PAGE_WRITECOPY:
+    case PAGE_EXECUTE:
+    case PAGE_EXECUTE_READ:
+    case PAGE_EXECUTE_WRITECOPY:
+        access = SECTION_QUERY | SECTION_MAP_READ;
+        break;
+    default:
+        return STATUS_INVALID_PARAMETER;
+    }
+
     if (process != NtCurrentProcess())
     {
         apc_call_t call;
@@ -2259,26 +2279,6 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
         return result.map_view.status;
     }
 
-    switch(protect)
-    {
-    case PAGE_NOACCESS:
-        access = SECTION_QUERY;
-        break;
-    case PAGE_READWRITE:
-    case PAGE_EXECUTE_READWRITE:
-        access = SECTION_QUERY | SECTION_MAP_WRITE;
-        break;
-    case PAGE_READONLY:
-    case PAGE_WRITECOPY:
-    case PAGE_EXECUTE:
-    case PAGE_EXECUTE_READ:
-    case PAGE_EXECUTE_WRITECOPY:
-        access = SECTION_QUERY | SECTION_MAP_READ;
-        break;
-    default:
-        return STATUS_INVALID_PARAMETER;
-    }
-
     SERVER_START_REQ( get_mapping_info )
     {
         req->handle = wine_server_obj_handle( handle );
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 6499753..6e60dab 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -349,9 +349,9 @@ typedef union
         client_ptr_t     addr;
         mem_size_t       size;
         file_pos_t       offset;
-        unsigned int     zero_bits;
         unsigned int     alloc_type;
-        unsigned int     prot;
+        unsigned short   zero_bits;
+        unsigned short   prot;
     } map_view;
     struct
     {
@@ -400,10 +400,10 @@ typedef union
         client_ptr_t     base;
         client_ptr_t     alloc_base;
         mem_size_t       size;
-        unsigned int     state;
-        unsigned int     prot;
-        unsigned int     alloc_prot;
-        unsigned int     alloc_type;
+        unsigned short   state;
+        unsigned short   prot;
+        unsigned short   alloc_prot;
+        unsigned short   alloc_type;
     } virtual_query;
     struct
     {
@@ -5059,6 +5059,6 @@ union generic_reply
     struct set_window_layered_info_reply set_window_layered_info_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 368
+#define SERVER_PROTOCOL_VERSION 369
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/protocol.def b/server/protocol.def
index f064838..966e900 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -365,9 +365,9 @@ typedef union
         client_ptr_t     addr;      /* requested address */
         mem_size_t       size;      /* allocation size */
         file_pos_t       offset;    /* file offset */
-        unsigned int     zero_bits; /* allocation alignment */
         unsigned int     alloc_type;/* allocation type */
-        unsigned int     prot;      /* memory protection flags */
+        unsigned short   zero_bits; /* allocation alignment */
+        unsigned short   prot;      /* memory protection flags */
     } map_view;
     struct
     {
@@ -416,10 +416,10 @@ typedef union
         client_ptr_t     base;      /* resulting base address */
         client_ptr_t     alloc_base;/* resulting allocation base */
         mem_size_t       size;      /* resulting region size */
-        unsigned int     state;     /* resulting region state */
-        unsigned int     prot;      /* resulting region protection */
-        unsigned int     alloc_prot;/* resulting allocation protection */
-        unsigned int     alloc_type;/* resulting region allocation type */
+        unsigned short   state;     /* resulting region state */
+        unsigned short   prot;      /* resulting region protection */
+        unsigned short   alloc_prot;/* resulting allocation protection */
+        unsigned short   alloc_type;/* resulting region allocation type */
     } virtual_query;
     struct
     {
diff --git a/tools/make_requests b/tools/make_requests
index c5b6ad1..eeec934 100755
--- a/tools/make_requests
+++ b/tools/make_requests
@@ -45,8 +45,8 @@ my %formats =
     "timeout_t"     => [  8,   8,  "&dump_timeout" ],
     "rectangle_t"   => [  16,  4,  "&dump_rectangle" ],
     "char_info_t"   => [  4,   2,  "&dump_char_info" ],
-    "apc_call_t"    => [  44,  8,  "&dump_apc_call" ],
-    "apc_result_t"  => [  48,  8,  "&dump_apc_result" ],
+    "apc_call_t"    => [  40,  8,  "&dump_apc_call" ],
+    "apc_result_t"  => [  40,  8,  "&dump_apc_result" ],
     "async_data_t"  => [  32,  8,  "&dump_async_data" ],
     "luid_t"        => [  8,   4,  "&dump_luid" ],
     "ioctl_code_t"  => [  4,   4,  "&dump_ioctl_code" ],




More information about the wine-cvs mailing list