Save a disk file's drive type in the server object.

diff --git a/files/dos_fs.c b/files/dos_fs.c
index c303472..c79133a 100644
--- a/files/dos_fs.c
+++ b/files/dos_fs.c
@@ -766,7 +766,7 @@
 		if (!strcmp(DOSFS_Devices[i].name,"NUL"))
                     return FILE_CreateFile( "/dev/null", access,
                                             FILE_SHARE_READ|FILE_SHARE_WRITE, sa,
-                                            OPEN_EXISTING, 0, 0, TRUE );
+                                            OPEN_EXISTING, 0, 0, TRUE, DRIVE_UNKNOWN );
 		if (!strcmp(DOSFS_Devices[i].name,"CON")) {
 			HANDLE to_dup;
 			switch (access & (GENERIC_READ|GENERIC_WRITE)) {
diff --git a/files/file.c b/files/file.c
index ec33637..b9e3fb0 100644
--- a/files/file.c
+++ b/files/file.c
@@ -281,7 +281,8 @@
  */
 HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing,
                         LPSECURITY_ATTRIBUTES sa, DWORD creation,
-                        DWORD attributes, HANDLE template, BOOL fail_read_only )
+                        DWORD attributes, HANDLE template, BOOL fail_read_only,
+                        UINT drive_type )
 {
     DWORD err;
     HANDLE ret;
@@ -297,11 +298,12 @@
  restart:
     SERVER_START_VAR_REQ( create_file, len )
     {
-        req->access  = access;
-        req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
-        req->sharing = sharing;
-        req->create  = creation;
-        req->attrs   = attributes;
+        req->access     = access;
+        req->inherit    = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
+        req->sharing    = sharing;
+        req->create     = creation;
+        req->attrs      = attributes;
+        req->drive_type = drive_type;
         memcpy( server_data_ptr(req), filename, len );
         SetLastError(0);
         err = SERVER_CALL();
@@ -509,7 +511,8 @@
 
     ret = FILE_CreateFile( full_name.long_name, access, sharing,
                            sa, creation, attributes, template,
-                           DRIVE_GetFlags(full_name.drive) & DRIVE_FAIL_READ_ONLY );
+                           DRIVE_GetFlags(full_name.drive) & DRIVE_FAIL_READ_ONLY,
+                           GetDriveTypeA( full_name.short_name ) );
  done:
     if (!ret) ret = INVALID_HANDLE_VALUE;
     return ret;
@@ -977,7 +980,8 @@
 
     hFileRet = FILE_CreateFile( full_name.long_name, access, sharing,
                                 NULL, OPEN_EXISTING, 0, 0,
-                                DRIVE_GetFlags(full_name.drive) & DRIVE_FAIL_READ_ONLY );
+                                DRIVE_GetFlags(full_name.drive) & DRIVE_FAIL_READ_ONLY,
+                                GetDriveTypeA( full_name.short_name ) );
     if (!hFileRet) goto not_found;
 
     GetFileTime( hFileRet, NULL, NULL, &filetime );
diff --git a/include/file.h b/include/file.h
index 5613351..260f8dd 100644
--- a/include/file.h
+++ b/include/file.h
@@ -77,7 +77,8 @@
 extern HFILE16 FILE_Dup2( HFILE16 hFile1, HFILE16 hFile2 );
 extern HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing,
                                LPSECURITY_ATTRIBUTES sa, DWORD creation,
-                               DWORD attributes, HANDLE template, BOOL fail_read_only );
+                               DWORD attributes, HANDLE template, BOOL fail_read_only,
+                               UINT drive_type );
 extern HANDLE FILE_CreateDevice( int client_id, DWORD access, LPSECURITY_ATTRIBUTES sa );
 
 extern LONG WINAPI WIN16_hread(HFILE16,SEGPTR,LONG);
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 375667c..fe437e9 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -566,6 +566,7 @@
     unsigned int sharing;
     int          create;
     unsigned int attrs;
+    int          drive_type;
     /* VARARG(filename,string); */
     handle_t     handle;
 };
@@ -907,6 +908,7 @@
     void*        base;
     handle_t     shared_file;
     int          shared_size;
+    int          drive_type;
 };
 
 
@@ -2054,6 +2056,6 @@
     struct get_window_properties_request get_window_properties;
 };
 
-#define SERVER_PROTOCOL_VERSION 61
+#define SERVER_PROTOCOL_VERSION 62
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/misc/registry.c b/misc/registry.c
index d24dcb0..818cd65 100644
--- a/misc/registry.c
+++ b/misc/registry.c
@@ -1184,7 +1184,7 @@
         case WINE_REG_VER_2: {
             HANDLE file;
             if ((file = FILE_CreateFile( fn, GENERIC_READ, 0, NULL, OPEN_EXISTING,
-                                              FILE_ATTRIBUTE_NORMAL, 0, TRUE )))
+                                              FILE_ATTRIBUTE_NORMAL, 0, TRUE, DRIVE_UNKNOWN )))
             {
                 SERVER_START_REQ( load_registry )
                 {
diff --git a/server/file.c b/server/file.c
index a972576..4ed9eac 100644
--- a/server/file.c
+++ b/server/file.c
@@ -38,6 +38,7 @@
     unsigned int        access;     /* file access (GENERIC_READ/WRITE) */
     unsigned int        flags;      /* flags (FILE_FLAG_*) */
     unsigned int        sharing;    /* file sharing mode */
+    int                 drive_type; /* type of drive the file is on */
 };
 
 #define NAME_HASH_SIZE 37
@@ -103,23 +104,25 @@
 /* create a file from a file descriptor */
 /* if the function fails the fd is closed */
 static struct file *create_file_for_fd( int fd, unsigned int access, unsigned int sharing,
-                                        unsigned int attrs )
+                                        unsigned int attrs, int drive_type )
 {
     struct file *file;
     if ((file = alloc_object( &file_ops, fd )))
     {
-        file->name    = NULL;
-        file->next    = NULL;
-        file->access  = access;
-        file->flags   = attrs;
-        file->sharing = sharing;
+        file->name       = NULL;
+        file->next       = NULL;
+        file->access     = access;
+        file->flags      = attrs;
+        file->sharing    = sharing;
+        file->drive_type = drive_type;
     }
     return file;
 }
 
 
 static struct file *create_file( const char *nameptr, size_t len, unsigned int access,
-                                 unsigned int sharing, int create, unsigned int attrs )
+                                 unsigned int sharing, int create, unsigned int attrs,
+                                 int drive_type )
 {
     struct file *file;
     int hash, flags;
@@ -169,7 +172,7 @@
         goto error;
     }
 
