Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

QEMU 0.10.0 available (Announce)

posted by Japheth Homepage, Germany (South), 21.03.2009, 07:03

> I've uploaded "qemu-0.10.0-win32-5.7z", which fixes the floppy drive issue
> by simply reverting r6677 changes.

Thanks! However, a true fix is preferable. The error is rather simple: GetFileSize() won't work with "disk" handles (those "\\.\x:" things).

Here's a possible fix to be applied to file block-raw-win32.c:
-----------------------------------------------------------------------

--- 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();

-----------------------------------------------------------------------

---
MS-DOS forever!

 

Complete thread:

Back to the forum
Board view  Mix view
22632 Postings in 2109 Threads, 402 registered users, 386 users online (0 registered, 386 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum