server: Use the file_pos_t type for file sizes and offsets in the protocol structures.
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index bbb071b..08bc17d 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -2095,10 +2095,8 @@
SERVER_START_REQ( lock_file )
{
req->handle = hFile;
- req->offset_low = offset->u.LowPart;
- req->offset_high = offset->u.HighPart;
- req->count_low = count->u.LowPart;
- req->count_high = count->u.HighPart;
+ req->offset = offset->QuadPart;
+ req->count = count->QuadPart;
req->shared = !exclusive;
req->wait = !dont_wait;
ret = wine_server_call( req );
@@ -2158,11 +2156,9 @@
SERVER_START_REQ( unlock_file )
{
- req->handle = hFile;
- req->offset_low = offset->u.LowPart;
- req->offset_high = offset->u.HighPart;
- req->count_low = count->u.LowPart;
- req->count_high = count->u.HighPart;
+ req->handle = hFile;
+ req->offset = offset->QuadPart;
+ req->count = count->QuadPart;
status = wine_server_call( req );
}
SERVER_END_REQ;
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index 8ece976..21a9814 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -754,8 +754,7 @@
result->type = call->type;
result->map_view.addr = call->map_view.addr;
result->map_view.size = call->map_view.size;
- offset.u.LowPart = call->map_view.offset_low;
- offset.u.HighPart = call->map_view.offset_high;
+ offset.QuadPart = call->map_view.offset;
result->map_view.status = NtMapViewOfSection( call->map_view.handle, NtCurrentProcess(),
&result->map_view.addr, call->map_view.zero_bits,
0, &offset, &result->map_view.size, ViewShare,
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 14ff665..39d81ed 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1877,8 +1877,7 @@
req->attributes = (attr) ? attr->Attributes : 0;
req->rootdir = attr ? attr->RootDirectory : 0;
req->file_handle = file;
- req->size_high = size ? size->u.HighPart : 0;
- req->size_low = size ? size->u.LowPart : 0;
+ req->size = size ? size->QuadPart : 0;
req->protect = vprot;
if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
ret = wine_server_call( req );
@@ -1922,13 +1921,14 @@
SECTION_INHERIT inherit, ULONG alloc_type, ULONG protect )
{
NTSTATUS res;
+ ULONGLONG full_size;
SIZE_T size = 0;
SIZE_T mask = get_mask( zero_bits );
int unix_handle = -1, needs_close;
int prot;
void *base;
struct file_view *view;
- DWORD size_low, size_high, header_size, shared_size;
+ DWORD header_size;
HANDLE dup_mapping, shared_file;
LARGE_INTEGER offset;
sigset_t sigset;
@@ -1952,8 +1952,7 @@
call.map_view.handle = handle;
call.map_view.addr = *addr_ptr;
call.map_view.size = *size_ptr;
- call.map_view.offset_low = offset.u.LowPart;
- call.map_view.offset_high = offset.u.HighPart;
+ call.map_view.offset = offset.QuadPart;
call.map_view.zero_bits = zero_bits;
call.map_view.alloc_type = alloc_type;
call.map_view.prot = protect;
@@ -1974,19 +1973,18 @@
res = wine_server_call( req );
prot = reply->protect;
base = reply->base;
- size_low = reply->size_low;
- size_high = reply->size_high;
+ full_size = reply->size;
header_size = reply->header_size;
dup_mapping = reply->mapping;
shared_file = reply->shared_file;
- shared_size = reply->shared_size;
}
SERVER_END_REQ;
if (res) return res;
- size = ((ULONGLONG)size_high << 32) | size_low;
- if (sizeof(size) == sizeof(size_low) && size_high)
- ERR( "Sizes larger than 4Gb (%x%08x) not supported on this platform\n", size_high, size_low );
+ 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 ((res = server_get_unix_fd( handle, 0, &unix_handle, &needs_close, NULL, NULL ))) goto done;
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index edaea23..116216b 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -22,6 +22,7 @@
typedef unsigned int thread_id_t;
typedef unsigned int data_size_t;
typedef unsigned int ioctl_code_t;
+typedef unsigned __int64 file_pos_t;
struct request_header
{
@@ -317,8 +318,7 @@
obj_handle_t handle;
void *addr;
unsigned long size;
- unsigned int offset_low;
- unsigned int offset_high;
+ file_pos_t offset;
unsigned int zero_bits;
unsigned int alloc_type;
unsigned int prot;
@@ -1094,10 +1094,8 @@
{
struct request_header __header;
obj_handle_t handle;
- unsigned int offset_low;
- unsigned int offset_high;
- unsigned int count_low;
- unsigned int count_high;
+ file_pos_t offset;
+ file_pos_t count;
int shared;
int wait;
};
@@ -1114,10 +1112,8 @@
{
struct request_header __header;
obj_handle_t handle;
- unsigned int offset_low;
- unsigned int offset_high;
- unsigned int count_low;
- unsigned int count_high;
+ file_pos_t offset;
+ file_pos_t count;
};
struct unlock_file_reply
{
@@ -1665,8 +1661,7 @@
unsigned int access;
unsigned int attributes;
obj_handle_t rootdir;
- int size_high;
- int size_low;
+ file_pos_t size;
int protect;
obj_handle_t file_handle;
/* VARARG(name,unicode_str); */
@@ -1712,14 +1707,12 @@
struct get_mapping_info_reply
{
struct reply_header __header;
- int size_high;
- int size_low;
+ file_pos_t size;
int protect;
int header_size;
void* base;
obj_handle_t mapping;
obj_handle_t shared_file;
- int shared_size;
};
@@ -4880,6 +4873,6 @@
struct set_completion_info_reply set_completion_info_reply;
};
-#define SERVER_PROTOCOL_VERSION 316
+#define SERVER_PROTOCOL_VERSION 317
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/file.c b/server/file.c
index 7c384a3..7a62b64 100644
--- a/server/file.c
+++ b/server/file.c
@@ -657,12 +657,10 @@
DECL_HANDLER(lock_file)
{
struct file *file;
- file_pos_t offset = ((file_pos_t)req->offset_high << 32) | req->offset_low;
- file_pos_t count = ((file_pos_t)req->count_high << 32) | req->count_low;
if ((file = get_file_obj( current->process, req->handle, 0 )))
{
- reply->handle = lock_fd( file->fd, offset, count, req->shared, req->wait );
+ reply->handle = lock_fd( file->fd, req->offset, req->count, req->shared, req->wait );
reply->overlapped = is_overlapped( file );
release_object( file );
}
@@ -672,12 +670,10 @@
DECL_HANDLER(unlock_file)
{
struct file *file;
- file_pos_t offset = ((file_pos_t)req->offset_high << 32) | req->offset_low;
- file_pos_t count = ((file_pos_t)req->count_high << 32) | req->count_low;
if ((file = get_file_obj( current->process, req->handle, 0 )))
{
- unlock_fd( file->fd, offset, count );
+ unlock_fd( file->fd, req->offset, req->count );
release_object( file );
}
}
diff --git a/server/file.h b/server/file.h
index 823cc2c..d6295d9 100644
--- a/server/file.h
+++ b/server/file.h
@@ -27,8 +27,6 @@
struct async_queue;
struct completion;
-typedef unsigned __int64 file_pos_t;
-
/* operations valid on file descriptor objects */
struct fd_ops
{
diff --git a/server/mapping.c b/server/mapping.c
index 8c1e6b0..33e4204 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -47,7 +47,6 @@
int header_size; /* size of headers (for PE image mapping) */
void *base; /* default base addr (for PE image mapping) */
struct file *shared_file; /* temp file for shared PE mapping */
- int shared_size; /* shared mapping total size */
struct list shared_entry; /* entry in global shared PE mappings list */
};
@@ -141,7 +140,8 @@
IMAGE_SECTION_HEADER *sec, unsigned int nb_sec )
{
unsigned int i;
- size_t file_size, map_size, max_size, total_size;
+ file_pos_t total_size;
+ size_t file_size, map_size, max_size;
off_t shared_pos, read_pos, write_pos;
char *buffer = NULL;
int shared_fd;
@@ -160,7 +160,7 @@
total_size += map_size;
}
}
- if (!(mapping->shared_size = total_size)) return 1; /* nothing to do */
+ if (!total_size) return 1; /* nothing to do */
if ((mapping->shared_file = get_shared_file( mapping ))) return 1;
@@ -296,7 +296,6 @@
mapping->header_size = 0;
mapping->base = NULL;
mapping->shared_file = NULL;
- mapping->shared_size = 0;
if (protect & VPROT_READ) access |= FILE_READ_DATA;
if (protect & VPROT_WRITE) access |= FILE_WRITE_DATA;
@@ -348,10 +347,10 @@
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 "
- "shared_file=%p shared_size=%08x ",
+ "shared_file=%p ",
(unsigned int)(mapping->size >> 32), (unsigned int)mapping->size,
mapping->protect, mapping->file, mapping->header_size,
- mapping->base, mapping->shared_file, mapping->shared_size );
+ mapping->base, mapping->shared_file );
dump_object_name( &mapping->obj );
fputc( '\n', stderr );
}
@@ -395,14 +394,13 @@
struct object *obj;
struct unicode_str name;
struct directory *root = NULL;
- file_pos_t size = ((file_pos_t)req->size_high << 32) | req->size_low;
reply->handle = 0;
get_req_unicode_str( &name );
if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 )))
return;
- if ((obj = create_mapping( root, &name, req->attributes, size, req->protect, req->file_handle )))
+ if ((obj = create_mapping( root, &name, req->attributes, req->size, req->protect, req->file_handle )))
{
reply->handle = alloc_handle( current->process, obj, req->access, req->attributes );
release_object( obj );
@@ -440,13 +438,11 @@
if ((mapping = (struct mapping *)get_handle_obj( current->process, req->handle,
0, &mapping_ops )))
{
- reply->size_high = (unsigned int)(mapping->size >> 32);
- reply->size_low = (unsigned int)mapping->size;
+ reply->size = mapping->size;
reply->protect = mapping->protect;
reply->header_size = mapping->header_size;
reply->base = mapping->base;
reply->shared_file = 0;
- reply->shared_size = mapping->shared_size;
if ((fd = get_obj_fd( &mapping->obj )))
{
if (!is_fd_removable(fd))
diff --git a/server/protocol.def b/server/protocol.def
index d7d4248..a00ccb9 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -38,6 +38,7 @@
typedef unsigned int thread_id_t;
typedef unsigned int data_size_t;
typedef unsigned int ioctl_code_t;
+typedef unsigned __int64 file_pos_t;
struct request_header
{
@@ -333,8 +334,7 @@
obj_handle_t handle; /* mapping handle */
void *addr; /* requested address */
unsigned long size; /* allocation size */
- unsigned int offset_low;/* file offset */
- unsigned int offset_high;
+ file_pos_t offset; /* file offset */
unsigned int zero_bits; /* allocation alignment */
unsigned int alloc_type;/* allocation type */
unsigned int prot; /* memory protection flags */
@@ -906,10 +906,8 @@
/* Lock a region of a file */
@REQ(lock_file)
obj_handle_t handle; /* handle to the file */
- unsigned int offset_low; /* offset of start of lock */
- unsigned int offset_high; /* offset of start of lock */
- unsigned int count_low; /* count of bytes to lock */
- unsigned int count_high; /* count of bytes to lock */
+ file_pos_t offset; /* offset of start of lock */
+ file_pos_t count; /* count of bytes to lock */
int shared; /* shared or exclusive lock? */
int wait; /* do we want to wait? */
@REPLY
@@ -921,10 +919,8 @@
/* Unlock a region of a file */
@REQ(unlock_file)
obj_handle_t handle; /* handle to the file */
- unsigned int offset_low; /* offset of start of unlock */
- unsigned int offset_high; /* offset of start of unlock */
- unsigned int count_low; /* count of bytes to unlock */
- unsigned int count_high; /* count of bytes to unlock */
+ file_pos_t offset; /* offset of start of unlock */
+ file_pos_t count; /* count of bytes to unlock */
@END
@@ -1310,8 +1306,7 @@
unsigned int access; /* wanted access rights */
unsigned int attributes; /* object attributes */
obj_handle_t rootdir; /* root directory */
- int size_high; /* mapping size */
- int size_low; /* mapping size */
+ file_pos_t size; /* mapping size */
int protect; /* protection flags (see below) */
obj_handle_t file_handle; /* file handle */
VARARG(name,unicode_str); /* object name */
@@ -1344,14 +1339,12 @@
@REQ(get_mapping_info)
obj_handle_t handle; /* handle to the mapping */
@REPLY
- int size_high; /* mapping size */
- int size_low; /* mapping size */
+ file_pos_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) */
obj_handle_t mapping; /* duplicate mapping handle unless removable */
obj_handle_t shared_file; /* shared mapping file handle */
- int shared_size; /* shared mapping size */
@END
diff --git a/server/trace.c b/server/trace.c
index 53e0de8..4471d6f 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -70,6 +70,11 @@
fprintf( stderr, get_timeout_str(*time) );
}
+static void dump_file_pos( const file_pos_t *pos )
+{
+ fprintf( stderr, "%x%08x", (unsigned int)(*pos >> 32), (unsigned int)*pos );
+}
+
static void dump_rectangle( const rectangle_t *rect )
{
fprintf( stderr, "{%d,%d;%d,%d}",
@@ -153,8 +158,8 @@
case APC_MAP_VIEW:
fprintf( stderr, "APC_MAP_VIEW,handle=%p,addr=%p,size=%lu,offset=%x%08x,zero_bits=%u,alloc_type=%x,prot=%x",
call->map_view.handle, call->map_view.addr, call->map_view.size,
- call->map_view.offset_high, call->map_view.offset_low, call->map_view.zero_bits,
- call->map_view.alloc_type, call->map_view.prot );
+ (unsigned int)(call->map_view.offset >> 32), (unsigned int)call->map_view.offset,
+ call->map_view.zero_bits, call->map_view.alloc_type, call->map_view.prot );
break;
case APC_UNMAP_VIEW:
fprintf( stderr, "APC_UNMAP_VIEW,addr=%p", call->unmap_view.addr );
@@ -1308,10 +1313,12 @@
static void dump_lock_file_request( const struct lock_file_request *req )
{
fprintf( stderr, " handle=%p,", req->handle );
- fprintf( stderr, " offset_low=%08x,", req->offset_low );
- fprintf( stderr, " offset_high=%08x,", req->offset_high );
- fprintf( stderr, " count_low=%08x,", req->count_low );
- fprintf( stderr, " count_high=%08x,", req->count_high );
+ fprintf( stderr, " offset=" );
+ dump_file_pos( &req->offset );
+ fprintf( stderr, "," );
+ fprintf( stderr, " count=" );
+ dump_file_pos( &req->count );
+ fprintf( stderr, "," );
fprintf( stderr, " shared=%d,", req->shared );
fprintf( stderr, " wait=%d", req->wait );
}
@@ -1325,10 +1332,11 @@
static void dump_unlock_file_request( const struct unlock_file_request *req )
{
fprintf( stderr, " handle=%p,", req->handle );
- fprintf( stderr, " offset_low=%08x,", req->offset_low );
- fprintf( stderr, " offset_high=%08x,", req->offset_high );
- fprintf( stderr, " count_low=%08x,", req->count_low );
- fprintf( stderr, " count_high=%08x", req->count_high );
+ fprintf( stderr, " offset=" );
+ dump_file_pos( &req->offset );
+ fprintf( stderr, "," );
+ fprintf( stderr, " count=" );
+ dump_file_pos( &req->count );
}
static void dump_create_socket_request( const struct create_socket_request *req )
@@ -1691,8 +1699,9 @@
fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " attributes=%08x,", req->attributes );
fprintf( stderr, " rootdir=%p,", req->rootdir );
- fprintf( stderr, " size_high=%d,", req->size_high );
- fprintf( stderr, " size_low=%d,", req->size_low );
+ fprintf( stderr, " size=" );
+ dump_file_pos( &req->size );
+ fprintf( stderr, "," );
fprintf( stderr, " protect=%d,", req->protect );
fprintf( stderr, " file_handle=%p,", req->file_handle );
fprintf( stderr, " name=" );
@@ -1725,14 +1734,14 @@
static void dump_get_mapping_info_reply( const struct get_mapping_info_reply *req )
{
- fprintf( stderr, " size_high=%d,", req->size_high );
- fprintf( stderr, " size_low=%d,", req->size_low );
+ fprintf( stderr, " size=" );
+ dump_file_pos( &req->size );
+ fprintf( stderr, "," );
fprintf( stderr, " protect=%d,", req->protect );
fprintf( stderr, " header_size=%d,", req->header_size );
fprintf( stderr, " base=%p,", req->base );
fprintf( stderr, " mapping=%p,", req->mapping );
- fprintf( stderr, " shared_file=%p,", req->shared_file );
- fprintf( stderr, " shared_size=%d", req->shared_size );
+ fprintf( stderr, " shared_file=%p", req->shared_file );
}
static void dump_create_snapshot_request( const struct create_snapshot_request *req )
diff --git a/tools/make_requests b/tools/make_requests
index e735de6..2dcac16 100755
--- a/tools/make_requests
+++ b/tools/make_requests
@@ -47,6 +47,7 @@
"async_data_t" => "&dump_async_data",
"luid_t" => "&dump_luid",
"ioctl_code_t" => "&dump_ioctl_code",
+ "file_pos_t" => "&dump_file_pos",
);
my @requests = ();