[FREELDR] Fix 64 bit issues

This commit is contained in:
Timo Kreuzer 2018-02-06 01:17:11 +01:00
parent 7cf7b27a3a
commit 6dcf3c29e0
6 changed files with 24 additions and 16 deletions

View file

@ -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);

View file

@ -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

View file

@ -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);
}

View file

@ -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 (;;);

View file

@ -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;
}

View file

@ -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 */