mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Added stubs for missing partition functions
svn path=/trunk/; revision=1951
This commit is contained in:
parent
624e3335e1
commit
18b431ed17
6 changed files with 292 additions and 256 deletions
|
@ -1,6 +1,6 @@
|
||||||
#ifndef _INCLUDE_DDK_IOFUNCS_H
|
#ifndef _INCLUDE_DDK_IOFUNCS_H
|
||||||
#define _INCLUDE_DDK_IOFUNCS_H
|
#define _INCLUDE_DDK_IOFUNCS_H
|
||||||
/* $Id: iofuncs.h,v 1.23 2001/05/01 23:08:17 chorns Exp $ */
|
/* $Id: iofuncs.h,v 1.24 2001/06/08 15:06:51 ekohl Exp $ */
|
||||||
|
|
||||||
/* --- EXPORTED BY NTOSKRNL --- */
|
/* --- EXPORTED BY NTOSKRNL --- */
|
||||||
|
|
||||||
|
@ -1181,7 +1181,7 @@ IoWritePartitionTable (
|
||||||
ULONG SectorSize,
|
ULONG SectorSize,
|
||||||
ULONG SectorsPerTrack,
|
ULONG SectorsPerTrack,
|
||||||
ULONG NumberOfHeads,
|
ULONG NumberOfHeads,
|
||||||
PDRIVE_LAYOUT_INFORMATION * PartitionBuffer
|
PDRIVE_LAYOUT_INFORMATION PartitionBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/* $Id: drive.c,v 1.2 2000/06/30 22:51:34 ekohl Exp $
|
/* $Id: drive.c,v 1.3 2001/06/08 15:08:36 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: hal/x86/drive.c
|
* FILE: hal/x86/drive.c
|
||||||
* PURPOSE: Drive letters
|
* PURPOSE: Drive letter assignment
|
||||||
* PROGRAMMER:
|
* PROGRAMMER:
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 2000-03-25
|
* 2000-03-25
|
||||||
|
@ -17,25 +17,22 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
VOID
|
VOID STDCALL
|
||||||
STDCALL
|
IoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
IoAssignDriveLetters (
|
IN PSTRING NtDeviceName,
|
||||||
IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
OUT PUCHAR NtSystemPath,
|
||||||
IN PSTRING NtDeviceName,
|
OUT PSTRING NtSystemPathString)
|
||||||
OUT PUCHAR NtSystemPath,
|
|
||||||
OUT PSTRING NtSystemPathString
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
#ifdef __NTOSKRNL__
|
#ifdef __NTOSKRNL__
|
||||||
HalDispatchTable.HalIoAssignDriveLetters (LoaderBlock,
|
HalDispatchTable.HalIoAssignDriveLetters(LoaderBlock,
|
||||||
NtDeviceName,
|
NtDeviceName,
|
||||||
NtSystemPath,
|
NtSystemPath,
|
||||||
NtSystemPathString);
|
NtSystemPathString);
|
||||||
#else
|
#else
|
||||||
HalDispatchTable->HalIoAssignDriveLetters (LoaderBlock,
|
HalDispatchTable->HalIoAssignDriveLetters(LoaderBlock,
|
||||||
NtDeviceName,
|
NtDeviceName,
|
||||||
NtSystemPath,
|
NtSystemPath,
|
||||||
NtSystemPathString);
|
NtSystemPathString);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: parttab.c,v 1.3 2000/08/21 00:12:20 ekohl Exp $
|
/* $Id: parttab.c,v 1.4 2001/06/08 15:08:36 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -19,14 +19,11 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
IoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
||||||
IoReadPartitionTable (
|
ULONG SectorSize,
|
||||||
PDEVICE_OBJECT DeviceObject,
|
BOOLEAN ReturnRecognizedPartitions,
|
||||||
ULONG SectorSize,
|
PDRIVE_LAYOUT_INFORMATION *PartitionBuffer)
|
||||||
BOOLEAN ReturnRecognizedPartitions,
|
|
||||||
PDRIVE_LAYOUT_INFORMATION * PartitionBuffer
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
#ifdef __NTOSKRNL__
|
#ifdef __NTOSKRNL__
|
||||||
return HalDispatchTable.HalIoReadPartitionTable(DeviceObject,
|
return HalDispatchTable.HalIoReadPartitionTable(DeviceObject,
|
||||||
|
@ -41,29 +38,47 @@ IoReadPartitionTable (
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
STDCALL
|
NTSTATUS STDCALL
|
||||||
IoSetPartitionInformation (
|
IoSetPartitionInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
PDEVICE_OBJECT DeviceObject,
|
ULONG SectorSize,
|
||||||
ULONG SectorSize,
|
ULONG PartitionNumber,
|
||||||
ULONG PartitionNumber,
|
ULONG PartitionType)
|
||||||
ULONG PartitionType)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
#ifdef __NTOSKRNL__
|
||||||
|
return HalDispatchTable.HalIoSetPartitionInformation(DeviceObject,
|
||||||
|
SectorSize,
|
||||||
|
PartitionNumber,
|
||||||
|
PartitionType);
|
||||||
|
#else
|
||||||
|
return HalDispatchTable->HalIoSetPartitionInformation(DeviceObject,
|
||||||
|
SectorSize,
|
||||||
|
PartitionNumber,
|
||||||
|
PartitionType);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
STDCALL
|
|
||||||
IoWritePartitionTable (
|
|
||||||
PDEVICE_OBJECT DeviceObject,
|
|
||||||
ULONG SectorSize,
|
|
||||||
ULONG SectorsPerTrack,
|
|
||||||
ULONG NumberOfHeads,
|
|
||||||
PDRIVE_LAYOUT_INFORMATION * PBuffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
IoWritePartitionTable(PDEVICE_OBJECT DeviceObject,
|
||||||
|
ULONG SectorSize,
|
||||||
|
ULONG SectorsPerTrack,
|
||||||
|
ULONG NumberOfHeads,
|
||||||
|
PDRIVE_LAYOUT_INFORMATION PartitionBuffer)
|
||||||
|
{
|
||||||
|
#ifdef __NTOSKRNL__
|
||||||
|
return HalDispatchTable.HalIoWritePartitionTable(DeviceObject,
|
||||||
|
SectorSize,
|
||||||
|
SectorsPerTrack,
|
||||||
|
NumberOfHeads,
|
||||||
|
PartitionBuffer);
|
||||||
|
#else
|
||||||
|
return HalDispatchTable->HalIoWritePartitionTable(DeviceObject,
|
||||||
|
SectorSize,
|
||||||
|
SectorsPerTrack,
|
||||||
|
NumberOfHeads,
|
||||||
|
PartitionBuffer);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,32 +1,35 @@
|
||||||
#ifndef __INCLUDE_INTERNAL_XHAL_H
|
#ifndef __INCLUDE_INTERNAL_XHAL_H
|
||||||
#define __INCLUDE_INTERNAL_XHAL_H
|
#define __INCLUDE_INTERNAL_XHAL_H
|
||||||
|
|
||||||
VOID
|
VOID FASTCALL
|
||||||
FASTCALL
|
xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
|
||||||
xHalExamineMBR (
|
IN ULONG SectorSize,
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN ULONG MBRTypeIdentifier,
|
||||||
IN ULONG SectorSize,
|
OUT PVOID *Buffer);
|
||||||
IN ULONG MBRTypeIdentifier,
|
|
||||||
OUT PVOID * Buffer
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
VOID FASTCALL
|
||||||
FASTCALL
|
xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
xHalIoAssignDriveLetters (
|
IN PSTRING NtDeviceName,
|
||||||
IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
OUT PUCHAR NtSystemPath,
|
||||||
IN PSTRING NtDeviceName,
|
OUT PSTRING NtSystemPathString);
|
||||||
OUT PUCHAR NtSystemPath,
|
|
||||||
OUT PSTRING NtSystemPathString
|
|
||||||
);
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS FASTCALL
|
||||||
FASTCALL
|
xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
||||||
xHalIoReadPartitionTable (
|
ULONG SectorSize,
|
||||||
PDEVICE_OBJECT DeviceObject,
|
BOOLEAN ReturnRecognizedPartitions,
|
||||||
ULONG SectorSize,
|
PDRIVE_LAYOUT_INFORMATION *PartitionBuffer);
|
||||||
BOOLEAN ReturnRecognizedPartitions,
|
|
||||||
PDRIVE_LAYOUT_INFORMATION * PartitionBuffer
|
|
||||||
);
|
|
||||||
|
|
||||||
|
NTSTATUS FASTCALL
|
||||||
|
xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN ULONG SectorSize,
|
||||||
|
IN ULONG PartitionNumber,
|
||||||
|
IN ULONG PartitionType);
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN ULONG SectorSize,
|
||||||
|
IN ULONG SectorsPerTrack,
|
||||||
|
IN ULONG NumberOfHeads,
|
||||||
|
IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: xhaldisp.c,v 1.3 2001/02/10 22:51:09 dwelch Exp $
|
/* $Id: xhaldisp.c,v 1.4 2001/06/08 15:11:04 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -27,8 +27,8 @@ HAL_DISPATCH EXPORTED HalDispatchTable =
|
||||||
xHalExamineMBR,
|
xHalExamineMBR,
|
||||||
xHalIoAssignDriveLetters,
|
xHalIoAssignDriveLetters,
|
||||||
xHalIoReadPartitionTable,
|
xHalIoReadPartitionTable,
|
||||||
NULL, // xHalIoSetPartitionInformation,
|
xHalIoSetPartitionInformation,
|
||||||
NULL, // xHalIoWritePartitionTable,
|
xHalIoWritePartitionTable,
|
||||||
NULL, // HalReferenceHandlerForBus
|
NULL, // HalReferenceHandlerForBus
|
||||||
NULL, // HalReferenceBusHandler
|
NULL, // HalReferenceBusHandler
|
||||||
NULL // HalDereferenceBusHandler
|
NULL // HalDereferenceBusHandler
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: xhaldrv.c,v 1.9 2001/06/07 21:16:41 ekohl Exp $
|
/* $Id: xhaldrv.c,v 1.10 2001/06/08 15:11:04 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -66,79 +66,80 @@ typedef struct _PARTITION_TABLE
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
xHalpQueryDriveLayout (
|
xHalpQueryDriveLayout(IN PUNICODE_STRING DeviceName,
|
||||||
IN PUNICODE_STRING DeviceName,
|
OUT PDRIVE_LAYOUT_INFORMATION *LayoutInfo)
|
||||||
OUT PDRIVE_LAYOUT_INFORMATION *LayoutInfo
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
IO_STATUS_BLOCK StatusBlock;
|
IO_STATUS_BLOCK StatusBlock;
|
||||||
DISK_GEOMETRY DiskGeometry;
|
DISK_GEOMETRY DiskGeometry;
|
||||||
PDEVICE_OBJECT DeviceObject = NULL;
|
PDEVICE_OBJECT DeviceObject = NULL;
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT ("xHalpQueryDriveLayout %wZ %p\n",
|
DPRINT("xHalpQueryDriveLayout %wZ %p\n",
|
||||||
DeviceName,
|
DeviceName,
|
||||||
LayoutInfo);
|
LayoutInfo);
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the drives sector size
|
|
||||||
*/
|
|
||||||
Status = IoGetDeviceObjectPointer (DeviceName,
|
|
||||||
FILE_READ_DATA,
|
|
||||||
&FileObject,
|
|
||||||
&DeviceObject);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT ("Status %x\n",Status);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
KeInitializeEvent (&Event,
|
|
||||||
NotificationEvent,
|
|
||||||
FALSE);
|
|
||||||
|
|
||||||
Irp = IoBuildDeviceIoControlRequest (IOCTL_DISK_GET_DRIVE_GEOMETRY,
|
|
||||||
DeviceObject,
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
&DiskGeometry,
|
|
||||||
sizeof(DISK_GEOMETRY),
|
|
||||||
FALSE,
|
|
||||||
&Event,
|
|
||||||
&StatusBlock);
|
|
||||||
if (Irp == NULL)
|
|
||||||
{
|
|
||||||
ObDereferenceObject (FileObject);
|
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = IoCallDriver(DeviceObject, Irp);
|
|
||||||
if (Status == STATUS_PENDING)
|
|
||||||
{
|
|
||||||
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
|
||||||
Status = StatusBlock.Status;
|
|
||||||
}
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
ObDereferenceObject (FileObject);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
DPRINT("DiskGeometry.BytesPerSector: %d\n",
|
|
||||||
DiskGeometry.BytesPerSector);
|
|
||||||
|
|
||||||
/* read the partition table */
|
|
||||||
Status = IoReadPartitionTable (DeviceObject,
|
|
||||||
DiskGeometry.BytesPerSector,
|
|
||||||
FALSE,
|
|
||||||
LayoutInfo);
|
|
||||||
|
|
||||||
ObDereferenceObject (FileObject);
|
|
||||||
|
|
||||||
|
/* Get the drives sector size */
|
||||||
|
Status = IoGetDeviceObjectPointer(DeviceName,
|
||||||
|
FILE_READ_DATA,
|
||||||
|
&FileObject,
|
||||||
|
&DeviceObject);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT("Status %x\n",Status);
|
||||||
return Status;
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
KeInitializeEvent(&Event,
|
||||||
|
NotificationEvent,
|
||||||
|
FALSE);
|
||||||
|
|
||||||
|
Irp = IoBuildDeviceIoControlRequest(IOCTL_DISK_GET_DRIVE_GEOMETRY,
|
||||||
|
DeviceObject,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
&DiskGeometry,
|
||||||
|
sizeof(DISK_GEOMETRY),
|
||||||
|
FALSE,
|
||||||
|
&Event,
|
||||||
|
&StatusBlock);
|
||||||
|
if (Irp == NULL)
|
||||||
|
{
|
||||||
|
ObDereferenceObject(FileObject);
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = IoCallDriver(DeviceObject,
|
||||||
|
Irp);
|
||||||
|
if (Status == STATUS_PENDING)
|
||||||
|
{
|
||||||
|
KeWaitForSingleObject(&Event,
|
||||||
|
Executive,
|
||||||
|
KernelMode,
|
||||||
|
FALSE,
|
||||||
|
NULL);
|
||||||
|
Status = StatusBlock.Status;
|
||||||
|
}
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ObDereferenceObject(FileObject);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("DiskGeometry.BytesPerSector: %d\n",
|
||||||
|
DiskGeometry.BytesPerSector);
|
||||||
|
|
||||||
|
/* read the partition table */
|
||||||
|
Status = IoReadPartitionTable(DeviceObject,
|
||||||
|
DiskGeometry.BytesPerSector,
|
||||||
|
FALSE,
|
||||||
|
LayoutInfo);
|
||||||
|
|
||||||
|
ObDereferenceObject(FileObject);
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -148,139 +149,138 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN ULONG MBRTypeIdentifier,
|
IN ULONG MBRTypeIdentifier,
|
||||||
OUT PVOID *Buffer)
|
OUT PVOID *Buffer)
|
||||||
{
|
{
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
IO_STATUS_BLOCK StatusBlock;
|
IO_STATUS_BLOCK StatusBlock;
|
||||||
LARGE_INTEGER Offset;
|
LARGE_INTEGER Offset;
|
||||||
PUCHAR LocalBuffer;
|
PUCHAR LocalBuffer;
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT ("xHalExamineMBR()\n");
|
DPRINT("xHalExamineMBR()\n");
|
||||||
*Buffer = NULL;
|
*Buffer = NULL;
|
||||||
|
|
||||||
if (SectorSize < 512)
|
if (SectorSize < 512)
|
||||||
SectorSize = 512;
|
SectorSize = 512;
|
||||||
if (SectorSize > 4096)
|
if (SectorSize > 4096)
|
||||||
SectorSize = 4096;
|
SectorSize = 4096;
|
||||||
|
|
||||||
LocalBuffer = (PUCHAR)ExAllocatePool (PagedPool,
|
LocalBuffer = (PUCHAR)ExAllocatePool(PagedPool,
|
||||||
SectorSize);
|
SectorSize);
|
||||||
if (LocalBuffer == NULL)
|
if (LocalBuffer == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
KeInitializeEvent (&Event,
|
KeInitializeEvent(&Event,
|
||||||
NotificationEvent,
|
NotificationEvent,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
Offset.QuadPart = 0;
|
Offset.QuadPart = 0;
|
||||||
|
|
||||||
Irp = IoBuildSynchronousFsdRequest (IRP_MJ_READ,
|
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
|
||||||
DeviceObject,
|
DeviceObject,
|
||||||
LocalBuffer,
|
LocalBuffer,
|
||||||
SectorSize,
|
SectorSize,
|
||||||
&Offset,
|
&Offset,
|
||||||
&Event,
|
&Event,
|
||||||
&StatusBlock);
|
&StatusBlock);
|
||||||
|
|
||||||
Status = IoCallDriver (DeviceObject,
|
Status = IoCallDriver(DeviceObject,
|
||||||
Irp);
|
Irp);
|
||||||
if (Status == STATUS_PENDING)
|
if (Status == STATUS_PENDING)
|
||||||
{
|
{
|
||||||
KeWaitForSingleObject (&Event,
|
KeWaitForSingleObject(&Event,
|
||||||
Executive,
|
Executive,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
Status = StatusBlock.Status;
|
Status = StatusBlock.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT ("xHalExamineMBR failed (Status = 0x%08lx)\n",
|
DPRINT("xHalExamineMBR failed (Status = 0x%08lx)\n",
|
||||||
Status);
|
Status);
|
||||||
ExFreePool (LocalBuffer);
|
ExFreePool(LocalBuffer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LocalBuffer[0x1FE] != 0x55 || LocalBuffer[0x1FF] != 0xAA)
|
if (LocalBuffer[0x1FE] != 0x55 || LocalBuffer[0x1FF] != 0xAA)
|
||||||
{
|
{
|
||||||
DPRINT ("xHalExamineMBR: invalid MBR signature\n");
|
DPRINT("xHalExamineMBR: invalid MBR signature\n");
|
||||||
ExFreePool (LocalBuffer);
|
ExFreePool(LocalBuffer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LocalBuffer[0x1C2] != MBRTypeIdentifier)
|
if (LocalBuffer[0x1C2] != MBRTypeIdentifier)
|
||||||
{
|
{
|
||||||
DPRINT ("xHalExamineMBR: invalid MBRTypeIdentifier\n");
|
DPRINT("xHalExamineMBR: invalid MBRTypeIdentifier\n");
|
||||||
ExFreePool (LocalBuffer);
|
ExFreePool(LocalBuffer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
*Buffer = (PVOID)LocalBuffer;
|
*Buffer = (PVOID)LocalBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
HalpAssignDrive (
|
HalpAssignDrive(IN PUNICODE_STRING PartitionName,
|
||||||
IN PUNICODE_STRING PartitionName,
|
IN OUT PULONG DriveMap,
|
||||||
IN OUT PULONG DriveMap,
|
IN ULONG DriveNumber)
|
||||||
IN ULONG DriveNumber
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
WCHAR DriveNameBuffer[8];
|
WCHAR DriveNameBuffer[8];
|
||||||
UNICODE_STRING DriveName;
|
UNICODE_STRING DriveName;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
DPRINT("HalpAssignDrive()\n");
|
DPRINT("HalpAssignDrive()\n");
|
||||||
|
|
||||||
if ((DriveNumber != AUTO_DRIVE) && (DriveNumber < 24))
|
if ((DriveNumber != AUTO_DRIVE) && (DriveNumber < 24))
|
||||||
{
|
{
|
||||||
/* force assignment */
|
/* force assignment */
|
||||||
if ((*DriveMap & (1 << DriveNumber)) != 0)
|
if ((*DriveMap & (1 << DriveNumber)) != 0)
|
||||||
{
|
{
|
||||||
DbgPrint("Drive letter already used!\n");
|
DbgPrint("Drive letter already used!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* automatic assignment */
|
/* automatic assignment */
|
||||||
DriveNumber = AUTO_DRIVE;
|
DriveNumber = AUTO_DRIVE;
|
||||||
|
|
||||||
for (i = 2; i < 24; i++)
|
for (i = 2; i < 24; i++)
|
||||||
{
|
{
|
||||||
if ((*DriveMap & (1 << i)) == 0)
|
if ((*DriveMap & (1 << i)) == 0)
|
||||||
{
|
{
|
||||||
DriveNumber = i;
|
DriveNumber = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DriveNumber == AUTO_DRIVE)
|
if (DriveNumber == AUTO_DRIVE)
|
||||||
{
|
{
|
||||||
DbgPrint("No drive letter available!\n");
|
DbgPrint("No drive letter available!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("DriveNumber %d\n", DriveNumber);
|
DPRINT("DriveNumber %d\n", DriveNumber);
|
||||||
|
|
||||||
/* set bit in drive map */
|
/* set bit in drive map */
|
||||||
*DriveMap = *DriveMap | (1 << DriveNumber);
|
*DriveMap = *DriveMap | (1 << DriveNumber);
|
||||||
|
|
||||||
/* build drive name */
|
/* build drive name */
|
||||||
swprintf (DriveNameBuffer,
|
swprintf(DriveNameBuffer,
|
||||||
L"\\??\\%C:",
|
L"\\??\\%C:",
|
||||||
'A' + DriveNumber);
|
'A' + DriveNumber);
|
||||||
RtlInitUnicodeString (&DriveName,
|
RtlInitUnicodeString(&DriveName,
|
||||||
DriveNameBuffer);
|
DriveNameBuffer);
|
||||||
|
|
||||||
DPRINT(" %wZ ==> %wZ\n",
|
DPRINT(" %wZ ==> %wZ\n",
|
||||||
&DriveName,
|
&DriveName,
|
||||||
PartitionName);
|
PartitionName);
|
||||||
|
|
||||||
/* create symbolic link */
|
/* create symbolic link */
|
||||||
IoCreateSymbolicLink (&DriveName,
|
IoCreateSymbolicLink(&DriveName,
|
||||||
PartitionName);
|
PartitionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -732,7 +732,7 @@ xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
||||||
IsRecognizedPartition (PartitionTable->Partition[i].PartitionType);
|
IsRecognizedPartition (PartitionTable->Partition[i].PartitionType);
|
||||||
LayoutBuffer->PartitionEntry[Count].RewritePartition = FALSE;
|
LayoutBuffer->PartitionEntry[Count].RewritePartition = FALSE;
|
||||||
|
|
||||||
DPRINT1(" %ld: nr: %d boot: %1x type: %x start: 0x%I64x count: 0x%I64x\n",
|
DPRINT(" %ld: nr: %d boot: %1x type: %x start: 0x%I64x count: 0x%I64x\n",
|
||||||
Count,
|
Count,
|
||||||
LayoutBuffer->PartitionEntry[Count].PartitionNumber,
|
LayoutBuffer->PartitionEntry[Count].PartitionNumber,
|
||||||
LayoutBuffer->PartitionEntry[Count].BootIndicator,
|
LayoutBuffer->PartitionEntry[Count].BootIndicator,
|
||||||
|
@ -764,4 +764,25 @@ xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NTSTATUS FASTCALL
|
||||||
|
xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN ULONG SectorSize,
|
||||||
|
IN ULONG PartitionNumber,
|
||||||
|
IN ULONG PartitionType)
|
||||||
|
{
|
||||||
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NTSTATUS FASTCALL
|
||||||
|
xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN ULONG SectorSize,
|
||||||
|
IN ULONG SectorsPerTrack,
|
||||||
|
IN ULONG NumberOfHeads,
|
||||||
|
IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer)
|
||||||
|
{
|
||||||
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue