From 8115ae07b65b38e5a3549d3fc8e8c2f0cb3dc3ed Mon Sep 17 00:00:00 2001 From: Rafal Kupiec Date: Mon, 29 Jan 2024 16:17:51 +0100 Subject: [PATCH] Unify variable types across project; use common type for storing numer of pages --- sdk/xtdk/bltypes.h | 14 +++++++------- sdk/xtdk/xtfw.h | 2 +- xtldr/console.c | 2 +- xtldr/debug.c | 2 +- xtldr/hardware.c | 8 ++++---- xtldr/includes/xtldr.h | 18 +++++++++--------- xtldr/memory.c | 28 ++++++++++++++-------------- xtldr/string.c | 28 ++++++++++++++-------------- xtldr/volume.c | 8 ++++---- 9 files changed, 55 insertions(+), 55 deletions(-) diff --git a/sdk/xtdk/bltypes.h b/sdk/xtdk/bltypes.h index d39b39d9..8690105a 100644 --- a/sdk/xtdk/bltypes.h +++ b/sdk/xtdk/bltypes.h @@ -40,7 +40,7 @@ #define XTBL_TUI_MAX_DIALOG_WIDTH 100 /* Boot Loader protocol routine pointers */ -typedef EFI_STATUS (*PBL_ALLOCATE_PAGES)(IN UINT64 Size, OUT PEFI_PHYSICAL_ADDRESS Memory); +typedef EFI_STATUS (*PBL_ALLOCATE_PAGES)(IN ULONGLONG Size, OUT PEFI_PHYSICAL_ADDRESS Memory); typedef EFI_STATUS (*PBL_ALLOCATE_POOL)(IN UINT_PTR Size, OUT PVOID *Memory); typedef VOID (*PBL_BOOTMENU_INITIALIZE_OS_LIST)(OUT PXTBL_BOOTMENU_ITEM MenuEntries, OUT PULONG EntriesCount, OUT PULONG DefaultId); typedef EFI_STATUS (*PBL_BOOTPROTO_BOOT_SYSTEM)(IN PXTBL_BOOT_PARAMETERS Parameters); @@ -52,7 +52,7 @@ typedef PWCHAR (*PBL_CONFIG_GET_VALUE)(IN CONST PWCHAR ConfigName); typedef VOID (*PBL_CONSOLE_CLEAR_SCREEN)(); typedef VOID (*PBL_CONSOLE_DISABLE_CURSOR)(); typedef VOID (*PBL_CONSOLE_ENABLE_CURSOR)(); -typedef VOID (*PBL_CONSOLE_PRINT)(IN PUINT16 Format, IN ...); +typedef VOID (*PBL_CONSOLE_PRINT)(IN PUSHORT Format, IN ...); typedef VOID (*PBL_CONSOLE_QUERY_MODE)(OUT PUINT_PTR ResX, OUT PUINT_PTR ResY); typedef VOID (*PBL_CONSOLE_READ_KEY_STROKE)(OUT PEFI_INPUT_KEY Key); typedef VOID (*PBL_CONSOLE_RESET_INPUT_BUFFER)(); @@ -60,7 +60,7 @@ typedef VOID (*PBL_CONSOLE_SET_ATTRIBUTES)(IN ULONGLONG Attributes); typedef VOID (*PBL_CONSOLE_SET_CURSOR_POSITION)(IN ULONGLONG PosX, IN ULONGLONG PosY); typedef VOID (*PBL_CONSOLE_WRITE)(IN PUSHORT String); typedef VOID (XTAPI *PBL_COPY_MEMORY)(OUT PVOID Destination, IN PCVOID Source, IN SIZE_T Length); -typedef VOID (*PBL_DEBUG_PRINT)(IN PUINT16 Format, IN ...); +typedef VOID (*PBL_DEBUG_PRINT)(IN PUSHORT Format, IN ...); typedef EFI_STATUS (*PBL_EXECIMAGE_GET_ENTRY_POINT)(IN PVOID ImagePointer, OUT PVOID *EntryPoint); typedef EFI_STATUS (*PBL_EXECIMAGE_GET_MACHINE_TYPE)(IN PVOID ImagePointer, OUT PUSHORT MachineType); typedef EFI_STATUS (*PBL_EXECIMAGE_GET_SECTION)(IN PVOID ImagePointer, IN PCHAR SectionName, OUT PULONG *RawData); @@ -74,7 +74,7 @@ typedef EFI_STATUS (*PBL_FIND_BOOT_PROTOCOL)(IN PWCHAR SystemType, OUT PEFI_GUID typedef EFI_STATUS (*PBL_FRAMEBUFFER_GET_DISPLAY_DRIVER)(OUT PEFI_GRAPHICS_PROTOCOL Protocol); typedef EFI_STATUS (*PBL_FRAMEBUFFER_GET_DISPLAY_INFORMATION)(OUT PXTBL_FRAMEBUFFER_INFORMATION FbInfo); typedef EFI_STATUS (*PBL_FRAMEBUFFER_INITIALIZE)(); -typedef EFI_STATUS (*PBL_FREE_PAGES)(IN UINT64 Size, IN EFI_PHYSICAL_ADDRESS Memory); +typedef EFI_STATUS (*PBL_FREE_PAGES)(IN ULONGLONG Size, IN EFI_PHYSICAL_ADDRESS Memory); typedef EFI_STATUS (*PBL_FREE_POOL)(IN PVOID Memory); typedef VOID (*PBL_GET_MAPPINGS_COUNT)(IN PXTBL_PAGE_MAPPING PageMap, OUT PULONG NumberOfMappings); typedef EFI_STATUS (*PBL_GET_MEMORY_MAP)(OUT PEFI_MEMORY_MAP MemoryMap); @@ -87,7 +87,7 @@ typedef EFI_STATUS (*PBL_LOCATE_PROTOCOL_HANDLES)(OUT PEFI_HANDLE *Handles, OUT typedef EFI_STATUS (*PBL_LOAD_EFI_IMAGE)(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath, IN PVOID ImageData, IN SIZE_T ImageSize, OUT PEFI_HANDLE ImageHandle); typedef EFI_STATUS (*PBL_MAP_EFI_MEMORY)(IN OUT PXTBL_PAGE_MAPPING PageMap, IN OUT PVOID *MemoryMapAddress); typedef EFI_STATUS (*PBL_MAP_PAGE)(IN PXTBL_PAGE_MAPPING PageMap, IN UINT_PTR VirtualAddress, IN UINT_PTR PhysicalAddress, IN UINT NumberOfPages); -typedef EFI_STATUS (*PBL_MAP_VIRTUAL_MEMORY)(IN OUT PXTBL_PAGE_MAPPING PageMap, IN PVOID VirtualAddress, IN PVOID PhysicalAddress, IN UINT NumberOfPages, IN LOADER_MEMORY_TYPE MemoryType); +typedef EFI_STATUS (*PBL_MAP_VIRTUAL_MEMORY)(IN OUT PXTBL_PAGE_MAPPING PageMap, IN PVOID VirtualAddress, IN PVOID PhysicalAddress, IN ULONGLONG NumberOfPages, IN LOADER_MEMORY_TYPE MemoryType); typedef EFI_STATUS (*PBL_OPEN_VOLUME)(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath, OUT PEFI_HANDLE DiskHandle, OUT PEFI_FILE_HANDLE *FsHandle); typedef EFI_STATUS (*PBL_OPEN_PROTOCOL)(OUT PEFI_HANDLE Handle, OUT PVOID *ProtocolHandler, IN PEFI_GUID ProtocolGuid); typedef EFI_STATUS (*PBL_OPEN_PROTOCOL_HANDLE)(IN EFI_HANDLE Handle, OUT PVOID *ProtocolHandler, IN PEFI_GUID ProtocolGuid); @@ -182,8 +182,8 @@ typedef struct _XTBL_MODULE_INFO PWCHAR ModuleDescription; LIST_ENTRY Dependencies; PVOID ModuleBase; - UINT64 ModuleSize; - UINT32 Revision; + ULONGLONG ModuleSize; + UINT Revision; PEFI_IMAGE_UNLOAD UnloadModule; } XTBL_MODULE_INFO, *PXTBL_MODULE_INFO; diff --git a/sdk/xtdk/xtfw.h b/sdk/xtdk/xtfw.h index a69ed772..fc4ed5be 100644 --- a/sdk/xtdk/xtfw.h +++ b/sdk/xtdk/xtfw.h @@ -117,7 +117,7 @@ typedef struct _LOADER_MEMORY_MAPPING LIST_ENTRY ListEntry; PVOID VirtualAddress; PVOID PhysicalAddress; - UINT NumberOfPages; + ULONGLONG NumberOfPages; LOADER_MEMORY_TYPE MemoryType; } LOADER_MEMORY_MAPPING, *PLOADER_MEMORY_MAPPING; diff --git a/xtldr/console.c b/xtldr/console.c index 8d7bca3c..9620297d 100644 --- a/xtldr/console.c +++ b/xtldr/console.c @@ -95,7 +95,7 @@ BlEnableConsoleCursor() */ XTCDECL VOID -BlConsolePrint(IN PUINT16 Format, +BlConsolePrint(IN PUSHORT Format, IN ...) { VA_LIST Arguments; diff --git a/xtldr/debug.c b/xtldr/debug.c index 221c6499..343be671 100644 --- a/xtldr/debug.c +++ b/xtldr/debug.c @@ -24,7 +24,7 @@ */ XTCDECL VOID -BlDebugPrint(IN PUINT16 Format, +BlDebugPrint(IN PUSHORT Format, IN ...) { VA_LIST Arguments; diff --git a/xtldr/hardware.c b/xtldr/hardware.c index a0fd6b6e..08b6a038 100644 --- a/xtldr/hardware.c +++ b/xtldr/hardware.c @@ -27,7 +27,7 @@ BlpActivateSerialIOController() PEFI_HANDLE PciHandle = NULL; PCI_COMMON_HEADER PciHeader; EFI_STATUS Status; - UINT64 Address; + ULONGLONG Address; /* Allocate memory for single EFI_HANDLE, what should be enough in most cases */ PciHandleSize = sizeof(EFI_HANDLE); @@ -83,9 +83,9 @@ BlpActivateSerialIOController() for(Function = 0; Function < PCI_MAX_FUNCTION; Function++) { /* Read configuration space */ - Address = ((UINT64)((((UINT_PTR) Bus) << 24) + (((UINT_PTR) Device) << 16) + - (((UINT_PTR) Function) << 8) + ((UINT_PTR) 0))); - PciDev->Pci.Read(PciDev, 2, Address, sizeof (PciHeader) / sizeof (UINT32), &PciHeader); + Address = ((ULONGLONG)((((UINT_PTR) Bus) << 24) + (((UINT_PTR) Device) << 16) + + (((UINT_PTR) Function) << 8) + ((UINT_PTR) 0))); + PciDev->Pci.Read(PciDev, 2, Address, sizeof (PciHeader) / sizeof (UINT), &PciHeader); /* Check if device exists */ if(PciHeader.VendorId == PCI_INVALID_VENDORID) diff --git a/xtldr/includes/xtldr.h b/xtldr/includes/xtldr.h index 032e4cba..59433505 100644 --- a/xtldr/includes/xtldr.h +++ b/xtldr/includes/xtldr.h @@ -21,7 +21,7 @@ typedef VOID (BLPRINTCHAR)(IN USHORT Character); /* XTLDR routines forward references */ XTCDECL EFI_STATUS -BlAllocateMemoryPages(IN UINT64 Pages, +BlAllocateMemoryPages(IN ULONGLONG Pages, OUT PEFI_PHYSICAL_ADDRESS Memory); XTCDECL @@ -52,7 +52,7 @@ BlCloseVolume(IN PEFI_HANDLE VolumeHandle); XTCDECL VOID -BlConsolePrint(IN PUINT16 Format, +BlConsolePrint(IN PUSHORT Format, IN ...); XTCDECL @@ -61,7 +61,7 @@ BlConsoleWrite(IN PUSHORT String); XTCDECL VOID -BlDebugPrint(IN PUINT16 Format, +BlDebugPrint(IN PUSHORT Format, IN ...); XTCDECL @@ -119,7 +119,7 @@ BlFindVolumeDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL FsHandle, XTCDECL EFI_STATUS -BlFreeMemoryPages(IN UINT64 Pages, +BlFreeMemoryPages(IN ULONGLONG Pages, IN EFI_PHYSICAL_ADDRESS Memory); XTCDECL @@ -226,7 +226,7 @@ EFI_STATUS BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap, IN PVOID VirtualAddress, IN PVOID PhysicalAddress, - IN UINT NumberOfPages, + IN ULONGLONG NumberOfPages, IN LOADER_MEMORY_TYPE MemoryType); XTCDECL @@ -469,13 +469,13 @@ BlpReadConfigFile(IN CONST PWCHAR ConfigDirectory, XTCDECL VOID BlpStringFormat(IN BLPRINTCHAR PrintCharRoutine, - IN PUINT16 Format, + IN PUSHORT Format, IN ...); XTCDECL VOID BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine, - IN PUINT16 Format, + IN PUSHORT Format, IN VA_LIST Arguments); XTCDECL @@ -505,8 +505,8 @@ BlpStringPrintUnsigned64(IN BLPRINTCHAR PrintCharRoutine, IN UINT_PTR Padding); XTCDECL -UINT64 -BlpStringReadPadding(IN PUINT16 *Format); +ULONGLONG +BlpStringReadPadding(IN PUSHORT *Format); XTCDECL VOID diff --git a/xtldr/memory.c b/xtldr/memory.c index 965dd734..1425e33e 100644 --- a/xtldr/memory.c +++ b/xtldr/memory.c @@ -24,7 +24,7 @@ */ XTCDECL EFI_STATUS -BlAllocateMemoryPages(IN UINT64 Pages, +BlAllocateMemoryPages(IN ULONGLONG Pages, OUT PEFI_PHYSICAL_ADDRESS Memory) { return EfiSystemTable->BootServices->AllocatePages(AllocateAnyPages, EfiLoaderData, Pages, Memory); @@ -67,7 +67,7 @@ BlAllocateMemoryPool(IN UINT_PTR Size, */ XTCDECL EFI_STATUS -BlFreeMemoryPages(IN UINT64 Pages, +BlFreeMemoryPages(IN ULONGLONG Pages, IN EFI_PHYSICAL_ADDRESS Memory) { return EfiSystemTable->BootServices->FreePages(Memory, Pages); @@ -328,7 +328,7 @@ EFI_STATUS BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap, IN PVOID VirtualAddress, IN PVOID PhysicalAddress, - IN UINT NumberOfPages, + IN ULONGLONG NumberOfPages, IN LOADER_MEMORY_TYPE MemoryType) { PLOADER_MEMORY_MAPPING Mapping1, Mapping2, Mapping3; @@ -352,7 +352,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap, Mapping1->MemoryType = MemoryType; /* Calculate the end of the physical address */ - PhysicalAddressEnd = (PUINT8)PhysicalAddress + (NumberOfPages * EFI_PAGE_SIZE) - 1; + PhysicalAddressEnd = (PUCHAR)PhysicalAddress + (NumberOfPages * EFI_PAGE_SIZE) - 1; /* Iterate through all the mappings already set to insert new mapping at the correct place */ ListEntry = PageMap->MemoryMap.Flink; @@ -360,7 +360,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap, { /* Take a mapping from the list and calculate its end of physical address */ Mapping2 = CONTAIN_RECORD(ListEntry, LOADER_MEMORY_MAPPING, ListEntry); - PhysicalAddress2End = (PUINT8)Mapping2->PhysicalAddress + (Mapping2->NumberOfPages * EFI_PAGE_SIZE) - 1 ; + PhysicalAddress2End = (PUCHAR)Mapping2->PhysicalAddress + (Mapping2->NumberOfPages * EFI_PAGE_SIZE) - 1 ; /* Check if new mapping is a subset of an existing mapping */ if(Mapping1->PhysicalAddress >= Mapping2->PhysicalAddress && PhysicalAddressEnd <= PhysicalAddress2End) @@ -384,7 +384,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap, } /* Calculate number of pages for this mapping */ - NumberOfMappedPages = ((PUINT8)PhysicalAddress2End - (PUINT8)PhysicalAddressEnd) / EFI_PAGE_SIZE; + NumberOfMappedPages = ((PUCHAR)PhysicalAddress2End - (PUCHAR)PhysicalAddressEnd) / EFI_PAGE_SIZE; if(NumberOfMappedPages > 0) { /* Pages associated to the mapping, allocate memory for it */ @@ -396,7 +396,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap, } /* Set mapping fields and insert it on the top */ - Mapping3->PhysicalAddress = (PUINT8)PhysicalAddressEnd + 1; + Mapping3->PhysicalAddress = (PUCHAR)PhysicalAddressEnd + 1; Mapping3->VirtualAddress = NULL; Mapping3->NumberOfPages = NumberOfMappedPages; Mapping3->MemoryType = Mapping2->MemoryType; @@ -404,9 +404,9 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap, } /* Calculate number of pages and the end of the physical address */ - Mapping2->NumberOfPages = ((PUINT8)PhysicalAddressEnd + 1 - - (PUINT8)Mapping2->PhysicalAddress) / EFI_PAGE_SIZE; - PhysicalAddress2End = (PUINT8)Mapping2->PhysicalAddress + (Mapping2->NumberOfPages * EFI_PAGE_SIZE) - 1; + Mapping2->NumberOfPages = ((PUCHAR)PhysicalAddressEnd + 1 - + (PUCHAR)Mapping2->PhysicalAddress) / EFI_PAGE_SIZE; + PhysicalAddress2End = (PUCHAR)Mapping2->PhysicalAddress + (Mapping2->NumberOfPages * EFI_PAGE_SIZE) - 1; } /* Check if they overlap */ @@ -420,7 +420,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap, } /* Calculate number of pages for this mapping */ - NumberOfMappedPages = ((PUINT8)PhysicalAddress2End + 1 - (PUINT8)Mapping1->PhysicalAddress) / EFI_PAGE_SIZE; + NumberOfMappedPages = ((PUCHAR)PhysicalAddress2End + 1 - (PUCHAR)Mapping1->PhysicalAddress) / EFI_PAGE_SIZE; if(NumberOfMappedPages > 0) { /* Pages associated to the mapping, allocate memory for it */ @@ -440,9 +440,9 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap, } /* Calculate number of pages and the end of the physical address */ - Mapping2->NumberOfPages = ((PUINT8)Mapping1->PhysicalAddress - - (PUINT8)Mapping2->PhysicalAddress) / EFI_PAGE_SIZE; - PhysicalAddress2End = (PUINT8)Mapping2->PhysicalAddress + (Mapping2->NumberOfPages * EFI_PAGE_SIZE) - 1; + Mapping2->NumberOfPages = ((PUCHAR)Mapping1->PhysicalAddress - + (PUCHAR)Mapping2->PhysicalAddress) / EFI_PAGE_SIZE; + PhysicalAddress2End = (PUCHAR)Mapping2->PhysicalAddress + (Mapping2->NumberOfPages * EFI_PAGE_SIZE) - 1; } /* Check if mapping is really needed */ diff --git a/xtldr/string.c b/xtldr/string.c index f082232b..b968511e 100644 --- a/xtldr/string.c +++ b/xtldr/string.c @@ -28,7 +28,7 @@ XTCDECL VOID BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine, - IN PUINT16 Format, + IN PUSHORT Format, IN VA_LIST Arguments) { PEFI_GUID Guid; @@ -46,7 +46,7 @@ BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine, { case L'b': /* Boolean */ - BlpStringFormat(PrintCharRoutine, L"%s", VA_ARG(Arguments, INT32) ? "TRUE" : "FALSE"); + BlpStringFormat(PrintCharRoutine, L"%s", VA_ARG(Arguments, INT) ? "TRUE" : "FALSE"); break; case L'c': /* Character */ @@ -54,7 +54,7 @@ BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine, break; case L'd': /* Signed 32-bit integer */ - BlpStringPrintSigned32(PrintCharRoutine, VA_ARG(Arguments, INT32), 10); + BlpStringPrintSigned32(PrintCharRoutine, VA_ARG(Arguments, INT), 10); break; case L'g': /* EFI GUID */ @@ -106,11 +106,11 @@ BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine, break; case L'u': /* Unsigned 32-bit integer */ - BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT32), 10, 0); + BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT), 10, 0); break; case L'x': /* Unsigned 32-bit hexadecimal integer */ - BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT32), 16, 0); + BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT), 16, 0); break; case L'0': /* Zero padded numbers */ @@ -120,7 +120,7 @@ BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine, { case L'd': /* Zero-padded, signed 32-bit integer */ - BlpStringPrintSigned32(PrintCharRoutine, VA_ARG(Arguments, INT32), 10); + BlpStringPrintSigned32(PrintCharRoutine, VA_ARG(Arguments, INT), 10); break; case L'l': /* 64-bit numbers */ @@ -146,11 +146,11 @@ BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine, break; case L'u': /* Zero-padded, unsigned 32-bit integer */ - BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT32), 10, PaddingCount); + BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT), 10, PaddingCount); break; case L'x': /* Zero-padded, unsigned 32-bit hexadecimal integer */ - BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT32), 16, PaddingCount); + BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT), 16, PaddingCount); break; default: /* Unknown by default */ @@ -203,7 +203,7 @@ BlpStringPrint(IN IN BLPRINTCHAR PrintCharRoutine, XTCDECL VOID BlpStringFormat(IN BLPRINTCHAR PrintCharRoutine, - IN PUINT16 Format, + IN PUSHORT Format, IN ...) { VA_LIST Arguments; @@ -371,9 +371,9 @@ BlpStringPrintUnsigned64(IN BLPRINTCHAR PrintCharRoutine, IN UINT_PTR Base, IN UINT_PTR Padding) { - UINT16 Buffer[20]; + USHORT Buffer[20]; UINT_PTR NumberLength; - PUINT16 Pointer; + PUSHORT Pointer; /* Set pointer to the end of buffer */ Pointer = Buffer + ARRAY_SIZE(Buffer); @@ -417,11 +417,11 @@ BlpStringPrintUnsigned64(IN BLPRINTCHAR PrintCharRoutine, * @since XT 1.0 */ XTCDECL -UINT64 -BlpStringReadPadding(IN PUINT16 *Format) +ULONGLONG +BlpStringReadPadding(IN PUSHORT *Format) { ULONG Count = 0; - PUINT16 Fmt = *Format; + PUSHORT Fmt = *Format; /* Read the padding */ for(;; ++Fmt) diff --git a/xtldr/volume.c b/xtldr/volume.c index 3692c005..d4c9378a 100644 --- a/xtldr/volume.c +++ b/xtldr/volume.c @@ -922,12 +922,12 @@ BlpDuplicateDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath) /* Get the device path length */ while(TRUE) { - Length += *(PUINT16)DevicePath->Length; + Length += *(PUSHORT)DevicePath->Length; if(DevicePathNode->Type == EFI_END_DEVICE_PATH) { break; } - DevicePathNode = (PEFI_DEVICE_PATH_PROTOCOL)((PUCHAR)DevicePathNode + *(PUINT16)DevicePath->Length); + DevicePathNode = (PEFI_DEVICE_PATH_PROTOCOL)((PUCHAR)DevicePathNode + *(PUSHORT)DevicePath->Length); } /* Check length */ @@ -1044,8 +1044,8 @@ BlpFindParentBlockDevice(IN PLIST_ENTRY BlockDevices, } /* Get child and parent node lengths */ - ChildLength = *(PUINT16)ChildDevicePath->Length; - ParentLength = *(PUINT16)ParentDevicePath->Length; + ChildLength = *(PUSHORT)ChildDevicePath->Length; + ParentLength = *(PUSHORT)ParentDevicePath->Length; /* Check if lengths match */ if(ChildLength != ParentLength)