winedos: Open files with write access on read only media.

If the CreateFile in INT21_CreateFile fails with ERROR_WRITE_PROTECT,
retry without write access.
oldstable
Rein Klazes 2006-01-10 12:12:46 +01:00 committed by Alexandre Julliard
parent d82af6f711
commit 43694d9582
1 changed files with 6 additions and 0 deletions

View File

@ -1090,6 +1090,12 @@ static BOOL INT21_CreateFile( CONTEXT86 *context,
{
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;