Removed the FailReadOnly option, this is now the default behavior.
diff --git a/dlls/kernel/volume.c b/dlls/kernel/volume.c
index 0fdf505..08d6e53 100644
--- a/dlls/kernel/volume.c
+++ b/dlls/kernel/volume.c
@@ -312,7 +312,7 @@
{
TRACE("trying %s\n", buffer );
- ret = FILE_CreateFile( buffer, access, sharing, sa, OPEN_EXISTING, 0, 0, TRUE, DRIVE_FIXED );
+ ret = FILE_CreateFile( buffer, access, sharing, sa, OPEN_EXISTING, 0, 0, DRIVE_FIXED );
if (ret || GetLastError() != ERROR_FILE_NOT_FOUND) break;
if (!dev) break;
diff --git a/dlls/kernel/vxd.c b/dlls/kernel/vxd.c
index 3da31da..02638a0 100644
--- a/dlls/kernel/vxd.c
+++ b/dlls/kernel/vxd.c
@@ -106,7 +106,7 @@
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, TRUE, DRIVE_FIXED );
+ OPEN_ALWAYS, 0, 0, DRIVE_FIXED );
HeapFree( GetProcessHeap(), 0, unix_name );
return ret;
}
diff --git a/documentation/wine.conf.man b/documentation/wine.conf.man
index 795bf06..58df5eb 100644
--- a/documentation/wine.conf.man
+++ b/documentation/wine.conf.man
@@ -60,12 +60,6 @@
or DOS programs; supported types are "floppy", "hd", "cdrom"
and "network".
.PP
-.I format: """FailReadOnly""=""<boolean>"""
-.br
-Read-only files may not be opened in write mode (the default is to
-allow opening read-only files for writing, because most Windows
-programs always request read-write access, even on CD-ROM drives...).
-.PP
.B [wine]
.br
.I format: """windows""=""<directory>"""
diff --git a/files/drive.c b/files/drive.c
index 8b7e7a1..7fc1378 100644
--- a/files/drive.c
+++ b/files/drive.c
@@ -71,7 +71,6 @@
char *unix_cwd; /* cwd in Unix format without leading or trailing / */
char *device; /* raw device path */
UINT type; /* drive type */
- UINT flags; /* drive flags */
dev_t dev; /* unix device number */
ino_t ino; /* unix inode number */
} DOSDRIVE;
@@ -104,8 +103,6 @@
return p;
}
-#define IS_OPTION_TRUE(ch) ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
-
extern void CDROM_InitRegistry(int dev);
/***********************************************************************
@@ -150,7 +147,6 @@
static const WCHAR PathW[] = {'P','a','t','h',0};
static const WCHAR TypeW[] = {'T','y','p','e',0};
static const WCHAR DeviceW[] = {'D','e','v','i','c','e',0};
- static const WCHAR FailReadOnlyW[] = {'F','a','i','l','R','e','a','d','O','n','l','y',0};
attr.Length = sizeof(attr);
attr.RootDirectory = 0;
@@ -187,7 +183,6 @@
drive->dos_cwd = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(drive->dos_cwd[0]));
drive->unix_cwd = heap_strdup( "" );
drive->device = NULL;
- drive->flags = 0;
drive->dev = drive_stat_buffer.st_dev;
drive->ino = drive_stat_buffer.st_ino;
drive->type = DRIVE_FIXED;
@@ -254,7 +249,6 @@
drive->dos_cwd = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(drive->dos_cwd[0]));
drive->unix_cwd = heap_strdup( "" );
drive->device = NULL;
- drive->flags = 0;
drive->dev = drive_stat_buffer.st_dev;
drive->ino = drive_stat_buffer.st_ino;
drive->type = DRIVE_FIXED;
@@ -291,22 +285,14 @@
}
}
- /* Get the FailReadOnly flag */
- RtlInitUnicodeString( &nameW, FailReadOnlyW );
- if (!NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, tmp, sizeof(tmp), &dummy ))
- {
- WCHAR *data = (WCHAR *)((KEY_VALUE_PARTIAL_INFORMATION *)tmp)->Data;
- if (IS_OPTION_TRUE(data[0])) drive->flags |= DRIVE_FAIL_READ_ONLY;
- }
-
/* Make the first hard disk the current drive */
if ((DRIVE_CurDrive == -1) && (drive->type == DRIVE_FIXED))
DRIVE_CurDrive = i;
count++;
- TRACE("Drive %c: path=%s type=%s flags=%08x dev=%x ino=%x\n",
+ TRACE("Drive %c: path=%s type=%s dev=%x ino=%x\n",
'A' + i, drive->root, debugstr_w(DRIVE_Types[drive->type]),
- drive->flags, (int)drive->dev, (int)drive->ino );
+ (int)drive->dev, (int)drive->ino );
}
next:
@@ -322,7 +308,6 @@
DOSDrives[2].unix_cwd = heap_strdup( "" );
DOSDrives[2].type = DRIVE_FIXED;
DOSDrives[2].device = NULL;
- DOSDrives[2].flags = 0;
DRIVE_CurDrive = 2;
}
@@ -375,7 +360,7 @@
/***********************************************************************
* DRIVE_SetCurrentDrive
*/
-int DRIVE_SetCurrentDrive( int drive )
+static int DRIVE_SetCurrentDrive( int drive )
{
TDB *pTask = GlobalLock16(GetCurrentTask());
if (!DRIVE_IsValid( drive ))
@@ -603,15 +588,6 @@
/***********************************************************************
- * DRIVE_GetFlags
- */
-UINT DRIVE_GetFlags( int drive )
-{
- if ((drive < 0) || (drive >= MAX_DOS_DRIVES)) return 0;
- return DOSDrives[drive].flags;
-}
-
-/***********************************************************************
* DRIVE_Chdir
*/
int DRIVE_Chdir( int drive, LPCWSTR path )
diff --git a/files/file.c b/files/file.c
index 7b90a7f..f0f670f 100644
--- a/files/file.c
+++ b/files/file.c
@@ -183,8 +183,7 @@
*/
HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing,
LPSECURITY_ATTRIBUTES sa, DWORD creation,
- DWORD attributes, HANDLE template, BOOL fail_read_only,
- UINT drive_type )
+ DWORD attributes, HANDLE template, UINT drive_type )
{
unsigned int err;
UINT disp, options;
@@ -213,53 +212,37 @@
options |= FILE_RANDOM_ACCESS;
attributes &= FILE_ATTRIBUTE_VALID_FLAGS;
- for (;;)
+ SERVER_START_REQ( create_file )
{
- SERVER_START_REQ( create_file )
- {
- req->access = access;
- req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
- req->sharing = 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 );
- ret = reply->handle;
- }
- SERVER_END_REQ;
-
- /* If write access failed, retry without GENERIC_WRITE */
-
- if (!ret && !fail_read_only && (access & GENERIC_WRITE))
- {
- if ((err == STATUS_MEDIA_WRITE_PROTECTED) || (err == STATUS_ACCESS_DENIED))
- {
- TRACE("Write access failed for file '%s', trying without "
- "write access\n", filename);
- access &= ~GENERIC_WRITE;
- continue;
- }
- }
-
- if (err)
- {
- /* In the case file creation was rejected due to CREATE_NEW flag
- * was specified and file with that name already exists, correct
- * last error is ERROR_FILE_EXISTS and not ERROR_ALREADY_EXISTS.
- * Note: RtlNtStatusToDosError is not the subject to blame here.
- */
- if (err == STATUS_OBJECT_NAME_COLLISION)
- SetLastError( ERROR_FILE_EXISTS );
- else
- SetLastError( RtlNtStatusToDosError(err) );
- }
-
- if (!ret) WARN("Unable to create file '%s' (GLE %ld)\n", filename, GetLastError());
- return ret;
+ req->access = access;
+ req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
+ req->sharing = 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 );
+ ret = reply->handle;
}
+ SERVER_END_REQ;
+
+ if (err)
+ {
+ /* In the case file creation was rejected due to CREATE_NEW flag
+ * was specified and file with that name already exists, correct
+ * last error is ERROR_FILE_EXISTS and not ERROR_ALREADY_EXISTS.
+ * Note: RtlNtStatusToDosError is not the subject to blame here.
+ */
+ if (err == STATUS_OBJECT_NAME_COLLISION)
+ SetLastError( ERROR_FILE_EXISTS );
+ else
+ SetLastError( RtlNtStatusToDosError(err) );
+ }
+
+ if (!ret) WARN("Unable to create file '%s' (GLE %ld)\n", filename, GetLastError());
+ return ret;
}
@@ -381,7 +364,7 @@
if (device)
{
ret = FILE_CreateFile( device, access, sharing, sa, creation,
- attributes, template, TRUE, DRIVE_FIXED );
+ attributes, template, DRIVE_FIXED );
}
else
{
@@ -459,7 +442,6 @@
ret = FILE_CreateFile( full_name.long_name, access, sharing,
sa, creation, attributes, template,
- DRIVE_GetFlags(full_name.drive) & DRIVE_FAIL_READ_ONLY,
GetDriveTypeW( full_name.short_name ) );
done:
if (!ret) ret = INVALID_HANDLE_VALUE;
@@ -1238,7 +1220,7 @@
/* check if we are allowed to delete the source */
hFile = FILE_CreateFile( full_name.long_name, GENERIC_READ|GENERIC_WRITE, 0,
- NULL, OPEN_EXISTING, 0, 0, TRUE,
+ NULL, OPEN_EXISTING, 0, 0,
GetDriveTypeW( full_name.short_name ) );
if (!hFile) return FALSE;
@@ -1521,7 +1503,7 @@
/* check if we are allowed to rename the source */
hFile = FILE_CreateFile( full_name1.long_name, 0, 0,
- NULL, OPEN_EXISTING, 0, 0, TRUE,
+ NULL, OPEN_EXISTING, 0, 0,
GetDriveTypeW( full_name1.short_name ) );
if (!hFile)
{
@@ -1534,7 +1516,7 @@
/* 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, TRUE,
+ NULL, OPEN_EXISTING, 0, 0,
GetDriveTypeW( full_name2.short_name ) );
if(!hFile && GetLastError() != ERROR_FILE_NOT_FOUND) return FALSE;
CloseHandle(hFile);
diff --git a/include/file.h b/include/file.h
index 831c821..af3bb33 100644
--- a/include/file.h
+++ b/include/file.h
@@ -41,33 +41,24 @@
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, BOOL fail_read_only,
- UINT drive_type );
+ DWORD attributes, HANDLE template, UINT drive_type );
/* files/directory.c */
extern int DIR_Init(void);
/* files/dos_fs.c */
-extern BOOL DOSFS_FindUnixName( const DOS_FULL_NAME *path, LPCWSTR name, char *long_buf,
- INT long_len, LPWSTR short_buf );
-extern BOOL DOSFS_GetFullName( LPCWSTR name, BOOL check_last,
- DOS_FULL_NAME *full );
+extern BOOL DOSFS_GetFullName( LPCWSTR name, BOOL check_last, DOS_FULL_NAME *full );
/* drive.c */
-
-#define DRIVE_FAIL_READ_ONLY 0x0001 /* Fail opening read-only files for writing */
-
extern int DRIVE_Init(void);
extern int DRIVE_IsValid( int drive );
extern int DRIVE_GetCurrentDrive(void);
-extern int DRIVE_SetCurrentDrive( int drive );
extern int DRIVE_FindDriveRoot( const char **path );
extern int DRIVE_FindDriveRootW( LPCWSTR *path );
extern const char * DRIVE_GetRoot( int drive );
extern LPCWSTR DRIVE_GetDosCwd( int drive );
extern const char * DRIVE_GetUnixCwd( int drive );
extern const char * DRIVE_GetDevice( int drive );
-extern UINT DRIVE_GetFlags( int drive );
extern int DRIVE_Chdir( int drive, LPCWSTR path );
extern WCHAR *DRIVE_BuildEnv(void);
diff --git a/misc/registry.c b/misc/registry.c
index c275409..3b6409b 100644
--- a/misc/registry.c
+++ b/misc/registry.c
@@ -1201,7 +1201,7 @@
{
HANDLE file;
if ((file = FILE_CreateFile( fn, GENERIC_READ, 0, NULL, OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL, 0, TRUE, DRIVE_UNKNOWN )))
+ FILE_ATTRIBUTE_NORMAL, 0, DRIVE_FIXED )))
{
SERVER_START_REQ( load_registry )
{