Index: server/fd.c =================================================================== RCS file: /home/wine/wine/server/fd.c,v retrieving revision 1.49 diff -u -p -r1.49 fd.c --- server/fd.c 24 Aug 2005 18:33:51 -0000 1.49 +++ server/fd.c 6 Oct 2005 06:05:21 -0000 @@ -1638,15 +1638,17 @@ DECL_HANDLER(flush_file) DECL_HANDLER(get_handle_fd) { struct fd *fd; + unsigned int access = req->access; + map_generic_mask(&access, &file_generic_mapping); reply->fd = -1; - if ((fd = get_handle_fd_obj( current->process, req->handle, req->access ))) + if ((fd = get_handle_fd_obj( current->process, req->handle, access ))) { int unix_fd = get_unix_fd( fd ); if (unix_fd != -1) { - int cached_fd = get_handle_unix_fd( current->process, req->handle, req->access ); + int cached_fd = get_handle_unix_fd( current->process, req->handle, access ); if (cached_fd != -1) reply->fd = cached_fd; else if (!get_error()) send_client_fd( current->process, unix_fd, req->handle ); } Index: server/file.c =================================================================== RCS file: /home/wine/wine/server/file.c,v retrieving revision 1.100 diff -u -p -r1.100 file.c --- server/file.c 8 Aug 2005 15:11:03 -0000 1.100 +++ server/file.c 6 Oct 2005 06:05:21 -0000 @@ -59,6 +59,30 @@ struct file unsigned int options; /* file options (FILE_DELETE_ON_CLOSE, FILE_SYNCHRONOUS...) */ }; +GENERIC_MAPPING file_generic_mapping = +{ + FILE_GENERIC_READ, + FILE_GENERIC_WRITE, + FILE_GENERIC_EXECUTE, + FILE_ALL_ACCESS +}; +void WINAPI map_generic_mask( unsigned int *AccessMask, const GENERIC_MAPPING *GenericMapping) +{ + if (*AccessMask & GENERIC_READ) + *AccessMask |= GenericMapping->GenericRead; + + if (*AccessMask & GENERIC_WRITE) + *AccessMask |= GenericMapping->GenericWrite; + + if (*AccessMask & GENERIC_EXECUTE) + *AccessMask |= GenericMapping->GenericExecute; + + if (*AccessMask & GENERIC_ALL) + *AccessMask |= GenericMapping->GenericAll; + + *AccessMask &= 0x0FFFFFFF; +} + static void file_dump( struct object *obj, int verbose ); static struct fd *file_get_fd( struct object *obj ); static void file_destroy( struct object *obj ); @@ -140,12 +164,12 @@ static struct object *create_file( const default: set_error( STATUS_INVALID_PARAMETER ); goto error; } - switch(access & (GENERIC_READ | GENERIC_WRITE)) + switch(access & 3) { case 0: break; - case GENERIC_READ: flags |= O_RDONLY; break; - case GENERIC_WRITE: flags |= O_WRONLY; break; - case GENERIC_READ|GENERIC_WRITE: flags |= O_RDWR; break; + case FILE_READ_DATA: flags |= O_RDONLY; break; + case FILE_WRITE_DATA: flags |= O_WRONLY; break; + case FILE_READ_DATA|FILE_WRITE_DATA: flags |= O_RDWR; break; } mode = (attrs & FILE_ATTRIBUTE_READONLY) ? 0444 : 0666; @@ -219,8 +243,8 @@ static int file_get_poll_events( struct struct file *file = get_fd_user( fd ); int events = 0; assert( file->obj.ops == &file_ops ); - if (file->access & GENERIC_READ) events |= POLLIN; - if (file->access & GENERIC_WRITE) events |= POLLOUT; + if (file->access & FILE_READ_DATA) events |= POLLIN; + if (file->access & FILE_WRITE_DATA) events |= POLLOUT; return events; } @@ -348,12 +372,14 @@ int grow_file( struct file *file, file_p DECL_HANDLER(create_file) { struct object *file; + unsigned int access = req->access; reply->handle = 0; - if ((file = create_file( get_req_data(), get_req_data_size(), req->access, + map_generic_mask(&access, &file_generic_mapping); + if ((file = create_file( get_req_data(), get_req_data_size(), access, req->sharing, req->create, req->options, req->attrs ))) { - reply->handle = alloc_handle( current->process, file, req->access, req->inherit ); + reply->handle = alloc_handle( current->process, file, access, req->inherit ); release_object( file ); } } @@ -363,16 +389,18 @@ DECL_HANDLER(alloc_file_handle) { struct file *file; int fd; + unsigned int access = req->access; + map_generic_mask(&access, &file_generic_mapping); reply->handle = 0; if ((fd = thread_get_inflight_fd( current, req->fd )) == -1) { set_error( STATUS_INVALID_HANDLE ); return; } - if ((file = create_file_for_fd( fd, req->access, FILE_SHARE_READ | FILE_SHARE_WRITE ))) + if ((file = create_file_for_fd( fd, access, FILE_SHARE_READ | FILE_SHARE_WRITE ))) { - reply->handle = alloc_handle( current->process, file, req->access, req->inherit ); + reply->handle = alloc_handle( current->process, file, access, req->inherit ); release_object( file ); } } Index: server/file.h =================================================================== RCS file: /home/wine/wine/server/file.h,v retrieving revision 1.24 diff -u -p -r1.24 file.h --- server/file.h 14 Jul 2005 12:18:05 -0000 1.24 +++ server/file.h 6 Oct 2005 06:05:21 -0000 @@ -27,6 +27,9 @@ struct fd; typedef unsigned __int64 file_pos_t; +extern GENERIC_MAPPING file_generic_mapping; +extern void WINAPI map_generic_mask( unsigned int *AccessMask, const GENERIC_MAPPING *GenericMapping); + /* operations valid on file descriptor objects */ struct fd_ops {