From: Robert Riebisch <rr@bttr-software.de>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] r6677 broke access to physical FDD on Win32
Date: Sun, 22 Mar 2009 21:49:29 +0100 [thread overview]
Message-ID: <49C6A459.3000409@bttr-software.de> (raw)
In-Reply-To: <49C4493E.9050701@codemonkey.ws>
Anthony Liguori wrote:
> Looks like the code is doing the right thing. Someone running windows
> is going to have to debug this because a: should be transformed to
> \\.\a: as far as I can read the code.
Japheth posted the following proposal to my forum, where I advertize
running DOS in QEMU
(<http://www.bttr-software.de/forum/forum_entry.php?id=6249>):
I didn't test so far, because I was AFK for this weekend.
--- block-raw-win32.co Wed Mar 4 22:54:44 2009
+++ block-raw-win32.c Sat Mar 21 05:51:34 2009
@@ -32,6 +32,7 @@
#define FTYPE_FILE 0
#define FTYPE_CD 1
#define FTYPE_HARDDISK 2
+#define FTYPE_DISK 3
typedef struct BDRVRawState {
HANDLE hfile;
@@ -305,6 +306,7 @@
if (l.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR)
return -EIO;
break;
+ case FTYPE_DISK:
case FTYPE_CD:
if (!GetDiskFreeSpaceEx(s->drive_path, &available, &total,
&total_free))
return -EIO;
@@ -402,7 +404,7 @@
if (type == DRIVE_CDROM)
return FTYPE_CD;
else
- return FTYPE_FILE;
+ return FTYPE_DISK;
} else {
return FTYPE_FILE;
}
@@ -411,7 +413,7 @@
static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
{
BDRVRawState *s = bs->opaque;
- int access_flags, create_flags;
+ int access_flags, create_flags, share_flags;
DWORD overlapped;
char device_name[64];
@@ -429,6 +431,10 @@
}
}
s->type = find_device_type(bs, filename);
+ if (s->type == FTYPE_DISK)
+ share_flags = FILE_SHARE_READ | FILE_SHARE_WRITE;
+ else
+ share_flags = FILE_SHARE_READ;
if ((flags & BDRV_O_ACCESS) == O_RDWR) {
access_flags = GENERIC_READ | GENERIC_WRITE;
@@ -447,7 +453,7 @@
else if (!(flags & BDRV_O_CACHE_WB))
overlapped |= FILE_FLAG_WRITE_THROUGH;
s->hfile = CreateFile(filename, access_flags,
- FILE_SHARE_READ, NULL,
+ share_flags, NULL,
create_flags, overlapped, NULL);
if (s->hfile == INVALID_HANDLE_VALUE) {
int err = GetLastError();
Robert Riebisch
--
BTTR Software
http://www.bttr-software.de/
next prev parent reply other threads:[~2009-03-22 20:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-18 21:53 [Qemu-devel] r6677 broke access to physical FDD on Win32 Robert Riebisch
2009-03-20 22:01 ` Anthony Liguori
2009-03-20 22:23 ` Robert Riebisch
2009-03-20 23:02 ` Anthony Liguori
2009-03-20 23:20 ` Luca Tettamanti
2009-03-21 1:56 ` Anthony Liguori
2009-03-22 20:49 ` Robert Riebisch [this message]
2009-03-23 2:20 ` Anthony Liguori
2009-03-23 12:31 ` Luca Tettamanti
2009-03-24 8:20 ` Japheth
2009-03-30 19:59 ` Robert Riebisch
2009-03-21 22:07 ` Luca Tettamanti
2009-04-07 1:46 ` Anthony Liguori
2009-04-07 11:45 ` Luca Tettamanti
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=49C6A459.3000409@bttr-software.de \
--to=rr@bttr-software.de \
--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).