135 EfiStatus = BlockProtocol->
ReadBlocks(BlockProtocol,
182 if (OperationType == 1)
184 for (FailureCount = 0; FailureCount < 3; FailureCount++)
195 for (FailureCount = 0; FailureCount < 3; FailureCount++)
328 if (OperationType == 1)
379 if (OffsetEnd <
Size)
386 if (AlignedOffsetEnd < OffsetEnd)
470 if (MaxOffset < BlockDevice->BlockSize)
475 if (LastOffset < MaxOffset)
488 RemainingOffset = LastOffset -
Offset + 1;
490 if (DesiredSize !=
FALSE)
492 RealSize = *DesiredSize;
499 if (RemainingOffset < RealSize)
508 RealSize = RemainingOffset;
575 DeviceInformation->BlockDeviceInfo.Offset;
589 BlockDevice->Unknown = DeviceInformation->BlockDeviceInfo.Unknown;
603 DeviceEntry->DeviceSpecificData,
604 sizeof(DeviceInformation->BlockDeviceInfo));
628 ParentDisk = &InputDevice->Partition.Disk;
653 if (!DeviceInformation)
690 if (!DeviceInformation)
820 if ((Device1) && (Device2) && (Device1->DeviceType == Device2->DeviceType))
823 DeviceSize =
max(Device1->Size, Device2->Size);
952 if (
Handle == ProtocolInterface->Handle)
961 (
PVOID*)&DevicePath);
971 if (ParentDevicePath == ProtocolInterface->Interface)
974 ChildProtocolInterface->Handle =
Handle;
975 ChildProtocolInterface->Interface = DevicePath;
1019 Device = DeviceEntry->DeviceDescriptor;
1041 EfiPrintf(
L"Pass %d, Leaf node: %p Type: %d\r\n",
i, LeafNode, LeafNode->
Type);
1054 Device->Local.FloppyDisk.DriveNumber = AcpiPath->
UID;
1090 &
Device->Local.HardDisk.Gpt.PartitionSignature);
1095 &
Device->Local.HardDisk.Gpt.PartitionSignature,
1115 Device->Local.FloppyDisk.DriveNumber = 0;
1224 Device->Size =
sizeof(*Device);
1247 *DeviceEntry = IoDeviceEntry;
1301 LocalDeviceInfo = &
Device->Partition.Disk;
1306 LocalDeviceInfo = &
Device->Local;
1333 EfiLocalDeviceInfo = &EfiDevice->
Partition.Disk;
1338 EfiLocalDeviceInfo = &EfiDevice->
Local;
1342 if (EfiLocalDeviceInfo->
Type != LocalDeviceInfo->
Type)
1349 switch (EfiLocalDeviceInfo->
Type)
1356 sizeof(LocalDeviceInfo->
HardDisk)) ==
1381 sizeof(LocalDeviceInfo->
RamDisk)) ==
1382 sizeof(LocalDeviceInfo->
RamDisk))
1392 &LocalDeviceInfo->
File,
1393 sizeof(LocalDeviceInfo->
File)) ==
1394 sizeof(LocalDeviceInfo->
File))
1453 DeviceMatch =
FALSE;
1471 sizeof(DeviceHandles[
i]));
1516 sizeof(*BlockIoDevice));
1594 DeviceEntry->Callbacks.Close =
DiskClose;
1719 if (((
Flags & 8) || !(DeviceEntry->
Flags & 8)) &&
1964 sizeof(DeviceEntry->Callbacks));
1986 if (FoundDeviceEntry)
1993 sizeof(DeviceEntry->Callbacks));
2004 switch (
Device->Local.Type)
2087 if (DeviceEntry ==
NULL)
2103 DeviceEntry->
Flags = ~BL_DEVICE_ENTRY_OPENED;
2161 Device = LocateDeviceDescriptor;
2209 DeviceEntry->
Flags |= 8;
2225 NextEntry = ListHead->
Flink;
2226 while (NextEntry != ListHead)
2242 NextEntry = NextEntry->
Flink;
2329#if BL_BITLOCKER_SUPPORT
2331 Status = FvebInitialize();
#define MEDIA_DEVICE_PATH
#define SIGNATURE_TYPE_GUID
#define MEDIA_HARDDRIVE_DP
#define SIGNATURE_TYPE_MBR
#define EISA_PNP_ID(_PNPId)
#define ReadBuffer(BaseIoAddress, Buffer, Count)
NTSTATUS EfiGetNtStatusCode(_In_ EFI_STATUS EfiStatus)
EFI_DEVICE_PATH * EfiIsDevicePathParent(_In_ EFI_DEVICE_PATH *DevicePath1, _In_ EFI_DEVICE_PATH *DevicePath2)
#define BL_BLOCK_DEVICE_VIRTUAL_FLAG
#define BL_DEVICE_READ_ACCESS
NTSTATUS EfiCloseProtocol(_In_ EFI_HANDLE Handle, _In_ EFI_GUID *Protocol)
struct _BL_DEVICE_DESCRIPTOR * PBL_DEVICE_DESCRIPTOR
#define BL_DEVICE_ENTRY_WRITE_ACCESS
VOID EfiPrintf(_In_ PWCHAR Format,...)
NTSTATUS BlHtStore(_In_ ULONG TableId, _In_ PBL_HASH_ENTRY Entry, _In_ PVOID Data, _In_ ULONG DataSize)
#define BL_DEVICE_WRITE_ACCESS
EFI_GUID EfiDevicePathProtocol
EFI_GUID EfiBlockIoProtocol
#define BL_MM_INCLUDE_MAPPED_ALLOCATED
NTSTATUS EfiOpenProtocol(_In_ EFI_HANDLE Handle, _In_ EFI_GUID *Protocol, _Out_ PVOID *Interface)
NTSTATUS MmPapAllocatePagesInRange(_Inout_ PVOID *PhysicalAddress, _In_ BL_MEMORY_TYPE MemoryType, _In_ ULONGLONG Pages, _In_ ULONG Attributes, _In_ ULONG Alignment, _In_opt_ PBL_ADDRESS_RANGE Range, _In_ ULONG Type)
PVOID BlMmAllocateHeap(_In_ SIZE_T Size)
NTSTATUS BlHtCreate(_In_ ULONG Size, _In_ PBL_HASH_TABLE_HASH_FUNCTION HashFunction, _In_ PBL_HASH_TABLE_COMPARE_FUNCTION CompareFunction, _Out_ PULONG Id)
PVOID BlTblFindEntry(_In_ PVOID *Table, _In_ ULONG Count, _Out_ PULONG EntryIndex, _In_ PBL_TBL_LOOKUP_ROUTINE Callback, _In_ PVOID Argument1, _In_ PVOID Argument2, _In_ PVOID Argument3, _In_ PVOID Argument4)
struct _BL_BLOCK_DEVICE * PBL_BLOCK_DEVICE
NTSTATUS MmPapFreePages(_In_ PVOID Address, _In_ ULONG WhichList)
PBL_DEVICE_DESCRIPTOR BlpBootDevice
#define BL_DEVICE_ENTRY_OPENED
VOID BlpArchSwitchContext(_In_ BL_ARCH_MODE NewMode)
struct _BL_DEVICE_ENTRY * PBL_DEVICE_ENTRY
NTSTATUS TblDoNotPurgeEntry(_In_ PVOID Entry)
PBL_ARCH_CONTEXT CurrentExecutionContext
#define BL_BLOCK_DEVICE_PRESENT_FLAG
NTSTATUS BlHtDelete(_In_ ULONG TableId, _In_ PBL_HASH_ENTRY Entry)
NTSTATUS BcInitialize(VOID)
NTSTATUS BlTblSetEntry(_Inout_ PVOID **Table, _Inout_ PULONG Count, _In_ PVOID Entry, _Out_ PULONG EntryIndex, _In_ PBL_TBL_SET_ROUTINE Callback)
#define BL_BLOCK_DEVICE_REMOVABLE_FLAG
NTSTATUS BlTblMap(_In_ PVOID *Table, _In_ ULONG Count, _In_ PBL_TBL_MAP_ROUTINE MapCallback)
EFI_DEVICE_PATH * EfiGetLeafNode(_In_ EFI_DEVICE_PATH *DevicePath)
#define BL_HT_VALUE_IS_INLINE
#define BL_DEVICE_ENTRY_READ_ACCESS
NTSTATUS BlMmFreeHeap(_In_ PVOID Buffer)
NTSTATUS BlpIoRegisterDestroyRoutine(_In_ PBL_IO_DESTROY_ROUTINE DestroyRoutine)
NTSTATUS EfiLocateHandleBuffer(_In_ EFI_LOCATE_SEARCH_TYPE SearchType, _In_ EFI_GUID *Protocol, _Inout_ PULONG HandleCount, _Inout_ EFI_HANDLE **Buffer)
NTSTATUS BlHtLookup(_In_ ULONG TableId, _In_ PBL_HASH_ENTRY Entry, _Out_ PBL_HASH_VALUE *Value)
enum _BL_ARCH_MODE BL_ARCH_MODE
NTSTATUS BlockIoEfiCompareDevice(_In_ PBL_DEVICE_DESCRIPTOR Device, _In_ EFI_HANDLE Handle)
struct _BL_DEVICE_IO_INFORMATION BL_DEVICE_IO_INFORMATION
NTSTATUS BlockIoGetGPTDiskSignature(_In_ PBL_DEVICE_ENTRY DeviceEntry, _Out_ PGUID DiskSignature)
BL_DEVICE_IO_INFORMATION DmDeviceIoInformation
NTSTATUS BlockIoEfiGetChildHandle(_In_ PBL_PROTOCOL_HANDLE ProtocolInterface, _In_ PBL_PROTOCOL_HANDLE ChildProtocolInterface)
BOOLEAN BlDeviceIsVirtualPartitionDevice(_In_ PBL_DEVICE_DESCRIPTOR InputDevice, _Outptr_ PBL_DEVICE_DESCRIPTOR *VirtualDevice)
NTSTATUS BlDeviceGetInformation(_In_ ULONG DeviceId, _Out_ PBL_DEVICE_INFORMATION DeviceInformation)
NTSTATUS BlDeviceReadAtOffset(_In_ ULONG DeviceId, _In_ ULONG Size, _In_ ULONGLONG Offset, _In_ PVOID Buffer, _Out_ PULONG BytesRead)
BL_DEVICE_CALLBACKS PartitionDeviceFunctionTable
NTSTATUS SpOpen(_In_ PBL_DEVICE_DESCRIPTOR Device, _In_ PBL_DEVICE_ENTRY DeviceEntry)
NTSTATUS BlockIopReadPhysicalDevice(_In_ PBL_DEVICE_ENTRY DeviceEntry, _In_ PVOID Buffer, _In_ ULONG Size, _Out_ PULONG BytesRead)
NTSTATUS BlockIoDeviceTableDestroy(VOID)
BL_DEVICE_CALLBACKS VirtualDiskDeviceFunctionTable
NTSTATUS BlockIoEfiFlush(VOID)
NTSTATUS UdpOpen(_In_ PBL_DEVICE_DESCRIPTOR Device, _In_ PBL_DEVICE_ENTRY DeviceEntry)
BOOLEAN DeviceTableCompare(_In_ PVOID Entry, _In_ PVOID Argument1, _In_ PVOID Argument2, _Inout_ PVOID Argument3, _Inout_ PVOID Argument4)
ULONG BlockIoDeviceTableEntries
NTSTATUS PartitionOpen(_In_ PBL_DEVICE_DESCRIPTOR Device, _In_ PBL_DEVICE_ENTRY DeviceEntry)
NTSTATUS BlockIoDeviceTableDestroyEntry(_In_ PVOID Entry, _In_ ULONG DeviceId)
struct _BL_REGISTERED_DEVICE BL_REGISTERED_DEVICE
BL_DEVICE_CALLBACKS FileDeviceFunctionTable
NTSTATUS BlockIopReadWriteVirtualDevice(_In_ PBL_DEVICE_ENTRY DeviceEntry, _In_ PVOID Buffer, _In_ ULONG Size, _In_ ULONG Operation, _Out_ PULONG BytesRead)
NTSTATUS BlockIoEfiCreateDeviceEntry(_In_ PBL_DEVICE_ENTRY *DeviceEntry, _Out_ PVOID Handle)
BOOLEAN BlpDeviceCompare(_In_ PBL_DEVICE_DESCRIPTOR Device1, _In_ PBL_DEVICE_DESCRIPTOR Device2)
struct _BL_REGISTERED_DEVICE * PBL_REGISTERED_DEVICE
NTSTATUS BlpDeviceOpen(_In_ PBL_DEVICE_DESCRIPTOR Device, _In_ ULONG Flags, _In_ ULONG Unknown, _Out_ PULONG DeviceId)
NTSTATUS BlDeviceClose(_In_ ULONG DeviceId)
NTSTATUS BlockIoSetInformation(_In_ PBL_DEVICE_ENTRY DeviceEntry, _Out_ PBL_DEVICE_INFORMATION DeviceInformation)
NTSTATUS BlockIopOperation(_In_ PBL_DEVICE_ENTRY DeviceEntry, _In_ PVOID Buffer, _In_ ULONG BlockCount, _In_ ULONG OperationType)
ULONG BlockIoFirmwareCdromCount
BL_DEVICE_CALLBACKS SerialPortFunctionTable
ULONG BlockIopPartialBlockBufferSize
BL_DEVICE_CALLBACKS DiskDeviceFunctionTable
NTSTATUS DeviceTablePurge(_In_ PVOID Entry)
struct _BL_DEVICE_IO_INFORMATION * PBL_DEVICE_IO_INFORMATION
ULONG BlockIopAlignedBufferSize
ULONG BlockIoEfiHashFunction(_In_ PBL_HASH_ENTRY Entry, _In_ ULONG TableSize)
NTSTATUS BlockIoFirmwareRead(_In_ PBL_BLOCK_DEVICE BlockDevice, _In_ PVOID Buffer, _In_ ULONGLONG Block, _In_ ULONGLONG BlockCount)
ULONG BlockIopReadBlockBufferSize
PVOID BlockIopPartialBlockBuffer
PVOID BlockIopReadBlockBuffer
NTSTATUS FileDeviceOpen(_In_ PBL_DEVICE_DESCRIPTOR Device, _In_ PBL_DEVICE_ENTRY DeviceEntry)
BL_DEVICE_CALLBACKS BlockIoDeviceFunctionTable
NTSTATUS BlockIopFreeAllocations(_In_ PBL_BLOCK_DEVICE BlockDevice)
NTSTATUS BlDeviceRead(_In_ ULONG DeviceId, _In_ PVOID Buffer, _In_ ULONG Size, _Out_opt_ PULONG BytesRead)
LIST_ENTRY DmRegisteredDevices
NTSTATUS DeviceTableDestroyEntry(_In_ PVOID Entry, _In_ ULONG DeviceId)
NTSTATUS BlockIopReadUsingPrefetch(_In_ PBL_DEVICE_ENTRY DeviceEntry, _In_ PVOID Buffer, _In_ ULONG BlockCount)
NTSTATUS BlockIoEfiGetDeviceInformation(_In_ PBL_DEVICE_ENTRY DeviceEntry)
NTSTATUS BlockIoEfiReset(VOID)
NTSTATUS BlockIoEfiGetBlockIoInformation(_In_ PBL_BLOCK_DEVICE BlockDevice)
NTSTATUS BlockIopDestroy(VOID)
BL_DEVICE_CALLBACKS UdpFunctionTable
PVOID BlockIopPrefetchBuffer
NTSTATUS BlockIopBlockInformationCheck(_In_ PBL_BLOCK_DEVICE BlockDevice, _In_opt_ PULONG DesiredSize, _Out_opt_ PULONG Size, _Out_opt_ PULONG OutputAdjustedSize)
BOOLEAN BlockIoInitialized
NTSTATUS BlockIoFirmwareWrite(_In_ PBL_BLOCK_DEVICE BlockDevice, _In_ PVOID Buffer, _In_ ULONGLONG Block, _In_ ULONGLONG BlockCount)
PVOID * BlockIoDeviceTable
PVOID BlockIopAlignedBuffer
NTSTATUS BlDeviceSetInformation(_In_ ULONG DeviceId, _Out_ PBL_DEVICE_INFORMATION DeviceInformation)
ULONG BlockIoFirmwareRemovableDiskCount
NTSTATUS DiskClose(_In_ PBL_DEVICE_ENTRY DeviceEntry)
NTSTATUS BlockIopFirmwareOperation(PBL_DEVICE_ENTRY DeviceEntry, _In_ PVOID Buffer, _In_ ULONGLONG Block, _In_ ULONGLONG BlockCount, _In_ ULONG OperationType)
NTSTATUS RdDeviceOpen(_In_ PBL_DEVICE_DESCRIPTOR Device, _In_ PBL_DEVICE_ENTRY DeviceEntry)
NTSTATUS BlockIoGetInformation(_In_ PBL_DEVICE_ENTRY DeviceEntry, _Out_ PBL_DEVICE_INFORMATION DeviceInformation)
NTSTATUS BlpDeviceInitialize(VOID)
ULONG BlockIoFirmwareRawDiskCount
NTSTATUS BlockIopAllocateAlignedBuffer(_Inout_ PVOID *Buffer, _Inout_ PULONG BufferSize, _In_ ULONG Size, _In_ ULONG Alignment)
NTSTATUS BlpDeviceResolveLocate(_In_ PBL_DEVICE_DESCRIPTOR InputDevice, _Out_ PBL_DEVICE_DESCRIPTOR *LocateDevice)
NTSTATUS BlockIopInitialize(VOID)
NTSTATUS VhdFileDeviceOpen(_In_ PBL_DEVICE_DESCRIPTOR Device, _In_ PBL_DEVICE_ENTRY DeviceEntry)
BOOLEAN BlockIoDeviceTableCompare(_In_ PVOID Entry, _In_ PVOID Argument1, _In_ PVOID Argument2, _In_ PVOID Argument3, _In_ PVOID Argument4)
NTSTATUS DiskOpen(_In_ PBL_DEVICE_DESCRIPTOR Device, _In_ PBL_DEVICE_ENTRY DeviceEntry)
NTSTATUS BlockIoOpen(_In_ PBL_DEVICE_DESCRIPTOR Device, _In_ PBL_DEVICE_ENTRY DeviceEntry)
BL_DEVICE_CALLBACKS RamDiskDeviceFunctionTable
NTSTATUS BlockIopFreeAlignedBuffer(_Inout_ PVOID *Buffer, _Inout_ PULONG BufferSize)
NTSTATUS BlockIoRead(_In_ PBL_DEVICE_ENTRY DeviceEntry, _In_ PVOID Buffer, _In_ ULONG Size, _Out_ PULONG BytesRead)
NTSTATUS BlockIoFirmwareOpen(_In_ PBL_DEVICE_DESCRIPTOR Device, _In_ PBL_BLOCK_DEVICE BlockIoDevice)
#define STATUS_NOT_SUPPORTED
#define STATUS_NOT_IMPLEMENTED
#define NT_SUCCESS(StatCode)
#define RtlCompareMemory(s1, s2, l)
#define InitializeListHead(ListHead)
union Alignment_ Alignment
InternalIoctlParams Argument4
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
#define RtlEqualMemory(dst, src, len)
_In_ ULONG _In_ ULONG Offset
#define STATUS_MEDIA_CHANGED
#define STATUS_INTEGER_OVERFLOW
#define STATUS_DEVICE_NOT_READY
base of all file and directory entries
PBL_DEVICE_GET_INFORMATION GetInformation
PBL_DEVICE_SET_INFORMATION SetInformation
struct _BL_DEVICE_DESCRIPTOR::@132::@135 Partition
PBL_DEVICE_DESCRIPTOR DeviceDescriptor
BL_DEVICE_CALLBACKS Callbacks
BL_HARDDISK_DEVICE VirtualHardDisk
BL_HARDDISK_DEVICE HardDisk
BL_LOCAL_DEVICE_TYPE Type
struct _BL_LOCAL_DEVICE::@128::@131 RamDisk
struct _BL_LOCAL_DEVICE::@128::@130 FloppyDisk
BL_DEVICE_CALLBACKS Callbacks
EFI_BLOCK_IO_MEDIA * Media
EFI_BLOCK_READ ReadBlocks
struct _LIST_ENTRY * Flink
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INVALID_PARAMETER
#define STATUS_NO_SUCH_DEVICE
#define STATUS_UNSUCCESSFUL
_Must_inspect_result_ _In_ WDFDEVICE Device
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _In_ PWDF_USB_CONTROL_SETUP_PACKET _In_opt_ PWDF_MEMORY_DESCRIPTOR _Out_opt_ PULONG BytesTransferred
_Must_inspect_result_ _In_ ULONG Flags
_IRQL_requires_same_ _In_opt_ PVOID Argument1
_Must_inspect_result_ typedef _Out_ PULONG TableSize
#define ROUND_TO_PAGES(Size)