CD-ROM read-only fix for win32
PATCH 1/1 CD-ROM read-only fix for win32
Hi,
When a file has a read-only attribute for its property, the program doesn't boot. An attached patch fixes it. For example, read-only CD-ROM file can be used.
It also fixes the problem that restricted user can't access host's CD-ROM drive.
Thanks,
Kazu
Index: block-raw.c
===================================================================
RCS file: /sources/qemu/qemu/block-raw.c,v
retrieving revision 1.16
block-raw.c +12 -2
@@ -914,8 +914,13 @@ s->hfile =CreateFile (filename, access_flags,FILE_SHARE_READ ,NULL , create_flags, overlapped,NULL ); -if (s->hfile ==INVALID_HANDLE_VALUE ) +if (s->hfile ==INVALID_HANDLE_VALUE ) { +int err =GetLastError (); + +if (err ==ERROR_ACCESS_DENIED ) +return -EACCES ;return -1 ; + }return 0 ; }
@@ -1278,8 +1283,13 @@ s->hfile =CreateFile (filename, access_flags,FILE_SHARE_READ ,NULL , create_flags, overlapped,NULL ); -if (s->hfile ==INVALID_HANDLE_VALUE ) +if (s->hfile ==INVALID_HANDLE_VALUE ) { +int err =GetLastError (); + +if (err ==ERROR_ACCESS_DENIED ) +return -EACCES ;return -1 ; + }return 0 ; }