- Add floppy image automount support from the registry, as it was done for HDDs in r69390 (it's really copy-paste & adaptation of the existing code).
- Increase HDD number support from 1 to 4 (maximum) for INT 13h.

svn path=/trunk/; revision=69411
This commit is contained in:
Hermès Bélusca-Maïto 2015-09-28 22:15:06 +00:00
parent 15bcae3db8
commit 746c7e4435
4 changed files with 79 additions and 1 deletions

View file

@ -32,7 +32,7 @@
// they will be arrays of objects containing disk information needed by // they will be arrays of objects containing disk information needed by
// the BIOS only. // the BIOS only.
static PDISK_IMAGE FloppyDrive[2] = {NULL}; static PDISK_IMAGE FloppyDrive[2] = {NULL};
static PDISK_IMAGE HardDrive[1] = {NULL}; static PDISK_IMAGE HardDrive[4] = {NULL};
#pragma pack(push, 1) #pragma pack(push, 1)
@ -689,6 +689,9 @@ BOOLEAN DiskBios32Initialize(VOID)
FloppyDrive[0] = RetrieveDisk(FLOPPY_DISK, 0); FloppyDrive[0] = RetrieveDisk(FLOPPY_DISK, 0);
FloppyDrive[1] = RetrieveDisk(FLOPPY_DISK, 1); FloppyDrive[1] = RetrieveDisk(FLOPPY_DISK, 1);
HardDrive[0] = RetrieveDisk(HARD_DISK, 0); HardDrive[0] = RetrieveDisk(HARD_DISK, 0);
HardDrive[1] = RetrieveDisk(HARD_DISK, 1);
HardDrive[2] = RetrieveDisk(HARD_DISK, 2);
HardDrive[3] = RetrieveDisk(HARD_DISK, 3);
return TRUE; return TRUE;
} }

View file

@ -553,6 +553,17 @@ BOOLEAN EmulatorInitialize(HANDLE ConsoleInput, HANDLE ConsoleOutput)
return FALSE; return FALSE;
} }
/* Mount the available floppy disks */
for (i = 0; i < ARRAYSIZE(GlobalSettings.FloppyDisks); ++i)
{
if (GlobalSettings.FloppyDisks[i].Length != 0 &&
GlobalSettings.FloppyDisks[i].Buffer &&
GlobalSettings.FloppyDisks[i].Buffer != '\0')
{
MountDisk(FLOPPY_DISK, i, GlobalSettings.FloppyDisks[i].Buffer, FALSE);
}
}
/* Mount the available hard disks */ /* Mount the available hard disks */
for (i = 0; i < ARRAYSIZE(GlobalSettings.HardDisks); ++i) for (i = 0; i < ARRAYSIZE(GlobalSettings.HardDisks); ++i)
{ {

View file

@ -333,6 +333,43 @@ NtVdmConfigureRom(IN PWSTR ValueName,
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
static NTSTATUS
NTAPI
NtVdmConfigureFloppy(IN PWSTR ValueName,
IN ULONG ValueType,
IN PVOID ValueData,
IN ULONG ValueLength,
IN PVOID Context,
IN PVOID EntryContext)
{
PNTVDM_SETTINGS Settings = (PNTVDM_SETTINGS)Context;
UNICODE_STRING ValueString;
ULONG DiskNumber = (ULONG)EntryContext;
ASSERT(DiskNumber < ARRAYSIZE(Settings->FloppyDisks));
/* Check whether the Hard Disk entry was not already configured */
if (Settings->FloppyDisks[DiskNumber].Buffer != NULL)
{
DPRINT1("Floppy Disk %d -- '%Z' already configured\n", DiskNumber, &Settings->FloppyDisks[DiskNumber]);
return STATUS_SUCCESS;
}
/* Check for the type of the value */
if (ValueType != REG_SZ)
{
RtlInitEmptyAnsiString(&Settings->FloppyDisks[DiskNumber], NULL, 0);
return STATUS_SUCCESS;
}
/* Convert the UNICODE string to ANSI and store it */
RtlInitEmptyUnicodeString(&ValueString, (PWCHAR)ValueData, ValueLength);
ValueString.Length = ValueString.MaximumLength;
RtlUnicodeStringToAnsiString(&Settings->FloppyDisks[DiskNumber], &ValueString, TRUE);
return STATUS_SUCCESS;
}
static NTSTATUS static NTSTATUS
NTAPI NTAPI
NtVdmConfigureHDD(IN PWSTR ValueName, NtVdmConfigureHDD(IN PWSTR ValueName,
@ -393,6 +430,26 @@ NtVdmConfigurationTable[] =
0 0
}, },
{
NtVdmConfigureFloppy,
0,
L"FloppyDisk0",
(PVOID)0,
REG_NONE,
NULL,
0
},
{
NtVdmConfigureFloppy,
0,
L"FloppyDisk1",
(PVOID)1,
REG_NONE,
NULL,
0
},
{ {
NtVdmConfigureHDD, NtVdmConfigureHDD,
0, 0,
@ -480,6 +537,12 @@ FreeGlobalSettings(IN PNTVDM_SETTINGS Settings)
if (Settings->RomFiles.Buffer) if (Settings->RomFiles.Buffer)
RtlFreeAnsiString(&Settings->RomFiles); RtlFreeAnsiString(&Settings->RomFiles);
for (i = 0; i < ARRAYSIZE(Settings->FloppyDisks); ++i)
{
if (Settings->FloppyDisks[i].Buffer)
RtlFreeAnsiString(&Settings->FloppyDisks[i]);
}
for (i = 0; i < ARRAYSIZE(Settings->HardDisks); ++i) for (i = 0; i < ARRAYSIZE(Settings->HardDisks); ++i)
{ {
if (Settings->HardDisks[i].Buffer) if (Settings->HardDisks[i].Buffer)

View file

@ -76,6 +76,7 @@ typedef struct _NTVDM_SETTINGS
{ {
ANSI_STRING BiosFileName; ANSI_STRING BiosFileName;
ANSI_STRING RomFiles; ANSI_STRING RomFiles;
ANSI_STRING FloppyDisks[2];
ANSI_STRING HardDisks[4]; ANSI_STRING HardDisks[4];
} NTVDM_SETTINGS, *PNTVDM_SETTINGS; } NTVDM_SETTINGS, *PNTVDM_SETTINGS;