qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Kazu" <kazoo@r3.dion.ne.jp>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel][PATCH]  CD-ROM read-only fix for win32
Date: Mon, 15 Jan 2007 13:32:21 +0900	[thread overview]
Message-ID: <000a01c7385e$261944e0$0464a8c0@athlon> (raw)

[-- Attachment #1: Type: text/plain, Size: 260 bytes --]

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

[-- Attachment #2: qemu-20070114-cdrom.patch --]
[-- Type: application/octet-stream, Size: 1163 bytes --]

Index: block-raw.c
===================================================================
RCS file: /sources/qemu/qemu/block-raw.c,v
retrieving revision 1.16
diff -u -r1.16 block-raw.c
--- block-raw.c	7 Jan 2007 22:43:30 -0000	1.16
+++ block-raw.c	14 Jan 2007 05:07:17 -0000
@@ -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;
 }
 

                 reply	other threads:[~2007-01-15  4:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000a01c7385e$261944e0$0464a8c0@athlon' \
    --to=kazoo@r3.dion.ne.jp \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).