-    if (!(file = create_file_for_fd( fd, access, sharing, attrs )))
+    if (!(file = create_file_for_fd( fd, access, sharing, attrs, drive_type )))
     {
         free( name );
         return NULL;
@@ -193,6 +196,12 @@
     return !strcmp( file1->name, file2->name );
 }
 
+/* get the type of drive the file is on */
+int get_file_drive_type( struct file *file )
+{
+    return file->drive_type;
+}
+
 /* Create an anonymous Unix file */
 int create_anonymous_file(void)
 {
@@ -223,7 +232,7 @@
     int fd;
 
     if ((fd = create_anonymous_file()) == -1) return NULL;
-    return create_file_for_fd( fd, access, 0, 0 );
+    return create_file_for_fd( fd, access, 0, 0, DRIVE_FIXED );
 }
 
 static void file_dump( struct object *obj, int verbose )
@@ -463,7 +472,7 @@
 
     req->handle = 0;
     if ((file = create_file( get_req_data(req), get_req_data_size(req), req->access,
-                             req->sharing, req->create, req->attrs )))
+                             req->sharing, req->create, req->attrs, req->drive_type )))
     {
         req->handle = alloc_handle( current->process, file, req->access, req->inherit );
         release_object( file );
@@ -482,7 +491,8 @@
         set_error( STATUS_INVALID_HANDLE );
         return;
     }
-    if ((file = create_file_for_fd( fd, req->access, FILE_SHARE_READ | FILE_SHARE_WRITE, 0 )))
+    if ((file = create_file_for_fd( fd, req->access, FILE_SHARE_READ | FILE_SHARE_WRITE,
+                                    0, DRIVE_UNKNOWN )))
     {
         req->handle = alloc_handle( current->process, file, req->access, 0 );
         release_object( file );
diff --git a/server/mapping.c b/server/mapping.c
index f4049f0..fd8194a 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -380,6 +380,7 @@
         req->base        = mapping->base;
         req->shared_file = 0;
         req->shared_size = mapping->shared_size;
+        req->drive_type  = get_file_drive_type( mapping->file );
         if (mapping->shared_file)
             req->shared_file = alloc_handle( current->process, mapping->shared_file,
                                              GENERIC_READ|GENERIC_WRITE, 0 );
diff --git a/server/object.h b/server/object.h
index 8455720..32fa346 100644
--- a/server/object.h
+++ b/server/object.h
@@ -145,6 +145,7 @@
 extern struct file *get_file_obj( struct process *process, handle_t handle,
                                   unsigned int access );
 extern int is_same_file( struct file *file1, struct file *file2 );
+extern int get_file_drive_type( struct file *file );
 extern int grow_file( struct file *file, int size_high, int size_low );
 extern int create_anonymous_file(void);
 extern struct file *create_temp_file( int access );
diff --git a/server/protocol.def b/server/protocol.def
index be779ea..07c7f79 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -523,6 +523,7 @@
     unsigned int sharing;       /* sharing flags */
     int          create;        /* file create action */
     unsigned int attrs;         /* file attributes for creation */
+    int          drive_type;    /* type of drive the file is on */
     VARARG(filename,string);    /* file name */
 @REPLY
     handle_t     handle;        /* handle to the file */
@@ -825,6 +826,7 @@
     void*        base;          /* default base addr (for VPROT_IMAGE mapping) */
     handle_t     shared_file;   /* shared mapping file handle */
     int          shared_size;   /* shared mapping size */
+    int          drive_type;    /* type of drive the file is on */
 @END
 
 
diff --git a/server/trace.c b/server/trace.c
index 7c68db2..ba98c0a 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -709,6 +709,7 @@
     fprintf( stderr, " sharing=%08x,", req->sharing );
     fprintf( stderr, " create=%d,", req->create );
     fprintf( stderr, " attrs=%08x,", req->attrs );
+    fprintf( stderr, " drive_type=%d,", req->drive_type );
     fprintf( stderr, " filename=" );
     cur_pos += dump_varargs_string( req );
 }
@@ -1032,7 +1033,8 @@
     fprintf( stderr, " header_size=%d,", req->header_size );
     fprintf( stderr, " base=%p,", req->base );
     fprintf( stderr, " shared_file=%d,", req->shared_file );
-    fprintf( stderr, " shared_size=%d", req->shared_size );
+    fprintf( stderr, " shared_size=%d,", req->shared_size );
+    fprintf( stderr, " drive_type=%d", req->drive_type );
 }
 
 static void dump_create_device_request( const struct create_device_request *req )