From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LlUbx-00019z-OD for qemu-devel@nongnu.org; Sun, 22 Mar 2009 16:49:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LlUbt-00016o-T7 for qemu-devel@nongnu.org; Sun, 22 Mar 2009 16:49:37 -0400 Received: from [199.232.76.173] (port=58437 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LlUbt-00016d-Pn for qemu-devel@nongnu.org; Sun, 22 Mar 2009 16:49:33 -0400 Received: from mailout.artfiles.de ([80.252.97.80]:55074) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LlUbt-0004cR-5I for qemu-devel@nongnu.org; Sun, 22 Mar 2009 16:49:33 -0400 Received: from [77.128.26.68] (helo=[192.168.0.4]) auth=rr@bttr-software.de by mailout.artfiles.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) id 1LlUbp-000128-Hb for qemu-devel@nongnu.org; Sun, 22 Mar 2009 21:49:29 +0100 Message-ID: <49C6A459.3000409@bttr-software.de> Date: Sun, 22 Mar 2009 21:49:29 +0100 From: Robert Riebisch MIME-Version: 1.0 Subject: Re: [Qemu-devel] r6677 broke access to physical FDD on Win32 References: <49C16D71.7020104@bttr-software.de> <49C41240.8030102@codemonkey.ws> <49C4177B.7080405@bttr-software.de> <49C42080.5080802@codemonkey.ws> <68676e00903201620n1ac29c01g9e3d7172f9bc69a4@mail.gmail.com> <49C4493E.9050701@codemonkey.ws> In-Reply-To: <49C4493E.9050701@codemonkey.ws> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 (): 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/