Get rid of the removable media handling in the server.

This commit is contained in:
Alexandre Julliard 2004-04-06 23:41:01 +00:00
parent 670711ef25
commit 49b2f6d964
12 changed files with 13 additions and 36 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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 */

View File

@ -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 )
{

View File

@ -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 );

View File

@ -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);

View File

@ -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 );

View File

@ -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

View File

@ -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 )