winedos: open files with write access on read only media.
Rein Klazes
wijn at wanadoo.nl
Thu Dec 22 12:24:14 CST 2005
Hi,
Application, Elektor magazine CD 1996 browser, opens file on CDROM with
RW access and fails with ERROR_WRITE_ACCESS followed by a crash. A DOS
test program shows that the call should have succeeded.
Changelog:
dlls/winedos : int21.c
If the CreateFile in INT21_CreateFile fails with ERROR_WRITE_ACCESS,
retry without write access.
Rein.
-------------- next part --------------
--- wine/dlls/winedos/int21.c 2005-10-17 12:49:35.000000000 +0200
+++ mywine/dlls/winedos/int21.c 2005-12-22 18:59:09.000000000 +0100
@@ -1090,6 +1090,12 @@ static BOOL INT21_CreateFile( CONTEXT86
{
winHandle = CreateFileW( pathW, winAccess, winSharing, NULL,
winMode, winAttributes, 0 );
+ /* DOS allows to open files on a CDROM R/W */
+ if( winHandle == INVALID_HANDLE_VALUE &&
+ GetLastError()== ERROR_WRITE_PROTECT) {
+ winHandle = CreateFileW( pathW, winAccess & ~GENERIC_WRITE,
+ winSharing, NULL, winMode, winAttributes, 0 );
+ }
if (winHandle == INVALID_HANDLE_VALUE)
return FALSE;
More information about the wine-patches
mailing list