[FREELDR]

Fix 64 bit warnings
Patch by Samuel Serapion, slightly modified by me

svn path=/trunk/; revision=55529
This commit is contained in:
Timo Kreuzer 2012-02-10 19:10:17 +00:00
parent fd8ceb0b0d
commit 3234bb7c43
22 changed files with 164 additions and 163 deletions

View file

@ -145,10 +145,10 @@ MempIsPageMapped(PVOID VirtualAddress)
return TRUE;
}
ULONG
MempMapRangeOfPages(ULONG64 VirtualAddress, ULONG64 PhysicalAddress, ULONG cPages)
PFN_NUMBER
MempMapRangeOfPages(ULONG64 VirtualAddress, ULONG64 PhysicalAddress, PFN_NUMBER cPages)
{
ULONG i;
PFN_NUMBER i;
for (i = 0; i < cPages; i++)
{
@ -165,8 +165,8 @@ MempMapRangeOfPages(ULONG64 VirtualAddress, ULONG64 PhysicalAddress, ULONG cPage
}
BOOLEAN
MempSetupPaging(IN ULONG StartPage,
IN ULONG NumberOfPages,
MempSetupPaging(IN PFN_NUMBER StartPage,
IN PFN_NUMBER NumberOfPages,
IN BOOLEAN KernelMapping)
{
TRACE(">>> MempSetupPaging(0x%lx, %ld, %p)\n",
@ -196,7 +196,7 @@ MempSetupPaging(IN ULONG StartPage,
}
VOID
MempUnmapPage(ULONG Page)
MempUnmapPage(PFN_NUMBER Page)
{
// TRACE(">>> MempUnmapPage\n");
}

View file

@ -80,14 +80,14 @@ PKPDR_PAGE PdrPage;
/* FUNCTIONS **************************************************************/
BOOLEAN
MempSetupPaging(IN ULONG StartPage,
IN ULONG NumberOfPages)
MempSetupPaging(IN PFN_NUMBER StartPage,
IN PFN_COUNT NumberOfPages)
{
return TRUE;
}
VOID
MempUnmapPage(IN ULONG Page)
MempUnmapPage(IN PFN_NUMBER Page)
{
return;
}

View file

@ -416,7 +416,7 @@ PcVideoSet480ScanLines(VOID)
CRTC = (CRTC | 0xE2);
/* (write) */
WRITE_PORT_UCHAR((PUCHAR)0x03C2, CRTC);
WRITE_PORT_UCHAR((PUCHAR)0x03C2, (UCHAR)CRTC);
}
static VOID

View file

@ -143,13 +143,13 @@ MempAllocatePTE(ULONG Entry, PHARDWARE_PTE *PhysicalPT, PHARDWARE_PTE *KernelPT)
}
BOOLEAN
MempSetupPaging(IN ULONG StartPage,
IN ULONG NumberOfPages,
MempSetupPaging(IN PFN_NUMBER StartPage,
IN PFN_COUNT NumberOfPages,
IN BOOLEAN KernelMapping)
{
PHARDWARE_PTE PhysicalPT;
PHARDWARE_PTE KernelPT;
ULONG Entry, Page;
PFN_COUNT Entry, Page;
TRACE("MempSetupPaging: SP 0x%X, Number: 0x%X, Kernel: %s\n",
StartPage, NumberOfPages, KernelMapping ? "yes" : "no");
@ -199,10 +199,10 @@ MempSetupPaging(IN ULONG StartPage,
}
VOID
MempUnmapPage(ULONG Page)
MempUnmapPage(PFN_NUMBER Page)
{
PHARDWARE_PTE KernelPT;
ULONG Entry = (Page >> 10) + (KSEG0_BASE >> 22);
PFN_NUMBER Entry = (Page >> 10) + (KSEG0_BASE >> 22);
/* Don't unmap hyperspace or HAL entries */
if (Entry == HYPER_SPACE_ENTRY || Entry == 1023)

View file

@ -175,7 +175,7 @@ BOOLEAN CacheInternalFreeBlock(PCACHE_DRIVE CacheDrive)
VOID CacheInternalCheckCacheSizeLimits(PCACHE_DRIVE CacheDrive)
{
ULONG NewCacheSize;
SIZE_T NewCacheSize;
TRACE("CacheInternalCheckCacheSizeLimits()\n");

View file

@ -31,8 +31,8 @@ CACHE_DRIVE CacheManagerDrive;
BOOLEAN CacheManagerInitialized = FALSE;
BOOLEAN CacheManagerDataInvalid = FALSE;
ULONG CacheBlockCount = 0;
ULONG CacheSizeLimit = 0;
ULONG CacheSizeCurrent = 0;
SIZE_T CacheSizeLimit = 0;
SIZE_T CacheSizeCurrent = 0;
BOOLEAN CacheInitializeDrive(UCHAR DriveNumber)
{

View file

@ -248,14 +248,14 @@ LONG ArcGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
LONG ArcOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
{
ULONG i, ret;
ULONG Count, i, ret;
PLIST_ENTRY pEntry;
DEVICE* pDevice;
CHAR* DeviceName;
CHAR* FileName;
CHAR* p;
CHAR* q;
ULONG dwCount, dwLength;
SIZE_T Length;
OPENMODE DeviceOpenMode;
ULONG DeviceId;
@ -271,16 +271,16 @@ LONG ArcOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
FileName++;
/* Count number of "()", which needs to be replaced by "(0)" */
dwCount = 0;
Count = 0;
for (p = Path; p != FileName; p++)
if (*p == '(' && *(p + 1) == ')')
dwCount++;
Count++;
/* Duplicate device name, and replace "()" by "(0)" (if required) */
dwLength = FileName - Path + dwCount;
if (dwCount != 0)
Length = FileName - Path + Count;
if (Count != 0)
{
DeviceName = MmHeapAlloc(FileName - Path + dwCount);
DeviceName = MmHeapAlloc(FileName - Path + Count);
if (!DeviceName)
return ENOMEM;
for (p = Path, q = DeviceName; p != FileName; p++)
@ -302,7 +302,7 @@ LONG ArcOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
while (pEntry != &DeviceListHead)
{
pDevice = CONTAINING_RECORD(pEntry, DEVICE, ListEntry);
if (strncmp(pDevice->Prefix, DeviceName, dwLength) == 0)
if (strncmp(pDevice->Prefix, DeviceName, Length) == 0)
{
/* OK, device found. It is already opened? */
if (pDevice->ReferenceCount == 0)
@ -412,18 +412,18 @@ LONG ArcSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode)
VOID FsRegisterDevice(CHAR* Prefix, const DEVVTBL* FuncTable)
{
DEVICE* pNewEntry;
ULONG dwLength;
SIZE_T Length;
TRACE("FsRegisterDevice() Prefix = %s\n", Prefix);
dwLength = strlen(Prefix) + 1;
pNewEntry = MmHeapAlloc(sizeof(DEVICE) + dwLength);
Length = strlen(Prefix) + 1;
pNewEntry = MmHeapAlloc(sizeof(DEVICE) + Length);
if (!pNewEntry)
return;
pNewEntry->FuncTable = FuncTable;
pNewEntry->ReferenceCount = 0;
pNewEntry->Prefix = (CHAR*)(pNewEntry + 1);
memcpy(pNewEntry->Prefix, Prefix, dwLength);
memcpy(pNewEntry->Prefix, Prefix, Length);
InsertHeadList(&DeviceListHead, &pNewEntry->ListEntry);
}

View file

@ -67,8 +67,8 @@ typedef struct
extern CACHE_DRIVE CacheManagerDrive;
extern BOOLEAN CacheManagerInitialized;
extern ULONG CacheBlockCount;
extern ULONG CacheSizeLimit;
extern ULONG CacheSizeCurrent;
extern SIZE_T CacheSizeLimit;
extern SIZE_T CacheSizeCurrent;
///////////////////////////////////////////////////////////////////////////////////////
//

View file

@ -60,7 +60,7 @@ typedef struct _FREELDR_MEMORY_DESCRIPTOR
typedef struct
{
TYPE_OF_MEMORY PageAllocated; // Type of allocated memory (LoaderFree if this memory is free)
ULONG PageAllocationLength; // Number of pages allocated (or zero if this isn't the first page in the chain)
PFN_NUMBER PageAllocationLength; // Number of pages allocated (or zero if this isn't the first page in the chain)
} PAGE_LOOKUP_TABLE_ITEM, *PPAGE_LOOKUP_TABLE_ITEM;
#include <poppack.h>
@ -72,38 +72,38 @@ typedef struct
#define DUMP_MEM_MAP_ON_VERIFY 0
extern PVOID PageLookupTableAddress;
extern ULONG TotalPagesInLookupTable;
extern ULONG FreePagesInLookupTable;
extern ULONG LastFreePageHint;
extern PFN_NUMBER TotalPagesInLookupTable;
extern PFN_NUMBER FreePagesInLookupTable;
extern PFN_NUMBER LastFreePageHint;
#if DBG
PCSTR MmGetSystemMemoryMapTypeString(TYPE_OF_MEMORY Type);
#endif
ULONG MmGetPageNumberFromAddress(PVOID Address); // Returns the page number that contains a linear address
ULONG MmGetAddressablePageCountIncludingHoles(VOID); // Returns the count of addressable pages from address zero including any memory holes and reserved memory regions
PVOID MmFindLocationForPageLookupTable(ULONG TotalPageCount); // Returns the address for a memory chunk big enough to hold the page lookup table (starts search from end of memory)
VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount); // Inits the page lookup table according to the memory types in the memory map
VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG PageCount, TYPE_OF_MEMORY PageAllocated); // Marks the specified pages as allocated or free in the lookup table
VOID MmAllocatePagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG PageCount, TYPE_OF_MEMORY MemoryType); // Allocates the specified pages in the lookup table
ULONG MmCountFreePagesInLookupTable(PVOID PageLookupTable, ULONG TotalPageCount); // Returns the number of free pages in the lookup table
ULONG MmFindAvailablePages(PVOID PageLookupTable, ULONG TotalPageCount, ULONG PagesNeeded, BOOLEAN FromEnd); // Returns the page number of the first available page range from the beginning or end of memory
ULONG MmFindAvailablePagesBeforePage(PVOID PageLookupTable, ULONG TotalPageCount, ULONG PagesNeeded, ULONG LastPage); // Returns the page number of the first available page range before the specified page
VOID MmUpdateLastFreePageHint(PVOID PageLookupTable, ULONG TotalPageCount); // Sets the LastFreePageHint to the last usable page of memory
BOOLEAN MmAreMemoryPagesAvailable(PVOID PageLookupTable, ULONG TotalPageCount, PVOID PageAddress, ULONG PageCount); // Returns TRUE if the specified pages of memory are available, otherwise FALSE
VOID MmSetMemoryType(PVOID MemoryAddress, ULONG MemorySize, TYPE_OF_MEMORY NewType); // Use with EXTREME caution!
PFN_NUMBER MmGetPageNumberFromAddress(PVOID Address); // Returns the page number that contains a linear address
PFN_NUMBER MmGetAddressablePageCountIncludingHoles(VOID); // Returns the count of addressable pages from address zero including any memory holes and reserved memory regions
PVOID MmFindLocationForPageLookupTable(PFN_NUMBER TotalPageCount); // Returns the address for a memory chunk big enough to hold the page lookup table (starts search from end of memory)
VOID MmInitPageLookupTable(PVOID PageLookupTable, PFN_NUMBER TotalPageCount); // Inits the page lookup table according to the memory types in the memory map
VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, PFN_NUMBER StartPage, PFN_NUMBER PageCount, TYPE_OF_MEMORY PageAllocated); // Marks the specified pages as allocated or free in the lookup table
VOID MmAllocatePagesInLookupTable(PVOID PageLookupTable, PFN_NUMBER StartPage, PFN_NUMBER PageCount, TYPE_OF_MEMORY MemoryType); // Allocates the specified pages in the lookup table
PFN_NUMBER MmCountFreePagesInLookupTable(PVOID PageLookupTable, PFN_NUMBER TotalPageCount); // Returns the number of free pages in the lookup table
PFN_NUMBER MmFindAvailablePages(PVOID PageLookupTable, PFN_NUMBER TotalPageCount, PFN_NUMBER PagesNeeded, BOOLEAN FromEnd); // Returns the page number of the first available page range from the beginning or end of memory
PFN_NUMBER MmFindAvailablePagesBeforePage(PVOID PageLookupTable, PFN_NUMBER TotalPageCount, PFN_NUMBER PagesNeeded, PFN_NUMBER LastPage); // Returns the page number of the first available page range before the specified page
VOID MmUpdateLastFreePageHint(PVOID PageLookupTable, PFN_NUMBER TotalPageCount); // Sets the LastFreePageHint to the last usable page of memory
BOOLEAN MmAreMemoryPagesAvailable(PVOID PageLookupTable, PFN_NUMBER TotalPageCount, PVOID PageAddress, PFN_NUMBER PageCount); // Returns TRUE if the specified pages of memory are available, otherwise FALSE
VOID MmSetMemoryType(PVOID MemoryAddress, SIZE_T MemorySize, TYPE_OF_MEMORY NewType); // Use with EXTREME caution!
PPAGE_LOOKUP_TABLE_ITEM MmGetMemoryMap(ULONG *NoEntries); // Returns a pointer to the memory mapping table and a number of entries in it
PPAGE_LOOKUP_TABLE_ITEM MmGetMemoryMap(PFN_NUMBER *NoEntries); // Returns a pointer to the memory mapping table and a number of entries in it
//BOOLEAN MmInitializeMemoryManager(ULONG LowMemoryStart, ULONG LowMemoryLength);
BOOLEAN MmInitializeMemoryManager(VOID);
VOID MmInitializeHeap(PVOID PageLookupTable);
PVOID MmAllocateMemory(ULONG MemorySize);
PVOID MmAllocateMemoryWithType(ULONG MemorySize, TYPE_OF_MEMORY MemoryType);
PVOID MmAllocateMemory(SIZE_T MemorySize);
PVOID MmAllocateMemoryWithType(SIZE_T MemorySize, TYPE_OF_MEMORY MemoryType);
VOID MmFreeMemory(PVOID MemoryPointer);
PVOID MmAllocateMemoryAtAddress(ULONG MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType);
PVOID MmAllocateHighestMemoryBelowAddress(ULONG MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType);
PVOID MmAllocateMemoryAtAddress(SIZE_T MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType);
PVOID MmAllocateHighestMemoryBelowAddress(SIZE_T MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType);
PVOID MmHeapAlloc(SIZE_T MemorySize);
VOID MmHeapFree(PVOID MemoryPointer);
@ -114,7 +114,7 @@ extern PVOID FrLdrTempHeap;
PVOID
HeapCreate(
ULONG MaximumSize,
SIZE_T MaximumSize,
TYPE_OF_MEMORY MemoryType);
VOID

View file

@ -162,12 +162,12 @@ BOOLEAN
MempAllocatePageTables();
BOOLEAN
MempSetupPaging(IN ULONG StartPage,
IN ULONG NumberOfPages,
MempSetupPaging(IN PFN_NUMBER StartPage,
IN PFN_NUMBER NumberOfPages,
IN BOOLEAN KernelMapping);
VOID
MempUnmapPage(ULONG Page);
MempUnmapPage(PFN_NUMBER Page);
VOID
MempDump();

View file

@ -73,7 +73,7 @@ BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
// Get the line of data
CurrentOffset = IniGetNextLine(IniFileData, IniFileSize, IniFileLine, IniFileLineSize, CurrentOffset);
LineLength = strlen(IniFileLine);
LineLength = (ULONG)strlen(IniFileLine);
// If it is a blank line or a comment then skip it
if (IniIsLineEmpty(IniFileLine, LineLength) || IniIsCommentLine(IniFileLine, LineLength))

View file

@ -30,8 +30,8 @@ PVOID FrLdrTempHeap;
typedef struct _BLOCK_DATA
{
ULONG Flink;
ULONG Blink;
ULONG_PTR Flink;
ULONG_PTR Blink;
} BLOCK_DATA, *PBLOCK_DATA;
typedef struct _HEAP_BLOCK
@ -44,26 +44,26 @@ typedef struct _HEAP_BLOCK
typedef struct _HEAP
{
ULONG MaximumSize;
ULONG CurrentAllocBytes;
ULONG MaxAllocBytes;
SIZE_T MaximumSize;
SIZE_T CurrentAllocBytes;
SIZE_T MaxAllocBytes;
ULONG NumAllocs;
ULONG NumFrees;
ULONG LargestAllocation;
SIZE_T LargestAllocation;
ULONGLONG AllocationTime;
ULONGLONG FreeTime;
ULONG TerminatingBlock;
ULONG_PTR TerminatingBlock;
HEAP_BLOCK Blocks;
} HEAP, *PHEAP;
PVOID
HeapCreate(
ULONG MaximumSize,
SIZE_T MaximumSize,
TYPE_OF_MEMORY MemoryType)
{
PHEAP Heap;
PHEAP_BLOCK Block;
ULONG Remaining;
SIZE_T Remaining;
USHORT PreviousSize;
TRACE("HeapCreate(MemoryType=%ld)\n", MemoryType);
@ -136,7 +136,7 @@ HeapDestroy(
/* Mark all pages as firmware temporary, so they are free for the kernel */
MmMarkPagesInLookupTable(PageLookupTableAddress,
(ULONG_PTR)Heap / MM_PAGE_SIZE,
Heap->MaximumSize / MM_PAGE_SIZE,
(PFN_COUNT)(Heap->MaximumSize / MM_PAGE_SIZE),
LoaderFirmwareTemporary);
}
@ -147,7 +147,7 @@ HeapRelease(
PHEAP Heap = HeapHandle;
PHEAP_BLOCK Block;
PUCHAR StartAddress, EndAddress;
ULONG FreePages, AllFreePages = 0;
PFN_COUNT FreePages, AllFreePages = 0;
TRACE("HeapRelease(%p)\n", HeapHandle);
/* Loop all heap chunks */
@ -176,7 +176,7 @@ HeapRelease(
EndAddress = ALIGN_DOWN_POINTER_BY(Block->Data, PAGE_SIZE);
}
FreePages = (EndAddress - StartAddress) / MM_PAGE_SIZE;
FreePages = (PFN_COUNT)((EndAddress - StartAddress) / MM_PAGE_SIZE);
AllFreePages += FreePages;
/* Now mark the pages free */
@ -449,7 +449,7 @@ MmInitializeHeap(PVOID PageLookupTable)
}
PVOID
MmHeapAlloc(ULONG MemorySize)
MmHeapAlloc(SIZE_T MemorySize)
{
return HeapAllocate(FrLdrDefaultHeap, MemorySize, 'pHmM');
}

View file

@ -53,11 +53,11 @@ ULONG MemoryTypeCount = sizeof(MemoryTypeArray) / sizeof(MemoryTypeArray[0]);
#endif
PVOID PageLookupTableAddress = NULL;
ULONG TotalPagesInLookupTable = 0;
ULONG FreePagesInLookupTable = 0;
ULONG LastFreePageHint = 0;
ULONG MmLowestPhysicalPage = 0xFFFFFFFF;
ULONG MmHighestPhysicalPage = 0;
PFN_NUMBER TotalPagesInLookupTable = 0;
PFN_NUMBER FreePagesInLookupTable = 0;
PFN_NUMBER LastFreePageHint = 0;
PFN_NUMBER MmLowestPhysicalPage = 0xFFFFFFFF;
PFN_NUMBER MmHighestPhysicalPage = 0;
PFREELDR_MEMORY_DESCRIPTOR BiosMemoryMap;
ULONG BiosMemoryMapEntryCount;
@ -232,15 +232,15 @@ PCSTR MmGetSystemMemoryMapTypeString(TYPE_OF_MEMORY Type)
}
#endif
ULONG MmGetPageNumberFromAddress(PVOID Address)
PFN_NUMBER MmGetPageNumberFromAddress(PVOID Address)
{
return ((ULONG_PTR)Address) / MM_PAGE_SIZE;
}
ULONG MmGetAddressablePageCountIncludingHoles(VOID)
PFN_NUMBER MmGetAddressablePageCountIncludingHoles(VOID)
{
const FREELDR_MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
ULONG PageCount;
PFN_NUMBER PageCount;
//
// Go through the whole memory map to get max address
@ -277,12 +277,12 @@ ULONG MmGetAddressablePageCountIncludingHoles(VOID)
return PageCount;
}
PVOID MmFindLocationForPageLookupTable(ULONG TotalPageCount)
PVOID MmFindLocationForPageLookupTable(PFN_NUMBER TotalPageCount)
{
const FREELDR_MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
ULONG PageLookupTableSize;
ULONG PageLookupTablePages;
ULONG PageLookupTableStartPage = 0;
SIZE_T PageLookupTableSize;
PFN_NUMBER PageLookupTablePages;
PFN_NUMBER PageLookupTableStartPage = 0;
PVOID PageLookupTableMemAddress = NULL;
// Calculate how much pages we need to keep the page lookup table
@ -316,11 +316,11 @@ PVOID MmFindLocationForPageLookupTable(ULONG TotalPageCount)
return PageLookupTableMemAddress;
}
VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount)
VOID MmInitPageLookupTable(PVOID PageLookupTable, PFN_NUMBER TotalPageCount)
{
const FREELDR_MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
ULONG PageLookupTableStartPage;
ULONG PageLookupTablePageCount;
PFN_NUMBER PageLookupTableStartPage;
PFN_NUMBER PageLookupTablePageCount;
TRACE("MmInitPageLookupTable()\n");
@ -359,10 +359,10 @@ VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount)
MmMarkPagesInLookupTable(PageLookupTable, PageLookupTableStartPage, PageLookupTablePageCount, LoaderFirmwareTemporary);
}
VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG PageCount, TYPE_OF_MEMORY PageAllocated)
VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, PFN_NUMBER StartPage, PFN_NUMBER PageCount, TYPE_OF_MEMORY PageAllocated)
{
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
ULONG Index;
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
PFN_NUMBER Index;
TRACE("MmMarkPagesInLookupTable()\n");
/* Validate the range */
@ -389,10 +389,10 @@ VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG Page
TRACE("MmMarkPagesInLookupTable() Done\n");
}
VOID MmAllocatePagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG PageCount, TYPE_OF_MEMORY MemoryType)
VOID MmAllocatePagesInLookupTable(PVOID PageLookupTable, PFN_NUMBER StartPage, PFN_NUMBER PageCount, TYPE_OF_MEMORY MemoryType)
{
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
ULONG Index;
PFN_NUMBER Index;
StartPage -= MmLowestPhysicalPage;
for (Index=StartPage; Index<(StartPage+PageCount); Index++)
@ -402,11 +402,11 @@ VOID MmAllocatePagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG
}
}
ULONG MmCountFreePagesInLookupTable(PVOID PageLookupTable, ULONG TotalPageCount)
PFN_NUMBER MmCountFreePagesInLookupTable(PVOID PageLookupTable, PFN_NUMBER TotalPageCount)
{
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
ULONG Index;
ULONG FreePageCount;
PFN_NUMBER Index;
PFN_NUMBER FreePageCount;
FreePageCount = 0;
for (Index=0; Index<TotalPageCount; Index++)
@ -420,11 +420,11 @@ ULONG MmCountFreePagesInLookupTable(PVOID PageLookupTable, ULONG TotalPageCount)
return FreePageCount;
}
ULONG MmFindAvailablePages(PVOID PageLookupTable, ULONG TotalPageCount, ULONG PagesNeeded, BOOLEAN FromEnd)
PFN_NUMBER MmFindAvailablePages(PVOID PageLookupTable, PFN_NUMBER TotalPageCount, PFN_NUMBER PagesNeeded, BOOLEAN FromEnd)
{
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
ULONG AvailablePagesSoFar;
ULONG Index;
PFN_NUMBER AvailablePagesSoFar;
PFN_NUMBER Index;
if (LastFreePageHint > TotalPageCount)
{
@ -479,11 +479,11 @@ ULONG MmFindAvailablePages(PVOID PageLookupTable, ULONG TotalPageCount, ULONG Pa
return 0;
}
ULONG MmFindAvailablePagesBeforePage(PVOID PageLookupTable, ULONG TotalPageCount, ULONG PagesNeeded, ULONG LastPage)
PFN_NUMBER MmFindAvailablePagesBeforePage(PVOID PageLookupTable, PFN_NUMBER TotalPageCount, PFN_NUMBER PagesNeeded, PFN_NUMBER LastPage)
{
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
ULONG AvailablePagesSoFar;
ULONG Index;
PFN_NUMBER AvailablePagesSoFar;
PFN_NUMBER Index;
if (LastPage > TotalPageCount)
{
@ -512,10 +512,10 @@ ULONG MmFindAvailablePagesBeforePage(PVOID PageLookupTable, ULONG TotalPageCount
return 0;
}
VOID MmUpdateLastFreePageHint(PVOID PageLookupTable, ULONG TotalPageCount)
VOID MmUpdateLastFreePageHint(PVOID PageLookupTable, PFN_NUMBER TotalPageCount)
{
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
ULONG Index;
PFN_NUMBER Index;
for (Index=TotalPageCount-1; Index>0; Index--)
{
@ -527,11 +527,11 @@ VOID MmUpdateLastFreePageHint(PVOID PageLookupTable, ULONG TotalPageCount)
}
}
BOOLEAN MmAreMemoryPagesAvailable(PVOID PageLookupTable, ULONG TotalPageCount, PVOID PageAddress, ULONG PageCount)
BOOLEAN MmAreMemoryPagesAvailable(PVOID PageLookupTable, PFN_NUMBER TotalPageCount, PVOID PageAddress, PFN_NUMBER PageCount)
{
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
ULONG StartPage;
ULONG Index;
PFN_NUMBER StartPage;
PFN_NUMBER Index;
StartPage = MmGetPageNumberFromAddress(PageAddress);

View file

@ -27,12 +27,12 @@ VOID MemAllocTest(VOID);
DBG_DEFAULT_CHANNEL(MEMORY);
ULONG LoaderPagesSpanned = 0;
PFN_NUMBER LoaderPagesSpanned = 0;
PVOID MmAllocateMemoryWithType(ULONG MemorySize, TYPE_OF_MEMORY MemoryType)
PVOID MmAllocateMemoryWithType(SIZE_T MemorySize, TYPE_OF_MEMORY MemoryType)
{
ULONG PagesNeeded;
ULONG FirstFreePageFromEnd;
PFN_NUMBER PagesNeeded;
PFN_NUMBER FirstFreePageFromEnd;
PVOID MemPointer;
if (MemorySize == 0)
@ -83,10 +83,10 @@ PVOID MmAllocateMemoryWithType(ULONG MemorySize, TYPE_OF_MEMORY MemoryType)
return MemPointer;
}
PVOID MmAllocateMemoryAtAddress(ULONG MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType)
PVOID MmAllocateMemoryAtAddress(SIZE_T MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType)
{
ULONG PagesNeeded;
ULONG StartPageNumber;
PFN_NUMBER PagesNeeded;
PFN_NUMBER StartPageNumber;
PVOID MemPointer;
if (MemorySize == 0)
@ -142,10 +142,10 @@ PVOID MmAllocateMemoryAtAddress(ULONG MemorySize, PVOID DesiredAddress, TYPE_OF_
return MemPointer;
}
VOID MmSetMemoryType(PVOID MemoryAddress, ULONG MemorySize, TYPE_OF_MEMORY NewType)
VOID MmSetMemoryType(PVOID MemoryAddress, SIZE_T MemorySize, TYPE_OF_MEMORY NewType)
{
ULONG PagesNeeded;
ULONG StartPageNumber;
PFN_NUMBER PagesNeeded;
PFN_NUMBER StartPageNumber;
// Find out how many blocks it will take to
// satisfy this allocation
@ -158,11 +158,11 @@ VOID MmSetMemoryType(PVOID MemoryAddress, ULONG MemorySize, TYPE_OF_MEMORY NewTy
MmAllocatePagesInLookupTable(PageLookupTableAddress, StartPageNumber, PagesNeeded, NewType);
}
PVOID MmAllocateHighestMemoryBelowAddress(ULONG MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType)
PVOID MmAllocateHighestMemoryBelowAddress(SIZE_T MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType)
{
ULONG PagesNeeded;
ULONG FirstFreePageFromEnd;
ULONG DesiredAddressPageNumber;
PFN_NUMBER PagesNeeded;
PFN_NUMBER FirstFreePageFromEnd;
PFN_NUMBER DesiredAddressPageNumber;
PVOID MemPointer;
if (MemorySize == 0)
@ -221,7 +221,7 @@ VOID MmFreeMemory(PVOID MemoryPointer)
VOID DumpMemoryAllocMap(VOID)
{
ULONG Idx;
PFN_NUMBER Idx;
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTableAddress;
DbgPrint("----------- Memory Allocation Bitmap -----------\n");
@ -295,7 +295,7 @@ VOID DumpMemoryAllocMap(VOID)
}
#endif // DBG
PPAGE_LOOKUP_TABLE_ITEM MmGetMemoryMap(ULONG *NoEntries)
PPAGE_LOOKUP_TABLE_ITEM MmGetMemoryMap(PFN_NUMBER *NoEntries)
{
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTableAddress;

View file

@ -15,7 +15,7 @@
/* GLOBALS ********************************************************************/
extern CHAR reactos_arc_hardware_data[];
ULONG FldrpHwHeapLocation;
SIZE_T FldrpHwHeapLocation;
PCONFIGURATION_COMPONENT_DATA FldrArcHwTreeRoot;
BOOLEAN UseRealHeap = FALSE;
@ -30,7 +30,7 @@ FldrSetConfigurationData(IN PCONFIGURATION_COMPONENT_DATA ComponentData,
PVOID
NTAPI
FldrpHwHeapAlloc(IN ULONG Size)
FldrpHwHeapAlloc(IN SIZE_T Size)
{
PVOID Buffer;
@ -62,7 +62,7 @@ NTAPI
FldrSetIdentifier(IN PCONFIGURATION_COMPONENT_DATA ComponentData,
IN PCHAR IdentifierString)
{
ULONG IdentifierLength;
SIZE_T IdentifierLength;
PCONFIGURATION_COMPONENT Component = &ComponentData->ComponentEntry;
PCHAR Identifier;
@ -75,7 +75,7 @@ FldrSetIdentifier(IN PCONFIGURATION_COMPONENT_DATA ComponentData,
RtlCopyMemory(Identifier, IdentifierString, IdentifierLength);
/* Set component information */
Component->IdentifierLength = IdentifierLength;
Component->IdentifierLength = (ULONG)IdentifierLength;
Component->Identifier = Identifier;
}

View file

@ -174,8 +174,8 @@ RegCreateKey(FRLDRHKEY ParentKey,
FRLDRHKEY NewKey;
PWCHAR p;
PCWSTR name;
int subkeyLength;
int stringLength;
SIZE_T subkeyLength;
SIZE_T stringLength;
ULONG NameSize;
int CmpResult;
@ -220,7 +220,7 @@ RegCreateKey(FRLDRHKEY ParentKey,
stringLength = subkeyLength;
name = KeyName;
}
NameSize = (subkeyLength + 1) * sizeof(WCHAR);
NameSize = (ULONG)((subkeyLength + 1) * sizeof(WCHAR));
Ptr = CurrentKey->SubKeyList.Flink;
CmpResult = 1;
@ -345,8 +345,8 @@ RegOpenKey(FRLDRHKEY ParentKey,
FRLDRHKEY CurrentKey;
PWCHAR p;
PCWSTR name;
int subkeyLength;
int stringLength;
SIZE_T subkeyLength;
SIZE_T stringLength;
ULONG NameSize;
TRACE("KeyName '%S'\n", KeyName);
@ -391,7 +391,7 @@ RegOpenKey(FRLDRHKEY ParentKey,
stringLength = subkeyLength;
name = KeyName;
}
NameSize = (subkeyLength + 1) * sizeof(WCHAR);
NameSize = (ULONG)((subkeyLength + 1) * sizeof(WCHAR));
Ptr = CurrentKey->SubKeyList.Flink;
while (Ptr != &CurrentKey->SubKeyList)
@ -495,7 +495,7 @@ RegSetValue(FRLDRHKEY Key,
InsertTailList(&Key->ValueList, &Value->ValueList);
Key->ValueCount++;
Value->NameSize = (wcslen(ValueName)+1) * sizeof(WCHAR);
Value->NameSize = (ULONG)(wcslen(ValueName)+1) * sizeof(WCHAR);
Value->Name = MmHeapAlloc(Value->NameSize);
if (Value->Name == NULL) return ERROR_OUTOFMEMORY;
wcscpy(Value->Name, ValueName);

View file

@ -128,7 +128,7 @@ VOID TuiDrawBackdrop(VOID)
//
// Draw title text
//
TuiDrawText( (UiScreenWidth / 2) - (strlen(UiTitleBoxTitleText) / 2),
TuiDrawText( (UiScreenWidth / 2) - ((ULONG)strlen(UiTitleBoxTitleText) / 2),
2,
UiTitleBoxTitleText,
ATTR(UiTitleBoxFgColor, UiTitleBoxBgColor));
@ -332,12 +332,12 @@ VOID TuiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr)
{
ULONG TextLength;
SIZE_T TextLength;
ULONG BoxWidth;
ULONG BoxHeight;
ULONG LineBreakCount;
ULONG Index;
ULONG LastIndex;
SIZE_T Index;
SIZE_T LastIndex;
ULONG RealLeft;
ULONG RealTop;
ULONG X;
@ -361,7 +361,7 @@ VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR
{
if ((Index - LastIndex) > BoxWidth)
{
BoxWidth = (Index - LastIndex);
BoxWidth = (ULONG)(Index - LastIndex);
}
}
}
@ -381,7 +381,7 @@ VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR
}
else
{
X = RealLeft + LastIndex;
X = (ULONG)(RealLeft + LastIndex);
Y = RealTop;
LastIndex++;
Temp[0] = TextString[Index];
@ -393,14 +393,14 @@ VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR
VOID TuiDrawStatusText(PCSTR StatusText)
{
ULONG i;
SIZE_T i;
TuiDrawText(0, UiScreenHeight-1, " ", ATTR(UiStatusBarFgColor, UiStatusBarBgColor));
TuiDrawText(1, UiScreenHeight-1, StatusText, ATTR(UiStatusBarFgColor, UiStatusBarBgColor));
for (i=strlen(StatusText)+1; i<UiScreenWidth; i++)
{
TuiDrawText(i, UiScreenHeight-1, " ", ATTR(UiStatusBarFgColor, UiStatusBarBgColor));
TuiDrawText((ULONG)i, UiScreenHeight-1, " ", ATTR(UiStatusBarFgColor, UiStatusBarBgColor));
}
VideoCopyOffScreenBufferToVRAM();
@ -459,7 +459,7 @@ VOID TuiUpdateDateTime(VOID)
strcat(DateString, TempString);
// Draw the date
TuiDrawText(UiScreenWidth-strlen(DateString)-2, 1, DateString, ATTR(UiTitleBoxFgColor, UiTitleBoxBgColor));
TuiDrawText(UiScreenWidth-(ULONG)strlen(DateString)-2, 1, DateString, ATTR(UiTitleBoxFgColor, UiTitleBoxBgColor));
// Get the hour and change from 24-hour mode to 12-hour
if (TimeInfo->Hour > 12)
@ -498,7 +498,7 @@ VOID TuiUpdateDateTime(VOID)
}
// Draw the time
TuiDrawText(UiScreenWidth-strlen(TimeString)-2, 2, TimeString, ATTR(UiTitleBoxFgColor, UiTitleBoxBgColor));
TuiDrawText(UiScreenWidth-(ULONG)strlen(TimeString)-2, 2, TimeString, ATTR(UiTitleBoxFgColor, UiTitleBoxBgColor));
}
VOID TuiSaveScreen(PUCHAR Buffer)

View file

@ -151,7 +151,7 @@ TuiCalcMenuBoxSize(PUI_MENU_INFO MenuInfo)
//
// Get the string length and make it become the new width if necessary
//
Length = strlen(MenuInfo->MenuItemList[i]);
Length = (ULONG)strlen(MenuInfo->MenuItemList[i]);
if (Length > Width) Width = Length;
}
@ -248,7 +248,7 @@ TuiDrawMenuBox(PUI_MENU_INFO MenuInfo)
// Copy the integral time text string, and remove the last 2 chars
//
strcpy(TempString, UiTimeText);
i = strlen(TempString);
i = (ULONG)strlen(TempString);
TempString[i - 2] = 0;
//
@ -271,7 +271,7 @@ TuiDrawMenuBox(PUI_MENU_INFO MenuInfo)
//
// Display it in the center of the menu
//
UiDrawText(MenuInfo->Right - strlen(MenuLineText) - 1,
UiDrawText(MenuInfo->Right - (ULONG)strlen(MenuLineText) - 1,
MenuInfo->Bottom,
MenuLineText,
ATTR(UiMenuFgColor, UiMenuBgColor));
@ -303,7 +303,7 @@ TuiDrawMenuBox(PUI_MENU_INFO MenuInfo)
//
if (UiCenterMenu)
{
UiDrawText(MenuInfo->Right - strlen(MenuLineText) - 1,
UiDrawText(MenuInfo->Right - (ULONG)strlen(MenuLineText) - 1,
MenuInfo->Bottom,
MenuLineText,
ATTR(UiMenuFgColor, UiMenuBgColor));
@ -364,7 +364,7 @@ TuiDrawMenuItem(PUI_MENU_INFO MenuInfo,
// how many spaces will be to the left and right
//
SpaceTotal = (MenuInfo->Right - MenuInfo->Left - 2) -
strlen(MenuInfo->MenuItemList[MenuItemNumber]);
(ULONG)strlen(MenuInfo->MenuItemList[MenuItemNumber]);
SpaceLeft = (SpaceTotal / 2) + 1;
SpaceRight = (SpaceTotal - SpaceLeft) + 1;

View file

@ -228,7 +228,8 @@ BOOLEAN UiInitialize(BOOLEAN ShowGui)
BOOLEAN SetupUiInitialize(VOID)
{
CHAR DisplayModeText[260];
ULONG Depth, Length;
ULONG Depth;
SIZE_T Length;
DisplayModeText[0] = '\0';
@ -313,12 +314,12 @@ VOID UiUpdateDateTime(VOID)
VOID UiInfoBox(PCSTR MessageText)
{
ULONG TextLength;
SIZE_T TextLength;
ULONG BoxWidth;
ULONG BoxHeight;
ULONG LineBreakCount;
ULONG Index;
ULONG LastIndex;
SIZE_T Index;
SIZE_T LastIndex;
ULONG Left;
ULONG Top;
ULONG Right;
@ -341,7 +342,7 @@ VOID UiInfoBox(PCSTR MessageText)
{
if ((Index - LastIndex) > BoxWidth)
{
BoxWidth = (Index - LastIndex);
BoxWidth = (ULONG)(Index - LastIndex);
}
}
}

View file

@ -453,7 +453,7 @@ WinLdrpCompareDllName(IN PCH DllName,
{
PWSTR Buffer;
UNICODE_STRING UnicodeNamePA;
ULONG i, Length;
SIZE_T i, Length;
/* First obvious check: for length of two names */
Length = strlen(DllName);

View file

@ -49,8 +49,8 @@ WinLdrInsertDescriptor(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
extern PFREELDR_MEMORY_DESCRIPTOR BiosMemoryMap;
extern ULONG BiosMemoryMapEntryCount;
extern ULONG MmLowestPhysicalPage;
extern ULONG MmHighestPhysicalPage;
extern PFN_NUMBER MmLowestPhysicalPage;
extern PFN_NUMBER MmHighestPhysicalPage;
/* GLOBALS ***************************************************************/
@ -63,8 +63,8 @@ ULONG MadCount = 0;
VOID
MempAddMemoryBlock(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
ULONG BasePage,
ULONG PageCount,
PFN_NUMBER BasePage,
PFN_NUMBER PageCount,
ULONG Type)
{
BOOLEAN Status = TRUE;
@ -195,10 +195,10 @@ MempAddMemoryBlock(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
BOOLEAN
WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
{
ULONG i, PagesCount, MemoryMapSizeInPages;
ULONG LastPageIndex, LastPageType, MemoryMapStartPage;
PFN_NUMBER i, PagesCount, MemoryMapSizeInPages, NoEntries;
PFN_NUMBER LastPageIndex, MemoryMapStartPage;
PPAGE_LOOKUP_TABLE_ITEM MemoryMap;
ULONG NoEntries;
ULONG LastPageType;
//PKTSS Tss;
//BOOLEAN Status;

View file

@ -720,7 +720,7 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
if (ImagePath && (wcslen(ImagePath) > 0))
{
// Just copy ImagePath to the corresponding field in the structure
PathLength = wcslen(ImagePath) * sizeof(WCHAR) + sizeof(UNICODE_NULL);
PathLength = (USHORT)wcslen(ImagePath) * sizeof(WCHAR) + sizeof(UNICODE_NULL);
BootDriverEntry->FilePath.Length = 0;
BootDriverEntry->FilePath.MaximumLength = PathLength;
@ -743,7 +743,7 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
else
{
// we have to construct ImagePath ourselves
PathLength = wcslen(ServiceName)*sizeof(WCHAR) + sizeof(L"system32\\drivers\\.sys");
PathLength = (USHORT)wcslen(ServiceName)*sizeof(WCHAR) + sizeof(L"system32\\drivers\\.sys");
BootDriverEntry->FilePath.Length = 0;
BootDriverEntry->FilePath.MaximumLength = PathLength;
BootDriverEntry->FilePath.Buffer = MmHeapAlloc(PathLength);
@ -780,7 +780,7 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
}
// Add registry path
PathLength = (wcslen(RegistryPath) + wcslen(ServiceName))*sizeof(WCHAR) + sizeof(UNICODE_NULL);
PathLength = (USHORT)(wcslen(RegistryPath) + wcslen(ServiceName))*sizeof(WCHAR) + sizeof(UNICODE_NULL);
BootDriverEntry->RegistryPath.Length = 0;
BootDriverEntry->RegistryPath.MaximumLength = PathLength;
BootDriverEntry->RegistryPath.Buffer = MmHeapAlloc(PathLength);