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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -60,7 +60,7 @@ typedef struct _FREELDR_MEMORY_DESCRIPTOR
typedef struct typedef struct
{ {
TYPE_OF_MEMORY PageAllocated; // Type of allocated memory (LoaderFree if this memory is free) 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; } PAGE_LOOKUP_TABLE_ITEM, *PPAGE_LOOKUP_TABLE_ITEM;
#include <poppack.h> #include <poppack.h>
@ -72,38 +72,38 @@ typedef struct
#define DUMP_MEM_MAP_ON_VERIFY 0 #define DUMP_MEM_MAP_ON_VERIFY 0
extern PVOID PageLookupTableAddress; extern PVOID PageLookupTableAddress;
extern ULONG TotalPagesInLookupTable; extern PFN_NUMBER TotalPagesInLookupTable;
extern ULONG FreePagesInLookupTable; extern PFN_NUMBER FreePagesInLookupTable;
extern ULONG LastFreePageHint; extern PFN_NUMBER LastFreePageHint;
#if DBG #if DBG
PCSTR MmGetSystemMemoryMapTypeString(TYPE_OF_MEMORY Type); PCSTR MmGetSystemMemoryMapTypeString(TYPE_OF_MEMORY Type);
#endif #endif
ULONG MmGetPageNumberFromAddress(PVOID Address); // Returns the page number that contains a linear address PFN_NUMBER 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 PFN_NUMBER 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) 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, ULONG TotalPageCount); // Inits the page lookup table according to the memory types in the memory map 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, ULONG StartPage, ULONG PageCount, TYPE_OF_MEMORY PageAllocated); // Marks the specified pages as allocated or free in the lookup table 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, ULONG StartPage, ULONG PageCount, TYPE_OF_MEMORY MemoryType); // Allocates the specified pages 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
ULONG MmCountFreePagesInLookupTable(PVOID PageLookupTable, ULONG TotalPageCount); // Returns the number of free pages in the lookup table PFN_NUMBER MmCountFreePagesInLookupTable(PVOID PageLookupTable, PFN_NUMBER 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 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
ULONG MmFindAvailablePagesBeforePage(PVOID PageLookupTable, ULONG TotalPageCount, ULONG PagesNeeded, ULONG LastPage); // Returns the page number of the first available page range before the specified page 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, ULONG TotalPageCount); // Sets the LastFreePageHint to the last usable page of memory VOID MmUpdateLastFreePageHint(PVOID PageLookupTable, PFN_NUMBER 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 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, ULONG MemorySize, TYPE_OF_MEMORY NewType); // Use with EXTREME caution! 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(ULONG LowMemoryStart, ULONG LowMemoryLength);
BOOLEAN MmInitializeMemoryManager(VOID); BOOLEAN MmInitializeMemoryManager(VOID);
VOID MmInitializeHeap(PVOID PageLookupTable); VOID MmInitializeHeap(PVOID PageLookupTable);
PVOID MmAllocateMemory(ULONG MemorySize); PVOID MmAllocateMemory(SIZE_T MemorySize);
PVOID MmAllocateMemoryWithType(ULONG MemorySize, TYPE_OF_MEMORY MemoryType); PVOID MmAllocateMemoryWithType(SIZE_T MemorySize, TYPE_OF_MEMORY MemoryType);
VOID MmFreeMemory(PVOID MemoryPointer); VOID MmFreeMemory(PVOID MemoryPointer);
PVOID MmAllocateMemoryAtAddress(ULONG MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType); PVOID MmAllocateMemoryAtAddress(SIZE_T MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType);
PVOID MmAllocateHighestMemoryBelowAddress(ULONG MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType); PVOID MmAllocateHighestMemoryBelowAddress(SIZE_T MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType);
PVOID MmHeapAlloc(SIZE_T MemorySize); PVOID MmHeapAlloc(SIZE_T MemorySize);
VOID MmHeapFree(PVOID MemoryPointer); VOID MmHeapFree(PVOID MemoryPointer);
@ -114,7 +114,7 @@ extern PVOID FrLdrTempHeap;
PVOID PVOID
HeapCreate( HeapCreate(
ULONG MaximumSize, SIZE_T MaximumSize,
TYPE_OF_MEMORY MemoryType); TYPE_OF_MEMORY MemoryType);
VOID VOID

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -128,7 +128,7 @@ VOID TuiDrawBackdrop(VOID)
// //
// Draw title text // Draw title text
// //
TuiDrawText( (UiScreenWidth / 2) - (strlen(UiTitleBoxTitleText) / 2), TuiDrawText( (UiScreenWidth / 2) - ((ULONG)strlen(UiTitleBoxTitleText) / 2),
2, 2,
UiTitleBoxTitleText, UiTitleBoxTitleText,
ATTR(UiTitleBoxFgColor, UiTitleBoxBgColor)); 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) VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr)
{ {
ULONG TextLength; SIZE_T TextLength;
ULONG BoxWidth; ULONG BoxWidth;
ULONG BoxHeight; ULONG BoxHeight;
ULONG LineBreakCount; ULONG LineBreakCount;
ULONG Index; SIZE_T Index;
ULONG LastIndex; SIZE_T LastIndex;
ULONG RealLeft; ULONG RealLeft;
ULONG RealTop; ULONG RealTop;
ULONG X; ULONG X;
@ -361,7 +361,7 @@ VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR
{ {
if ((Index - LastIndex) > BoxWidth) 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 else
{ {
X = RealLeft + LastIndex; X = (ULONG)(RealLeft + LastIndex);
Y = RealTop; Y = RealTop;
LastIndex++; LastIndex++;
Temp[0] = TextString[Index]; Temp[0] = TextString[Index];
@ -393,14 +393,14 @@ VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR
VOID TuiDrawStatusText(PCSTR StatusText) VOID TuiDrawStatusText(PCSTR StatusText)
{ {
ULONG i; SIZE_T i;
TuiDrawText(0, UiScreenHeight-1, " ", ATTR(UiStatusBarFgColor, UiStatusBarBgColor)); TuiDrawText(0, UiScreenHeight-1, " ", ATTR(UiStatusBarFgColor, UiStatusBarBgColor));
TuiDrawText(1, UiScreenHeight-1, StatusText, ATTR(UiStatusBarFgColor, UiStatusBarBgColor)); TuiDrawText(1, UiScreenHeight-1, StatusText, ATTR(UiStatusBarFgColor, UiStatusBarBgColor));
for (i=strlen(StatusText)+1; i<UiScreenWidth; i++) for (i=strlen(StatusText)+1; i<UiScreenWidth; i++)
{ {
TuiDrawText(i, UiScreenHeight-1, " ", ATTR(UiStatusBarFgColor, UiStatusBarBgColor)); TuiDrawText((ULONG)i, UiScreenHeight-1, " ", ATTR(UiStatusBarFgColor, UiStatusBarBgColor));
} }
VideoCopyOffScreenBufferToVRAM(); VideoCopyOffScreenBufferToVRAM();
@ -459,7 +459,7 @@ VOID TuiUpdateDateTime(VOID)
strcat(DateString, TempString); strcat(DateString, TempString);
// Draw the date // 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 // Get the hour and change from 24-hour mode to 12-hour
if (TimeInfo->Hour > 12) if (TimeInfo->Hour > 12)
@ -498,7 +498,7 @@ VOID TuiUpdateDateTime(VOID)
} }
// Draw the time // 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) 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 // 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; 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 // Copy the integral time text string, and remove the last 2 chars
// //
strcpy(TempString, UiTimeText); strcpy(TempString, UiTimeText);
i = strlen(TempString); i = (ULONG)strlen(TempString);
TempString[i - 2] = 0; TempString[i - 2] = 0;
// //
@ -271,7 +271,7 @@ TuiDrawMenuBox(PUI_MENU_INFO MenuInfo)
// //
// Display it in the center of the menu // Display it in the center of the menu
// //
UiDrawText(MenuInfo->Right - strlen(MenuLineText) - 1, UiDrawText(MenuInfo->Right - (ULONG)strlen(MenuLineText) - 1,
MenuInfo->Bottom, MenuInfo->Bottom,
MenuLineText, MenuLineText,
ATTR(UiMenuFgColor, UiMenuBgColor)); ATTR(UiMenuFgColor, UiMenuBgColor));
@ -303,7 +303,7 @@ TuiDrawMenuBox(PUI_MENU_INFO MenuInfo)
// //
if (UiCenterMenu) if (UiCenterMenu)
{ {
UiDrawText(MenuInfo->Right - strlen(MenuLineText) - 1, UiDrawText(MenuInfo->Right - (ULONG)strlen(MenuLineText) - 1,
MenuInfo->Bottom, MenuInfo->Bottom,
MenuLineText, MenuLineText,
ATTR(UiMenuFgColor, UiMenuBgColor)); ATTR(UiMenuFgColor, UiMenuBgColor));
@ -364,7 +364,7 @@ TuiDrawMenuItem(PUI_MENU_INFO MenuInfo,
// how many spaces will be to the left and right // how many spaces will be to the left and right
// //
SpaceTotal = (MenuInfo->Right - MenuInfo->Left - 2) - SpaceTotal = (MenuInfo->Right - MenuInfo->Left - 2) -
strlen(MenuInfo->MenuItemList[MenuItemNumber]); (ULONG)strlen(MenuInfo->MenuItemList[MenuItemNumber]);
SpaceLeft = (SpaceTotal / 2) + 1; SpaceLeft = (SpaceTotal / 2) + 1;
SpaceRight = (SpaceTotal - SpaceLeft) + 1; SpaceRight = (SpaceTotal - SpaceLeft) + 1;

View file

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

View file

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

View file

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

View file

@ -720,7 +720,7 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
if (ImagePath && (wcslen(ImagePath) > 0)) if (ImagePath && (wcslen(ImagePath) > 0))
{ {
// Just copy ImagePath to the corresponding field in the structure // 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.Length = 0;
BootDriverEntry->FilePath.MaximumLength = PathLength; BootDriverEntry->FilePath.MaximumLength = PathLength;
@ -743,7 +743,7 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
else else
{ {
// we have to construct ImagePath ourselves // 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.Length = 0;
BootDriverEntry->FilePath.MaximumLength = PathLength; BootDriverEntry->FilePath.MaximumLength = PathLength;
BootDriverEntry->FilePath.Buffer = MmHeapAlloc(PathLength); BootDriverEntry->FilePath.Buffer = MmHeapAlloc(PathLength);
@ -780,7 +780,7 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
} }
// Add registry path // 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.Length = 0;
BootDriverEntry->RegistryPath.MaximumLength = PathLength; BootDriverEntry->RegistryPath.MaximumLength = PathLength;
BootDriverEntry->RegistryPath.Buffer = MmHeapAlloc(PathLength); BootDriverEntry->RegistryPath.Buffer = MmHeapAlloc(PathLength);