https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6dcf3c29e0ef73c138bd7…
commit 6dcf3c29e0ef73c138bd7e3455ca635d613acc48
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Tue Feb 6 01:17:11 2018 +0100
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sat Aug 4 19:19:34 2018 +0200
[FREELDR] Fix 64 bit issues
---
boot/freeldr/freeldr/arch/i386/machpc.c | 2 +-
boot/freeldr/freeldr/disk/partition.c | 5 +++--
boot/freeldr/freeldr/include/mm.h | 3 ++-
boot/freeldr/freeldr/lib/debug.c | 14 ++++++++++----
boot/freeldr/freeldr/lib/fs/pxe.c | 14 +++++++-------
boot/freeldr/freeldr/ntldr/registry.c | 2 +-
6 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/boot/freeldr/freeldr/arch/i386/machpc.c
b/boot/freeldr/freeldr/arch/i386/machpc.c
index 64b6a43a86..527b944dee 100644
--- a/boot/freeldr/freeldr/arch/i386/machpc.c
+++ b/boot/freeldr/freeldr/arch/i386/machpc.c
@@ -643,7 +643,7 @@ DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
for (i = 0; i < MAX_COM_PORTS; i++, BasePtr++)
{
Base = (ULONG) * BasePtr;
- if (Base == 0 || !CpDoesPortExist((PUCHAR)Base))
+ if ((Base == 0) || !CpDoesPortExist(UlongToPtr(Base)))
continue;
TRACE("Found COM%u port at 0x%x\n", i + 1, Base);
diff --git a/boot/freeldr/freeldr/disk/partition.c
b/boot/freeldr/freeldr/disk/partition.c
index df2d1a7055..1feaf5105c 100644
--- a/boot/freeldr/freeldr/disk/partition.c
+++ b/boot/freeldr/freeldr/disk/partition.c
@@ -253,6 +253,7 @@ BOOLEAN DiskReadBootRecord(UCHAR DriveNumber, ULONGLONG
LogicalSectorNumber, PMA
return TRUE;
}
+#ifndef _M_AMD64
NTSTATUS
NTAPI
IopReadBootRecord(
@@ -261,7 +262,7 @@ IopReadBootRecord(
IN ULONG SectorSize,
OUT PMASTER_BOOT_RECORD BootRecord)
{
- ULONG FileId = (ULONG)DeviceObject;
+ ULONG_PTR FileId = (ULONG_PTR)DeviceObject;
LARGE_INTEGER Position;
ULONG BytesRead;
ARC_STATUS Status;
@@ -399,5 +400,5 @@ IoReadPartitionTable(
*PartitionBuffer = Partitions;
return STATUS_SUCCESS;
}
-
+#endif // _M_AMD64
#endif
diff --git a/boot/freeldr/freeldr/include/mm.h b/boot/freeldr/freeldr/include/mm.h
index d9ada754cb..d29fe6087f 100644
--- a/boot/freeldr/freeldr/include/mm.h
+++ b/boot/freeldr/freeldr/include/mm.h
@@ -176,7 +176,8 @@ FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
FORCEINLINE
PVOID
FrLdrTempAlloc(
- ULONG Size, ULONG Tag)
+ _In_ SIZE_T Size,
+ _In_ ULONG Tag)
{
return FrLdrHeapAllocateEx(FrLdrTempHeap, Size, Tag);
}
diff --git a/boot/freeldr/freeldr/lib/debug.c b/boot/freeldr/freeldr/lib/debug.c
index a0520a99be..d2143ad599 100644
--- a/boot/freeldr/freeldr/lib/debug.c
+++ b/boot/freeldr/freeldr/lib/debug.c
@@ -454,7 +454,7 @@ MsgBoxPrint(const char *Format, ...)
return 0;
}
-// DECLSPEC_NORETURN
+DECLSPEC_NORETURN
VOID
NTAPI
KeBugCheckEx(
@@ -465,9 +465,15 @@ KeBugCheckEx(
IN ULONG_PTR BugCheckParameter4)
{
char Buffer[70];
- sprintf(Buffer, "*** STOP: 0x%08lX (0x%08lX, 0x%08lX, 0x%08lX, 0x%08lX)",
- BugCheckCode, BugCheckParameter1, BugCheckParameter2,
- BugCheckParameter3, BugCheckParameter4);
+
+ sprintf(Buffer,
+ "*** STOP: 0x%08lX (0x%p,0x%p,0x%p,0x%p)",
+ BugCheckCode,
+ (PVOID)BugCheckParameter1,
+ (PVOID)BugCheckParameter2,
+ (PVOID)BugCheckParameter3,
+ (PVOID)BugCheckParameter4);
+
UiMessageBoxCritical(Buffer);
ASSERT(FALSE);
for (;;);
diff --git a/boot/freeldr/freeldr/lib/fs/pxe.c b/boot/freeldr/freeldr/lib/fs/pxe.c
index ea91710a4f..71f7e37bdd 100644
--- a/boot/freeldr/freeldr/lib/fs/pxe.c
+++ b/boot/freeldr/freeldr/lib/fs/pxe.c
@@ -45,9 +45,9 @@ FindPxeStructure(VOID)
/* Find the '!PXE' structure */
Ptr = (PPXE)0xA0000;
- while ((ULONG)Ptr > 0x10000)
+ while ((ULONG_PTR)Ptr > 0x10000)
{
- Ptr = (PPXE)((ULONG)Ptr - 0x10);
+ Ptr = (PPXE)((ULONG_PTR)Ptr - 0x10);
/* Look for signature */
if (memcmp(Ptr, "!PXE", 4) != 0)
@@ -224,8 +224,8 @@ static ARC_STATUS PxeRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG*
Count)
return EBADF;
RtlZeroMemory(&readData, sizeof(readData));
- readData.Buffer.segment = ((UINT32)_Packet & 0xf0000) / 16;
- readData.Buffer.offset = (UINT32)_Packet & 0xffff;
+ readData.Buffer.segment = ((ULONG_PTR)_Packet & 0xf0000) / 16;
+ readData.Buffer.offset = (ULONG_PTR)_Packet & 0xffff;
// Get new packets as required
while (N > 0)
@@ -276,8 +276,8 @@ static ARC_STATUS PxeSeek(ULONG FileId, LARGE_INTEGER* Position,
SEEKMODE SeekMo
}
RtlZeroMemory(&readData, sizeof(readData));
- readData.Buffer.segment = ((UINT32)_Packet & 0xf0000) / 16;
- readData.Buffer.offset = (UINT32)_Packet & 0xffff;
+ readData.Buffer.segment = ((ULONG_PTR)_Packet & 0xf0000) / 16;
+ readData.Buffer.offset = (ULONG_PTR)_Packet & 0xffff;
// Get new packets as required
while (Position->LowPart > _CachedLength)
@@ -363,7 +363,7 @@ static BOOLEAN GetCachedInfo(VOID)
return FALSE;
if (Data.BufferSize < 36)
return FALSE;
- Packet = (UCHAR*)((UINT32)(Data.Buffer.segment << 4) + Data.Buffer.offset);
+ Packet = (UCHAR*)((ULONG_PTR)(Data.Buffer.segment << 4) + Data.Buffer.offset);
RtlCopyMemory(&_ServerIP, Packet + 20, sizeof(IP4));
return TRUE;
}
diff --git a/boot/freeldr/freeldr/ntldr/registry.c
b/boot/freeldr/freeldr/ntldr/registry.c
index 0c84127a14..6b826bc23c 100644
--- a/boot/freeldr/freeldr/ntldr/registry.c
+++ b/boot/freeldr/freeldr/ntldr/registry.c
@@ -204,7 +204,7 @@ GetNextPathElement(
RemainingPath->Length -= sizeof(WCHAR);
}
- NextElement->Length = (RemainingPath->Buffer - NextElement->Buffer) *
sizeof(WCHAR);
+ NextElement->Length = (USHORT)(RemainingPath->Buffer - NextElement->Buffer)
* sizeof(WCHAR);
NextElement->MaximumLength = NextElement->Length;
/* Check if the path element ended with a path separator */