55#define VHD_TIMESTAMP_BASE 946684800
115 ULONG cyls_times_heads;
117 if (total_sectors > 65535 * 16 * 255)
120 if (total_sectors > 65535 * 16 * 63)
124 cyls_times_heads = total_sectors / *secs_per_cyl;
129 cyls_times_heads = total_sectors / *secs_per_cyl;
130 *
heads = (cyls_times_heads + 1023) / 1024;
135 if (cyls_times_heads >= (*
heads * 1024) || *
heads > 16)
139 cyls_times_heads = total_sectors / *secs_per_cyl;
142 if (cyls_times_heads >= (*
heads * 1024))
146 cyls_times_heads = total_sectors / *secs_per_cyl;
150 *cyls = cyls_times_heads / *
heads;
179 { 200, 10, 1, 40, 0},
182 { 400, 10, 2, 40, 1},
184 {1200, 15, 2, 80, 2},
185 {1440, 18, 2, 80, 4},
186 {2880, 36, 2, 80, 6},
227 DiskImage->hDisk =
hFile;
250 DWORD FilePointer, BytesToRead;
277 if (vhd_footer.
version != 0x00000100 &&
278 vhd_footer.
version != 0x00000500)
290 DisplayMessage(
L"MountHDD: Unexpected data offset for VHD HDD fixed image.");
295 DisplayMessage(
L"MountHDD: VHD HDD fixed image size should be the same as its original size.");
301 DiskImage->DiskType = 0;
303 DiskImage->DiskInfo.Heads = vhd_footer.
heads;
306 DiskImage->DiskInfo.Cylinders /
307 DiskImage->DiskInfo.Heads / DiskImage->DiskInfo.Sectors;
312 DiskImage->hDisk =
hFile;
345 FilePointer = (
DWORD)((
DWORD)((
DWORD)Cylinder * DiskImage->DiskInfo.Heads + Head)
346 * DiskImage->DiskInfo.Sectors + (Sector - 1))
347 * DiskImage->DiskInfo.SectorSize;
369 BYTE StaticBuffer[1024];
376 BytesToRead = (
DWORD)NumSectors * DiskImage->DiskInfo.SectorSize;
380 if (BytesToRead <=
sizeof(StaticBuffer))
382 LocalBuffer = StaticBuffer;
390 if (
ReadFile(DiskImage->hDisk, LocalBuffer, BytesToRead, &BytesToRead,
NULL))
405 if (LocalBuffer != StaticBuffer)
423 BYTE StaticBuffer[1024];
426 if (DiskImage->ReadOnly)
437 BytesToWrite = (
DWORD)NumSectors * DiskImage->DiskInfo.SectorSize;
441 if (BytesToWrite <=
sizeof(StaticBuffer))
443 LocalBuffer = StaticBuffer;
457 if (
WriteFile(DiskImage->hDisk, LocalBuffer, BytesToWrite, &BytesToWrite,
NULL))
462 if (LocalBuffer != StaticBuffer)
492 DisplayMessage(
L"RetrieveDisk: Disk number %d:%d invalid.", DiskType, DiskNumber);
515 DisplayMessage(
L"MountDisk: Disk number %d:%d invalid.", DiskType, DiskNumber);
522 DPRINT1(
"MountDisk: Disk %d:%d:0x%p already in use, recycling...\n", DiskType, DiskNumber, DiskImage);
535 DPRINT1(
"File '%S' opening %s ; GetLastError() = %u\n",
598 DisplayMessage(
L"UnmountDisk: Disk number %d:%d invalid.", DiskType, DiskNumber);
605 DPRINT1(
"UnmountDisk: Disk %d:%d:0x%p is already unmounted\n", DiskType, DiskNumber, DiskImage);
INT __cdecl DisplayMessage(_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage,...)
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
#define ERROR_INVALID_FUNCTION
#define RtlUlongByteSwap(_x)
#define INVALID_SET_FILE_POINTER
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define FILE_ATTRIBUTE_NORMAL
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
BOOL WINAPI FlushFileBuffers(IN HANDLE hFile)
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
#define TO_LINEAR(seg, off)
#define RtlCompareMemory(s1, s2, l)
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static OUT PIO_STATUS_BLOCK OUT PVOID FileInformation
MOUNT_DISK_HANDLER MountDiskHelper
FAST486_STATE EmulatorContext
static DISK_MOUNT_INFO DiskMountInfo[MAX_DISK_TYPE]
BOOLEAN DiskCtrlInitialize(VOID)
struct _VHD_FOOTER VHD_FOOTER
static DISK_GEO DiskGeometryList[]
static DISK_IMAGE XDCHardDrive[4]
BYTE ReadDisk(IN PDISK_IMAGE DiskImage, IN WORD Cylinder, IN BYTE Head, IN BYTE Sector, IN BYTE NumSectors)
static BOOLEAN MountFDI(IN PDISK_IMAGE DiskImage, IN HANDLE hFile)
BOOLEAN UnmountDisk(IN DISK_TYPE DiskType, IN ULONG DiskNumber)
struct _DISK_GEO * PDISK_GEO
VOID DiskCtrlCleanup(VOID)
BOOLEAN IsDiskPresent(IN PDISK_IMAGE DiskImage)
BYTE WriteDisk(IN PDISK_IMAGE DiskImage, IN WORD Cylinder, IN BYTE Head, IN BYTE Sector, IN BYTE NumSectors)
struct _VHD_FOOTER * PVHD_FOOTER
static DISK_IMAGE XDCFloppyDrive[4]
static BOOLEAN MountHDD(IN PDISK_IMAGE DiskImage, IN HANDLE hFile)
BYTE SeekDisk(IN PDISK_IMAGE DiskImage, IN WORD Cylinder, IN BYTE Head, IN BYTE Sector)
static WORD HackSectorSize
struct _DISK_GEO DISK_GEO
struct _DISK_MOUNT_INFO DISK_MOUNT_INFO
BOOLEAN MountDisk(IN DISK_TYPE DiskType, IN ULONG DiskNumber, IN PCWSTR FileName, IN BOOLEAN ReadOnly)
BOOLEAN(* MOUNT_DISK_HANDLER)(IN PDISK_IMAGE DiskImage, IN HANDLE hFile)
PDISK_IMAGE RetrieveDisk(IN DISK_TYPE DiskType, IN ULONG DiskNumber)
struct _DISK_MOUNT_INFO * PDISK_MOUNT_INFO
enum _DISK_TYPE DISK_TYPE
VOID FASTCALL EmulatorReadMemory(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
VOID FASTCALL EmulatorWriteMemory(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
VOID FileClose(IN HANDLE FileHandle)
USHORT WINAPI getBX(VOID)
USHORT WINAPI getES(VOID)
DWORD WINAPI GetLastError(void)
#define INVALID_FILE_SIZE
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
#define RtlUlonglongByteSwap(_x)
#define RtlUshortByteSwap(_x)