From 18b6ab89d04f8f1fd1ef3cabca5366e62193f2e4 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sun, 16 Dec 2012 20:18:54 -0800 Subject: [PATCH] Fixing compiler complaints with MinGW and adding support for RAW disk access when compiling with MinGW on windows. --- sim_disk.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sim_disk.c b/sim_disk.c index 6986332c..0066cad2 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -1285,8 +1285,12 @@ if ((dwStatus >= ERROR_INVALID_STARTING_CODESEG) && (dwStatus <= ERROR_INFLOOP_I } errno = EINVAL; } +#if defined(__GNUC__) +#include +#include +#else #include -#if !defined(__GNUC__) +#endif struct _device_type { int32 Type; char *desc; @@ -1377,7 +1381,6 @@ for (i=0; DeviceTypes[i].desc; i++) return DeviceTypes[i].desc; return "Unknown"; } -#endif static t_stat sim_os_disk_implemented_raw (void) { @@ -1528,7 +1531,6 @@ return TRUE; static t_stat sim_os_disk_info_raw (FILE *Disk, uint32 *sector_size, uint32 *removable) { DWORD IoctlReturnSize; -#if !defined(__GNUC__) STORAGE_DEVICE_NUMBER Device; ZeroMemory (&Device, sizeof (Device)); @@ -1541,7 +1543,6 @@ if (DeviceIoControl((HANDLE)Disk, /* handle to volume */ (LPDWORD) &IoctlReturnSize, /* number of bytes returned */ (LPOVERLAPPED) NULL)) /* OVERLAPPED structure */ printf ("Device OK - Type: %s, Number: %d\n", _device_type_name (Device.DeviceType), (int)Device.DeviceNumber); -#endif if (sector_size) *sector_size = 512;