Index: block-raw.c
===================================================================
RCS file: /sources/qemu/qemu/block-raw.c,v
retrieving revision 1.7
diff -u -r1.7 block-raw.c
--- block-raw.c	19 Aug 2006 11:45:59 -0000	1.7
+++ block-raw.c	21 Aug 2006 00:48:38 -0000
@@ -871,13 +871,15 @@
 				 NULL, 0, NULL, 0, &returned, NULL);
 }
 
+static int find_cdrom(char *cdrom_name, int cdrom_name_size);
+static int find_device_type(BlockDriverState *bs, const char *filename);
+
 static int raw_open(BlockDriverState *bs, const char *filename, int flags)
 {
     BDRVRawState *s = bs->opaque;
     int access_flags, create_flags;
     DWORD overlapped;
     char device_name[64];
-    const char *p;
 
     if (strstart(filename, "/dev/cdrom", NULL)) {
         if (find_cdrom(device_name, sizeof(device_name)) < 0)
@@ -892,7 +894,7 @@
             filename = device_name;
         }
     }
-    s->type = find_device_type(filename);
+    s->type = find_device_type(bs, filename);
 
     if ((flags & BDRV_O_ACCESS) == O_RDWR) {
         access_flags = GENERIC_READ | GENERIC_WRITE;
@@ -1095,7 +1097,7 @@
     LARGE_INTEGER l;
     ULARGE_INTEGER available, total, total_free; 
 
-    switch(s->ftype) {
+    switch(s->type) {
     case FTYPE_FILE:
         l.LowPart = GetFileSize(s->hfile, &l.HighPart);
         if (l.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR)
@@ -1104,7 +1106,7 @@
     case FTYPE_CD:
         if (!GetDiskFreeSpaceEx(s->drive_letter, &available, &total, &total_free))
             return -EIO;
-        l = total;
+        l.QuadPart = total.QuadPart;
         break;
     default:
         return -EIO;
@@ -1182,7 +1184,7 @@
     char drives[256], *pdrv = drives;
     UINT type;
 
-    memset(drives, 0, sizeof(drivers));
+    memset(drives, 0, sizeof(drives));
     GetLogicalDriveStrings(sizeof(drives), drives);
     while(pdrv[0] != '\0') {
         type = GetDriveType(pdrv);
@@ -1197,16 +1199,19 @@
     return -1;
 }
 
-static int find_device_type(const char *filename)
+static int find_device_type(BlockDriverState *bs, const char *filename)
 {
+    BDRVRawState *s = bs->opaque;
     UINT type;
     const char *p;
+    char root_path[4];
 
     if (strstart(filename, "\\\\.\\", &p) ||
         strstart(filename, "//./", &p)) {
         s->drive_letter[0] = p[0];
         s->drive_letter[1] = '\0';
-        type = GetDriveType(s->drive_letter);
+        snprintf(root_path, sizeof(root_path), "%c:\\", p[0]);
+        type = GetDriveType(root_path);
         if (type == DRIVE_CDROM)
             return FTYPE_CD;
         else
@@ -1222,7 +1227,6 @@
     int access_flags, create_flags;
     DWORD overlapped;
     char device_name[64];
-    const char *p;
 
     if (strstart(filename, "/dev/cdrom", NULL)) {
         if (find_cdrom(device_name, sizeof(device_name)) < 0)
@@ -1237,7 +1241,7 @@
             filename = device_name;
         }
     }
-    s->type = find_device_type(filename);
+    s->type = find_device_type(bs, filename);
 
     if ((flags & BDRV_O_ACCESS) == O_RDWR) {
         access_flags = GENERIC_READ | GENERIC_WRITE;
Index: block.c
===================================================================
RCS file: /sources/qemu/qemu/block.c,v
retrieving revision 1.34
diff -u -r1.34 block.c
--- block.c	19 Aug 2006 11:45:59 -0000	1.34
+++ block.c	21 Aug 2006 00:48:41 -0000
@@ -182,11 +182,18 @@
 #endif
 
 #ifdef _WIN32
-static int is_windows_drive(const char *filename)
+static int is_windows_file(const char *filename)
 {
     if (((filename[0] >= 'a' && filename[0] <= 'z') ||
          (filename[0] >= 'A' && filename[0] <= 'Z')) &&
-        filename[1] == ':' && filename[2] == '\0')
+        filename[1] == ':')
+        return 1;
+    return 0;
+}
+
+static int is_windows_drive(const char *filename)
+{
+    if (is_windows_file(filename) && filename[2] == '\0')
         return 1;
     if (strstart(filename, "\\\\.\\", NULL) ||
         strstart(filename, "//./", NULL))
@@ -205,6 +212,8 @@
 #ifdef _WIN32
     if (is_windows_drive(filename))
         return &bdrv_raw;
+    if (is_windows_file(filename))
+        return &bdrv_raw;
 #endif
     p = strchr(filename, ':');
     if (!p)
