Commit 29d97591 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Use mem_size_t instead of file_pos_t for memory mapping sizes.

parent 401f4b71
...@@ -2210,7 +2210,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p ...@@ -2210,7 +2210,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
SECTION_INHERIT inherit, ULONG alloc_type, ULONG protect ) SECTION_INHERIT inherit, ULONG alloc_type, ULONG protect )
{ {
NTSTATUS res; NTSTATUS res;
ULONGLONG full_size; mem_size_t full_size;
ACCESS_MASK access; ACCESS_MASK access;
SIZE_T size = 0; SIZE_T size = 0;
SIZE_T mask = get_mask( zero_bits ); SIZE_T mask = get_mask( zero_bits );
...@@ -2295,9 +2295,13 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p ...@@ -2295,9 +2295,13 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
if (res) return res; if (res) return res;
size = full_size; size = full_size;
if (sizeof(size) < sizeof(full_size) && (size != full_size)) if (size != full_size)
ERR( "Sizes larger than 4Gb (%x%08x) not supported on this platform\n", {
(DWORD)(full_size >> 32), (DWORD)full_size ); WARN( "Sizes larger than 4Gb (%s) not supported on this platform\n",
wine_dbgstr_longlong(full_size) );
if (dup_mapping) NtClose( dup_mapping );
return STATUS_INVALID_PARAMETER;
}
if ((res = server_get_unix_fd( handle, 0, &unix_handle, &needs_close, NULL, NULL ))) goto done; if ((res = server_get_unix_fd( handle, 0, &unix_handle, &needs_close, NULL, NULL ))) goto done;
......
...@@ -1673,7 +1673,7 @@ struct create_mapping_request ...@@ -1673,7 +1673,7 @@ struct create_mapping_request
struct request_header __header; struct request_header __header;
unsigned int access; unsigned int access;
unsigned int attributes; unsigned int attributes;
file_pos_t size; mem_size_t size;
unsigned int protect; unsigned int protect;
obj_handle_t file_handle; obj_handle_t file_handle;
/* VARARG(objattr,object_attributes); */ /* VARARG(objattr,object_attributes); */
...@@ -1725,7 +1725,7 @@ struct get_mapping_info_request ...@@ -1725,7 +1725,7 @@ struct get_mapping_info_request
struct get_mapping_info_reply struct get_mapping_info_reply
{ {
struct reply_header __header; struct reply_header __header;
file_pos_t size; mem_size_t size;
int protect; int protect;
int header_size; int header_size;
void* base; void* base;
...@@ -1744,7 +1744,7 @@ struct get_mapping_committed_range_request ...@@ -1744,7 +1744,7 @@ struct get_mapping_committed_range_request
struct get_mapping_committed_range_reply struct get_mapping_committed_range_reply
{ {
struct reply_header __header; struct reply_header __header;
file_pos_t size; mem_size_t size;
int committed; int committed;
}; };
...@@ -1755,7 +1755,7 @@ struct add_mapping_committed_range_request ...@@ -1755,7 +1755,7 @@ struct add_mapping_committed_range_request
struct request_header __header; struct request_header __header;
obj_handle_t handle; obj_handle_t handle;
file_pos_t offset; file_pos_t offset;
file_pos_t size; mem_size_t size;
}; };
struct add_mapping_committed_range_reply struct add_mapping_committed_range_reply
{ {
......
...@@ -54,7 +54,7 @@ struct ranges ...@@ -54,7 +54,7 @@ struct ranges
struct mapping struct mapping
{ {
struct object obj; /* object header */ struct object obj; /* object header */
file_pos_t size; /* mapping size */ mem_size_t size; /* mapping size */
int protect; /* protection flags */ int protect; /* protection flags */
struct file *file; /* file mapped */ struct file *file; /* file mapped */
int header_size; /* size of headers (for PE image mapping) */ int header_size; /* size of headers (for PE image mapping) */
...@@ -199,7 +199,7 @@ static void add_committed_range( struct mapping *mapping, file_pos_t start, file ...@@ -199,7 +199,7 @@ static void add_committed_range( struct mapping *mapping, file_pos_t start, file
} }
/* find the range containing start and return whether it's committed */ /* find the range containing start and return whether it's committed */
static int find_committed_range( struct mapping *mapping, file_pos_t start, file_pos_t *size ) static int find_committed_range( struct mapping *mapping, file_pos_t start, mem_size_t *size )
{ {
unsigned int i; unsigned int i;
struct range *ranges; struct range *ranges;
...@@ -231,7 +231,7 @@ static int build_shared_mapping( struct mapping *mapping, int fd, ...@@ -231,7 +231,7 @@ static int build_shared_mapping( struct mapping *mapping, int fd,
IMAGE_SECTION_HEADER *sec, unsigned int nb_sec ) IMAGE_SECTION_HEADER *sec, unsigned int nb_sec )
{ {
unsigned int i; unsigned int i;
file_pos_t total_size; mem_size_t total_size;
size_t file_size, map_size, max_size; size_t file_size, map_size, max_size;
off_t shared_pos, read_pos, write_pos; off_t shared_pos, read_pos, write_pos;
char *buffer = NULL; char *buffer = NULL;
...@@ -360,7 +360,7 @@ static int get_image_params( struct mapping *mapping ) ...@@ -360,7 +360,7 @@ static int get_image_params( struct mapping *mapping )
} }
/* get the size of the unix file associated with the mapping */ /* get the size of the unix file associated with the mapping */
static inline int get_file_size( struct file *file, file_pos_t *size ) static inline int get_file_size( struct file *file, mem_size_t *size )
{ {
struct stat st; struct stat st;
int unix_fd = get_file_unix_fd( file ); int unix_fd = get_file_unix_fd( file );
...@@ -371,7 +371,7 @@ static inline int get_file_size( struct file *file, file_pos_t *size ) ...@@ -371,7 +371,7 @@ static inline int get_file_size( struct file *file, file_pos_t *size )
} }
static struct object *create_mapping( struct directory *root, const struct unicode_str *name, static struct object *create_mapping( struct directory *root, const struct unicode_str *name,
unsigned int attr, file_pos_t size, int protect, unsigned int attr, mem_size_t size, int protect,
obj_handle_t handle, const struct security_descriptor *sd ) obj_handle_t handle, const struct security_descriptor *sd )
{ {
struct mapping *mapping; struct mapping *mapping;
...@@ -440,7 +440,7 @@ static struct object *create_mapping( struct directory *root, const struct unico ...@@ -440,7 +440,7 @@ static struct object *create_mapping( struct directory *root, const struct unico
if (!(mapping->file = create_temp_file( access ))) goto error; if (!(mapping->file = create_temp_file( access ))) goto error;
if (!grow_file( mapping->file, size )) goto error; if (!grow_file( mapping->file, size )) goto error;
} }
mapping->size = (size + page_mask) & ~((file_pos_t)page_mask); mapping->size = (size + page_mask) & ~((mem_size_t)page_mask);
mapping->protect = protect; mapping->protect = protect;
return &mapping->obj; return &mapping->obj;
......
...@@ -1318,7 +1318,7 @@ enum char_info_mode ...@@ -1318,7 +1318,7 @@ enum char_info_mode
@REQ(create_mapping) @REQ(create_mapping)
unsigned int access; /* wanted access rights */ unsigned int access; /* wanted access rights */
unsigned int attributes; /* object attributes */ unsigned int attributes; /* object attributes */
file_pos_t size; /* mapping size */ mem_size_t size; /* mapping size */
unsigned int protect; /* protection flags (see below) */ unsigned int protect; /* protection flags (see below) */
obj_handle_t file_handle; /* file handle */ obj_handle_t file_handle; /* file handle */
VARARG(objattr,object_attributes); /* object attributes */ VARARG(objattr,object_attributes); /* object attributes */
...@@ -1357,7 +1357,7 @@ enum char_info_mode ...@@ -1357,7 +1357,7 @@ enum char_info_mode
obj_handle_t handle; /* handle to the mapping */ obj_handle_t handle; /* handle to the mapping */
unsigned int access; /* wanted access rights */ unsigned int access; /* wanted access rights */
@REPLY @REPLY
file_pos_t size; /* mapping size */ mem_size_t size; /* mapping size */
int protect; /* protection flags */ int protect; /* protection flags */
int header_size; /* header size (for VPROT_IMAGE mapping) */ int header_size; /* header size (for VPROT_IMAGE mapping) */
void* base; /* default base addr (for VPROT_IMAGE mapping) */ void* base; /* default base addr (for VPROT_IMAGE mapping) */
...@@ -1371,7 +1371,7 @@ enum char_info_mode ...@@ -1371,7 +1371,7 @@ enum char_info_mode
obj_handle_t handle; /* handle to the mapping */ obj_handle_t handle; /* handle to the mapping */
file_pos_t offset; /* starting offset (page-aligned, in bytes) */ file_pos_t offset; /* starting offset (page-aligned, in bytes) */
@REPLY @REPLY
file_pos_t size; /* size of range starting at offset (page-aligned, in bytes) */ mem_size_t size; /* size of range starting at offset (page-aligned, in bytes) */
int committed; /* whether it is a committed range */ int committed; /* whether it is a committed range */
@END @END
...@@ -1380,7 +1380,7 @@ enum char_info_mode ...@@ -1380,7 +1380,7 @@ enum char_info_mode
@REQ(add_mapping_committed_range) @REQ(add_mapping_committed_range)
obj_handle_t handle; /* handle to the mapping */ obj_handle_t handle; /* handle to the mapping */
file_pos_t offset; /* starting offset (page-aligned, in bytes) */ file_pos_t offset; /* starting offset (page-aligned, in bytes) */
file_pos_t size; /* size to set (page-aligned, in bytes) or 0 if only retrieving */ mem_size_t size; /* size to set (page-aligned, in bytes) or 0 if only retrieving */
@END @END
......
...@@ -38,6 +38,8 @@ my %formats = ...@@ -38,6 +38,8 @@ my %formats =
"thread_id_t" => [ 4, 4, "%04x" ], "thread_id_t" => [ 4, 4, "%04x" ],
"lparam_t" => [ 4, 4, "%lx" ], "lparam_t" => [ 4, 4, "%lx" ],
"apc_param_t" => [ 4, 4, "%lx" ], "apc_param_t" => [ 4, 4, "%lx" ],
"file_pos_t" => [ 8, 8, "&dump_uint64" ],
"mem_size_t" => [ 8, 8, "&dump_uint64" ],
"timeout_t" => [ 8, 8, "&dump_timeout" ], "timeout_t" => [ 8, 8, "&dump_timeout" ],
"rectangle_t" => [ 16, 4, "&dump_rectangle" ], "rectangle_t" => [ 16, 4, "&dump_rectangle" ],
"char_info_t" => [ 4, 2, "&dump_char_info" ], "char_info_t" => [ 4, 2, "&dump_char_info" ],
...@@ -46,7 +48,6 @@ my %formats = ...@@ -46,7 +48,6 @@ my %formats =
"async_data_t" => [ 24, 4, "&dump_async_data" ], "async_data_t" => [ 24, 4, "&dump_async_data" ],
"luid_t" => [ 8, 4, "&dump_luid" ], "luid_t" => [ 8, 4, "&dump_luid" ],
"ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ], "ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ],
"file_pos_t" => [ 8, 8, "&dump_uint64" ],
); );
my @requests = (); my @requests = ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment