mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:52:59 +00:00
[BOOTLIB] Fix 64 bit issues (#433)
This commit is contained in:
parent
8bbbab534a
commit
3be4081607
18 changed files with 85 additions and 58 deletions
|
@ -231,7 +231,7 @@ BmpFwGetApplicationDirectoryPath (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG i, AppPathLength;
|
SIZE_T i, AppPathLength;
|
||||||
PWCHAR ApplicationPath, PathCopy;
|
PWCHAR ApplicationPath, PathCopy;
|
||||||
|
|
||||||
/* Clear the incoming string */
|
/* Clear the incoming string */
|
||||||
|
@ -257,11 +257,11 @@ BmpFwGetApplicationDirectoryPath (
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we have space for one more character */
|
/* Check if we have space for one more character */
|
||||||
Status = RtlULongAdd(i, 1, &AppPathLength);
|
Status = RtlSIZETAdd(i, 1, &AppPathLength);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Check if it's safe to multiply by two */
|
/* Check if it's safe to multiply by two */
|
||||||
Status = RtlULongMult(AppPathLength, sizeof(WCHAR), &AppPathLength);
|
Status = RtlSIZETMult(AppPathLength, sizeof(WCHAR), &AppPathLength);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Allocate a copy for the string */
|
/* Allocate a copy for the string */
|
||||||
|
@ -647,11 +647,11 @@ BmpFwGetFullPath (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG BootDirLength, PathLength;
|
SIZE_T BootDirLength, PathLength;
|
||||||
|
|
||||||
/* Compute the length of the directory, and add a NUL */
|
/* Compute the length of the directory, and add a NUL */
|
||||||
BootDirLength = wcslen(BootDirectory);
|
BootDirLength = wcslen(BootDirectory);
|
||||||
Status = RtlULongAdd(BootDirLength, 1, &BootDirLength);
|
Status = RtlSIZETAdd(BootDirLength, 1, &BootDirLength);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
|
@ -659,14 +659,14 @@ BmpFwGetFullPath (
|
||||||
|
|
||||||
/* Add the length of the file, make sure it fits */
|
/* Add the length of the file, make sure it fits */
|
||||||
PathLength = wcslen(FileName);
|
PathLength = wcslen(FileName);
|
||||||
Status = RtlULongAdd(PathLength, BootDirLength, &PathLength);
|
Status = RtlSIZETAdd(PathLength, BootDirLength, &PathLength);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert to bytes */
|
/* Convert to bytes */
|
||||||
Status = RtlULongLongToULong(PathLength * sizeof(WCHAR), &PathLength);
|
Status = RtlSIZETMult(PathLength, sizeof(WCHAR), &PathLength);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
|
@ -716,7 +716,7 @@ BmOpenDataStore (
|
||||||
PBL_DEVICE_DESCRIPTOR BcdDevice;
|
PBL_DEVICE_DESCRIPTOR BcdDevice;
|
||||||
PWCHAR BcdPath, FullPath, PathBuffer;
|
PWCHAR BcdPath, FullPath, PathBuffer;
|
||||||
BOOLEAN HavePath;
|
BOOLEAN HavePath;
|
||||||
ULONG PathLength, FullSize;
|
SIZE_T PathLength, FullSize;
|
||||||
PVOID FinalBuffer;
|
PVOID FinalBuffer;
|
||||||
UNICODE_STRING BcdString;
|
UNICODE_STRING BcdString;
|
||||||
|
|
||||||
|
@ -795,21 +795,21 @@ BmOpenDataStore (
|
||||||
|
|
||||||
/* Add a NUL to the path, make sure it'll fit */
|
/* Add a NUL to the path, make sure it'll fit */
|
||||||
PathLength = wcslen(PathBuffer);
|
PathLength = wcslen(PathBuffer);
|
||||||
Status = RtlULongAdd(PathLength, 1, &PathLength);
|
Status = RtlSIZETAdd(PathLength, 1, &PathLength);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert to bytes */
|
/* Convert to bytes */
|
||||||
Status = RtlULongLongToULong(PathLength * sizeof(WCHAR), &PathLength);
|
Status = RtlSIZETMult(PathLength, sizeof(WCHAR), &PathLength);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now add the size of the path to the device path, check if it fits */
|
/* Now add the size of the path to the device path, check if it fits */
|
||||||
Status = RtlULongAdd(PathLength, BcdDevice->Size, &FullSize);
|
Status = RtlSIZETAdd(PathLength, BcdDevice->Size, &FullSize);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
|
@ -2158,7 +2158,7 @@ BmDisplayDumpError (
|
||||||
if (BmpInternalBootError)
|
if (BmpInternalBootError)
|
||||||
{
|
{
|
||||||
/* Return it -- but it's a pointer? */
|
/* Return it -- but it's a pointer? */
|
||||||
return (ULONG)BmpInternalBootError; // ???
|
return (ULONG_PTR)BmpInternalBootError; // ???
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, show the menu to see what to do */
|
/* Otherwise, show the menu to see what to do */
|
||||||
|
|
|
@ -9785,7 +9785,7 @@ OslDrawLogo (
|
||||||
CoordinateX = (DspGraphicalConsole->DisplayMode.HRes / 2) - (BmpWidth / 2);
|
CoordinateX = (DspGraphicalConsole->DisplayMode.HRes / 2) - (BmpWidth / 2);
|
||||||
CoordinateY = (DspGraphicalConsole->DisplayMode.VRes / 2) - (BmpHeight / 2);
|
CoordinateY = (DspGraphicalConsole->DisplayMode.VRes / 2) - (BmpHeight / 2);
|
||||||
BlMmTranslateVirtualAddress(GopBlt, &GopBltPhys);
|
BlMmTranslateVirtualAddress(GopBlt, &GopBltPhys);
|
||||||
GopBlt = (PVOID)GopBltPhys.LowPart;
|
GopBlt = PhysicalAddressToPtr(GopBltPhys);
|
||||||
|
|
||||||
/* Make the screen black */
|
/* Make the screen black */
|
||||||
RtlFillMemory(DspGraphicalConsole->FrameBuffer,
|
RtlFillMemory(DspGraphicalConsole->FrameBuffer,
|
||||||
|
|
|
@ -1385,6 +1385,14 @@ MmMdInitializeListHead (
|
||||||
List->Type = 0;
|
List->Type = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FORCEINLINE
|
||||||
|
PVOID
|
||||||
|
PhysicalAddressToPtr (
|
||||||
|
_In_ PHYSICAL_ADDRESS PhysicalAddress)
|
||||||
|
{
|
||||||
|
return (PVOID)(ULONG_PTR)PhysicalAddress.QuadPart;
|
||||||
|
}
|
||||||
|
|
||||||
/* INITIALIZATION ROUTINES ***************************************************/
|
/* INITIALIZATION ROUTINES ***************************************************/
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -2369,7 +2377,7 @@ BlpMmCreateBlockAllocator (
|
||||||
|
|
||||||
PVOID
|
PVOID
|
||||||
BlMmAllocateHeap (
|
BlMmAllocateHeap (
|
||||||
_In_ ULONG Size
|
_In_ SIZE_T Size
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
/* DATA VARIABLES ************************************************************/
|
/* DATA VARIABLES ************************************************************/
|
||||||
|
|
||||||
PBL_ARCH_CONTEXT CurrentExecutionContext;
|
PBL_ARCH_CONTEXT CurrentExecutionContext;
|
||||||
|
PBL_MM_RELOCATE_SELF_MAP BlMmRelocateSelfMap;
|
||||||
|
PBL_MM_MOVE_VIRTUAL_ADDRESS_RANGE BlMmMoveVirtualAddressRange;
|
||||||
|
PBL_MM_ZERO_VIRTUAL_ADDRESS_RANGE BlMmZeroVirtualAddressRange;
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
@ -50,3 +53,13 @@ Archx86TransferTo32BitApplicationAsm (VOID)
|
||||||
EfiPrintf(L" Archx86TransferTo32BitApplicationAsm NOT IMPLEMENTED for this platform\r\n");
|
EfiPrintf(L" Archx86TransferTo32BitApplicationAsm NOT IMPLEMENTED for this platform\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
OslArchTransferToKernel(
|
||||||
|
_In_ struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
|
||||||
|
_In_ PVOID KernelEntrypoint
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EfiPrintf(L" OslArchTransferToKernel NOT IMPLEMENTED for this platform\r\n");
|
||||||
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,7 +280,7 @@ EfiVmOpenProtocol (
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check what address the interface lives at, and translate it */
|
/* Check what address the interface lives at, and translate it */
|
||||||
InterfaceVa = (PVOID)InterfaceAddress.LowPart;
|
InterfaceVa = PhysicalAddressToPtr(InterfaceAddress);
|
||||||
if (BlMmTranslateVirtualAddress(InterfaceVa, &TranslatedAddress))
|
if (BlMmTranslateVirtualAddress(InterfaceVa, &TranslatedAddress))
|
||||||
{
|
{
|
||||||
/* We expect firmware to be 1:1 mapped, fail if not */
|
/* We expect firmware to be 1:1 mapped, fail if not */
|
||||||
|
@ -868,9 +868,9 @@ EfiConInExSetState (
|
||||||
{
|
{
|
||||||
/* Translate pointers from virtual to physical */
|
/* Translate pointers from virtual to physical */
|
||||||
BlMmTranslateVirtualAddress(ConInEx, &ConInExPhys);
|
BlMmTranslateVirtualAddress(ConInEx, &ConInExPhys);
|
||||||
ConInEx = (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)ConInExPhys.LowPart;
|
ConInEx = (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)PhysicalAddressToPtr(ConInExPhys);
|
||||||
BlMmTranslateVirtualAddress(KeyToggleState, &KeyTogglePhys);
|
BlMmTranslateVirtualAddress(KeyToggleState, &KeyTogglePhys);
|
||||||
KeyToggleState = (EFI_KEY_TOGGLE_STATE*)KeyTogglePhys.LowPart;
|
KeyToggleState = (EFI_KEY_TOGGLE_STATE*)PhysicalAddressToPtr(KeyTogglePhys);
|
||||||
|
|
||||||
/* Switch to real mode */
|
/* Switch to real mode */
|
||||||
BlpArchSwitchContext(BlRealMode);
|
BlpArchSwitchContext(BlRealMode);
|
||||||
|
@ -938,15 +938,15 @@ EfiGetMemoryMap (
|
||||||
{
|
{
|
||||||
/* Convert all of the addresses to physical */
|
/* Convert all of the addresses to physical */
|
||||||
BlMmTranslateVirtualAddress(MemoryMapSize, &MemoryMapSizePhysical);
|
BlMmTranslateVirtualAddress(MemoryMapSize, &MemoryMapSizePhysical);
|
||||||
MemoryMapSize = (UINTN*)MemoryMapSizePhysical.LowPart;
|
MemoryMapSize = (UINTN*)PhysicalAddressToPtr(MemoryMapSizePhysical);
|
||||||
BlMmTranslateVirtualAddress(MemoryMap, &MemoryMapPhysical);
|
BlMmTranslateVirtualAddress(MemoryMap, &MemoryMapPhysical);
|
||||||
MemoryMap = (EFI_MEMORY_DESCRIPTOR*)MemoryMapPhysical.LowPart;
|
MemoryMap = (EFI_MEMORY_DESCRIPTOR*)PhysicalAddressToPtr(MemoryMapPhysical);
|
||||||
BlMmTranslateVirtualAddress(MapKey, &MapKeyPhysical);
|
BlMmTranslateVirtualAddress(MapKey, &MapKeyPhysical);
|
||||||
MapKey = (UINTN*)MapKeyPhysical.LowPart;
|
MapKey = (UINTN*)PhysicalAddressToPtr(MapKeyPhysical);
|
||||||
BlMmTranslateVirtualAddress(DescriptorSize, &DescriptorSizePhysical);
|
BlMmTranslateVirtualAddress(DescriptorSize, &DescriptorSizePhysical);
|
||||||
DescriptorSize = (UINTN*)DescriptorSizePhysical.LowPart;
|
DescriptorSize = (UINTN*)PhysicalAddressToPtr(DescriptorSizePhysical);
|
||||||
BlMmTranslateVirtualAddress(DescriptorVersion, &DescriptorVersionPhysical);
|
BlMmTranslateVirtualAddress(DescriptorVersion, &DescriptorVersionPhysical);
|
||||||
DescriptorVersion = (UINTN*)DescriptorVersionPhysical.LowPart;
|
DescriptorVersion = (UINTN*)PhysicalAddressToPtr(DescriptorVersionPhysical);
|
||||||
|
|
||||||
/* Switch to real mode */
|
/* Switch to real mode */
|
||||||
BlpArchSwitchContext(BlRealMode);
|
BlpArchSwitchContext(BlRealMode);
|
||||||
|
@ -1267,15 +1267,15 @@ EfiGopGetFrameBuffer (
|
||||||
{
|
{
|
||||||
/* Translate pointer to physical */
|
/* Translate pointer to physical */
|
||||||
BlMmTranslateVirtualAddress(GopInterface, &GopInterfacePhys);
|
BlMmTranslateVirtualAddress(GopInterface, &GopInterfacePhys);
|
||||||
GopInterface = (PVOID)GopInterfacePhys.LowPart;
|
GopInterface = PhysicalAddressToPtr(GopInterfacePhys);
|
||||||
|
|
||||||
/* Translate pointer to physical */
|
/* Translate pointer to physical */
|
||||||
BlMmTranslateVirtualAddress(FrameBuffer, &FrameBufferPhys);
|
BlMmTranslateVirtualAddress(FrameBuffer, &FrameBufferPhys);
|
||||||
FrameBuffer = (PVOID)FrameBufferPhys.LowPart;
|
FrameBuffer = PhysicalAddressToPtr(FrameBufferPhys);
|
||||||
|
|
||||||
/* Translate pointer to physical */
|
/* Translate pointer to physical */
|
||||||
BlMmTranslateVirtualAddress(FrameBufferSize, &FrameBufferSizePhys);
|
BlMmTranslateVirtualAddress(FrameBufferSize, &FrameBufferSizePhys);
|
||||||
FrameBufferSize = (PVOID)FrameBufferSizePhys.LowPart;
|
FrameBufferSize = PhysicalAddressToPtr(FrameBufferSizePhys);
|
||||||
|
|
||||||
/* Switch to real mode */
|
/* Switch to real mode */
|
||||||
BlpArchSwitchContext(BlRealMode);
|
BlpArchSwitchContext(BlRealMode);
|
||||||
|
@ -1311,21 +1311,21 @@ EfiGopGetCurrentMode (
|
||||||
{
|
{
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
GopInterface = (PVOID)GopInterfacePhys.LowPart;
|
GopInterface = PhysicalAddressToPtr(GopInterfacePhys);
|
||||||
|
|
||||||
/* Translate pointer to physical */
|
/* Translate pointer to physical */
|
||||||
if (!BlMmTranslateVirtualAddress(Mode, &ModePhys))
|
if (!BlMmTranslateVirtualAddress(Mode, &ModePhys))
|
||||||
{
|
{
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
Mode = (PVOID)ModePhys.LowPart;
|
Mode = PhysicalAddressToPtr(ModePhys);
|
||||||
|
|
||||||
/* Translate pointer to physical */
|
/* Translate pointer to physical */
|
||||||
if (!BlMmTranslateVirtualAddress(Information, &InformationPhys))
|
if (!BlMmTranslateVirtualAddress(Information, &InformationPhys))
|
||||||
{
|
{
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
Information = (PVOID)InformationPhys.LowPart;
|
Information = PhysicalAddressToPtr(InformationPhys);
|
||||||
|
|
||||||
/* Switch to real mode */
|
/* Switch to real mode */
|
||||||
BlpArchSwitchContext(BlRealMode);
|
BlpArchSwitchContext(BlRealMode);
|
||||||
|
@ -1435,7 +1435,7 @@ EfiLocateHandleBuffer (
|
||||||
{
|
{
|
||||||
/* Translate the input buffer from virtual to physical */
|
/* Translate the input buffer from virtual to physical */
|
||||||
TranslateResult = BlMmTranslateVirtualAddress(InputBuffer, &BufferPhys);
|
TranslateResult = BlMmTranslateVirtualAddress(InputBuffer, &BufferPhys);
|
||||||
InputBuffer = TranslateResult ? (PVOID)BufferPhys.LowPart : NULL;
|
InputBuffer = TranslateResult ? PhysicalAddressToPtr(BufferPhys) : NULL;
|
||||||
|
|
||||||
/* Switch to real mode */
|
/* Switch to real mode */
|
||||||
BlpArchSwitchContext(BlRealMode);
|
BlpArchSwitchContext(BlRealMode);
|
||||||
|
@ -1478,7 +1478,7 @@ EfiLocateHandleBuffer (
|
||||||
/* Translate the input buffer from virtual to physical */
|
/* Translate the input buffer from virtual to physical */
|
||||||
TranslateResult = BlMmTranslateVirtualAddress(InputBuffer,
|
TranslateResult = BlMmTranslateVirtualAddress(InputBuffer,
|
||||||
&BufferPhys);
|
&BufferPhys);
|
||||||
InputBuffer = TranslateResult ? (PVOID)BufferPhys.LowPart : NULL;
|
InputBuffer = TranslateResult ? PhysicalAddressToPtr(BufferPhys) : NULL;
|
||||||
|
|
||||||
/* Switch to real mode */
|
/* Switch to real mode */
|
||||||
BlpArchSwitchContext(BlRealMode);
|
BlpArchSwitchContext(BlRealMode);
|
||||||
|
@ -1581,7 +1581,7 @@ EfiAllocatePages (
|
||||||
{
|
{
|
||||||
/* Translate output address */
|
/* Translate output address */
|
||||||
BlMmTranslateVirtualAddress(Memory, &MemoryPhysical);
|
BlMmTranslateVirtualAddress(Memory, &MemoryPhysical);
|
||||||
Memory = (EFI_PHYSICAL_ADDRESS*)MemoryPhysical.LowPart;
|
Memory = (EFI_PHYSICAL_ADDRESS*)PhysicalAddressToPtr(MemoryPhysical);
|
||||||
|
|
||||||
/* Switch to real mode */
|
/* Switch to real mode */
|
||||||
BlpArchSwitchContext(BlRealMode);
|
BlpArchSwitchContext(BlRealMode);
|
||||||
|
|
|
@ -1835,7 +1835,7 @@ BlockIoEfiHashFunction (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/* Get rid of the alignment bits to have a more unique number */
|
/* Get rid of the alignment bits to have a more unique number */
|
||||||
return ((ULONG)Entry->Value >> 3) % TableSize;
|
return ((ULONG_PTR)Entry->Value >> 3) % TableSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
|
@ -61,7 +61,7 @@ DsppLoadFontFile (
|
||||||
{
|
{
|
||||||
PBL_DEVICE_DESCRIPTOR FontDevice;
|
PBL_DEVICE_DESCRIPTOR FontDevice;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG NameLength, DirectoryLength, TotalLength;
|
SIZE_T NameLength, DirectoryLength, TotalLength;
|
||||||
PWCHAR FontPath, FontDirectory;
|
PWCHAR FontPath, FontDirectory;
|
||||||
BL_LIBRARY_PARAMETERS LibraryParameters;
|
BL_LIBRARY_PARAMETERS LibraryParameters;
|
||||||
BOOLEAN CustomDirectory, CustomDevice;
|
BOOLEAN CustomDirectory, CustomDevice;
|
||||||
|
@ -114,21 +114,21 @@ DsppLoadFontFile (
|
||||||
DirectoryLength = wcslen(FontDirectory);
|
DirectoryLength = wcslen(FontDirectory);
|
||||||
|
|
||||||
/* Safely add them up*/
|
/* Safely add them up*/
|
||||||
Status = RtlULongAdd(NameLength, DirectoryLength, &TotalLength);
|
Status = RtlSIZETAdd(NameLength, DirectoryLength, &TotalLength);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert to bytes */
|
/* Convert to bytes */
|
||||||
Status = RtlULongLongToULong(TotalLength * sizeof(WCHAR), &TotalLength);
|
Status = RtlSIZETMult(TotalLength, sizeof(WCHAR), &TotalLength);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add a terminating NUL */
|
/* Add a terminating NUL */
|
||||||
Status = RtlULongAdd(TotalLength, sizeof(UNICODE_NULL), &TotalLength);
|
Status = RtlSIZETAdd(TotalLength, sizeof(UNICODE_NULL), &TotalLength);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
|
|
|
@ -547,7 +547,8 @@ EtfsOpen (
|
||||||
PBL_FILE_ENTRY NewFile;
|
PBL_FILE_ENTRY NewFile;
|
||||||
PWCHAR FilePath, FormatString;
|
PWCHAR FilePath, FormatString;
|
||||||
PBL_ETFS_FILE EtfsFile;
|
PBL_ETFS_FILE EtfsFile;
|
||||||
ULONG DeviceId, FileSize, DirOffset, FileOffset, Size;
|
ULONG DeviceId, FileSize, DirOffset, FileOffset;
|
||||||
|
SIZE_T Size;
|
||||||
PRAW_DIR_REC DirEntry;
|
PRAW_DIR_REC DirEntry;
|
||||||
BOOLEAN IsDirectory;
|
BOOLEAN IsDirectory;
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ FileIoCopyParentDirectoryPath (
|
||||||
_In_ PWCHAR FilePath
|
_In_ PWCHAR FilePath
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ULONG PathSize, PathSizeWithNull;
|
SIZE_T PathSize, PathSizeWithNull;
|
||||||
PWCHAR Backslash, ParentCopy;
|
PWCHAR Backslash, ParentCopy;
|
||||||
|
|
||||||
PathSize = wcslen(FilePath) * sizeof(WCHAR);
|
PathSize = wcslen(FilePath) * sizeof(WCHAR);
|
||||||
|
@ -81,7 +81,7 @@ FileIoCopyFileName (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PWCHAR Separator, FileCopy;
|
PWCHAR Separator, FileCopy;
|
||||||
ULONG PathSize;
|
SIZE_T PathSize;
|
||||||
|
|
||||||
Separator = wcsrchr(FilePath, '\\');
|
Separator = wcsrchr(FilePath, '\\');
|
||||||
if (!Separator)
|
if (!Separator)
|
||||||
|
|
|
@ -59,7 +59,7 @@ BiConvertRegistryDataToElement (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG Length, Size, ReturnedLength;
|
SIZE_T Length, Size, ReturnedLength;
|
||||||
PBL_DEVICE_DESCRIPTOR Device;
|
PBL_DEVICE_DESCRIPTOR Device;
|
||||||
BOOLEAN NullTerminate;
|
BOOLEAN NullTerminate;
|
||||||
PBCD_DEVICE_OPTION BcdDevice, ElementDevice;
|
PBCD_DEVICE_OPTION BcdDevice, ElementDevice;
|
||||||
|
|
|
@ -192,7 +192,7 @@ BiOpenKey(
|
||||||
PBI_KEY_OBJECT ParentKey, NewKey;
|
PBI_KEY_OBJECT ParentKey, NewKey;
|
||||||
PBI_KEY_HIVE ParentHive;
|
PBI_KEY_HIVE ParentHive;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG NameLength, SubNameLength, NameBytes;
|
SIZE_T NameLength, SubNameLength, NameBytes;
|
||||||
PWCHAR NameStart, NameBuffer;
|
PWCHAR NameStart, NameBuffer;
|
||||||
UNICODE_STRING KeyString;
|
UNICODE_STRING KeyString;
|
||||||
HCELL_INDEX KeyCell;
|
HCELL_INDEX KeyCell;
|
||||||
|
|
|
@ -54,7 +54,7 @@ BfLoadFontFile (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PBL_DEFERRED_FONT_FILE DeferredFont;
|
PBL_DEFERRED_FONT_FILE DeferredFont;
|
||||||
ULONG FontPathSize;
|
SIZE_T FontPathSize;
|
||||||
|
|
||||||
/* Allocate the deferred font structure */
|
/* Allocate the deferred font structure */
|
||||||
DeferredFont = (PBL_DEFERRED_FONT_FILE)BlMmAllocateHeap(sizeof(*DeferredFont));
|
DeferredFont = (PBL_DEFERRED_FONT_FILE)BlMmAllocateHeap(sizeof(*DeferredFont));
|
||||||
|
|
|
@ -304,7 +304,7 @@ BlImgAllocateImageBuffer (
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now map the physical buffer at the address requested */
|
/* Now map the physical buffer at the address requested */
|
||||||
MappedBase = (PVOID)PhysicalAddress.LowPart;
|
MappedBase = PhysicalAddressToPtr(PhysicalAddress);
|
||||||
Status = BlMmMapPhysicalAddressEx(&MappedBase,
|
Status = BlMmMapPhysicalAddressEx(&MappedBase,
|
||||||
BlMemoryFixed,
|
BlMemoryFixed,
|
||||||
Size,
|
Size,
|
||||||
|
@ -976,7 +976,7 @@ ImgpLoadPEImage (
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure that the section doesn't overflow in memory */
|
/* Make sure that the section doesn't overflow in memory */
|
||||||
Status = RtlULongAdd(Section->VirtualAddress,
|
Status = RtlULongPtrAdd(Section->VirtualAddress,
|
||||||
SectionSize,
|
SectionSize,
|
||||||
&SectionEnd);
|
&SectionEnd);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -994,7 +994,7 @@ ImgpLoadPEImage (
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure it doesn't overflow on disk */
|
/* Make sure it doesn't overflow on disk */
|
||||||
Status = RtlULongAdd(Section->VirtualAddress,
|
Status = RtlULongPtrAdd(Section->VirtualAddress,
|
||||||
AlignSize,
|
AlignSize,
|
||||||
&SectionEnd);
|
&SectionEnd);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -1848,7 +1848,7 @@ ImgArchEfiStartBootApplication (
|
||||||
__sidt(&Idt.Limit);
|
__sidt(&Idt.Limit);
|
||||||
|
|
||||||
/* Allocate space for the IDT, GDT, and 24 pages of stack */
|
/* Allocate space for the IDT, GDT, and 24 pages of stack */
|
||||||
BootSizeNeeded = (ULONG)PAGE_ALIGN(Idt.Limit + Gdt.Limit + 1 + 25 * PAGE_SIZE);
|
BootSizeNeeded = (ULONG_PTR)PAGE_ALIGN(Idt.Limit + Gdt.Limit + 1 + 25 * PAGE_SIZE);
|
||||||
Status = MmPapAllocatePagesInRange(&BootData,
|
Status = MmPapAllocatePagesInRange(&BootData,
|
||||||
BlLoaderArchData,
|
BlLoaderArchData,
|
||||||
BootSizeNeeded >> PAGE_SHIFT,
|
BootSizeNeeded >> PAGE_SHIFT,
|
||||||
|
|
|
@ -23,7 +23,11 @@ CHECK_PAGED_CODE_RTL (
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
PVOID MmHighestUserAddress = (PVOID)0xFFFFFFFFULL; // CHECKME
|
||||||
|
#else
|
||||||
PVOID MmHighestUserAddress = (PVOID)0xFFFFFFFF;
|
PVOID MmHighestUserAddress = (PVOID)0xFFFFFFFF;
|
||||||
|
#endif
|
||||||
|
|
||||||
PVOID
|
PVOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
|
@ -960,6 +960,7 @@ BlArchGetCpuVendor (
|
||||||
{
|
{
|
||||||
return CPU_VIA;
|
return CPU_VIA;
|
||||||
}
|
}
|
||||||
|
#ifdef _M_IX86
|
||||||
if (!strncmp((PCHAR)&CpuInfo.Ebx, "CyrixInstead", 12))
|
if (!strncmp((PCHAR)&CpuInfo.Ebx, "CyrixInstead", 12))
|
||||||
{
|
{
|
||||||
return CPU_CYRIX;
|
return CPU_CYRIX;
|
||||||
|
@ -972,7 +973,7 @@ BlArchGetCpuVendor (
|
||||||
{
|
{
|
||||||
return CPU_RISE;
|
return CPU_RISE;
|
||||||
}
|
}
|
||||||
|
#endif // _M_IX86
|
||||||
/* Other */
|
/* Other */
|
||||||
return CPU_UNKNOWN;
|
return CPU_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ MmBapCompareBlockAllocatorTableEntry (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PBL_BLOCK_DESCRIPTOR BlockInfo = (PBL_BLOCK_DESCRIPTOR)Entry;
|
PBL_BLOCK_DESCRIPTOR BlockInfo = (PBL_BLOCK_DESCRIPTOR)Entry;
|
||||||
ULONG BlockId = (ULONG)Argument1;
|
ULONG BlockId = PtrToUlong(Argument1);
|
||||||
|
|
||||||
/* Check if the block ID matches */
|
/* Check if the block ID matches */
|
||||||
return BlockInfo->BlockId == BlockId;
|
return BlockInfo->BlockId == BlockId;
|
||||||
|
@ -67,7 +67,7 @@ MmBapFindBlockInformation (
|
||||||
MmBlockAllocatorTableEntries,
|
MmBlockAllocatorTableEntries,
|
||||||
&EntryId,
|
&EntryId,
|
||||||
MmBapCompareBlockAllocatorTableEntry,
|
MmBapCompareBlockAllocatorTableEntry,
|
||||||
(PVOID)EntryId,
|
UlongToPtr(EntryId),
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
|
@ -567,7 +567,7 @@ MmHaInitialize (
|
||||||
|
|
||||||
PVOID
|
PVOID
|
||||||
BlMmAllocateHeap (
|
BlMmAllocateHeap (
|
||||||
_In_ ULONG Size
|
_In_ SIZE_T Size
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ULONG BufferSize;
|
ULONG BufferSize;
|
||||||
|
@ -581,7 +581,7 @@ BlMmAllocateHeap (
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Align the buffer size to the minimum size required */
|
/* Align the buffer size to the minimum size required */
|
||||||
BufferSize = ALIGN_UP(Size + FIELD_OFFSET(BL_BUSY_HEAP_ENTRY, Buffer),
|
BufferSize = ALIGN_UP_BY(Size + FIELD_OFFSET(BL_BUSY_HEAP_ENTRY, Buffer),
|
||||||
FIELD_OFFSET(BL_BUSY_HEAP_ENTRY, Buffer));
|
FIELD_OFFSET(BL_BUSY_HEAP_ENTRY, Buffer));
|
||||||
|
|
||||||
/* Watch out for overflow */
|
/* Watch out for overflow */
|
||||||
|
|
|
@ -865,7 +865,7 @@ MmPapAllocatePagesInRange (
|
||||||
Type);
|
Type);
|
||||||
|
|
||||||
/* Return the allocated address */
|
/* Return the allocated address */
|
||||||
*PhysicalAddress = (PVOID)BaseAddress.LowPart;
|
*PhysicalAddress = PhysicalAddressToPtr(BaseAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
|
@ -1639,7 +1639,7 @@ MmSelectMappingAddress (
|
||||||
if (MmTranslationType == BlNone)
|
if (MmTranslationType == BlNone)
|
||||||
{
|
{
|
||||||
/* Just return the physical address as the mapping address */
|
/* Just return the physical address as the mapping address */
|
||||||
PreferredAddress = (PVOID)PhysicalAddress.LowPart;
|
PreferredAddress = PhysicalAddressToPtr(PhysicalAddress);
|
||||||
goto Success;
|
goto Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue