Fixing compiler complaints with MinGW and adding support for RAW disk access when compiling with MinGW on windows.

This commit is contained in:
Mark Pizzolato 2012-12-16 20:18:54 -08:00
parent cd0ef35bbf
commit 18b6ab89d0

View file

@ -1285,8 +1285,12 @@ if ((dwStatus >= ERROR_INVALID_STARTING_CODESEG) && (dwStatus <= ERROR_INFLOOP_I
} }
errno = EINVAL; errno = EINVAL;
} }
#if defined(__GNUC__)
#include <ddk/ntddstor.h>
#include <ddk/ntdddisk.h>
#else
#include <winioctl.h> #include <winioctl.h>
#if !defined(__GNUC__) #endif
struct _device_type { struct _device_type {
int32 Type; int32 Type;
char *desc; char *desc;
@ -1377,7 +1381,6 @@ for (i=0; DeviceTypes[i].desc; i++)
return DeviceTypes[i].desc; return DeviceTypes[i].desc;
return "Unknown"; return "Unknown";
} }
#endif
static t_stat sim_os_disk_implemented_raw (void) 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) static t_stat sim_os_disk_info_raw (FILE *Disk, uint32 *sector_size, uint32 *removable)
{ {
DWORD IoctlReturnSize; DWORD IoctlReturnSize;
#if !defined(__GNUC__)
STORAGE_DEVICE_NUMBER Device; STORAGE_DEVICE_NUMBER Device;
ZeroMemory (&Device, sizeof (Device)); ZeroMemory (&Device, sizeof (Device));
@ -1541,7 +1543,6 @@ if (DeviceIoControl((HANDLE)Disk, /* handle to volume */
(LPDWORD) &IoctlReturnSize, /* number of bytes returned */ (LPDWORD) &IoctlReturnSize, /* number of bytes returned */
(LPOVERLAPPED) NULL)) /* OVERLAPPED structure */ (LPOVERLAPPED) NULL)) /* OVERLAPPED structure */
printf ("Device OK - Type: %s, Number: %d\n", _device_type_name (Device.DeviceType), (int)Device.DeviceNumber); printf ("Device OK - Type: %s, Number: %d\n", _device_type_name (Device.DeviceType), (int)Device.DeviceNumber);
#endif
if (sector_size) if (sector_size)
*sector_size = 512; *sector_size = 512;