From 49b2f6d96420e41caefd2e022732dba05851bbff Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 6 Apr 2004 23:41:01 +0000 Subject: [PATCH] Get rid of the removable media handling in the server. --- dlls/kernel/volume.c | 3 +-- dlls/kernel/vxd.c | 2 +- dlls/winedos/int21.c | 1 - files/file.c | 14 +++++--------- include/file.h | 2 +- include/wine/server_protocol.h | 4 +--- misc/registry.c | 2 +- server/file.c | 13 ++----------- server/file.h | 1 - server/mapping.c | 1 - server/protocol.def | 2 -- server/trace.c | 4 +--- 12 files changed, 13 insertions(+), 36 deletions(-) diff --git a/dlls/kernel/volume.c b/dlls/kernel/volume.c index 48cc2f130ff..2a4eab3d4b4 100644 --- a/dlls/kernel/volume.c +++ b/dlls/kernel/volume.c @@ -312,8 +312,7 @@ HANDLE VOLUME_OpenDevice( LPCWSTR name, DWORD access, DWORD sharing, { TRACE("trying %s\n", buffer ); - ret = FILE_CreateFile( buffer, access, sharing, sa, OPEN_EXISTING, - attributes, 0, DRIVE_FIXED ); + ret = FILE_CreateFile( buffer, access, sharing, sa, OPEN_EXISTING, attributes, 0 ); if (ret || GetLastError() != ERROR_FILE_NOT_FOUND) break; if (!dev) break; diff --git a/dlls/kernel/vxd.c b/dlls/kernel/vxd.c index 02638a0f837..fa90196b39f 100644 --- a/dlls/kernel/vxd.c +++ b/dlls/kernel/vxd.c @@ -106,7 +106,7 @@ static HANDLE open_vxd_handle( LPCWSTR name ) unix_name[len1] = '/'; WideCharToMultiByte( CP_UNIXCP, 0, name, -1, unix_name + len1 + 1, len2, NULL, NULL); ret = FILE_CreateFile( unix_name, 0, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, - OPEN_ALWAYS, 0, 0, DRIVE_FIXED ); + OPEN_ALWAYS, 0, 0 ); HeapFree( GetProcessHeap(), 0, unix_name ); return ret; } diff --git a/dlls/winedos/int21.c b/dlls/winedos/int21.c index eb5d9b37652..58967e9680b 100644 --- a/dlls/winedos/int21.c +++ b/dlls/winedos/int21.c @@ -824,7 +824,6 @@ static HANDLE INT21_CreateMagicDeviceHandle( LPCWSTR name ) req->create = FILE_OPEN_IF; req->options = FILE_SYNCHRONOUS_IO_ALERT; req->attrs = 0; - req->removable = 0; wine_server_add_data( req, unix_name, strlen(unix_name) ); SetLastError(0); if (!wine_server_call_err( req )) ret = reply->handle; diff --git a/files/file.c b/files/file.c index c41bc9fd1c8..6645a45a944 100644 --- a/files/file.c +++ b/files/file.c @@ -183,7 +183,7 @@ void FILE_SetDosError(void) */ HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing, LPSECURITY_ATTRIBUTES sa, DWORD creation, - DWORD attributes, HANDLE template, UINT drive_type ) + DWORD attributes, HANDLE template ) { unsigned int err; UINT disp, options; @@ -220,7 +220,6 @@ HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing, req->create = disp; req->options = options; req->attrs = attributes; - req->removable = (drive_type == DRIVE_REMOVABLE || drive_type == DRIVE_CDROM); wine_server_add_data( req, filename, strlen(filename) ); SetLastError(0); err = wine_server_call( req ); @@ -365,7 +364,7 @@ HANDLE WINAPI CreateFileW( LPCWSTR filename, DWORD access, DWORD sharing, if (device) { ret = FILE_CreateFile( device, access, sharing, sa, creation, - attributes, template, DRIVE_FIXED ); + attributes, template ); } else { @@ -442,8 +441,7 @@ HANDLE WINAPI CreateFileW( LPCWSTR filename, DWORD access, DWORD sharing, } ret = FILE_CreateFile( full_name.long_name, access, sharing, - sa, creation, attributes, template, - GetDriveTypeW( full_name.short_name ) ); + sa, creation, attributes, template ); done: if (!ret) ret = INVALID_HANDLE_VALUE; TRACE("returning %p\n", ret); @@ -1439,8 +1437,7 @@ BOOL WINAPI MoveFileExW( LPCWSTR fn1, LPCWSTR fn2, DWORD flag ) /* check if we are allowed to rename the source */ hFile = FILE_CreateFile( full_name1.long_name, 0, 0, - NULL, OPEN_EXISTING, 0, 0, - GetDriveTypeW( full_name1.short_name ) ); + NULL, OPEN_EXISTING, 0, 0 ); if (!hFile) { if (GetLastError() != ERROR_ACCESS_DENIED) return FALSE; @@ -1452,8 +1449,7 @@ BOOL WINAPI MoveFileExW( LPCWSTR fn1, LPCWSTR fn2, DWORD flag ) /* check, if we are allowed to delete the destination, ** (but the file not being there is fine) */ hFile = FILE_CreateFile( full_name2.long_name, GENERIC_READ|GENERIC_WRITE, 0, - NULL, OPEN_EXISTING, 0, 0, - GetDriveTypeW( full_name2.short_name ) ); + NULL, OPEN_EXISTING, 0, 0 ); if(!hFile && GetLastError() != ERROR_FILE_NOT_FOUND) return FALSE; CloseHandle(hFile); diff --git a/include/file.h b/include/file.h index af3bb333252..28e621f8d58 100644 --- a/include/file.h +++ b/include/file.h @@ -41,7 +41,7 @@ extern void FILE_SetDosError(void); extern BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info, BOOL *is_symlink ); extern HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing, LPSECURITY_ATTRIBUTES sa, DWORD creation, - DWORD attributes, HANDLE template, UINT drive_type ); + DWORD attributes, HANDLE template ); /* files/directory.c */ extern int DIR_Init(void); diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 653f7e003a0..7f87a5ec2b4 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -753,7 +753,6 @@ struct create_file_request int create; unsigned int options; unsigned int attrs; - int removable; /* VARARG(filename,string); */ }; struct create_file_reply @@ -1487,7 +1486,6 @@ struct get_mapping_info_reply void* base; obj_handle_t shared_file; int shared_size; - int removable; }; @@ -3693,6 +3691,6 @@ union generic_reply struct set_global_windows_reply set_global_windows_reply; }; -#define SERVER_PROTOCOL_VERSION 136 +#define SERVER_PROTOCOL_VERSION 137 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/misc/registry.c b/misc/registry.c index 3b6409b350c..2a837e8166f 100644 --- a/misc/registry.c +++ b/misc/registry.c @@ -1201,7 +1201,7 @@ static void load_wine_registry(HKEY hkey,LPCSTR fn) { HANDLE file; if ((file = FILE_CreateFile( fn, GENERIC_READ, 0, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, 0, DRIVE_FIXED ))) + FILE_ATTRIBUTE_NORMAL, 0 ))) { SERVER_START_REQ( load_registry ) { diff --git a/server/file.c b/server/file.c index 8f599ec5c95..af421fcbf4d 100644 --- a/server/file.c +++ b/server/file.c @@ -58,7 +58,6 @@ struct file struct fd *fd; /* file descriptor for this file */ unsigned int access; /* file access (GENERIC_READ/WRITE) */ unsigned int options; /* file options (FILE_DELETE_ON_CLOSE, FILE_SYNCHRONOUS...) */ - int removable; /* is file on removable media? */ struct async_queue read_q; struct async_queue write_q; }; @@ -109,7 +108,6 @@ static struct file *create_file_for_fd( int fd, unsigned int access, unsigned in { file->access = access; file->options = FILE_SYNCHRONOUS_IO_NONALERT; - file->removable = 0; if (!(file->fd = create_anonymous_fd( &file_fd_ops, fd, &file->obj ))) { release_object( file ); @@ -122,7 +120,7 @@ static struct file *create_file_for_fd( int fd, unsigned int access, unsigned in static struct object *create_file( const char *nameptr, size_t len, unsigned int access, unsigned int sharing, int create, unsigned int options, - unsigned int attrs, int removable ) + unsigned int attrs ) { struct file *file; int flags; @@ -160,7 +158,6 @@ static struct object *create_file( const char *nameptr, size_t len, unsigned int file->access = access; file->options = options; - file->removable = removable; if (is_overlapped( file )) { init_async_queue (&file->read_q); @@ -207,12 +204,6 @@ int is_same_file( struct file *file1, struct file *file2 ) return is_same_file_fd( file1->fd, file2->fd ); } -/* check if the file is on removable media */ -int is_file_removable( struct file *file ) -{ - return file->removable; -} - /* create a temp file for anonymous mappings */ struct file *create_temp_file( int access ) { @@ -525,7 +516,7 @@ DECL_HANDLER(create_file) reply->handle = 0; if ((file = create_file( get_req_data(), get_req_data_size(), req->access, - req->sharing, req->create, req->options, req->attrs, req->removable ))) + req->sharing, req->create, req->options, req->attrs ))) { reply->handle = alloc_handle( current->process, file, req->access, req->inherit ); release_object( file ); diff --git a/server/file.h b/server/file.h index 4d4538a9e3a..a8e5f3efd8a 100644 --- a/server/file.h +++ b/server/file.h @@ -93,7 +93,6 @@ extern struct file *get_file_obj( struct process *process, obj_handle_t handle, unsigned int access ); extern int get_file_unix_fd( struct file *file ); extern int is_same_file( struct file *file1, struct file *file2 ); -extern int is_file_removable( struct file *file ); extern int grow_file( struct file *file, int size_high, int size_low ); extern struct file *create_temp_file( int access ); extern void file_set_error(void); diff --git a/server/mapping.c b/server/mapping.c index f84f51c4ab4..2cac776901b 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -396,7 +396,6 @@ DECL_HANDLER(get_mapping_info) reply->base = mapping->base; reply->shared_file = 0; reply->shared_size = mapping->shared_size; - reply->removable = is_file_removable( mapping->file ); if (mapping->shared_file) reply->shared_file = alloc_handle( current->process, mapping->shared_file, GENERIC_READ|GENERIC_WRITE, 0 ); diff --git a/server/protocol.def b/server/protocol.def index 5d0f732a955..cf8edf43010 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -577,7 +577,6 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT }; int create; /* file create action */ unsigned int options; /* file options */ unsigned int attrs; /* file attributes for creation */ - int removable; /* is file on removable media? */ VARARG(filename,string); /* file name */ @REPLY obj_handle_t handle; /* handle to the file */ @@ -1095,7 +1094,6 @@ enum char_info_mode void* base; /* default base addr (for VPROT_IMAGE mapping) */ obj_handle_t shared_file; /* shared mapping file handle */ int shared_size; /* shared mapping size */ - int removable; /* is file on removable media? */ @END diff --git a/server/trace.c b/server/trace.c index b18ae51c473..3b4af2cb466 100644 --- a/server/trace.c +++ b/server/trace.c @@ -837,7 +837,6 @@ static void dump_create_file_request( const struct create_file_request *req ) fprintf( stderr, " create=%d,", req->create ); fprintf( stderr, " options=%08x,", req->options ); fprintf( stderr, " attrs=%08x,", req->attrs ); - fprintf( stderr, " removable=%d,", req->removable ); fprintf( stderr, " filename=" ); dump_varargs_string( cur_size ); } @@ -1336,8 +1335,7 @@ static void dump_get_mapping_info_reply( const struct get_mapping_info_reply *re fprintf( stderr, " header_size=%d,", req->header_size ); fprintf( stderr, " base=%p,", req->base ); fprintf( stderr, " shared_file=%p,", req->shared_file ); - fprintf( stderr, " shared_size=%d,", req->shared_size ); - fprintf( stderr, " removable=%d", req->removable ); + fprintf( stderr, " shared_size=%d", req->shared_size ); } static void dump_create_snapshot_request( const struct create_snapshot_request *req )