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

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 10 14:13:52 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 43694d95824d51ea6f4475958e4553450ff2705c
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=43694d95824d51ea6f4475958e4553450ff2705c

Author: Rein Klazes <wijn at wanadoo.nl>
Date:   Tue Jan 10 12:12:46 2006 +0100

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.

---

 dlls/winedos/int21.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/dlls/winedos/int21.c b/dlls/winedos/int21.c
index a75f7a6..85edf2a 100644
--- a/dlls/winedos/int21.c
+++ b/dlls/winedos/int21.c
@@ -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-cvs mailing list