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

This commit is contained in:
Alexandre Julliard 2008-12-17 19:25:49 +01:00
parent 401f4b717a
commit 29d9759156
5 changed files with 24 additions and 19 deletions

View File

@ -2210,7 +2210,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
SECTION_INHERIT inherit, ULONG alloc_type, ULONG protect )
{
NTSTATUS res;
ULONGLONG full_size;
mem_size_t full_size;
ACCESS_MASK access;
SIZE_T size = 0;
SIZE_T mask = get_mask( zero_bits );
@ -2295,9 +2295,13 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
if (res) return res;
size = full_size;
if (sizeof(size) < sizeof(full_size) && (size != full_size))
ERR( "Sizes larger than 4Gb (%x%08x) not supported on this platform\n",
(DWORD)(full_size >> 32), (DWORD)full_size );
if (size != 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;

View File

@ -1673,7 +1673,7 @@ struct create_mapping_request
struct request_header __header;
unsigned int access;
unsigned int attributes;
file_pos_t size;
mem_size_t size;
unsigned int protect;
obj_handle_t file_handle;
/* VARARG(objattr,object_attributes); */
@ -1725,7 +1725,7 @@ struct get_mapping_info_request
struct get_mapping_info_reply
{
struct reply_header __header;
file_pos_t size;
mem_size_t size;
int protect;
int header_size;
void* base;
@ -1744,7 +1744,7 @@ struct get_mapping_committed_range_request
struct get_mapping_committed_range_reply
{
struct reply_header __header;
file_pos_t size;
mem_size_t size;
int committed;
};
@ -1755,7 +1755,7 @@ struct add_mapping_committed_range_request
struct request_header __header;
obj_handle_t handle;
file_pos_t offset;
file_pos_t size;
mem_size_t size;
};
struct add_mapping_committed_range_reply
{

View File

@ -54,7 +54,7 @@ struct ranges
struct mapping
{
struct object obj; /* object header */
file_pos_t size; /* mapping size */
mem_size_t size; /* mapping size */
int protect; /* protection flags */
struct file *file; /* file mapped */
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
}
/* 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;
struct range *ranges;
@ -231,7 +231,7 @@ static int build_shared_mapping( struct mapping *mapping, int fd,
IMAGE_SECTION_HEADER *sec, unsigned int nb_sec )
{
unsigned int i;
file_pos_t total_size;
mem_size_t total_size;
size_t file_size, map_size, max_size;
off_t shared_pos, read_pos, write_pos;
char *buffer = NULL;
@ -360,7 +360,7 @@ static int get_image_params( struct mapping *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;
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 )
}
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 )
{
struct mapping *mapping;
@ -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 (!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;
return &mapping->obj;

View File

@ -1318,7 +1318,7 @@ enum char_info_mode
@REQ(create_mapping)
unsigned int access; /* wanted access rights */
unsigned int attributes; /* object attributes */
file_pos_t size; /* mapping size */
mem_size_t size; /* mapping size */
unsigned int protect; /* protection flags (see below) */
obj_handle_t file_handle; /* file handle */
VARARG(objattr,object_attributes); /* object attributes */
@ -1357,7 +1357,7 @@ enum char_info_mode
obj_handle_t handle; /* handle to the mapping */
unsigned int access; /* wanted access rights */
@REPLY
file_pos_t size; /* mapping size */
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) */
@ -1371,7 +1371,7 @@ enum char_info_mode
obj_handle_t handle; /* handle to the mapping */
file_pos_t offset; /* starting offset (page-aligned, in bytes) */
@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 */
@END
@ -1380,7 +1380,7 @@ enum char_info_mode
@REQ(add_mapping_committed_range)
obj_handle_t handle; /* handle to the mapping */
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

View File

@ -38,6 +38,8 @@ my %formats =
"thread_id_t" => [ 4, 4, "%04x" ],
"lparam_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" ],
"rectangle_t" => [ 16, 4, "&dump_rectangle" ],
"char_info_t" => [ 4, 2, "&dump_char_info" ],
@ -46,7 +48,6 @@ my %formats =
"async_data_t" => [ 24, 4, "&dump_async_data" ],
"luid_t" => [ 8, 4, "&dump_luid" ],
"ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ],
"file_pos_t" => [ 8, 8, "&dump_uint64" ],
);
my @requests = ();