mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
Added support for the Ontrack Disk Manager.
svn path=/trunk/; revision=4451
This commit is contained in:
parent
1d95979106
commit
7bf5e6cae6
2 changed files with 69 additions and 26 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: disk.c,v 1.22 2003/02/26 16:25:40 ekohl Exp $
|
||||
/* $Id: disk.c,v 1.23 2003/03/28 22:45:47 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -48,6 +48,13 @@ typedef struct _DISK_DATA
|
|||
BOOLEAN DriveNotReady;
|
||||
} DISK_DATA, *PDISK_DATA;
|
||||
|
||||
typedef enum _DISK_MANAGER
|
||||
{
|
||||
NoDiskManager,
|
||||
OntrackDiskManager,
|
||||
EZ_Drive
|
||||
} DISK_MANAGER;
|
||||
|
||||
|
||||
BOOLEAN STDCALL
|
||||
DiskClassFindDevices(PDRIVER_OBJECT DriverObject,
|
||||
|
@ -403,6 +410,7 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
|
|||
ULONG PartitionNumber;
|
||||
PVOID MbrBuffer;
|
||||
NTSTATUS Status;
|
||||
DISK_MANAGER DiskManager = NoDiskManager;
|
||||
|
||||
DPRINT("DiskClassCreateDeviceObject() called\n");
|
||||
|
||||
|
@ -548,9 +556,8 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
|
|||
&MbrBuffer);
|
||||
if (MbrBuffer != NULL)
|
||||
{
|
||||
DPRINT1("Found 'Ontrack Disk Manager'!\n");
|
||||
KeBugCheck(0);
|
||||
|
||||
DPRINT("Found 'Ontrack Disk Manager'!\n");
|
||||
DiskManager = OntrackDiskManager;
|
||||
ExFreePool(MbrBuffer);
|
||||
MbrBuffer = NULL;
|
||||
}
|
||||
|
@ -561,13 +568,18 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
|
|||
&MbrBuffer);
|
||||
if (MbrBuffer != NULL)
|
||||
{
|
||||
DPRINT1("Found 'EZ-Drive' disk manager!\n");
|
||||
KeBugCheck(0);
|
||||
|
||||
DPRINT("Found 'EZ-Drive' disk manager!\n");
|
||||
DiskManager = EZ_Drive;
|
||||
ExFreePool(MbrBuffer);
|
||||
MbrBuffer = NULL;
|
||||
}
|
||||
|
||||
/* Start disk at sector 63 if the Ontrack Disk Manager was found */
|
||||
if (DiskManager == OntrackDiskManager)
|
||||
{
|
||||
DiskDeviceExtension->StartingOffset.QuadPart =
|
||||
(ULONGLONG)(63 * DiskDeviceExtension->DiskGeometry->BytesPerSector);
|
||||
}
|
||||
|
||||
if ((DiskDeviceObject->Characteristics & FILE_REMOVABLE_MEDIA) &&
|
||||
(DiskDeviceExtension->DiskGeometry->MediaType == RemovableMedia))
|
||||
|
@ -667,8 +679,17 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
|
|||
PartitionDeviceExtension->DiskGeometry = DiskDeviceExtension->DiskGeometry;
|
||||
PartitionDeviceExtension->PhysicalDevice = DiskDeviceExtension->PhysicalDevice;
|
||||
PartitionDeviceExtension->PortCapabilities = Capabilities;
|
||||
PartitionDeviceExtension->StartingOffset.QuadPart =
|
||||
PartitionEntry->StartingOffset.QuadPart;
|
||||
if (DiskManager == OntrackDiskManager)
|
||||
{
|
||||
PartitionDeviceExtension->StartingOffset.QuadPart =
|
||||
PartitionEntry->StartingOffset.QuadPart +
|
||||
(ULONGLONG)(63 * DiskDeviceExtension->DiskGeometry->BytesPerSector);
|
||||
}
|
||||
else
|
||||
{
|
||||
PartitionDeviceExtension->StartingOffset.QuadPart =
|
||||
PartitionEntry->StartingOffset.QuadPart;
|
||||
}
|
||||
PartitionDeviceExtension->PartitionLength.QuadPart =
|
||||
PartitionEntry->PartitionLength.QuadPart;
|
||||
PartitionDeviceExtension->PortNumber = (UCHAR)PortNumber;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: xhaldrv.c,v 1.28 2003/03/04 21:58:05 ekohl Exp $
|
||||
/* $Id: xhaldrv.c,v 1.29 2003/03/28 22:47:33 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -58,7 +58,8 @@ typedef struct _MBR
|
|||
typedef enum _DISK_MANAGER
|
||||
{
|
||||
NoDiskManager,
|
||||
OntrackDiskManager
|
||||
OntrackDiskManager,
|
||||
EZ_Drive
|
||||
} DISK_MANAGER;
|
||||
|
||||
|
||||
|
@ -188,7 +189,7 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
|
|||
PIRP Irp;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT1("xHalExamineMBR()\n");
|
||||
DPRINT("xHalExamineMBR()\n");
|
||||
*Buffer = NULL;
|
||||
|
||||
if (SectorSize < 512)
|
||||
|
@ -229,7 +230,7 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Reading MBR failed (Status 0x%08lx)\n",
|
||||
DPRINT("Reading MBR failed (Status 0x%08lx)\n",
|
||||
Status);
|
||||
ExFreePool(Sector);
|
||||
return;
|
||||
|
@ -239,14 +240,14 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
if (Mbr->Magic != PARTITION_MAGIC)
|
||||
{
|
||||
DPRINT1("Invalid MBR magic value\n");
|
||||
DPRINT("Invalid MBR magic value\n");
|
||||
ExFreePool(Sector);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Mbr->Partition[0].PartitionType != MBRTypeIdentifier)
|
||||
{
|
||||
DPRINT1("Invalid MBRTypeIdentifier\n");
|
||||
DPRINT("Invalid MBRTypeIdentifier\n");
|
||||
ExFreePool(Sector);
|
||||
return;
|
||||
}
|
||||
|
@ -254,7 +255,7 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
|
|||
if (Mbr->Partition[0].PartitionType == 0x54)
|
||||
{
|
||||
/* Found 'Ontrack Disk Manager'. Shift all sectors by 63 */
|
||||
DPRINT1("Found 'Ontrack Disk Manager'!\n");
|
||||
DPRINT("Found 'Ontrack Disk Manager'!\n");
|
||||
Shift = (PULONG)Mbr;
|
||||
*Shift = 63;
|
||||
}
|
||||
|
@ -615,8 +616,9 @@ xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
|||
KEVENT Event;
|
||||
IO_STATUS_BLOCK StatusBlock;
|
||||
ULARGE_INTEGER PartitionOffset;
|
||||
ULARGE_INTEGER nextPartitionOffset;
|
||||
ULARGE_INTEGER containerOffset;
|
||||
ULARGE_INTEGER RealPartitionOffset;
|
||||
ULARGE_INTEGER nextPartitionOffset;
|
||||
ULARGE_INTEGER containerOffset;
|
||||
PUCHAR SectorBuffer;
|
||||
PIRP Irp;
|
||||
NTSTATUS Status;
|
||||
|
@ -638,14 +640,26 @@ xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
|||
*PartitionBuffer = NULL;
|
||||
|
||||
/* Check for 'Ontrack Disk Manager' */
|
||||
xHalExamineMBR(DeviceObject,
|
||||
SectorSize,
|
||||
0x54,
|
||||
&MbrBuffer);
|
||||
if (MbrBuffer != NULL)
|
||||
{
|
||||
DPRINT("Found 'Ontrack Disk Manager'\n");
|
||||
DiskManager = OntrackDiskManager;
|
||||
ExFreePool(MbrBuffer);
|
||||
}
|
||||
|
||||
/* Check for 'EZ-Drive' */
|
||||
xHalExamineMBR(DeviceObject,
|
||||
SectorSize,
|
||||
0x55,
|
||||
&MbrBuffer);
|
||||
if (MbrBuffer != NULL)
|
||||
{
|
||||
DPRINT1("Found 'Ontrack Disk Manager'\n");
|
||||
DiskManager = OntrackDiskManager;
|
||||
DPRINT("Found 'EZ-Drive'\n");
|
||||
DiskManager = EZ_Drive;
|
||||
ExFreePool(MbrBuffer);
|
||||
}
|
||||
|
||||
|
@ -667,25 +681,33 @@ xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
|||
RtlZeroMemory(LayoutBuffer,
|
||||
0x1000);
|
||||
|
||||
PartitionOffset.QuadPart = 0;
|
||||
containerOffset.QuadPart = 0;
|
||||
PartitionOffset.QuadPart = (ULONGLONG)0;
|
||||
containerOffset.QuadPart = (ULONGLONG)0;
|
||||
|
||||
do
|
||||
{
|
||||
if (DiskManager == OntrackDiskManager)
|
||||
PartitionOffset.QuadPart += (63 * 512);
|
||||
|
||||
KeInitializeEvent(&Event,
|
||||
NotificationEvent,
|
||||
FALSE);
|
||||
|
||||
DPRINT("PartitionOffset: %I64u\n", PartitionOffset.QuadPart / SectorSize);
|
||||
|
||||
if (DiskManager == OntrackDiskManager)
|
||||
{
|
||||
RealPartitionOffset.QuadPart = PartitionOffset.QuadPart + (ULONGLONG)(63 * SectorSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
RealPartitionOffset.QuadPart = PartitionOffset.QuadPart;
|
||||
}
|
||||
|
||||
DPRINT("RealPartitionOffset: %I64u\n", RealPartitionOffset.QuadPart / SectorSize);
|
||||
|
||||
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
|
||||
DeviceObject,
|
||||
SectorBuffer,
|
||||
SectorSize,
|
||||
(PLARGE_INTEGER)&PartitionOffset,
|
||||
(PLARGE_INTEGER)&RealPartitionOffset,
|
||||
&Event,
|
||||
&StatusBlock);
|
||||
Status = IoCallDriver(DeviceObject,
|
||||
|
|
Loading…
Reference in a new issue