Changes in v1.7 (8/6/2002) (brianp)

- EXT2/EXT3 file system support.
- Does not yet support symbolic links or booting from an EXT2/3 partition.
- Fixed bug in UI code.
- Added '%%' format specifier to printf()-like functions.
- Added functions __udivdi3 & __umoddi3 so that 64-bit division is now supported.
- Changed types BYTE, WORD, DWORD, LONG, ULONG to U8, U16, U32, S32, U32
  so that you know the size of the variable across different
  architectures with different sized words & dwords, etc.
- Types CHAR, UCHAR, PCHAR, PUCHAR, WCHAR, PWCHAR have not been
  changed yet (I haven't decided exactly how I'm going to handle unicode)

(isn't this an awesome commit? ;-) Just look at that list of files)

svn path=/trunk/; revision=3318
This commit is contained in:
Brian Palmer 2002-08-07 05:13:18 +00:00
parent aac9125953
commit 70d2e3812d
71 changed files with 9869 additions and 1035 deletions

View file

@ -1,3 +1,16 @@
Changes in v1.7 (8/6/2002) (brianp)
- EXT2/EXT3 file system support.
- Does not yet support symbolic links or booting from an EXT2/3 partition.
- Fixed bug in UI code.
- Added '%%' format specifier to printf()-like functions.
- Added functions __udivdi3 & __umoddi3 so that 64-bit division is now supported.
- Changed types BYTE, WORD, DWORD, LONG, ULONG to U8, U16, U32, S32, U32
so that you know the size of the variable across different
architectures with different sized words & dwords, etc.
- Types CHAR, UCHAR, PCHAR, PUCHAR, WCHAR, PWCHAR have not been
changed yet (I haven't decided exactly how I'm going to handle unicode)
Changes in v1.6.2 (7/28/2002) (brianp)
- Fix for GetFatEntry16 bug (fathelp.asm) by Mike Lerwill

View file

@ -194,7 +194,8 @@ RTL_OBJS = memory.o \
FS_OBJS = fs.o \
fat.o \
iso.o
iso.o \
ext2.o
UI_OBJS = tui.o \
tuimenu.o \
@ -228,6 +229,11 @@ INIFILE_OBJS= inifile.o \
VIDEO_OBJS = video.o \
vidmode.o
# libgcc2.o contains code (__udivdi3, __umoddi3) necessary to do
# 64-bit division on the i386 (and other 32-bit) architectures
# This code was taken from the GCC v3.1 source
MATH_OBJS = libgcc2.o
FREELDR_OBJS= freeldr.o \
miscboot.o \
options.o \
@ -253,6 +259,7 @@ OBJS = $(ARCH_OBJS) \
$(CACHE_OBJS) \
$(INIFILE_OBJS) \
$(VIDEO_OBJS) \
$(MATH_OBJS) \
$(FREELDR_OBJS)
#############################################
@ -270,6 +277,7 @@ VPATH = $(SRCDIR)/ \
$(SRCDIR)/cache \
$(SRCDIR)/inifile \
$(SRCDIR)/video \
$(SRCDIR)/math \
$(SRCDIR)/include
#############################################
@ -283,6 +291,7 @@ freeldr.sys : $(OBJS)
@echo ===================================================== LINKING $@
# @$(LD) -N -Ttext=0x8000 --oformat=binary -s -o freeldr.sys $(OBJS)
@$(LD) $(LFLAGS) -Map freeldr.map -o freeldr.exe $(OBJS)
# @$(CC) -Wl,-Ttext=0x8000,-N,-Map,freeldr.map -o freeldr.exe $(OBJS)
@$(NM) --numeric-sort freeldr.exe > freeldr.sym
@$(OBJCOPY) -O binary freeldr.exe freeldr.sys

View file

@ -37,13 +37,13 @@ VOID RunBootManager(VOID)
{
UCHAR SettingName[80];
UCHAR SettingValue[80];
ULONG SectionId;
ULONG OperatingSystemCount;
U32 SectionId;
U32 OperatingSystemCount;
PUCHAR *OperatingSystemSectionNames;
PUCHAR *OperatingSystemDisplayNames;
ULONG DefaultOperatingSystem;
LONG TimeOut;
ULONG SelectedOperatingSystem;
U32 DefaultOperatingSystem;
S32 TimeOut;
U32 SelectedOperatingSystem;
if (!IniFileInitialize())
{
@ -148,12 +148,12 @@ reboot:
return;
}
ULONG GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG OperatingSystemCount)
U32 GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], U32 OperatingSystemCount)
{
UCHAR DefaultOSText[80];
ULONG SectionId;
ULONG DefaultOS = 0;
ULONG Idx;
U32 SectionId;
U32 DefaultOS = 0;
U32 Idx;
if (!IniOpenSection("FreeLoader", &SectionId))
{
@ -175,11 +175,11 @@ ULONG GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG OperatingSys
return DefaultOS;
}
LONG GetTimeOut(VOID)
S32 GetTimeOut(VOID)
{
UCHAR TimeOutText[20];
ULONG TimeOut;
ULONG SectionId;
U32 TimeOut;
U32 SectionId;
if (!IniOpenSection("FreeLoader", &SectionId))
{

View file

@ -29,7 +29,7 @@
// Returns a pointer to a CACHE_BLOCK structure
// Adds the block to the cache manager block list
// in cache memory if it isn't already there
PCACHE_BLOCK CacheInternalGetBlockPointer(PCACHE_DRIVE CacheDrive, ULONG BlockNumber)
PCACHE_BLOCK CacheInternalGetBlockPointer(PCACHE_DRIVE CacheDrive, U32 BlockNumber)
{
PCACHE_BLOCK CacheBlock = NULL;
@ -54,7 +54,7 @@ PCACHE_BLOCK CacheInternalGetBlockPointer(PCACHE_DRIVE CacheDrive, ULONG BlockNu
return CacheBlock;
}
PCACHE_BLOCK CacheInternalFindBlock(PCACHE_DRIVE CacheDrive, ULONG BlockNumber)
PCACHE_BLOCK CacheInternalFindBlock(PCACHE_DRIVE CacheDrive, U32 BlockNumber)
{
PCACHE_BLOCK CacheBlock = NULL;
@ -92,7 +92,7 @@ PCACHE_BLOCK CacheInternalFindBlock(PCACHE_DRIVE CacheDrive, ULONG BlockNumber)
return NULL;
}
PCACHE_BLOCK CacheInternalAddBlockToCache(PCACHE_DRIVE CacheDrive, ULONG BlockNumber)
PCACHE_BLOCK CacheInternalAddBlockToCache(PCACHE_DRIVE CacheDrive, U32 BlockNumber)
{
PCACHE_BLOCK CacheBlock = NULL;
@ -194,7 +194,7 @@ BOOL CacheInternalFreeBlock(PCACHE_DRIVE CacheDrive)
VOID CacheInternalCheckCacheSizeLimits(PCACHE_DRIVE CacheDrive)
{
ULONG NewCacheSize;
U32 NewCacheSize;
DbgPrint((DPRINT_CACHE, "CacheInternalCheckCacheSizeLimits()\n"));

View file

@ -33,11 +33,11 @@
CACHE_DRIVE CacheManagerDrive;
BOOL CacheManagerInitialized = FALSE;
BOOL CacheManagerDataInvalid = FALSE;
ULONG CacheBlockCount = 0;
ULONG CacheSizeLimit = 0;
ULONG CacheSizeCurrent = 0;
U32 CacheBlockCount = 0;
U32 CacheSizeLimit = 0;
U32 CacheSizeCurrent = 0;
BOOL CacheInitializeDrive(ULONG DriveNumber)
BOOL CacheInitializeDrive(U32 DriveNumber)
{
PCACHE_BLOCK NextCacheBlock;
@ -129,16 +129,16 @@ VOID CacheInvalidateCacheData(VOID)
CacheManagerDataInvalid = TRUE;
}
BOOL CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount, PVOID Buffer)
BOOL CacheReadDiskSectors(U32 DiskNumber, U32 StartSector, U32 SectorCount, PVOID Buffer)
{
PCACHE_BLOCK CacheBlock;
ULONG StartBlock;
ULONG SectorOffsetInStartBlock;
ULONG CopyLengthInStartBlock;
ULONG EndBlock;
ULONG SectorOffsetInEndBlock;
ULONG BlockCount;
ULONG Idx;
U32 StartBlock;
U32 SectorOffsetInStartBlock;
U32 CopyLengthInStartBlock;
U32 EndBlock;
U32 SectorOffsetInEndBlock;
U32 BlockCount;
U32 Idx;
DbgPrint((DPRINT_CACHE, "CacheReadDiskSectors() DiskNumber: 0x%x StartSector: %d SectorCount: %d Buffer: 0x%x\n", DiskNumber, StartSector, SectorCount, Buffer));
@ -261,13 +261,13 @@ BOOL CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount
return TRUE;
}
BOOL CacheForceDiskSectorsIntoCache(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount)
BOOL CacheForceDiskSectorsIntoCache(U32 DiskNumber, U32 StartSector, U32 SectorCount)
{
PCACHE_BLOCK CacheBlock;
ULONG StartBlock;
ULONG EndBlock;
ULONG BlockCount;
ULONG Idx;
U32 StartBlock;
U32 EndBlock;
U32 BlockCount;
U32 Idx;
DbgPrint((DPRINT_CACHE, "CacheForceDiskSectorsIntoCache() DiskNumber: 0x%x StartSector: %d SectorCount: %d\n", DiskNumber, StartSector, SectorCount));
@ -307,9 +307,9 @@ BOOL CacheForceDiskSectorsIntoCache(ULONG DiskNumber, ULONG StartSector, ULONG S
return TRUE;
}
BOOL CacheReleaseMemory(ULONG MinimumAmountToRelease)
BOOL CacheReleaseMemory(U32 MinimumAmountToRelease)
{
ULONG AmountReleased;
U32 AmountReleased;
DbgPrint((DPRINT_CACHE, "CacheReleaseMemory() MinimumAmountToRelease = %d\n", MinimumAmountToRelease));

View file

@ -38,9 +38,9 @@ typedef struct
{
LIST_ITEM ListEntry; // Doubly linked list synchronization member
ULONG BlockNumber; // Track index for CHS, 64k block index for LBA
U32 BlockNumber; // Track index for CHS, 64k block index for LBA
BOOL LockedInCache; // Indicates that this block is locked in cache memory
ULONG AccessCount; // Access count for this block
U32 AccessCount; // Access count for this block
PVOID BlockData; // Pointer to block data
@ -55,11 +55,11 @@ typedef struct
///////////////////////////////////////////////////////////////////////////////////////
typedef struct
{
ULONG DriveNumber;
U32 DriveNumber;
BOOL LbaSupported;
GEOMETRY DriveGeometry;
ULONG BlockSize; // Block size (in sectors)
U32 BlockSize; // Block size (in sectors)
PCACHE_BLOCK CacheBlockHead;
} CACHE_DRIVE, *PCACHE_DRIVE;
@ -72,18 +72,18 @@ typedef struct
///////////////////////////////////////////////////////////////////////////////////////
extern CACHE_DRIVE CacheManagerDrive;
extern BOOL CacheManagerInitialized;
extern ULONG CacheBlockCount;
extern ULONG CacheSizeLimit;
extern ULONG CacheSizeCurrent;
extern U32 CacheBlockCount;
extern U32 CacheSizeLimit;
extern U32 CacheSizeCurrent;
///////////////////////////////////////////////////////////////////////////////////////
//
// Internal functions
//
///////////////////////////////////////////////////////////////////////////////////////
PCACHE_BLOCK CacheInternalGetBlockPointer(PCACHE_DRIVE CacheDrive, ULONG BlockNumber); // Returns a pointer to a CACHE_BLOCK structure given a block number
PCACHE_BLOCK CacheInternalFindBlock(PCACHE_DRIVE CacheDrive, ULONG BlockNumber); // Searches the block list for a particular block
PCACHE_BLOCK CacheInternalAddBlockToCache(PCACHE_DRIVE CacheDrive, ULONG BlockNumber); // Adds a block to the cache's block list
PCACHE_BLOCK CacheInternalGetBlockPointer(PCACHE_DRIVE CacheDrive, U32 BlockNumber); // Returns a pointer to a CACHE_BLOCK structure given a block number
PCACHE_BLOCK CacheInternalFindBlock(PCACHE_DRIVE CacheDrive, U32 BlockNumber); // Searches the block list for a particular block
PCACHE_BLOCK CacheInternalAddBlockToCache(PCACHE_DRIVE CacheDrive, U32 BlockNumber); // Adds a block to the cache's block list
BOOL CacheInternalFreeBlock(PCACHE_DRIVE CacheDrive); // Removes a block from the cache's block list & frees the memory
VOID CacheInternalCheckCacheSizeLimits(PCACHE_DRIVE CacheDrive); // Checks the cache size limits to see if we can add a new block, if not calls CacheInternalFreeBlock()
VOID CacheInternalDumpBlockList(PCACHE_DRIVE CacheDrive); // Dumps the list of cached blocks to the debug output port

View file

@ -1,4 +1,4 @@
/* $Id: portio.c,v 1.2 2002/06/06 05:58:35 bpalmer Exp $
/* $Id: portio.c,v 1.3 2002/08/07 05:13:15 bpalmer Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -54,7 +54,7 @@
VOID /*STDCALL*/
READ_PORT_BUFFER_UCHAR (PUCHAR Port,
PUCHAR Buffer,
ULONG Count)
U32 Count)
{
__asm__ __volatile__ ("cld ; rep ; insb\n\t"
: "=D" (Buffer), "=c" (Count)
@ -62,9 +62,9 @@ READ_PORT_BUFFER_UCHAR (PUCHAR Port,
}
VOID /*STDCALL*/
READ_PORT_BUFFER_USHORT (PUSHORT Port,
PUSHORT Buffer,
ULONG Count)
READ_PORT_BUFFER_USHORT (U16* Port,
U16* Buffer,
U32 Count)
{
__asm__ __volatile__ ("cld ; rep ; insw"
: "=D" (Buffer), "=c" (Count)
@ -72,9 +72,9 @@ READ_PORT_BUFFER_USHORT (PUSHORT Port,
}
VOID /*STDCALL*/
READ_PORT_BUFFER_ULONG (PULONG Port,
PULONG Buffer,
ULONG Count)
READ_PORT_BUFFER_ULONG (U32* Port,
U32* Buffer,
U32 Count)
{
__asm__ __volatile__ ("cld ; rep ; insl"
: "=D" (Buffer), "=c" (Count)
@ -93,10 +93,10 @@ READ_PORT_UCHAR (PUCHAR Port)
return(Value);
}
USHORT /*STDCALL*/
READ_PORT_USHORT (PUSHORT Port)
U16 /*STDCALL*/
READ_PORT_USHORT (U16* Port)
{
USHORT Value;
U16 Value;
__asm__("inw %w1, %0\n\t"
: "=a" (Value)
@ -105,10 +105,10 @@ READ_PORT_USHORT (PUSHORT Port)
return(Value);
}
ULONG /*STDCALL*/
READ_PORT_ULONG (PULONG Port)
U32 /*STDCALL*/
READ_PORT_ULONG (U32* Port)
{
ULONG Value;
U32 Value;
__asm__("inl %w1, %0\n\t"
: "=a" (Value)
@ -120,7 +120,7 @@ READ_PORT_ULONG (PULONG Port)
VOID /*STDCALL*/
WRITE_PORT_BUFFER_UCHAR (PUCHAR Port,
PUCHAR Buffer,
ULONG Count)
U32 Count)
{
__asm__ __volatile__ ("cld ; rep ; outsb"
: "=S" (Buffer), "=c" (Count)
@ -128,9 +128,9 @@ WRITE_PORT_BUFFER_UCHAR (PUCHAR Port,
}
VOID /*STDCALL*/
WRITE_PORT_BUFFER_USHORT (PUSHORT Port,
PUSHORT Buffer,
ULONG Count)
WRITE_PORT_BUFFER_USHORT (U16* Port,
U16* Buffer,
U32 Count)
{
__asm__ __volatile__ ("cld ; rep ; outsw"
: "=S" (Buffer), "=c" (Count)
@ -138,9 +138,9 @@ WRITE_PORT_BUFFER_USHORT (PUSHORT Port,
}
VOID /*STDCALL*/
WRITE_PORT_BUFFER_ULONG (PULONG Port,
PULONG Buffer,
ULONG Count)
WRITE_PORT_BUFFER_ULONG (U32* Port,
U32* Buffer,
U32 Count)
{
__asm__ __volatile__ ("cld ; rep ; outsl"
: "=S" (Buffer), "=c" (Count)
@ -159,8 +159,8 @@ WRITE_PORT_UCHAR (PUCHAR Port,
}
VOID /*STDCALL*/
WRITE_PORT_USHORT (PUSHORT Port,
USHORT Value)
WRITE_PORT_USHORT (U16* Port,
U16 Value)
{
__asm__("outw %0, %w1\n\t"
:
@ -170,8 +170,8 @@ WRITE_PORT_USHORT (PUSHORT Port,
}
VOID /*STDCALL*/
WRITE_PORT_ULONG (PULONG Port,
ULONG Value)
WRITE_PORT_ULONG (U32* Port,
U32 Value)
{
__asm__("outl %0, %w1\n\t"
:

View file

@ -60,8 +60,8 @@
/* STATIC VARIABLES *********************************************************/
static ULONG Rs232ComPort = 0;
static ULONG Rs232BaudRate = 0;
static U32 Rs232ComPort = 0;
static U32 Rs232BaudRate = 0;
static PUCHAR Rs232PortBase = (PUCHAR)0;
/* The com port must only be initialized once! */
@ -72,8 +72,8 @@ static BOOLEAN PortInitialized = FALSE;
static BOOL Rs232DoesComPortExist(PUCHAR BaseAddress)
{
BOOLEAN found;
BYTE mcr;
BYTE msr;
U8 mcr;
U8 msr;
found = FALSE;
@ -117,12 +117,12 @@ static BOOL Rs232DoesComPortExist(PUCHAR BaseAddress)
/* FUNCTIONS *********************************************************/
BOOL Rs232PortInitialize(ULONG ComPort, ULONG BaudRate)
BOOL Rs232PortInitialize(U32 ComPort, U32 BaudRate)
{
ULONG BaseArray[5] = {0, 0x3F8, 0x2F8, 0x3E8, 0x2E8};
U32 BaseArray[5] = {0, 0x3F8, 0x2F8, 0x3E8, 0x2E8};
//char buffer[80];
ULONG divisor;
BYTE lcr;
U32 divisor;
U8 lcr;
if (PortInitialized == FALSE)
{
@ -145,7 +145,7 @@ BOOL Rs232PortInitialize(ULONG ComPort, ULONG BaudRate)
sprintf (buffer,
"\nSerial port COM%ld found at 0x%lx\n",
ComPort,
(ULONG)PortBase);
(U32)PortBase);
HalDisplayString (buffer);
#endif*/ /* NDEBUG */
}
@ -157,7 +157,7 @@ BOOL Rs232PortInitialize(ULONG ComPort, ULONG BaudRate)
sprintf (buffer,
"\nSerial port COM%ld found at 0x%lx\n",
ComPort,
(ULONG)PortBase);
(U32)PortBase);
HalDisplayString (buffer);
#endif*/ /* NDEBUG */
}
@ -179,7 +179,7 @@ BOOL Rs232PortInitialize(ULONG ComPort, ULONG BaudRate)
sprintf (buffer,
"\nSerial port COM%ld found at 0x%lx\n",
ComPort,
(ULONG)PortBase);
(U32)PortBase);
HalDisplayString (buffer);
#endif*/ /* NDEBUG */
}
@ -221,7 +221,7 @@ BOOL Rs232PortInitialize(ULONG ComPort, ULONG BaudRate)
/*
* set global info
*/
//KdComPortInUse = (ULONG)PortBase;
//KdComPortInUse = (U32)PortBase;
/*
* print message to blue screen
@ -229,7 +229,7 @@ BOOL Rs232PortInitialize(ULONG ComPort, ULONG BaudRate)
/*sprintf (buffer,
"\nKernel Debugger: COM%ld (Port 0x%lx) BaudRate %ld\n\n",
ComPort,
(ULONG)PortBase,
(U32)PortBase,
BaudRate);
HalDisplayString (buffer);*/

View file

@ -31,17 +31,17 @@
//#define DEBUG_NONE
#if defined (DEBUG_ULTRA)
ULONG DebugPrintMask = DPRINT_WARNING | DPRINT_MEMORY | DPRINT_FILESYSTEM |
U32 DebugPrintMask = DPRINT_WARNING | DPRINT_MEMORY | DPRINT_FILESYSTEM |
DPRINT_UI | DPRINT_DISK | DPRINT_CACHE | DPRINT_REACTOS |
DPRINT_LINUX;
#elif defined (DEBUG_INIFILE)
ULONG DebugPrintMask = DPRINT_INIFILE;
U32 DebugPrintMask = DPRINT_INIFILE;
#elif defined (DEBUG_REACTOS)
ULONG DebugPrintMask = DPRINT_REACTOS | DPRINT_REGISTRY;
U32 DebugPrintMask = DPRINT_REACTOS | DPRINT_REGISTRY;
#elif defined (DEBUG_CUSTOM)
ULONG DebugPrintMask = DPRINT_WARNING;
U32 DebugPrintMask = DPRINT_WARNING|DPRINT_FILESYSTEM;
#else //#elif defined (DEBUG_NONE)
ULONG DebugPrintMask = 0;
U32 DebugPrintMask = 0;
#endif
#define SCREEN 0
@ -55,12 +55,12 @@ ULONG DebugPrintMask = 0;
#define BOCHS_OUTPUT_PORT 0xe9
//ULONG DebugPort = RS232;
//ULONG DebugPort = SCREEN;
ULONG DebugPort = BOCHS;
ULONG ComPort = COM1;
//ULONG BaudRate = 19200;
ULONG BaudRate = 115200;
//U32 DebugPort = RS232;
//U32 DebugPort = SCREEN;
U32 DebugPort = BOCHS;
U32 ComPort = COM1;
//U32 BaudRate = 19200;
U32 BaudRate = 115200;
BOOL DebugStartOfLine = TRUE;
@ -97,7 +97,7 @@ VOID DebugPrintChar(UCHAR Character)
}
}
VOID DebugPrintHeader(ULONG Mask)
VOID DebugPrintHeader(U32 Mask)
{
/* No header */
if (Mask == 0)
@ -217,7 +217,7 @@ VOID DebugPrintHeader(ULONG Mask)
}
}
VOID DebugPrint(ULONG Mask, char *format, ...)
VOID DebugPrint(U32 Mask, char *format, ...)
{
int *dataptr = (int *) &format;
char c, *ptr, str[16];
@ -245,13 +245,7 @@ VOID DebugPrint(ULONG Mask, char *format, ...)
}
else
{
c = *(format++);
if (c == 'l')
{
c = *(format++);
}
switch (c)
switch (c = *(format++))
{
case 'd': case 'u': case 'x':
@ -279,6 +273,12 @@ VOID DebugPrint(ULONG Mask, char *format, ...)
DebugPrintChar(c);
}
break;
case '%':
DebugPrintChar(c);
break;
default:
DebugPrint(Mask, "\nDebugPrint() invalid format specifier - %%%c\n", c);
break;
}
}
}
@ -291,11 +291,11 @@ VOID DebugPrint(ULONG Mask, char *format, ...)
}
VOID DebugDumpBuffer(ULONG Mask, PVOID Buffer, ULONG Length)
VOID DebugDumpBuffer(U32 Mask, PVOID Buffer, U32 Length)
{
PUCHAR BufPtr = (PUCHAR)Buffer;
ULONG Idx;
ULONG Idx2;
U32 Idx;
U32 Idx2;
// Mask out unwanted debug messages
if (!(Mask & DebugPrintMask))

View file

@ -41,13 +41,13 @@ VOID DiskError(PUCHAR ErrorString)
UiMessageBox(ErrorCodeString);
}
BOOL DiskReadLogicalSectors(ULONG DriveNumber, ULONG SectorNumber, ULONG SectorCount, PVOID Buffer)
BOOL DiskReadLogicalSectors(U32 DriveNumber, U32 SectorNumber, U32 SectorCount, PVOID Buffer)
{
ULONG PhysicalSector;
ULONG PhysicalHead;
ULONG PhysicalTrack;
U32 PhysicalSector;
U32 PhysicalHead;
U32 PhysicalTrack;
GEOMETRY DriveGeometry;
ULONG NumberOfSectorsToRead;
U32 NumberOfSectorsToRead;
DbgPrint((DPRINT_DISK, "ReadLogicalSectors() DriveNumber: 0x%x SectorNumber: %d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer));

View file

@ -23,7 +23,7 @@
#include <mm.h>
BOOL DiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry)
BOOL DiskGetDriveGeometry(U32 DriveNumber, PGEOMETRY DriveGeometry)
{
// For now just return the geometry as the BIOS reports it
// BytesPerSector is always set to 512 by BiosInt13GetDriveParameters()

View file

@ -26,7 +26,7 @@
BOOL DiskIsDriveRemovable(ULONG DriveNumber)
BOOL DiskIsDriveRemovable(U32 DriveNumber)
{
// Hard disks use drive numbers >= 0x80
// So if the drive number indicates a hard disk
@ -41,7 +41,7 @@ BOOL DiskIsDriveRemovable(ULONG DriveNumber)
}
BOOL DiskIsDriveCdRom(ULONG DriveNumber)
BOOL DiskIsDriveCdRom(U32 DriveNumber)
{
PUCHAR Sector = (PUCHAR)DISKREADBUFFER;
BOOL Result;
@ -74,9 +74,9 @@ BOOL DiskIsDriveCdRom(ULONG DriveNumber)
}
BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
BOOL DiskGetActivePartitionEntry(U32 DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
{
ULONG BootablePartitionCount = 0;
U32 BootablePartitionCount = 0;
MASTER_BOOT_RECORD MasterBootRecord;
// Read master boot record
@ -108,9 +108,14 @@ BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY Parti
}
// Make sure there was only one bootable partition
if (BootablePartitionCount != 1)
if (BootablePartitionCount == 0)
{
DiskError("Too many bootable partitions or none found.");
DiskError("No bootable (active) partitions found.");
return FALSE;
}
else if (BootablePartitionCount != 1)
{
DiskError("Too many bootable (active) partitions found.");
return FALSE;
}
@ -120,12 +125,12 @@ BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY Parti
return TRUE;
}
BOOL DiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
BOOL DiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
{
MASTER_BOOT_RECORD MasterBootRecord;
PARTITION_TABLE_ENTRY ExtendedPartitionTableEntry;
ULONG ExtendedPartitionNumber;
ULONG Index;
U32 ExtendedPartitionNumber;
U32 Index;
// Read master boot record
if (!DiskReadBootRecord(DriveNumber, 0, &MasterBootRecord))
@ -184,7 +189,7 @@ BOOL DiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_
BOOL DiskGetFirstPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry)
{
ULONG Index;
U32 Index;
for (Index=0; Index<4; Index++)
{
@ -205,7 +210,7 @@ BOOL DiskGetFirstPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION
BOOL DiskGetFirstExtendedPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry)
{
ULONG Index;
U32 Index;
for (Index=0; Index<4; Index++)
{
@ -222,10 +227,10 @@ BOOL DiskGetFirstExtendedPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PP
return FALSE;
}
BOOL DiskReadBootRecord(ULONG DriveNumber, ULONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord)
BOOL DiskReadBootRecord(U32 DriveNumber, U32 LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord)
{
#ifdef DEBUG
ULONG Index;
U32 Index;
#endif
// Read master boot record

View file

@ -26,9 +26,9 @@
#include <debug.h>
BOOL DriveMapInstalled = FALSE; // Tells us if we have already installed our drive map int 13h handler code
ULONG OldInt13HandlerAddress = 0; // Address of BIOS int 13h handler
ULONG DriveMapHandlerAddress = 0; // Linear address of our drive map handler
ULONG DriveMapHandlerSegOff = 0; // Segment:offset style address of our drive map handler
U32 OldInt13HandlerAddress = 0; // Address of BIOS int 13h handler
U32 DriveMapHandlerAddress = 0; // Linear address of our drive map handler
U32 DriveMapHandlerSegOff = 0; // Segment:offset style address of our drive map handler
VOID DriveMapMapDrivesInSection(PUCHAR SectionName)
{
@ -37,10 +37,10 @@ VOID DriveMapMapDrivesInSection(PUCHAR SectionName)
UCHAR ErrorText[260];
UCHAR Drive1[80];
UCHAR Drive2[80];
ULONG SectionId;
ULONG SectionItemCount;
ULONG Index;
ULONG Index2;
U32 SectionId;
U32 SectionItemCount;
U32 Index;
U32 Index2;
DRIVE_MAP_LIST DriveMapList;
RtlZeroMemory(&DriveMapList, sizeof(DRIVE_MAP_LIST));
@ -119,7 +119,7 @@ VOID DriveMapMapDrivesInSection(PUCHAR SectionName)
BOOL DriveMapIsValidDriveString(PUCHAR DriveString)
{
ULONG Index;
U32 Index;
// Now verify that the user has given us appropriate strings
if ((strlen(DriveString) < 3) ||
@ -147,9 +147,9 @@ BOOL DriveMapIsValidDriveString(PUCHAR DriveString)
return TRUE;
}
ULONG DriveMapGetBiosDriveNumber(PUCHAR DeviceName)
U32 DriveMapGetBiosDriveNumber(PUCHAR DeviceName)
{
ULONG BiosDriveNumber = 0;
U32 BiosDriveNumber = 0;
// Convert the drive number string into a number
// 'hd1' = 1
@ -167,8 +167,8 @@ ULONG DriveMapGetBiosDriveNumber(PUCHAR DeviceName)
VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap)
{
PDWORD RealModeIVT = (PULONG)0x00000000;
PWORD BiosLowMemorySize = (PWORD)0x00000413;
U32* RealModeIVT = (U32*)0x00000000;
U16* BiosLowMemorySize = (U16*)0x00000413;
if (!DriveMapInstalled)
{
@ -179,7 +179,7 @@ VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap)
(*BiosLowMemorySize)--;
// Get linear address for drive map handler
DriveMapHandlerAddress = (ULONG)(*BiosLowMemorySize) << 10;
DriveMapHandlerAddress = (U32)(*BiosLowMemorySize) << 10;
// Convert to segment:offset style address
DriveMapHandlerSegOff = (DriveMapHandlerAddress << 12) & 0xffff0000;
@ -192,7 +192,7 @@ VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap)
DriveMapOldInt13HandlerAddress = OldInt13HandlerAddress;
// Copy the code to our reserved area
RtlCopyMemory((PVOID)DriveMapHandlerAddress, &DriveMapInt13HandlerStart, ((ULONG)&DriveMapInt13HandlerEnd - (ULONG)&DriveMapInt13HandlerStart));
RtlCopyMemory((PVOID)DriveMapHandlerAddress, &DriveMapInt13HandlerStart, ((U32)&DriveMapInt13HandlerEnd - (U32)&DriveMapInt13HandlerStart));
// Update the IVT
RealModeIVT[0x13] = DriveMapHandlerSegOff;
@ -203,8 +203,8 @@ VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap)
VOID DriveMapRemoveInt13Handler(VOID)
{
PDWORD RealModeIVT = (PULONG)0x00000000;
PWORD BiosLowMemorySize = (PWORD)0x00000413;
U32* RealModeIVT = (U32*)0x00000000;
U16* BiosLowMemorySize = (U16*)0x00000413;
if (DriveMapInstalled)
{

View file

@ -23,10 +23,11 @@
#include <mm.h>
#include <debug.h>
#include <bootmgr.h>
#include <fs.h>
// Variable BootDrive moved to asmcode.S
//ULONG BootDrive = 0; // BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc.
ULONG BootPartition = 0; // Boot Partition, 1-4
//U32 BootDrive = 0; // BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc.
U32 BootPartition = 0; // Boot Partition, 1-4
VOID BootMain(VOID)
{

1065
freeldr/freeldr/fs/ext2.c Normal file

File diff suppressed because it is too large Load diff

694
freeldr/freeldr/fs/ext2.h Normal file
View file

@ -0,0 +1,694 @@
/*
* FreeLoader
* Copyright (C) 1998-2002 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __EXT2_H
#define __EXT2_H
/*
* linux/include/linux/ext3_fs.h
*
* Copyright (C) 1992, 1993, 1994, 1995
* Remy Card (card@masi.ibp.fr)
* Laboratoire MASI - Institut Blaise Pascal
* Universite Pierre et Marie Curie (Paris VI)
*
* from
*
* linux/include/linux/minix_fs.h
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
#ifndef _LINUX_EXT3_FS_H
#define _LINUX_EXT3_FS_H
//#include <linux/types.h>
/*
* The second extended filesystem constants/structures
*/
/*
* Define EXT3FS_DEBUG to produce debug messages
*/
#undef EXT3FS_DEBUG
/*
* Define EXT3_PREALLOCATE to preallocate data blocks for expanding files
*/
#undef EXT3_PREALLOCATE /* @@@ Fix this! */
#define EXT3_DEFAULT_PREALLOC_BLOCKS 8
/*
* The second extended file system version
*/
#define EXT3FS_DATE "10 Jan 2002"
#define EXT3FS_VERSION "2.4-0.9.17"
/*
* Debug code
*/
#ifdef EXT3FS_DEBUG
#define ext3_debug(f, a...) \
do { \
printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", \
__FILE__, __LINE__, __FUNCTION__); \
printk (KERN_DEBUG f, ## a); \
} while (0)
#else
#define ext3_debug(f, a...) do {} while (0)
#endif
/*
* Special inodes numbers
*/
#define EXT3_BAD_INO 1 /* Bad blocks inode */
#define EXT3_ROOT_INO 2 /* Root inode */
#define EXT3_ACL_IDX_INO 3 /* ACL inode */
#define EXT3_ACL_DATA_INO 4 /* ACL inode */
#define EXT3_BOOT_LOADER_INO 5 /* Boot loader inode */
#define EXT3_UNDEL_DIR_INO 6 /* Undelete directory inode */
#define EXT3_RESIZE_INO 7 /* Reserved group descriptors inode */
#define EXT3_JOURNAL_INO 8 /* Journal inode */
/* First non-reserved inode for old ext3 filesystems */
#define EXT3_GOOD_OLD_FIRST_INO 11
/*
* The second extended file system magic number
*/
#define EXT3_SUPER_MAGIC 0xEF53
/*
* Maximal count of links to a file
*/
#define EXT3_LINK_MAX 32000
/*
* Macro-instructions used to manage several block sizes
*/
#define EXT3_MIN_BLOCK_SIZE 1024
#define EXT3_MAX_BLOCK_SIZE 4096
#define EXT3_MIN_BLOCK_LOG_SIZE 10
#ifdef __KERNEL__
# define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize)
#else
# define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
#endif
#define EXT3_ACLE_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_acl_entry))
#define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
#ifdef __KERNEL__
# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
#else
# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
#endif
#ifdef __KERNEL__
#define EXT3_ADDR_PER_BLOCK_BITS(s) ((s)->u.ext3_sb.s_addr_per_block_bits)
#define EXT3_INODE_SIZE(s) ((s)->u.ext3_sb.s_inode_size)
#define EXT3_FIRST_INO(s) ((s)->u.ext3_sb.s_first_ino)
#else
#define EXT3_INODE_SIZE(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
EXT3_GOOD_OLD_INODE_SIZE : \
(s)->s_inode_size)
#define EXT3_FIRST_INO(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
EXT3_GOOD_OLD_FIRST_INO : \
(s)->s_first_ino)
#endif
/*
* Macro-instructions used to manage fragments
*/
#define EXT3_MIN_FRAG_SIZE 1024
#define EXT3_MAX_FRAG_SIZE 4096
#define EXT3_MIN_FRAG_LOG_SIZE 10
#ifdef __KERNEL__
# define EXT3_FRAG_SIZE(s) ((s)->u.ext3_sb.s_frag_size)
# define EXT3_FRAGS_PER_BLOCK(s) ((s)->u.ext3_sb.s_frags_per_block)
#else
# define EXT3_FRAG_SIZE(s) (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size)
# define EXT3_FRAGS_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s))
#endif
/*
* ACL structures
*/
struct ext3_acl_header /* Header of Access Control Lists */
{
__u32 aclh_size;
__u32 aclh_file_count;
__u32 aclh_acle_count;
__u32 aclh_first_acle;
};
struct ext3_acl_entry /* Access Control List Entry */
{
__u32 acle_size;
__u16 acle_perms; /* Access permissions */
__u16 acle_type; /* Type of entry */
__u16 acle_tag; /* User or group identity */
__u16 acle_pad1;
__u32 acle_next; /* Pointer on next entry for the */
/* same inode or on next free entry */
};
/*
* Structure of a blocks group descriptor
*/
struct ext3_group_desc
{
__u32 bg_block_bitmap; /* Blocks bitmap block */
__u32 bg_inode_bitmap; /* Inodes bitmap block */
__u32 bg_inode_table; /* Inodes table block */
__u16 bg_free_blocks_count; /* Free blocks count */
__u16 bg_free_inodes_count; /* Free inodes count */
__u16 bg_used_dirs_count; /* Directories count */
__u16 bg_pad;
__u32 bg_reserved[3];
};
/*
* Macro-instructions used to manage group descriptors
*/
#ifdef __KERNEL__
# define EXT3_BLOCKS_PER_GROUP(s) ((s)->u.ext3_sb.s_blocks_per_group)
# define EXT3_DESC_PER_BLOCK(s) ((s)->u.ext3_sb.s_desc_per_block)
# define EXT3_INODES_PER_GROUP(s) ((s)->u.ext3_sb.s_inodes_per_group)
# define EXT3_DESC_PER_BLOCK_BITS(s) ((s)->u.ext3_sb.s_desc_per_block_bits)
#else
# define EXT3_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
# define EXT3_DESC_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc))
# define EXT3_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
#endif
/*
* Constants relative to the data blocks
*/
#define EXT3_NDIR_BLOCKS 12
#define EXT3_IND_BLOCK EXT3_NDIR_BLOCKS
#define EXT3_DIND_BLOCK (EXT3_IND_BLOCK + 1)
#define EXT3_TIND_BLOCK (EXT3_DIND_BLOCK + 1)
#define EXT3_N_BLOCKS (EXT3_TIND_BLOCK + 1)
/*
* Inode flags
*/
#define EXT3_SECRM_FL 0x00000001 /* Secure deletion */
#define EXT3_UNRM_FL 0x00000002 /* Undelete */
#define EXT3_COMPR_FL 0x00000004 /* Compress file */
#define EXT3_SYNC_FL 0x00000008 /* Synchronous updates */
#define EXT3_IMMUTABLE_FL 0x00000010 /* Immutable file */
#define EXT3_APPEND_FL 0x00000020 /* writes to file may only append */
#define EXT3_NODUMP_FL 0x00000040 /* do not dump file */
#define EXT3_NOATIME_FL 0x00000080 /* do not update atime */
/* Reserved for compression usage... */
#define EXT3_DIRTY_FL 0x00000100
#define EXT3_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
#define EXT3_NOCOMPR_FL 0x00000400 /* Don't compress */
#define EXT3_ECOMPR_FL 0x00000800 /* Compression error */
/* End compression flags --- maybe not all used */
#define EXT3_INDEX_FL 0x00001000 /* hash-indexed directory */
#define EXT3_IMAGIC_FL 0x00002000 /* AFS directory */
#define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
#define EXT3_RESERVED_FL 0x80000000 /* reserved for ext3 lib */
#define EXT3_FL_USER_VISIBLE 0x00005FFF /* User visible flags */
#define EXT3_FL_USER_MODIFIABLE 0x000000FF /* User modifiable flags */
/*
* Inode dynamic state flags
*/
#define EXT3_STATE_JDATA 0x00000001 /* journaled data exists */
#define EXT3_STATE_NEW 0x00000002 /* inode is newly created */
/*
* ioctl commands
*/
#define EXT3_IOC_GETFLAGS _IOR('f', 1, long)
#define EXT3_IOC_SETFLAGS _IOW('f', 2, long)
#define EXT3_IOC_GETVERSION _IOR('f', 3, long)
#define EXT3_IOC_SETVERSION _IOW('f', 4, long)
#define EXT3_IOC_GETVERSION_OLD _IOR('v', 1, long)
#define EXT3_IOC_SETVERSION_OLD _IOW('v', 2, long)
#ifdef CONFIG_JBD_DEBUG
#define EXT3_IOC_WAIT_FOR_READONLY _IOR('f', 99, long)
#endif
/*
* Structure of an inode on the disk
*/
struct ext3_inode {
__u16 i_mode; /* File mode */
__u16 i_uid; /* Low 16 bits of Owner Uid */
__u32 i_size; /* Size in bytes */
__u32 i_atime; /* Access time */
__u32 i_ctime; /* Creation time */
__u32 i_mtime; /* Modification time */
__u32 i_dtime; /* Deletion Time */
__u16 i_gid; /* Low 16 bits of Group Id */
__u16 i_links_count; /* Links count */
__u32 i_blocks; /* Blocks count */
__u32 i_flags; /* File flags */
union {
struct {
__u32 l_i_reserved1;
} linux1;
struct {
__u32 h_i_translator;
} hurd1;
struct {
__u32 m_i_reserved1;
} masix1;
} osd1; /* OS dependent 1 */
__u32 i_block[EXT3_N_BLOCKS];/* Pointers to blocks */
__u32 i_generation; /* File version (for NFS) */
__u32 i_file_acl; /* File ACL */
__u32 i_dir_acl; /* Directory ACL */
__u32 i_faddr; /* Fragment address */
union {
struct {
__u8 l_i_frag; /* Fragment number */
__u8 l_i_fsize; /* Fragment size */
__u16 i_pad1;
__u16 l_i_uid_high; /* these 2 fields */
__u16 l_i_gid_high; /* were reserved2[0] */
__u32 l_i_reserved2;
} linux2;
struct {
__u8 h_i_frag; /* Fragment number */
__u8 h_i_fsize; /* Fragment size */
__u16 h_i_mode_high;
__u16 h_i_uid_high;
__u16 h_i_gid_high;
__u32 h_i_author;
} hurd2;
struct {
__u8 m_i_frag; /* Fragment number */
__u8 m_i_fsize; /* Fragment size */
__u16 m_pad1;
__u32 m_i_reserved2[2];
} masix2;
} osd2; /* OS dependent 2 */
};
#define i_size_high i_dir_acl
#if defined(__KERNEL__) || defined(__linux__)
#define i_reserved1 osd1.linux1.l_i_reserved1
#define i_frag osd2.linux2.l_i_frag
#define i_fsize osd2.linux2.l_i_fsize
#define i_uid_low i_uid
#define i_gid_low i_gid
#define i_uid_high osd2.linux2.l_i_uid_high
#define i_gid_high osd2.linux2.l_i_gid_high
#define i_reserved2 osd2.linux2.l_i_reserved2
#elif defined(__GNU__)
#define i_translator osd1.hurd1.h_i_translator
#define i_frag osd2.hurd2.h_i_frag;
#define i_fsize osd2.hurd2.h_i_fsize;
#define i_uid_high osd2.hurd2.h_i_uid_high
#define i_gid_high osd2.hurd2.h_i_gid_high
#define i_author osd2.hurd2.h_i_author
#elif defined(__masix__)
#define i_reserved1 osd1.masix1.m_i_reserved1
#define i_frag osd2.masix2.m_i_frag
#define i_fsize osd2.masix2.m_i_fsize
#define i_reserved2 osd2.masix2.m_i_reserved2
#endif /* defined(__KERNEL__) || defined(__linux__) */
/*
* File system states
*/
#define EXT3_VALID_FS 0x0001 /* Unmounted cleanly */
#define EXT3_ERROR_FS 0x0002 /* Errors detected */
#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */
/*
* Mount flags
*/
#define EXT3_MOUNT_CHECK 0x0001 /* Do mount-time checks */
#define EXT3_MOUNT_GRPID 0x0004 /* Create files with directory's group */
#define EXT3_MOUNT_DEBUG 0x0008 /* Some debugging messages */
#define EXT3_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */
#define EXT3_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */
#define EXT3_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */
#define EXT3_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */
#define EXT3_MOUNT_NOLOAD 0x0100 /* Don't use existing journal*/
#define EXT3_MOUNT_ABORT 0x0200 /* Fatal error detected */
#define EXT3_MOUNT_DATA_FLAGS 0x0C00 /* Mode for data writes: */
#define EXT3_MOUNT_JOURNAL_DATA 0x0400 /* Write data to journal */
#define EXT3_MOUNT_ORDERED_DATA 0x0800 /* Flush data before commit */
#define EXT3_MOUNT_WRITEBACK_DATA 0x0C00 /* No data ordering */
#define EXT3_MOUNT_UPDATE_JOURNAL 0x1000 /* Update the journal format */
#define EXT3_MOUNT_NO_UID32 0x2000 /* Disable 32-bit UIDs */
/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
#ifndef _LINUX_EXT2_FS_H
#define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt
#define set_opt(o, opt) o |= EXT3_MOUNT_##opt
#define test_opt(sb, opt) ((sb)->u.ext3_sb.s_mount_opt & \
EXT3_MOUNT_##opt)
#else
#define EXT2_MOUNT_NOLOAD EXT3_MOUNT_NOLOAD
#define EXT2_MOUNT_ABORT EXT3_MOUNT_ABORT
#endif
#define ext3_set_bit ext2_set_bit
#define ext3_clear_bit ext2_clear_bit
#define ext3_test_bit ext2_test_bit
#define ext3_find_first_zero_bit ext2_find_first_zero_bit
#define ext3_find_next_zero_bit ext2_find_next_zero_bit
/*
* Maximal mount counts between two filesystem checks
*/
#define EXT3_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
#define EXT3_DFL_CHECKINTERVAL 0 /* Don't use interval check */
/*
* Behaviour when detecting errors
*/
#define EXT3_ERRORS_CONTINUE 1 /* Continue execution */
#define EXT3_ERRORS_RO 2 /* Remount fs read-only */
#define EXT3_ERRORS_PANIC 3 /* Panic */
#define EXT3_ERRORS_DEFAULT EXT3_ERRORS_CONTINUE
/*
* Structure of the super block
*/
struct ext3_super_block {
/*00*/ __u32 s_inodes_count; /* Inodes count */
__u32 s_blocks_count; /* Blocks count */
__u32 s_r_blocks_count; /* Reserved blocks count */
__u32 s_free_blocks_count; /* Free blocks count */
/*10*/ __u32 s_free_inodes_count; /* Free inodes count */
__u32 s_first_data_block; /* First Data Block */
__u32 s_log_block_size; /* Block size */
__s32 s_log_frag_size; /* Fragment size */
/*20*/ __u32 s_blocks_per_group; /* # Blocks per group */
__u32 s_frags_per_group; /* # Fragments per group */
__u32 s_inodes_per_group; /* # Inodes per group */
__u32 s_mtime; /* Mount time */
/*30*/ __u32 s_wtime; /* Write time */
__u16 s_mnt_count; /* Mount count */
__s16 s_max_mnt_count; /* Maximal mount count */
__u16 s_magic; /* Magic signature */
__u16 s_state; /* File system state */
__u16 s_errors; /* Behaviour when detecting errors */
__u16 s_minor_rev_level; /* minor revision level */
/*40*/ __u32 s_lastcheck; /* time of last check */
__u32 s_checkinterval; /* max. time between checks */
__u32 s_creator_os; /* OS */
__u32 s_rev_level; /* Revision level */
/*50*/ __u16 s_def_resuid; /* Default uid for reserved blocks */
__u16 s_def_resgid; /* Default gid for reserved blocks */
/*
* These fields are for EXT3_DYNAMIC_REV superblocks only.
*
* Note: the difference between the compatible feature set and
* the incompatible feature set is that if there is a bit set
* in the incompatible feature set that the kernel doesn't
* know about, it should refuse to mount the filesystem.
*
* e2fsck's requirements are more strict; if it doesn't know
* about a feature in either the compatible or incompatible
* feature set, it must abort and not try to meddle with
* things it doesn't understand...
*/
__u32 s_first_ino; /* First non-reserved inode */
__u16 s_inode_size; /* size of inode structure */
__u16 s_block_group_nr; /* block group # of this superblock */
__u32 s_feature_compat; /* compatible feature set */
/*60*/ __u32 s_feature_incompat; /* incompatible feature set */
__u32 s_feature_ro_compat; /* readonly-compatible feature set */
/*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
/*78*/ char s_volume_name[16]; /* volume name */
/*88*/ char s_last_mounted[64]; /* directory where last mounted */
/*C8*/ __u32 s_algorithm_usage_bitmap; /* For compression */
/*
* Performance hints. Directory preallocation should only
* happen if the EXT3_FEATURE_COMPAT_DIR_PREALLOC flag is on.
*/
__u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
__u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
__u16 s_padding1;
/*
* Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
*/
/*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
/*E0*/ __u32 s_journal_inum; /* inode number of journal file */
__u32 s_journal_dev; /* device number of journal file */
__u32 s_last_orphan; /* start of list of inodes to delete */
/*EC*/ __u32 s_reserved[197]; /* Padding to the end of the block */
};
#ifdef __KERNEL__
#define EXT3_SB(sb) (&((sb)->u.ext3_sb))
#define EXT3_I(inode) (&((inode)->u.ext3_i))
#else
/* Assume that user mode programs are passing in an ext3fs superblock, not
* a kernel struct super_block. This will allow us to call the feature-test
* macros from user land. */
#define EXT3_SB(sb) (sb)
#endif
#define NEXT_ORPHAN(inode) (inode)->u.ext3_i.i_dtime
/*
* Codes for operating systems
*/
#define EXT3_OS_LINUX 0
#define EXT3_OS_HURD 1
#define EXT3_OS_MASIX 2
#define EXT3_OS_FREEBSD 3
#define EXT3_OS_LITES 4
/*
* Revision levels
*/
#define EXT3_GOOD_OLD_REV 0 /* The good old (original) format */
#define EXT3_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
#define EXT3_CURRENT_REV EXT3_GOOD_OLD_REV
#define EXT3_MAX_SUPP_REV EXT3_DYNAMIC_REV
#define EXT3_GOOD_OLD_INODE_SIZE 128
/*
* Feature set definitions
*/
#define EXT3_HAS_COMPAT_FEATURE(sb,mask) \
( EXT3_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
#define EXT3_HAS_RO_COMPAT_FEATURE(sb,mask) \
( EXT3_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
#define EXT3_HAS_INCOMPAT_FEATURE(sb,mask) \
( EXT3_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
#define EXT3_SET_COMPAT_FEATURE(sb,mask) \
EXT3_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
#define EXT3_SET_RO_COMPAT_FEATURE(sb,mask) \
EXT3_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
#define EXT3_SET_INCOMPAT_FEATURE(sb,mask) \
EXT3_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
#define EXT3_CLEAR_COMPAT_FEATURE(sb,mask) \
EXT3_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
#define EXT3_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
EXT3_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
#define EXT3_CLEAR_INCOMPAT_FEATURE(sb,mask) \
EXT3_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
#define EXT3_FEATURE_COMPAT_DIR_PREALLOC 0x0001
#define EXT3_FEATURE_COMPAT_IMAGIC_INODES 0x0002
#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
#define EXT3_FEATURE_COMPAT_EXT_ATTR 0x0008
#define EXT3_FEATURE_COMPAT_RESIZE_INODE 0x0010
#define EXT3_FEATURE_COMPAT_DIR_INDEX 0x0020
#define EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
#define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
#define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
#define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001
#define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002
#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
#define EXT3_FEATURE_COMPAT_SUPP 0
/*#define EXT3_FEATURE_INCOMPAT_SUPP (EXT3_FEATURE_INCOMPAT_FILETYPE| \
EXT3_FEATURE_INCOMPAT_RECOVER)*/
#define EXT3_FEATURE_INCOMPAT_SUPP (EXT3_FEATURE_INCOMPAT_FILETYPE)
#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
/*
* Default values for user and/or group using reserved blocks
*/
#define EXT3_DEF_RESUID 0
#define EXT3_DEF_RESGID 0
/*
* Structure of a directory entry
*/
#define EXT3_NAME_LEN 255
struct ext3_dir_entry {
__u32 inode; /* Inode number */
__u16 rec_len; /* Directory entry length */
__u16 name_len; /* Name length */
char name[EXT3_NAME_LEN]; /* File name */
};
/*
* The new version of the directory entry. Since EXT3 structures are
* stored in intel byte order, and the name_len field could never be
* bigger than 255 chars, it's safe to reclaim the extra byte for the
* file_type field.
*/
struct ext3_dir_entry_2 {
__u32 inode; /* Inode number */
__u16 rec_len; /* Directory entry length */
__u8 name_len; /* Name length */
__u8 file_type;
char name[EXT3_NAME_LEN]; /* File name */
};
/*
* Ext3 directory file types. Only the low 3 bits are used. The
* other bits are reserved for now.
*/
#define EXT3_FT_UNKNOWN 0
#define EXT3_FT_REG_FILE 1
#define EXT3_FT_DIR 2
#define EXT3_FT_CHRDEV 3
#define EXT3_FT_BLKDEV 4
#define EXT3_FT_FIFO 5
#define EXT3_FT_SOCK 6
#define EXT3_FT_SYMLINK 7
#define EXT3_FT_MAX 8
/*
* EXT3_DIR_PAD defines the directory entries boundaries
*
* NOTE: It must be a multiple of 4
*/
#define EXT3_DIR_PAD 4
#define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1)
#define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \
~EXT3_DIR_ROUND)
#ifdef __KERNEL__
/*
* Describe an inode's exact location on disk and in memory
*/
struct ext3_iloc
{
struct buffer_head *bh;
struct ext3_inode *raw_inode;
unsigned long block_group;
};
#endif /* __KERNEL__ */
#endif /* _LINUX_EXT3_FS_H */
typedef struct ext3_super_block EXT2_SUPER_BLOCK, *PEXT2_SUPER_BLOCK;
typedef struct ext3_inode EXT2_INODE, *PEXT2_INODE;
typedef struct ext3_group_desc EXT2_GROUP_DESC, *PEXT2_GROUP_DESC;
typedef struct ext3_dir_entry_2 EXT2_DIR_ENTRY, *PEXT2_DIR_ENTRY;
// EXT2_INODE::i_mode values
#define EXT2_S_IRWXO 0x0007 // Other mask
#define EXT2_S_IXOTH 0x0001 // ---------x execute
#define EXT2_S_IWOTH 0x0002 // --------w- write
#define EXT2_S_IROTH 0x0004 // -------r-- read
#define EXT2_S_IRWXG 0x0038 // Group mask
#define EXT2_S_IXGRP 0x0008 // ------x--- execute
#define EXT2_S_IWGRP 0x0010 // -----w---- write
#define EXT2_S_IRGRP 0x0020 // ----r----- read
#define EXT2_S_IRWXU 0x01C0 // User mask
#define EXT2_S_IXUSR 0x0040 // ---x------ execute
#define EXT2_S_IWUSR 0x0080 // --w------- write
#define EXT2_S_IRUSR 0x0100 // -r-------- read
#define EXT2_S_ISVTX 0x0200 // Sticky bit
#define EXT2_S_ISGID 0x0400 // SGID
#define EXT2_S_ISUID 0x0800 // SUID
#define EXT2_S_IFMT 0xF000 // Format mask
#define EXT2_S_IFIFO 0x1000 // FIFO buffer
#define EXT2_S_IFCHR 0x2000 // Character device
#define EXT2_S_IFDIR 0x4000 // Directory
#define EXT2_S_IFBLK 0x6000 // Block device
#define EXT2_S_IFREG 0x8000 // Regular file
#define EXT2_S_IFSOCK 0xA000 // Socket
#define EXT2_S_IFLNK 0xC000 // Symbolic link
typedef struct
{
U64 FileSize; // File size
U64 FilePointer; // File pointer
U32* FileBlockList; // File block list
U8 DriveNumber; // Drive number of open file
} EXT2_FILE_INFO, * PEXT2_FILE_INFO;
BOOL Ext2OpenVolume(U8 DriveNumber, U64 VolumeStartSector);
FILE* Ext2OpenFile(PUCHAR FileName);
BOOL Ext2LookupFile(PUCHAR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer);
BOOL Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, U32 DirectorySize, PUCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry);
BOOL Ext2ReadFile(FILE *FileHandle, U64 BytesToRead, U64* BytesRead, PVOID Buffer);
U64 Ext2GetFileSize(FILE *FileHandle);
VOID Ext2SetFilePointer(FILE *FileHandle, U64 NewFilePointer);
U64 Ext2GetFilePointer(FILE *FileHandle);
BOOL Ext2ReadVolumeSectors(U8 DriveNumber, U64 SectorNumber, U64 SectorCount, PVOID Buffer);
BOOL Ext2ReadSuperBlock(VOID);
BOOL Ext2ReadGroupDescriptors(VOID);
BOOL Ext2ReadDirectory(U32 Inode, PVOID* DirectoryBuffer, PEXT2_INODE InodePointer);
BOOL Ext2ReadBlock(U32 BlockNumber, PVOID Buffer);
BOOL Ext2ReadPartialBlock(U32 BlockNumber, U32 StartingOffset, U32 Length, PVOID Buffer);
U32 Ext2GetGroupDescBlockNumber(U32 Group);
U32 Ext2GetGroupDescOffsetInBlock(U32 Group);
U32 Ext2GetInodeGroupNumber(U32 Inode);
U32 Ext2GetInodeBlockNumber(U32 Inode);
U32 Ext2GetInodeOffsetInBlock(U32 Inode);
BOOL Ext2ReadInode(U32 Inode, PEXT2_INODE InodeBuffer);
BOOL Ext2ReadGroupDescriptor(U32 Group, PEXT2_GROUP_DESC GroupBuffer);
U32* Ext2ReadBlockPointerList(PEXT2_INODE Inode);
U64 Ext2GetInodeFileSize(PEXT2_INODE Inode);
BOOL Ext2CopyIndirectBlockPointers(U32 IndirectBlock, U32 BlockCount, U32* BlockList);
BOOL Ext2CopyDoubleIndirectBlockPointers(U32 DoubleIndirectBlock, U32 BlockCount, U32* BlockList);
BOOL Ext2CopyTripleIndirectBlockPointers(U32 TripleIndirectBlock, U32 BlockCount, U32* BlockList);
#endif // #defined __EXT2_H

View file

@ -32,15 +32,15 @@
PFAT_BOOTSECTOR FatVolumeBootSector = NULL;
PFAT32_BOOTSECTOR Fat32VolumeBootSector = NULL;
ULONG RootDirSectorStart; // Starting sector of the root directory (fat12/16)
ULONG DataSectorStart; // Starting sector of the data area
ULONG SectorsPerFat; // Sectors per FAT table
ULONG RootDirSectors; // Number of sectors of the root directory (fat32)
U32 RootDirSectorStart; // Starting sector of the root directory (fat12/16)
U32 DataSectorStart; // Starting sector of the data area
U32 SectorsPerFat; // Sectors per FAT table
U32 RootDirSectors; // Number of sectors of the root directory (fat32)
ULONG FatType = 0; // FAT12, FAT16, or FAT32
ULONG FatDriveNumber = 0;
U32 FatType = 0; // FAT12, FAT16, or FAT32
U32 FatDriveNumber = 0;
BOOL FatOpenVolume(ULONG DriveNumber, ULONG VolumeStartSector)
BOOL FatOpenVolume(U32 DriveNumber, U32 VolumeStartSector)
{
DbgPrint((DPRINT_FILESYSTEM, "FatOpenVolume() DriveNumber = 0x%x VolumeStartSector = %d\n", DriveNumber, VolumeStartSector));
@ -234,13 +234,13 @@ BOOL FatOpenVolume(ULONG DriveNumber, ULONG VolumeStartSector)
return TRUE;
}
ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector)
U32 FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector)
{
ULONG RootDirSectors;
ULONG DataSectorCount;
ULONG SectorsPerFat;
ULONG TotalSectors;
ULONG CountOfClusters;
U32 RootDirSectors;
U32 DataSectorCount;
U32 SectorsPerFat;
U32 TotalSectors;
U32 CountOfClusters;
PFAT32_BOOTSECTOR Fat32BootSector = (PFAT32_BOOTSECTOR)FatBootSector;
RootDirSectors = ((FatBootSector->RootDirEntries * 32) + (FatBootSector->BytesPerSector - 1)) / FatBootSector->BytesPerSector;
@ -271,12 +271,12 @@ ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector)
}
}
PVOID FatBufferDirectory(UINT32 DirectoryStartCluster, PUINT32 EntryCountPointer, BOOL RootDirectory)
PVOID FatBufferDirectory(U32 DirectoryStartCluster, U32* EntryCountPointer, BOOL RootDirectory)
{
UINT32 RootDirectoryStartSector;
UINT32 RootDirectorySectorCount;
U32 RootDirectoryStartSector;
U32 RootDirectorySectorCount;
PVOID DirectoryBuffer;
UINT32 DirectorySize;
U32 DirectorySize;
DbgPrint((DPRINT_FILESYSTEM, "FatBufferDirectory() DirectoryStartCluster = %d RootDirectory = %s\n", DirectoryStartCluster, (RootDirectory ? "TRUE" : "FALSE")));
@ -352,14 +352,14 @@ PVOID FatBufferDirectory(UINT32 DirectoryStartCluster, PUINT32 EntryCountPointer
return DirectoryBuffer;
}
BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, UINT32 EntryCount, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, U32 EntryCount, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
{
ULONG CurrentEntry;
U32 CurrentEntry;
PDIRENTRY DirEntry;
PLFN_DIRENTRY LfnDirEntry;
UCHAR LfnNameBuffer[265];
UCHAR ShortNameBuffer[20];
UINT32 StartCluster;
U32 StartCluster;
DbgPrint((DPRINT_FILESYSTEM, "FatSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x EntryCount = %d FileName = %s\n", DirectoryBuffer, EntryCount, FileName));
@ -535,7 +535,7 @@ BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, UINT32 EntryCount, P
//
// Get the cluster chain
//
StartCluster = ((UINT32)DirEntry->ClusterHigh << 16) + DirEntry->ClusterLow;
StartCluster = ((U32)DirEntry->ClusterHigh << 16) + DirEntry->ClusterLow;
DbgPrint((DPRINT_FILESYSTEM, "StartCluster = 0x%x\n", StartCluster));
FatFileInfoPointer->FileFatChain = FatGetClusterChainArray(StartCluster);
@ -571,29 +571,21 @@ BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, UINT32 EntryCount, P
BOOL FatLookupFile(PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
{
int i;
ULONG NumberOfPathParts;
U32 NumberOfPathParts;
UCHAR PathPart[261];
PVOID DirectoryBuffer;
UINT32 DirectoryStartCluster = 0;
ULONG DirectoryEntryCount;
U32 DirectoryStartCluster = 0;
U32 DirectoryEntryCount;
FAT_FILE_INFO FatFileInfo;
DbgPrint((DPRINT_FILESYSTEM, "FatLookupFile() FileName = %s\n", FileName));
memset(FatFileInfoPointer, 0, sizeof(FAT_FILE_INFO));
//
// Check and see if the first character is '\' or '/' and remove it if so
//
while ((*FileName == '\\') || (*FileName == '/'))
{
FileName++;
}
//
// Figure out how many sub-directories we are nested in
//
NumberOfPathParts = FatGetNumPathParts(FileName);
NumberOfPathParts = FsGetNumPathParts(FileName);
//
// Loop once for each part
@ -603,7 +595,7 @@ BOOL FatLookupFile(PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
//
// Get first path part
//
FatGetFirstNameFromPath(PathPart, FileName);
FsGetFirstNameFromPath(PathPart, FileName);
//
// Advance to the next part of the path
@ -649,60 +641,6 @@ BOOL FatLookupFile(PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
return TRUE;
}
/*
* FatGetNumPathParts()
* This function parses a path in the form of dir1\dir2\file1.ext
* and returns the number of parts it has (i.e. 3 - dir1,dir2,file1.ext)
*/
ULONG FatGetNumPathParts(PUCHAR Path)
{
ULONG i;
ULONG num;
for (i=0,num=0; i<(int)strlen(Path); i++)
{
if ((Path[i] == '\\') || (Path[i] == '/'))
{
num++;
}
}
num++;
DbgPrint((DPRINT_FILESYSTEM, "FatGetNumPathParts() Path = %s NumPathParts = %d\n", Path, num));
return num;
}
/*
* FatGetFirstNameFromPath()
* This function parses a path in the form of dir1\dir2\file1.ext
* and puts the first name of the path (e.g. "dir1") in buffer
* compatible with the MSDOS directory structure
*/
VOID FatGetFirstNameFromPath(PUCHAR Buffer, PUCHAR Path)
{
ULONG i;
// Copy all the characters up to the end of the
// string or until we hit a '\' character
// and put them in Buffer
for (i=0; i<(int)strlen(Path); i++)
{
if ((Path[i] == '\\') || (Path[i] == '/'))
{
break;
}
else
{
Buffer[i] = Path[i];
}
}
Buffer[i] = 0;
DbgPrint((DPRINT_FILESYSTEM, "FatGetFirstNameFromPath() Path = %s FirstName = %s\n", Path, Buffer));
}
/*
* FatParseFileName()
* This function parses a directory entry name which
@ -711,7 +649,7 @@ VOID FatGetFirstNameFromPath(PUCHAR Buffer, PUCHAR Path)
*/
void FatParseShortFileName(PUCHAR Buffer, PDIRENTRY DirEntry)
{
ULONG Idx;
U32 Idx;
Idx = 0;
RtlZeroMemory(Buffer, 13);
@ -756,9 +694,9 @@ void FatParseShortFileName(PUCHAR Buffer, PDIRENTRY DirEntry)
* FatGetFatEntry()
* returns the Fat entry for a given cluster number
*/
BOOL FatGetFatEntry(UINT32 Cluster, PUINT32 ClusterPointer)
BOOL FatGetFatEntry(U32 Cluster, U32* ClusterPointer)
{
DWORD fat = 0;
U32 fat = 0;
int FatOffset;
int ThisFatSecNum;
int ThisFatEntOffset;
@ -792,7 +730,7 @@ BOOL FatGetFatEntry(UINT32 Cluster, PUINT32 ClusterPointer)
}
}
fat = *((WORD *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset));
fat = *((U16 *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset));
if (Cluster & 0x0001)
fat = fat >> 4; /* Cluster number is ODD */
else
@ -811,7 +749,7 @@ BOOL FatGetFatEntry(UINT32 Cluster, PUINT32 ClusterPointer)
return FALSE;
}
fat = *((WORD *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset));
fat = *((U16 *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset));
break;
@ -828,7 +766,7 @@ BOOL FatGetFatEntry(UINT32 Cluster, PUINT32 ClusterPointer)
}
// Get the fat entry
fat = (*((DWORD *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset))) & 0x0FFFFFFF;
fat = (*((U32 *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset))) & 0x0FFFFFFF;
break;
@ -870,9 +808,9 @@ FILE* FatOpenFile(PUCHAR FileName)
return (FILE*)FileHandle;
}
UINT32 FatCountClustersInChain(UINT32 StartCluster)
U32 FatCountClustersInChain(U32 StartCluster)
{
UINT32 ClusterCount = 0;
U32 ClusterCount = 0;
DbgPrint((DPRINT_FILESYSTEM, "FatCountClustersInChain() StartCluster = %d\n", StartCluster));
@ -907,17 +845,17 @@ UINT32 FatCountClustersInChain(UINT32 StartCluster)
return ClusterCount;
}
PUINT32 FatGetClusterChainArray(UINT32 StartCluster)
U32* FatGetClusterChainArray(U32 StartCluster)
{
UINT32 ClusterCount;
ULONG ArraySize;
PUINT32 ArrayPointer;
ULONG Idx;
U32 ClusterCount;
U32 ArraySize;
U32* ArrayPointer;
U32 Idx;
DbgPrint((DPRINT_FILESYSTEM, "FatGetClusterChainArray() StartCluster = %d\n", StartCluster));
ClusterCount = FatCountClustersInChain(StartCluster) + 1; // Lets get the 0x0ffffff8 on the end of the array
ArraySize = ClusterCount * sizeof(UINT32);
ArraySize = ClusterCount * sizeof(U32);
//
// Allocate array memory
@ -968,9 +906,9 @@ PUINT32 FatGetClusterChainArray(UINT32 StartCluster)
* Reads the specified cluster into memory
* and returns the number of bytes read
*/
BOOL FatReadCluster(ULONG ClusterNumber, PVOID Buffer)
BOOL FatReadCluster(U32 ClusterNumber, PVOID Buffer)
{
ULONG ClusterStartSector;
U32 ClusterStartSector;
ClusterStartSector = ((ClusterNumber - 2) * FatVolumeBootSector->SectorsPerCluster) + DataSectorStart;
@ -990,9 +928,9 @@ BOOL FatReadCluster(ULONG ClusterNumber, PVOID Buffer)
* FatReadClusterChain()
* Reads the specified clusters into memory
*/
BOOL FatReadClusterChain(ULONG StartClusterNumber, ULONG NumberOfClusters, PVOID Buffer)
BOOL FatReadClusterChain(U32 StartClusterNumber, U32 NumberOfClusters, PVOID Buffer)
{
ULONG ClusterStartSector;
U32 ClusterStartSector;
DbgPrint((DPRINT_FILESYSTEM, "FatReadClusterChain() StartClusterNumber = %d NumberOfClusters = %d Buffer = 0x%x\n", StartClusterNumber, NumberOfClusters, Buffer));
@ -1051,9 +989,9 @@ BOOL FatReadClusterChain(ULONG StartClusterNumber, ULONG NumberOfClusters, PVOID
* FatReadPartialCluster()
* Reads part of a cluster into memory
*/
BOOL FatReadPartialCluster(ULONG ClusterNumber, ULONG StartingOffset, ULONG Length, PVOID Buffer)
BOOL FatReadPartialCluster(U32 ClusterNumber, U32 StartingOffset, U32 Length, PVOID Buffer)
{
ULONG ClusterStartSector;
U32 ClusterStartSector;
DbgPrint((DPRINT_FILESYSTEM, "FatReadPartialCluster() ClusterNumber = %d StartingOffset = %d Length = %d Buffer = 0x%x\n", ClusterNumber, StartingOffset, Length, Buffer));
@ -1074,14 +1012,14 @@ BOOL FatReadPartialCluster(ULONG ClusterNumber, ULONG StartingOffset, ULONG Leng
* Reads BytesToRead from open file and
* returns the number of bytes read in BytesRead
*/
BOOL FatReadFile(FILE *FileHandle, ULONG BytesToRead, PULONG BytesRead, PVOID Buffer)
BOOL FatReadFile(FILE *FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer)
{
PFAT_FILE_INFO FatFileInfo = (PFAT_FILE_INFO)FileHandle;
UINT32 ClusterNumber;
UINT32 OffsetInCluster;
UINT32 LengthInCluster;
UINT32 NumberOfClusters;
UINT32 BytesPerCluster;
U32 ClusterNumber;
U32 OffsetInCluster;
U32 LengthInCluster;
U32 NumberOfClusters;
U32 BytesPerCluster;
DbgPrint((DPRINT_FILESYSTEM, "FatReadFile() BytesToRead = %d Buffer = 0x%x\n", BytesToRead, Buffer));
@ -1228,7 +1166,7 @@ BOOL FatReadFile(FILE *FileHandle, ULONG BytesToRead, PULONG BytesRead, PVOID Bu
return TRUE;
}
ULONG FatGetFileSize(FILE *FileHandle)
U32 FatGetFileSize(FILE *FileHandle)
{
PFAT_FILE_INFO FatFileHandle = (PFAT_FILE_INFO)FileHandle;
@ -1237,7 +1175,7 @@ ULONG FatGetFileSize(FILE *FileHandle)
return FatFileHandle->FileSize;
}
VOID FatSetFilePointer(FILE *FileHandle, ULONG NewFilePointer)
VOID FatSetFilePointer(FILE *FileHandle, U32 NewFilePointer)
{
PFAT_FILE_INFO FatFileHandle = (PFAT_FILE_INFO)FileHandle;
@ -1246,7 +1184,7 @@ VOID FatSetFilePointer(FILE *FileHandle, ULONG NewFilePointer)
FatFileHandle->FilePointer = NewFilePointer;
}
ULONG FatGetFilePointer(FILE *FileHandle)
U32 FatGetFilePointer(FILE *FileHandle)
{
PFAT_FILE_INFO FatFileHandle = (PFAT_FILE_INFO)FileHandle;
@ -1255,7 +1193,7 @@ ULONG FatGetFilePointer(FILE *FileHandle)
return FatFileHandle->FilePointer;
}
BOOL FatReadVolumeSectors(ULONG DriveNumber, ULONG SectorNumber, ULONG SectorCount, PVOID Buffer)
BOOL FatReadVolumeSectors(U32 DriveNumber, U32 SectorNumber, U32 SectorCount, PVOID Buffer)
{
//GEOMETRY DiskGeometry;
//BOOL ReturnValue;

View file

@ -22,66 +22,66 @@
typedef struct _FAT_BOOTSECTOR
{
BYTE JumpBoot[3]; // Jump instruction to boot code
UCHAR OemName[8]; // "MSWIN4.1" for MS formatted volumes
WORD BytesPerSector; // Bytes per sector
BYTE SectorsPerCluster; // Number of sectors in a cluster
WORD ReservedSectors; // Reserved sectors, usually 1 (the bootsector)
BYTE NumberOfFats; // Number of FAT tables
WORD RootDirEntries; // Number of root directory entries (fat12/16)
WORD TotalSectors; // Number of total sectors on the drive, 16-bit
BYTE MediaDescriptor; // Media descriptor byte
WORD SectorsPerFat; // Sectors per FAT table (fat12/16)
WORD SectorsPerTrack; // Number of sectors in a track
WORD NumberOfHeads; // Number of heads on the disk
DWORD HiddenSectors; // Hidden sectors (sectors before the partition start like the partition table)
DWORD TotalSectorsBig; // This field is the new 32-bit total count of sectors on the volume
BYTE DriveNumber; // Int 0x13 drive number (e.g. 0x80)
BYTE Reserved1; // Reserved (used by Windows NT). Code that formats FAT volumes should always set this byte to 0.
BYTE BootSignature; // Extended boot signature (0x29). This is a signature byte that indicates that the following three fields in the boot sector are present.
DWORD VolumeSerialNumber; // Volume serial number
UCHAR VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory
UCHAR FileSystemType[8]; // One of the strings "FAT12 ", "FAT16 ", or "FAT "
U8 JumpBoot[3]; // Jump instruction to boot code
U8 OemName[8]; // "MSWIN4.1" for MS formatted volumes
U16 BytesPerSector; // Bytes per sector
U8 SectorsPerCluster; // Number of sectors in a cluster
U16 ReservedSectors; // Reserved sectors, usually 1 (the bootsector)
U8 NumberOfFats; // Number of FAT tables
U16 RootDirEntries; // Number of root directory entries (fat12/16)
U16 TotalSectors; // Number of total sectors on the drive, 16-bit
U8 MediaDescriptor; // Media descriptor byte
U16 SectorsPerFat; // Sectors per FAT table (fat12/16)
U16 SectorsPerTrack; // Number of sectors in a track
U16 NumberOfHeads; // Number of heads on the disk
U32 HiddenSectors; // Hidden sectors (sectors before the partition start like the partition table)
U32 TotalSectorsBig; // This field is the new 32-bit total count of sectors on the volume
U8 DriveNumber; // Int 0x13 drive number (e.g. 0x80)
U8 Reserved1; // Reserved (used by Windows NT). Code that formats FAT volumes should always set this byte to 0.
U8 BootSignature; // Extended boot signature (0x29). This is a signature byte that indicates that the following three fields in the boot sector are present.
U32 VolumeSerialNumber; // Volume serial number
U8 VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory
U8 FileSystemType[8]; // One of the strings "FAT12 ", "FAT16 ", or "FAT "
BYTE BootCodeAndData[448]; // The remainder of the boot sector
U8 BootCodeAndData[448]; // The remainder of the boot sector
WORD BootSectorMagic; // 0xAA55
U16 BootSectorMagic; // 0xAA55
} PACKED FAT_BOOTSECTOR, *PFAT_BOOTSECTOR;
typedef struct _FAT32_BOOTSECTOR
{
BYTE JumpBoot[3]; // Jump instruction to boot code
UCHAR OemName[8]; // "MSWIN4.1" for MS formatted volumes
WORD BytesPerSector; // Bytes per sector
BYTE SectorsPerCluster; // Number of sectors in a cluster
WORD ReservedSectors; // Reserved sectors, usually 1 (the bootsector)
BYTE NumberOfFats; // Number of FAT tables
WORD RootDirEntries; // Number of root directory entries (fat12/16)
WORD TotalSectors; // Number of total sectors on the drive, 16-bit
BYTE MediaDescriptor; // Media descriptor byte
WORD SectorsPerFat; // Sectors per FAT table (fat12/16)
WORD SectorsPerTrack; // Number of sectors in a track
WORD NumberOfHeads; // Number of heads on the disk
DWORD HiddenSectors; // Hidden sectors (sectors before the partition start like the partition table)
DWORD TotalSectorsBig; // This field is the new 32-bit total count of sectors on the volume
DWORD SectorsPerFatBig; // This field is the FAT32 32-bit count of sectors occupied by ONE FAT. BPB_FATSz16 must be 0
WORD ExtendedFlags; // Extended flags (fat32)
WORD FileSystemVersion; // File system version (fat32)
DWORD RootDirStartCluster; // Starting cluster of the root directory (fat32)
WORD FsInfo; // Sector number of FSINFO structure in the reserved area of the FAT32 volume. Usually 1.
WORD BackupBootSector; // If non-zero, indicates the sector number in the reserved area of the volume of a copy of the boot record. Usually 6.
BYTE Reserved[12]; // Reserved for future expansion
BYTE DriveNumber; // Int 0x13 drive number (e.g. 0x80)
BYTE Reserved1; // Reserved (used by Windows NT). Code that formats FAT volumes should always set this byte to 0.
BYTE BootSignature; // Extended boot signature (0x29). This is a signature byte that indicates that the following three fields in the boot sector are present.
DWORD VolumeSerialNumber; // Volume serial number
UCHAR VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory
UCHAR FileSystemType[8]; // Always set to the string "FAT32 "
U8 JumpBoot[3]; // Jump instruction to boot code
U8 OemName[8]; // "MSWIN4.1" for MS formatted volumes
U16 BytesPerSector; // Bytes per sector
U8 SectorsPerCluster; // Number of sectors in a cluster
U16 ReservedSectors; // Reserved sectors, usually 1 (the bootsector)
U8 NumberOfFats; // Number of FAT tables
U16 RootDirEntries; // Number of root directory entries (fat12/16)
U16 TotalSectors; // Number of total sectors on the drive, 16-bit
U8 MediaDescriptor; // Media descriptor byte
U16 SectorsPerFat; // Sectors per FAT table (fat12/16)
U16 SectorsPerTrack; // Number of sectors in a track
U16 NumberOfHeads; // Number of heads on the disk
U32 HiddenSectors; // Hidden sectors (sectors before the partition start like the partition table)
U32 TotalSectorsBig; // This field is the new 32-bit total count of sectors on the volume
U32 SectorsPerFatBig; // This field is the FAT32 32-bit count of sectors occupied by ONE FAT. BPB_FATSz16 must be 0
U16 ExtendedFlags; // Extended flags (fat32)
U16 FileSystemVersion; // File system version (fat32)
U32 RootDirStartCluster; // Starting cluster of the root directory (fat32)
U16 FsInfo; // Sector number of FSINFO structure in the reserved area of the FAT32 volume. Usually 1.
U16 BackupBootSector; // If non-zero, indicates the sector number in the reserved area of the volume of a copy of the boot record. Usually 6.
U8 Reserved[12]; // Reserved for future expansion
U8 DriveNumber; // Int 0x13 drive number (e.g. 0x80)
U8 Reserved1; // Reserved (used by Windows NT). Code that formats FAT volumes should always set this byte to 0.
U8 BootSignature; // Extended boot signature (0x29). This is a signature byte that indicates that the following three fields in the boot sector are present.
U32 VolumeSerialNumber; // Volume serial number
U8 VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory
U8 FileSystemType[8]; // Always set to the string "FAT32 "
BYTE BootCodeAndData[420]; // The remainder of the boot sector
U8 BootCodeAndData[420]; // The remainder of the boot sector
WORD BootSectorMagic; // 0xAA55
U16 BootSectorMagic; // 0xAA55
} PACKED FAT32_BOOTSECTOR, *PFAT32_BOOTSECTOR;
@ -91,61 +91,59 @@ typedef struct _FAT32_BOOTSECTOR
typedef struct //_DIRENTRY
{
UCHAR FileName[11]; /* Filename + extension */
UINT8 Attr; /* File attributes */
UINT8 ReservedNT; /* Reserved for use by Windows NT */
UINT8 TimeInTenths; /* Millisecond stamp at file creation */
UINT16 CreateTime; /* Time file was created */
UINT16 CreateDate; /* Date file was created */
UINT16 LastAccessDate; /* Date file was last accessed */
UINT16 ClusterHigh; /* High word of this entry's start cluster */
UINT16 Time; /* Time last modified */
UINT16 Date; /* Date last modified */
UINT16 ClusterLow; /* First cluster number low word */
UINT32 Size; /* File size */
U8 Attr; /* File attributes */
U8 ReservedNT; /* Reserved for use by Windows NT */
U8 TimeInTenths; /* Millisecond stamp at file creation */
U16 CreateTime; /* Time file was created */
U16 CreateDate; /* Date file was created */
U16 LastAccessDate; /* Date file was last accessed */
U16 ClusterHigh; /* High word of this entry's start cluster */
U16 Time; /* Time last modified */
U16 Date; /* Date last modified */
U16 ClusterLow; /* First cluster number low word */
U32 Size; /* File size */
} PACKED DIRENTRY, * PDIRENTRY;
typedef struct
{
UINT8 SequenceNumber; /* Sequence number for slot */
U8 SequenceNumber; /* Sequence number for slot */
WCHAR Name0_4[5]; /* First 5 characters in name */
UINT8 EntryAttributes; /* Attribute byte */
UINT8 Reserved; /* Always 0 */
UINT8 AliasChecksum; /* Checksum for 8.3 alias */
U8 EntryAttributes; /* Attribute byte */
U8 Reserved; /* Always 0 */
U8 AliasChecksum; /* Checksum for 8.3 alias */
WCHAR Name5_10[6]; /* 6 more characters in name */
UINT16 StartCluster; /* Starting cluster number */
U16 StartCluster; /* Starting cluster number */
WCHAR Name11_12[2]; /* Last 2 characters in name */
} PACKED LFN_DIRENTRY, * PLFN_DIRENTRY;
typedef struct
{
ULONG FileSize; // File size
ULONG FilePointer; // File pointer
PUINT32 FileFatChain; // File fat chain array
ULONG DriveNumber;
U32 FileSize; // File size
U32 FilePointer; // File pointer
U32* FileFatChain; // File fat chain array
U32 DriveNumber;
} FAT_FILE_INFO, * PFAT_FILE_INFO;
BOOL FatOpenVolume(ULONG DriveNumber, ULONG VolumeStartSector);
ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector);
PVOID FatBufferDirectory(UINT32 DirectoryStartCluster, PUINT32 EntryCountPointer, BOOL RootDirectory);
BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, UINT32 EntryCount, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer);
BOOL FatOpenVolume(U32 DriveNumber, U32 VolumeStartSector);
U32 FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector);
PVOID FatBufferDirectory(U32 DirectoryStartCluster, U32* EntryCountPointer, BOOL RootDirectory);
BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, U32 EntryCount, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer);
BOOL FatLookupFile(PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer);
ULONG FatGetNumPathParts(PUCHAR Path);
VOID FatGetFirstNameFromPath(PUCHAR Buffer, PUCHAR Path);
void FatParseShortFileName(PUCHAR Buffer, PDIRENTRY DirEntry);
BOOL FatGetFatEntry(UINT32 Cluster, PUINT32 ClusterPointer);
BOOL FatGetFatEntry(U32 Cluster, U32* ClusterPointer);
FILE* FatOpenFile(PUCHAR FileName);
UINT32 FatCountClustersInChain(UINT32 StartCluster);
PUINT32 FatGetClusterChainArray(UINT32 StartCluster);
BOOL FatReadCluster(ULONG ClusterNumber, PVOID Buffer);
BOOL FatReadClusterChain(ULONG StartClusterNumber, ULONG NumberOfClusters, PVOID Buffer);
BOOL FatReadPartialCluster(ULONG ClusterNumber, ULONG StartingOffset, ULONG Length, PVOID Buffer);
BOOL FatReadFile(FILE *FileHandle, ULONG BytesToRead, PULONG BytesRead, PVOID Buffer);
ULONG FatGetFileSize(FILE *FileHandle);
VOID FatSetFilePointer(FILE *FileHandle, ULONG NewFilePointer);
ULONG FatGetFilePointer(FILE *FileHandle);
BOOL FatReadVolumeSectors(ULONG DriveNumber, ULONG SectorNumber, ULONG SectorCount, PVOID Buffer);
U32 FatCountClustersInChain(U32 StartCluster);
U32* FatGetClusterChainArray(U32 StartCluster);
BOOL FatReadCluster(U32 ClusterNumber, PVOID Buffer);
BOOL FatReadClusterChain(U32 StartClusterNumber, U32 NumberOfClusters, PVOID Buffer);
BOOL FatReadPartialCluster(U32 ClusterNumber, U32 StartingOffset, U32 Length, PVOID Buffer);
BOOL FatReadFile(FILE *FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer);
U32 FatGetFileSize(FILE *FileHandle);
VOID FatSetFilePointer(FILE *FileHandle, U32 NewFilePointer);
U32 FatGetFilePointer(FILE *FileHandle);
BOOL FatReadVolumeSectors(U32 DriveNumber, U32 SectorNumber, U32 SectorCount, PVOID Buffer);
#define ATTR_NORMAL 0x00

View file

@ -21,6 +21,7 @@
#include <fs.h>
#include "fat.h"
#include "iso.h"
#include "ext2.h"
#include <disk.h>
#include <rtl.h>
#include <ui.h>
@ -32,7 +33,7 @@
// DATA
/////////////////////////////////////////////////////////////////////////////////////////////
ULONG FileSystemType = 0; // Type of filesystem on boot device, set by OpenDiskDrive()
U32 FileSystemType = 0; // Type of filesystem on boot device, set by OpenDiskDrive()
/////////////////////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
@ -47,7 +48,7 @@ VOID FileSystemError(PUCHAR ErrorString)
/*
*
* BOOL OpenDiskDrive(ULONG DriveNumber, ULONG PartitionNumber);
* BOOL OpenDiskDrive(U32 DriveNumber, U32 PartitionNumber);
*
* This function is called to open a disk drive for file access.
* It must be called before any of the file functions will work.
@ -60,9 +61,10 @@ VOID FileSystemError(PUCHAR ErrorString)
* If it is zero then it opens the active (bootable) partition
*
*/
BOOL OpenDiskDrive(ULONG DriveNumber, ULONG PartitionNumber)
BOOL OpenDiskDrive(U32 DriveNumber, U32 PartitionNumber)
{
PARTITION_TABLE_ENTRY PartitionTableEntry;
UCHAR ErrorText[80];
DbgPrint((DPRINT_FILESYSTEM, "OpenDiskDrive() DriveNumber: 0x%x PartitionNumber: 0x%x\n", DriveNumber, PartitionNumber));
@ -126,9 +128,13 @@ BOOL OpenDiskDrive(ULONG DriveNumber, ULONG PartitionNumber)
case PARTITION_FAT32_XINT13:
FileSystemType = FS_FAT;
return FatOpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition);
case PARTITION_EXT2:
FileSystemType = FS_EXT2;
return Ext2OpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition);
default:
FileSystemType = 0;
FileSystemError("Unsupported file system.");
sprintf(ErrorText, "Unsupported file system. Type: 0x%x", PartitionTableEntry.SystemIndicator);
FileSystemError(ErrorText);
return FALSE;
}
@ -143,21 +149,32 @@ PFILE OpenFile(PUCHAR FileName)
// Print status message
//
DbgPrint((DPRINT_FILESYSTEM, "Opening file '%s'...\n", FileName));
//
// Check and see if the first character is '\' or '/' and remove it if so
//
while ((*FileName == '\\') || (*FileName == '/'))
{
FileName++;
}
//
// Check file system type and pass off to appropriate handler
//
if (FileSystemType == FS_FAT)
switch (FileSystemType)
{
case FS_FAT:
FileHandle = FatOpenFile(FileName);
}
else if (FileSystemType == FS_ISO9660)
{
break;
case FS_ISO9660:
FileHandle = IsoOpenFile(FileName);
}
else
{
break;
case FS_EXT2:
FileHandle = Ext2OpenFile(FileName);
break;
default:
FileSystemError("Error: Unknown filesystem.");
break;
}
#ifdef DEBUG
@ -185,7 +202,7 @@ VOID CloseFile(PFILE FileHandle)
* ReadFile()
* returns number of bytes read or EOF
*/
BOOL ReadFile(PFILE FileHandle, ULONG BytesToRead, PULONG BytesRead, PVOID Buffer)
BOOL ReadFile(PFILE FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer)
{
//
// Set the number of bytes read equal to zero
@ -205,6 +222,10 @@ BOOL ReadFile(PFILE FileHandle, ULONG BytesToRead, PULONG BytesRead, PVOID Buffe
return IsoReadFile(FileHandle, BytesToRead, BytesRead, Buffer);
case FS_EXT2:
return Ext2ReadFile(FileHandle, BytesToRead, BytesRead, Buffer);
default:
FileSystemError("Unknown file system.");
@ -214,7 +235,7 @@ BOOL ReadFile(PFILE FileHandle, ULONG BytesToRead, PULONG BytesRead, PVOID Buffe
return FALSE;
}
ULONG GetFileSize(PFILE FileHandle)
U32 GetFileSize(PFILE FileHandle)
{
switch (FileSystemType)
{
@ -226,6 +247,10 @@ ULONG GetFileSize(PFILE FileHandle)
return IsoGetFileSize(FileHandle);
case FS_EXT2:
return Ext2GetFileSize(FileHandle);
default:
FileSystemError("Unknown file system.");
break;
@ -234,7 +259,7 @@ ULONG GetFileSize(PFILE FileHandle)
return 0;
}
VOID SetFilePointer(PFILE FileHandle, ULONG NewFilePointer)
VOID SetFilePointer(PFILE FileHandle, U32 NewFilePointer)
{
switch (FileSystemType)
{
@ -248,13 +273,18 @@ VOID SetFilePointer(PFILE FileHandle, ULONG NewFilePointer)
IsoSetFilePointer(FileHandle, NewFilePointer);
break;
case FS_EXT2:
Ext2SetFilePointer(FileHandle, NewFilePointer);
break;
default:
FileSystemError("Unknown file system.");
break;
}
}
ULONG GetFilePointer(PFILE FileHandle)
U32 GetFilePointer(PFILE FileHandle)
{
switch (FileSystemType)
{
@ -268,6 +298,11 @@ ULONG GetFilePointer(PFILE FileHandle)
return IsoGetFilePointer(FileHandle);
break;
case FS_EXT2:
return Ext2GetFilePointer(FileHandle);
break;
default:
FileSystemError("Unknown file system.");
break;
@ -287,3 +322,57 @@ BOOL IsEndOfFile(PFILE FileHandle)
return FALSE;
}
}
/*
* FsGetNumPathParts()
* This function parses a path in the form of dir1\dir2\file1.ext
* and returns the number of parts it has (i.e. 3 - dir1,dir2,file1.ext)
*/
U32 FsGetNumPathParts(PUCHAR Path)
{
U32 i;
U32 num;
for (i=0,num=0; i<(int)strlen(Path); i++)
{
if ((Path[i] == '\\') || (Path[i] == '/'))
{
num++;
}
}
num++;
DbgPrint((DPRINT_FILESYSTEM, "FatGetNumPathParts() Path = %s NumPathParts = %d\n", Path, num));
return num;
}
/*
* FsGetFirstNameFromPath()
* This function parses a path in the form of dir1\dir2\file1.ext
* and puts the first name of the path (e.g. "dir1") in buffer
* compatible with the MSDOS directory structure
*/
VOID FsGetFirstNameFromPath(PUCHAR Buffer, PUCHAR Path)
{
U32 i;
// Copy all the characters up to the end of the
// string or until we hit a '\' character
// and put them in Buffer
for (i=0; i<(int)strlen(Path); i++)
{
if ((Path[i] == '\\') || (Path[i] == '/'))
{
break;
}
else
{
Buffer[i] = Path[i];
}
}
Buffer[i] = 0;
DbgPrint((DPRINT_FILESYSTEM, "FatGetFirstNameFromPath() Path = %s FirstName = %s\n", Path, Buffer));
}

View file

@ -31,13 +31,13 @@
#define SECTORSIZE 2048
static ULONG IsoRootSector; // Starting sector of the root directory
static ULONG IsoRootLength; // Length of the root directory
static U32 IsoRootSector; // Starting sector of the root directory
static U32 IsoRootLength; // Length of the root directory
ULONG IsoDriveNumber = 0;
U32 IsoDriveNumber = 0;
BOOL IsoOpenVolume(ULONG DriveNumber)
BOOL IsoOpenVolume(U32 DriveNumber)
{
PPVD Pvd;
@ -69,11 +69,11 @@ BOOL IsoOpenVolume(ULONG DriveNumber)
}
static BOOL IsoSearchDirectoryBufferForFile(PVOID DirectoryBuffer, UINT32 DirectoryLength, PUCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer)
static BOOL IsoSearchDirectoryBufferForFile(PVOID DirectoryBuffer, U32 DirectoryLength, PUCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer)
{
PDIR_RECORD Record;
ULONG Offset;
ULONG i;
U32 Offset;
U32 i;
UCHAR Name[32];
DbgPrint((DPRINT_FILESYSTEM, "IsoSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x DirectoryLength = %d FileName = %s\n", DirectoryBuffer, DirectoryLength, FileName));
@ -131,10 +131,10 @@ static BOOL IsoSearchDirectoryBufferForFile(PVOID DirectoryBuffer, UINT32 Direct
static PVOID IsoBufferDirectory(UINT32 DirectoryStartSector, UINT32 DirectoryLength)
static PVOID IsoBufferDirectory(U32 DirectoryStartSector, U32 DirectoryLength)
{
PVOID DirectoryBuffer;
UINT32 SectorCount;
U32 SectorCount;
DbgPrint((DPRINT_FILESYSTEM, "IsoBufferDirectory() DirectoryStartSector = %d DirectoryLength = %d\n", DirectoryStartSector, DirectoryLength));
@ -165,62 +165,6 @@ static PVOID IsoBufferDirectory(UINT32 DirectoryStartSector, UINT32 DirectoryLen
}
/*
* IsoGetNumPathParts()
* This function parses a path in the form of dir1\dir2\file1.ext
* and returns the number of parts it has (i.e. 3 - dir1,dir2,file1.ext)
*/
static ULONG IsoGetNumPathParts(PUCHAR Path)
{
ULONG i;
ULONG num;
for (i=0,num=0; i<(int)strlen(Path); i++)
{
if ((Path[i] == '\\') || (Path[i] == '/'))
{
num++;
}
}
num++;
DbgPrint((DPRINT_FILESYSTEM, "IsoGetNumPathParts() Path = %s NumPathParts = %d\n", Path, num));
return num;
}
/*
* IsoGetFirstNameFromPath()
* This function parses a path in the form of dir1\dir2\file1.ext
* and puts the first name of the path (e.g. "dir1") in buffer
* compatible with the MSDOS directory structure
*/
static VOID IsoGetFirstNameFromPath(PUCHAR Buffer, PUCHAR Path)
{
ULONG i;
// Copy all the characters up to the end of the
// string or until we hit a '\' character
// and put them in Buffer
for (i=0; i<(int)strlen(Path); i++)
{
if ((Path[i] == '\\') || (Path[i] == '/'))
{
break;
}
else
{
Buffer[i] = Path[i];
}
}
Buffer[i] = 0;
DbgPrint((DPRINT_FILESYSTEM, "IsoGetFirstNameFromPath() Path = %s FirstName = %s\n", Path, Buffer));
}
/*
* IsoLookupFile()
* This function searches the file system for the
@ -231,29 +175,21 @@ static VOID IsoGetFirstNameFromPath(PUCHAR Buffer, PUCHAR Path)
static BOOL IsoLookupFile(PUCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer)
{
int i;
ULONG NumberOfPathParts;
U32 NumberOfPathParts;
UCHAR PathPart[261];
PVOID DirectoryBuffer;
UINT32 DirectorySector;
UINT32 DirectoryLength;
U32 DirectorySector;
U32 DirectoryLength;
ISO_FILE_INFO IsoFileInfo;
DbgPrint((DPRINT_FILESYSTEM, "IsoLookupFile() FileName = %s\n", FileName));
memset(IsoFileInfoPointer, 0, sizeof(ISO_FILE_INFO));
//
// Check and see if the first character is '\' and remove it if so
//
while ((*FileName == '\\') || (*FileName == '/'))
{
FileName++;
}
//
// Figure out how many sub-directories we are nested in
//
NumberOfPathParts = IsoGetNumPathParts(FileName);
NumberOfPathParts = FsGetNumPathParts(FileName);
DirectorySector = IsoRootSector;
DirectoryLength = IsoRootLength;
@ -266,7 +202,7 @@ static BOOL IsoLookupFile(PUCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer)
//
// Get first path part
//
IsoGetFirstNameFromPath(PathPart, FileName);
FsGetFirstNameFromPath(PathPart, FileName);
//
// Advance to the next part of the path
@ -348,7 +284,7 @@ FILE* IsoOpenFile(PUCHAR FileName)
* IsoReadPartialSector()
* Reads part of a cluster into memory
*/
static BOOL IsoReadPartialSector(ULONG SectorNumber, ULONG StartingOffset, ULONG Length, PVOID Buffer)
static BOOL IsoReadPartialSector(U32 SectorNumber, U32 StartingOffset, U32 Length, PVOID Buffer)
{
PUCHAR SectorBuffer;
@ -379,13 +315,13 @@ static BOOL IsoReadPartialSector(ULONG SectorNumber, ULONG StartingOffset, ULONG
* Reads BytesToRead from open file and
* returns the number of bytes read in BytesRead
*/
BOOL IsoReadFile(FILE *FileHandle, ULONG BytesToRead, PULONG BytesRead, PVOID Buffer)
BOOL IsoReadFile(FILE *FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer)
{
PISO_FILE_INFO IsoFileInfo = (PISO_FILE_INFO)FileHandle;
UINT32 SectorNumber;
UINT32 OffsetInSector;
UINT32 LengthInSector;
UINT32 NumberOfSectors;
U32 SectorNumber;
U32 OffsetInSector;
U32 LengthInSector;
U32 NumberOfSectors;
DbgPrint((DPRINT_FILESYSTEM, "IsoReadFile() BytesToRead = %d Buffer = 0x%x\n", BytesToRead, Buffer));
@ -531,7 +467,7 @@ BOOL IsoReadFile(FILE *FileHandle, ULONG BytesToRead, PULONG BytesRead, PVOID Bu
}
ULONG IsoGetFileSize(FILE *FileHandle)
U32 IsoGetFileSize(FILE *FileHandle)
{
PISO_FILE_INFO IsoFileHandle = (PISO_FILE_INFO)FileHandle;
@ -540,7 +476,7 @@ ULONG IsoGetFileSize(FILE *FileHandle)
return IsoFileHandle->FileSize;
}
VOID IsoSetFilePointer(FILE *FileHandle, ULONG NewFilePointer)
VOID IsoSetFilePointer(FILE *FileHandle, U32 NewFilePointer)
{
PISO_FILE_INFO IsoFileHandle = (PISO_FILE_INFO)FileHandle;
@ -549,7 +485,7 @@ VOID IsoSetFilePointer(FILE *FileHandle, ULONG NewFilePointer)
IsoFileHandle->FilePointer = NewFilePointer;
}
ULONG IsoGetFilePointer(FILE *FileHandle)
U32 IsoGetFilePointer(FILE *FileHandle)
{
PISO_FILE_INFO IsoFileHandle = (PISO_FILE_INFO)FileHandle;

View file

@ -25,10 +25,10 @@ struct _DIR_RECORD
{
UCHAR RecordLength; // 1
UCHAR ExtAttrRecordLength; // 2
ULONG ExtentLocationL; // 3-6
ULONG ExtentLocationM; // 7-10
ULONG DataLengthL; // 11-14
ULONG DataLengthM; // 15-18
U32 ExtentLocationL; // 3-6
U32 ExtentLocationM; // 7-10
U32 DataLengthL; // 11-14
U32 DataLengthM; // 15-18
UCHAR Year; // 19
UCHAR Month; // 20
UCHAR Day; // 21
@ -39,7 +39,7 @@ struct _DIR_RECORD
UCHAR FileFlags; // 26
UCHAR FileUnitSize; // 27
UCHAR InterleaveGapSize; // 28
ULONG VolumeSequenceNumber; // 29-32
U32 VolumeSequenceNumber; // 29-32
UCHAR FileIdLength; // 33
UCHAR FileId[1]; // 34
} __attribute__((packed));
@ -71,18 +71,18 @@ struct _PVD
UCHAR SystemId[32]; // 9-40
UCHAR VolumeId[32]; // 41-72
UCHAR unused1[8]; // 73-80
ULONG VolumeSpaceSizeL; // 81-84
ULONG VolumeSpaceSizeM; // 85-88
U32 VolumeSpaceSizeL; // 81-84
U32 VolumeSpaceSizeM; // 85-88
UCHAR unused2[32]; // 89-120
ULONG VolumeSetSize; // 121-124
ULONG VolumeSequenceNumber; // 125-128
ULONG LogicalBlockSize; // 129-132
ULONG PathTableSizeL; // 133-136
ULONG PathTableSizeM; // 137-140
ULONG LPathTablePos; // 141-144
ULONG LOptPathTablePos; // 145-148
ULONG MPathTablePos; // 149-152
ULONG MOptPathTablePos; // 153-156
U32 VolumeSetSize; // 121-124
U32 VolumeSequenceNumber; // 125-128
U32 LogicalBlockSize; // 129-132
U32 PathTableSizeL; // 133-136
U32 PathTableSizeM; // 137-140
U32 LPathTablePos; // 141-144
U32 LOptPathTablePos; // 145-148
U32 MPathTablePos; // 149-152
U32 MOptPathTablePos; // 153-156
DIR_RECORD RootDirRecord; // 157-190
UCHAR VolumeSetIdentifier[128]; // 191-318
UCHAR PublisherIdentifier[128]; // 319-446
@ -97,19 +97,19 @@ typedef struct _PVD PVD, *PPVD;
typedef struct
{
ULONG FileStart; // File start sector
ULONG FileSize; // File size
ULONG FilePointer; // File pointer
U32 FileStart; // File start sector
U32 FileSize; // File size
U32 FilePointer; // File pointer
BOOL Directory;
ULONG DriveNumber;
U32 DriveNumber;
} ISO_FILE_INFO, * PISO_FILE_INFO;
BOOL IsoOpenVolume(ULONG DriveNumber);
BOOL IsoOpenVolume(U32 DriveNumber);
FILE* IsoOpenFile(PUCHAR FileName);
BOOL IsoReadFile(FILE *FileHandle, ULONG BytesToRead, PULONG BytesRead, PVOID Buffer);
ULONG IsoGetFileSize(FILE *FileHandle);
VOID IsoSetFilePointer(FILE *FileHandle, ULONG NewFilePointer);
ULONG IsoGetFilePointer(FILE *FileHandle);
BOOL IsoReadFile(FILE *FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer);
U32 IsoGetFileSize(FILE *FileHandle);
VOID IsoSetFilePointer(FILE *FileHandle, U32 NewFilePointer);
U32 IsoGetFilePointer(FILE *FileHandle);
#endif // #defined __FAT_H

View file

@ -22,8 +22,8 @@
VOID RunBootManager(VOID);
ULONG GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG OperatingSystemCount);
LONG GetTimeOut(VOID);
U32 GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], U32 OperatingSystemCount);
S32 GetTimeOut(VOID);
#endif // #defined __BOOTMGR_H

View file

@ -21,10 +21,10 @@
#ifndef __CACHE_H
#define __CACHE_H
BOOL CacheInitializeDrive(ULONG DriveNumber);
BOOL CacheInitializeDrive(U32 DriveNumber);
VOID CacheInvalidateCacheData(VOID);
BOOL CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount, PVOID Buffer);
BOOL CacheForceDiskSectorsIntoCache(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount);
BOOL CacheReleaseMemory(ULONG MinimumAmountToRelease);
BOOL CacheReadDiskSectors(U32 DiskNumber, U32 StartSector, U32 SectorCount, PVOID Buffer);
BOOL CacheForceDiskSectorsIntoCache(U32 DiskNumber, U32 StartSector, U32 SectorCount);
BOOL CacheReleaseMemory(U32 MinimumAmountToRelease);
#endif // defined __CACHE_H

View file

@ -22,7 +22,7 @@
#ifndef __RS232_H
#define __RS232_H
BOOL Rs232PortInitialize(ULONG ComPort, ULONG BaudRate);
BOOL Rs232PortInitialize(U32 ComPort, U32 BaudRate);
BOOL Rs232PortGetByte(PUCHAR ByteRecieved);
BOOL Rs232PortPollByte(PUCHAR ByteRecieved);
VOID Rs232PortPutByte(UCHAR ByteToSend);
@ -35,39 +35,39 @@ VOID Rs232PortPutByte(UCHAR ByteToSend);
VOID
/*STDCALL*/
READ_PORT_BUFFER_UCHAR (PUCHAR Port, PUCHAR Value, ULONG Count);
READ_PORT_BUFFER_UCHAR (PUCHAR Port, PUCHAR Value, U32 Count);
VOID
/*STDCALL*/
READ_PORT_BUFFER_ULONG (PULONG Port, PULONG Value, ULONG Count);
READ_PORT_BUFFER_ULONG (U32* Port, U32* Value, U32 Count);
VOID
/*STDCALL*/
READ_PORT_BUFFER_USHORT (PUSHORT Port, PUSHORT Value, ULONG Count);
READ_PORT_BUFFER_USHORT (U16* Port, U16* Value, U32 Count);
UCHAR
/*STDCALL*/
READ_PORT_UCHAR (PUCHAR Port);
ULONG
U32
/*STDCALL*/
READ_PORT_ULONG (PULONG Port);
READ_PORT_ULONG (U32* Port);
USHORT
U16
/*STDCALL*/
READ_PORT_USHORT (PUSHORT Port);
READ_PORT_USHORT (U16* Port);
VOID
/*STDCALL*/
WRITE_PORT_BUFFER_UCHAR (PUCHAR Port, PUCHAR Value, ULONG Count);
WRITE_PORT_BUFFER_UCHAR (PUCHAR Port, PUCHAR Value, U32 Count);
VOID
/*STDCALL*/
WRITE_PORT_BUFFER_ULONG (PULONG Port, PULONG Value, ULONG Count);
WRITE_PORT_BUFFER_ULONG (U32* Port, U32* Value, U32 Count);
VOID
/*STDCALL*/
WRITE_PORT_BUFFER_USHORT (PUSHORT Port, PUSHORT Value, ULONG Count);
WRITE_PORT_BUFFER_USHORT (U16* Port, U16* Value, U32 Count);
VOID
/*STDCALL*/
@ -75,11 +75,11 @@ WRITE_PORT_UCHAR (PUCHAR Port, UCHAR Value);
VOID
/*STDCALL*/
WRITE_PORT_ULONG (PULONG Port, ULONG Value);
WRITE_PORT_ULONG (U32* Port, U32 Value);
VOID
/*STDCALL*/
WRITE_PORT_USHORT (PUSHORT Port, USHORT Value);
WRITE_PORT_USHORT (U16* Port, U16 Value);
#endif // defined __RS232_H

View file

@ -36,8 +36,8 @@
#define DPRINT_LINUX 0x00000200 // OR this with DebugPrintMask to enable Linux messages
VOID DebugInit(VOID);
VOID DebugPrint(ULONG Mask, char *format, ...);
VOID DebugDumpBuffer(ULONG Mask, PVOID Buffer, ULONG Length);
VOID DebugPrint(U32 Mask, char *format, ...);
VOID DebugDumpBuffer(U32 Mask, PVOID Buffer, U32 Length);
#define DbgPrint(_x_) { DebugPrint(DPRINT_NONE, "%s:%d(%s)\n", __FILE__, __LINE__, __FUNCTION__); DebugPrint _x_ ; }
#define BugCheck(_x_) { DebugPrint(DPRINT_WARNING, "Fatal Error: %s:%d(%s)\n", __FILE__, __LINE__, __FUNCTION__); DebugPrint _x_ ; for (;;); }

View file

@ -23,10 +23,10 @@
typedef struct _GEOMETRY
{
ULONG Cylinders;
ULONG Heads;
ULONG Sectors;
ULONG BytesPerSector;
U32 Cylinders;
U32 Heads;
U32 Sectors;
U32 BytesPerSector;
} GEOMETRY, *PGEOMETRY;
@ -35,16 +35,16 @@ typedef struct _GEOMETRY
//
typedef struct _PARTITION_TABLE_ENTRY
{
BYTE BootIndicator; // 0x00 - non-bootable partition, 0x80 - bootable partition (one partition only)
BYTE StartHead; // Beginning head number
BYTE StartSector; // Beginning sector (2 high bits of cylinder #)
BYTE StartCylinder; // Beginning cylinder# (low order bits of cylinder #)
BYTE SystemIndicator; // System indicator
BYTE EndHead; // Ending head number
BYTE EndSector; // Ending sector (2 high bits of cylinder #)
BYTE EndCylinder; // Ending cylinder# (low order bits of cylinder #)
DWORD SectorCountBeforePartition; // Number of sectors preceding the partition
DWORD PartitionSectorCount; // Number of sectors in the partition
U8 BootIndicator; // 0x00 - non-bootable partition, 0x80 - bootable partition (one partition only)
U8 StartHead; // Beginning head number
U8 StartSector; // Beginning sector (2 high bits of cylinder #)
U8 StartCylinder; // Beginning cylinder# (low order bits of cylinder #)
U8 SystemIndicator; // System indicator
U8 EndHead; // Ending head number
U8 EndSector; // Ending sector (2 high bits of cylinder #)
U8 EndCylinder; // Ending cylinder# (low order bits of cylinder #)
U32 SectorCountBeforePartition; // Number of sectors preceding the partition
U32 PartitionSectorCount; // Number of sectors in the partition
} PACKED PARTITION_TABLE_ENTRY, *PPARTITION_TABLE_ENTRY;
@ -53,9 +53,9 @@ typedef struct _PARTITION_TABLE_ENTRY
//
typedef struct _MASTER_BOOT_RECORD
{
BYTE MasterBootRecordCodeAndData[0x1be];
U8 MasterBootRecordCodeAndData[0x1be];
PARTITION_TABLE_ENTRY PartitionTable[4];
WORD MasterBootRecordMagic;
U16 MasterBootRecordMagic;
} PACKED MASTER_BOOT_RECORD, *PMASTER_BOOT_RECORD;
@ -78,6 +78,8 @@ typedef struct _MASTER_BOOT_RECORD
#define PARTITION_PREP 0x41 // PowerPC Reference Platform (PReP) Boot Partition
#define PARTITION_LDM 0x42 // Logical Disk Manager partition
#define PARTITION_UNIX 0x63 // Unix
#define PARTITION_LINUX_SWAP 0x82 // Linux Swap Partition
#define PARTITION_EXT2 0x83 // Linux Ext2/Ext3
///////////////////////////////////////////////////////////////////////////////////////
//
@ -86,16 +88,16 @@ typedef struct _MASTER_BOOT_RECORD
///////////////////////////////////////////////////////////////////////////////////////
int biosdisk(int cmd, int drive, int head, int track, int sector, int nsects, void *buffer); // Implemented in asmcode.S
BOOL BiosInt13Read(ULONG Drive, ULONG Head, ULONG Track, ULONG Sector, ULONG SectorCount, PVOID Buffer); // Implemented in asmcode.S
BOOL BiosInt13ReadExtended(ULONG Drive, ULONG Sector, ULONG SectorCount, PVOID Buffer); // Implemented in asmcode.S
BOOL BiosInt13ExtensionsSupported(ULONG Drive);
ULONG BiosInt13GetLastErrorCode(VOID);
BOOL BiosInt13Read(U32 Drive, U32 Head, U32 Track, U32 Sector, U32 SectorCount, PVOID Buffer); // Implemented in asmcode.S
BOOL BiosInt13ReadExtended(U32 Drive, U32 Sector, U32 SectorCount, PVOID Buffer); // Implemented in asmcode.S
BOOL BiosInt13ExtensionsSupported(U32 Drive);
U32 BiosInt13GetLastErrorCode(VOID);
void StopFloppyMotor(void); // Implemented in asmcode.S
int get_heads(int drive); // Implemented in asmcode.S
int get_cylinders(int drive); // Implemented in asmcode.S
int get_sectors(int drive); // Implemented in asmcode.S
BOOL BiosInt13GetDriveParameters(ULONG Drive, PGEOMETRY Geometry); // Implemented in disk.S
BOOL BiosInt13GetDriveParameters(U32 Drive, PGEOMETRY Geometry); // Implemented in disk.S
///////////////////////////////////////////////////////////////////////////////////////
//
@ -103,20 +105,20 @@ BOOL BiosInt13GetDriveParameters(ULONG Drive, PGEOMETRY Geometry); // Implemente
//
///////////////////////////////////////////////////////////////////////////////////////
VOID DiskError(PUCHAR ErrorString);
BOOL DiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry);
BOOL DiskReadLogicalSectors(ULONG DriveNumber, ULONG SectorNumber, ULONG SectorCount, PVOID Buffer);
BOOL DiskGetDriveGeometry(U32 DriveNumber, PGEOMETRY DriveGeometry);
BOOL DiskReadLogicalSectors(U32 DriveNumber, U32 SectorNumber, U32 SectorCount, PVOID Buffer);
///////////////////////////////////////////////////////////////////////////////////////
//
// Fixed Disk Partition Management Functions
//
///////////////////////////////////////////////////////////////////////////////////////
BOOL DiskIsDriveRemovable(ULONG DriveNumber);
BOOL DiskIsDriveCdRom(ULONG DriveNumber);
BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
BOOL DiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
BOOL DiskIsDriveRemovable(U32 DriveNumber);
BOOL DiskIsDriveCdRom(U32 DriveNumber);
BOOL DiskGetActivePartitionEntry(U32 DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
BOOL DiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
BOOL DiskGetFirstPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry);
BOOL DiskGetFirstExtendedPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry);
BOOL DiskReadBootRecord(ULONG DriveNumber, ULONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord);
BOOL DiskReadBootRecord(U32 DriveNumber, U32 LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord);
#endif // defined __DISK_H

View file

@ -23,21 +23,21 @@
typedef struct
{
BYTE DriveMapCount; // Count of drives currently mapped
U8 DriveMapCount; // Count of drives currently mapped
BYTE DriveMap[8]; // Map of BIOS drives
U8 DriveMap[8]; // Map of BIOS drives
} PACKED DRIVE_MAP_LIST, *PDRIVE_MAP_LIST;
VOID DriveMapMapDrivesInSection(PUCHAR SectionName);
BOOL DriveMapIsValidDriveString(PUCHAR DriveString); // Checks the drive string ("hd0") for validity
ULONG DriveMapGetBiosDriveNumber(PUCHAR DeviceName); // Returns a BIOS drive number for any given device name (e.g. 0x80 for 'hd0')
U32 DriveMapGetBiosDriveNumber(PUCHAR DeviceName); // Returns a BIOS drive number for any given device name (e.g. 0x80 for 'hd0')
VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap); // Installs the int 13h handler for the drive mapper
VOID DriveMapRemoveInt13Handler(VOID); // Removes a previously installed int 13h drive map handler
extern PVOID DriveMapInt13HandlerStart;
extern PVOID DriveMapInt13HandlerEnd;
extern ULONG DriveMapOldInt13HandlerAddress;
extern U32 DriveMapOldInt13HandlerAddress;
extern DRIVE_MAP_LIST DriveMapInt13HandlerMapList;
#endif // #defined __DRIVEMAP_H

View file

@ -20,48 +20,53 @@
#ifndef __FREELDR_H
#define __FREELDR_H
#define size_t unsigned int
#define BOOL int
#define BOOLEAN int
#define NULL 0
#define TRUE 1
#define FALSE 0
#define BYTE unsigned char
#define WORD unsigned short
#define DWORD unsigned long
#define BOOL int
#define BOOLEAN int
#define CHAR char
#define PCHAR char *
#define UCHAR unsigned char
#define PUCHAR unsigned char *
#define WCHAR unsigned short
#define PWCHAR unsigned short *
#define SHORT short
#define USHORT unsigned short
#define PUSHORT unsigned short *
#define LONG long
#define ULONG unsigned long
#define PULONG unsigned long *
#define PDWORD DWORD *
#define PWORD WORD *
#define VOID void
#define PVOID VOID*
#define INT8 char
#define UINT8 unsigned char
#define INT16 short
#define UINT16 unsigned short
#define INT32 long
#define UINT32 unsigned long
#define PUINT32 UINT32 *
#define INT64 long long
#define UINT64 unsigned long long
#ifdef __i386__
#define size_t unsigned int
typedef unsigned char U8;
typedef char S8;
typedef unsigned short U16;
typedef short S16;
typedef unsigned long U32;
typedef long S32;
typedef unsigned long long U64;
typedef long long S64;
typedef U8 __u8;
typedef S8 __s8;
typedef U16 __u16;
typedef S16 __s16;
typedef U32 __u32;
typedef S32 __s32;
typedef U64 __u64;
typedef S64 __s64;
#endif // __i386__
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
#define PACKED __attribute__((packed))
extern ULONG BootDrive; // BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc.
extern ULONG BootPartition; // Boot Partition, 1-4
extern U32 BootDrive; // BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc.
extern U32 BootPartition; // Boot Partition, 1-4
extern BOOL UserInterfaceUp; // Tells us if the user interface is displayed
void BootMain(void);

View file

@ -33,13 +33,15 @@
#define PFILE FILE *
VOID FileSystemError(PUCHAR ErrorString);
BOOL OpenDiskDrive(ULONG DriveNumber, ULONG PartitionNumber);
BOOL OpenDiskDrive(U32 DriveNumber, U32 PartitionNumber);
PFILE OpenFile(PUCHAR FileName);
VOID CloseFile(PFILE FileHandle);
BOOL ReadFile(PFILE FileHandle, ULONG BytesToRead, PULONG BytesRead, PVOID Buffer);
ULONG GetFileSize(PFILE FileHandle);
VOID SetFilePointer(PFILE FileHandle, ULONG NewFilePointer);
ULONG GetFilePointer(PFILE FileHandle);
BOOL ReadFile(PFILE FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer);
U32 GetFileSize(PFILE FileHandle);
VOID SetFilePointer(PFILE FileHandle, U32 NewFilePointer);
U32 GetFilePointer(PFILE FileHandle);
BOOL IsEndOfFile(PFILE FileHandle);
U32 FsGetNumPathParts(PUCHAR Path);
VOID FsGetFirstNameFromPath(PUCHAR Buffer, PUCHAR Path);
#endif // #defined __FS_H

View file

@ -22,10 +22,10 @@
BOOL IniFileInitialize(VOID);
BOOL IniOpenSection(PUCHAR SectionName, PULONG SectionId);
ULONG IniGetNumSectionItems(ULONG SectionId);
BOOL IniReadSettingByNumber(ULONG SectionId, ULONG SettingNumber, PUCHAR SettingName, ULONG NameSize, PUCHAR SettingValue, ULONG ValueSize);
BOOL IniReadSettingByName(ULONG SectionId, PUCHAR SettingName, PUCHAR Buffer, ULONG BufferSize);
BOOL IniOpenSection(PUCHAR SectionName, U32* SectionId);
U32 IniGetNumSectionItems(U32 SectionId);
BOOL IniReadSettingByNumber(U32 SectionId, U32 SettingNumber, PUCHAR SettingName, U32 NameSize, PUCHAR SettingValue, U32 ValueSize);
BOOL IniReadSettingByName(U32 SectionId, PUCHAR SettingName, PUCHAR Buffer, U32 BufferSize);
#endif // defined __PARSEINI_H

View file

@ -41,34 +41,34 @@
typedef struct
{
BYTE BootCode1[0x20];
U8 BootCode1[0x20];
WORD CommandLineMagic;
WORD CommandLineOffset;
U16 CommandLineMagic;
U16 CommandLineOffset;
BYTE BootCode2[0x1CD];
U8 BootCode2[0x1CD];
BYTE SetupSectors;
WORD RootFlags;
WORD SystemSize;
WORD SwapDevice;
WORD RamSize;
WORD VideoMode;
WORD RootDevice;
WORD BootFlag; // 0xAA55
U8 SetupSectors;
U16 RootFlags;
U16 SystemSize;
U16 SwapDevice;
U16 RamSize;
U16 VideoMode;
U16 RootDevice;
U16 BootFlag; // 0xAA55
} PACKED LINUX_BOOTSECTOR, *PLINUX_BOOTSECTOR;
typedef struct
{
BYTE JumpInstruction[2];
DWORD SetupHeaderSignature; // Signature for SETUP-header
WORD Version; // Version number of header format
WORD RealModeSwitch; // Default switch
WORD SetupSeg; // SETUPSEG
WORD StartSystemSeg;
WORD KernelVersion; // Offset to kernel version string
BYTE TypeOfLoader; // Loader ID
U8 JumpInstruction[2];
U32 SetupHeaderSignature; // Signature for SETUP-header
U16 Version; // Version number of header format
U16 RealModeSwitch; // Default switch
U16 SetupSeg; // SETUPSEG
U16 StartSystemSeg;
U16 KernelVersion; // Offset to kernel version string
U8 TypeOfLoader; // Loader ID
// =0, old one (LILO, Loadlin,
// Bootlin, SYSLX, bootsect...)
// else it is set by the loader:
@ -79,7 +79,7 @@ typedef struct
// T=4 for ETHERBOOT
// V = version
BYTE LoadFlags; // flags, unused bits must be zero (RFU)
U8 LoadFlags; // flags, unused bits must be zero (RFU)
// LOADED_HIGH = 1
// bit within loadflags,
// if set, then the kernel is loaded high
@ -89,28 +89,28 @@ typedef struct
// can be used for heap purposes.
// Only the loader knows what is free!
WORD SetupMoveSize; // size to move, when we (setup) are not
U16 SetupMoveSize; // size to move, when we (setup) are not
// loaded at 0x90000. We will move ourselves
// to 0x90000 then just before jumping into
// the kernel. However, only the loader
// know how much of data behind us also needs
// to be loaded.
DWORD Code32Start; // here loaders can put a different
U32 Code32Start; // here loaders can put a different
// start address for 32-bit code.
//
// 0x1000 = default for zImage
//
// 0x100000 = default for big kernel
DWORD RamdiskAddress; // address of loaded ramdisk image
U32 RamdiskAddress; // address of loaded ramdisk image
// Here the loader (or kernel generator) puts
// the 32-bit address were it loaded the image.
DWORD RamdiskSize; // its size in bytes
U32 RamdiskSize; // its size in bytes
WORD BootSectKludgeOffset;
WORD BootSectKludgeSegment;
WORD HeapEnd; // space from here (exclusive) down to
U16 BootSectKludgeOffset;
U16 BootSectKludgeSegment;
U16 HeapEnd; // space from here (exclusive) down to
// end of setup code can be used by setup
// for local heap purposes.
@ -118,7 +118,7 @@ typedef struct
} PACKED LINUX_SETUPSECTOR, *PLINUX_SETUPSECTOR;
VOID BootNewLinuxKernel(VOID); // Implemented in linux.S
VOID BootOldLinuxKernel(ULONG KernelSize); // Implemented in linux.S
VOID BootOldLinuxKernel(U32 KernelSize); // Implemented in linux.S
VOID LoadAndBootLinux(PUCHAR OperatingSystemName);

View file

@ -29,12 +29,12 @@
typedef struct
{
ULONG BaseAddressLow;
ULONG BaseAddressHigh;
ULONG LengthLow;
ULONG LengthHigh;
ULONG Type;
ULONG Reserved;
U32 BaseAddressLow;
U32 BaseAddressHigh;
U32 LengthLow;
U32 LengthHigh;
U32 Type;
U32 Reserved;
} PACKED BIOS_MEMORY_MAP, *PBIOS_MEMORY_MAP;
typedef struct
@ -43,22 +43,22 @@ typedef struct
} PACKED BIOS_MEMORY_MAP_ARRAY, *PBIOS_MEMORY_MAP_ARRAY;
ULONG GetSystemMemorySize(VOID); // Returns the amount of total memory in the system
U32 GetSystemMemorySize(VOID); // Returns the amount of total memory in the system
// These functions are implemented in mem.S
ULONG GetExtendedMemorySize(VOID); // Returns extended memory size in KB
ULONG GetConventionalMemorySize(VOID); // Returns conventional memory size in KB
ULONG GetBiosMemoryMap(PBIOS_MEMORY_MAP_ARRAY BiosMemoryMap); // Fills structure with BIOS memory map and returns memory map item count
U32 GetExtendedMemorySize(VOID); // Returns extended memory size in KB
U32 GetConventionalMemorySize(VOID); // Returns conventional memory size in KB
U32 GetBiosMemoryMap(PBIOS_MEMORY_MAP_ARRAY BiosMemoryMap); // Fills structure with BIOS memory map and returns memory map item count
//BOOL MmInitializeMemoryManager(ULONG LowMemoryStart, ULONG LowMemoryLength);
//BOOL MmInitializeMemoryManager(U32 LowMemoryStart, U32 LowMemoryLength);
BOOL MmInitializeMemoryManager(VOID);
PVOID MmAllocateMemory(ULONG MemorySize);
PVOID MmAllocateMemory(U32 MemorySize);
VOID MmFreeMemory(PVOID MemoryPointer);
//PVOID MmAllocateLowMemory(ULONG MemorySize);
//PVOID MmAllocateLowMemory(U32 MemorySize);
//VOID MmFreeLowMemory(PVOID MemoryPointer);
PVOID MmAllocateMemoryAtAddress(ULONG MemorySize, PVOID DesiredAddress);
PVOID MmAllocateMemoryAtAddress(U32 MemorySize, PVOID DesiredAddress);
#endif // defined __MEMORY_H

View file

@ -146,12 +146,12 @@ void boot_reactos(void);
BOOL MultiBootLoadKernel(FILE *KernelImage);
//BOOL MultiBootLoadModule(FILE *ModuleImage, char *ModuleName);
PVOID MultiBootLoadModule(FILE *ModuleImage, char *ModuleName, PULONG ModuleSize);
PVOID MultiBootLoadModule(FILE *ModuleImage, char *ModuleName, U32* ModuleSize);
int GetBootPartition(char *OperatingSystemName);
PVOID MultiBootCreateModule(char *ModuleName);
BOOL MultiBootCloseModule(PVOID ModuleBase, DWORD dwModuleSize);
BOOL MultiBootCloseModule(PVOID ModuleBase, U32 dwModuleSize);
#endif /* ! ASM */

View file

@ -20,9 +20,9 @@
#ifndef __OSLIST_H
#define __OSLIST_H
BOOL InitOperatingSystemList(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, PULONG OperatingSystemCountPointer);
ULONG CountOperatingSystems(ULONG SectionId);
BOOL AllocateListMemory(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, ULONG OperatingSystemCount);
BOOL InitOperatingSystemList(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, U32* OperatingSystemCountPointer);
U32 CountOperatingSystems(U32 SectionId);
BOOL AllocateListMemory(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, U32 OperatingSystemCount);
BOOL RemoveQuotes(PUCHAR QuotedString);
#endif // #defined __OSLIST_H

View file

@ -40,9 +40,9 @@ VOID ReactOSRunSetupLoader(VOID);
// ARC Path Functions
//
///////////////////////////////////////////////////////////////////////////////////////
BOOL DissectArcPath(char *ArcPath, char *BootPath, PULONG BootDrive, PULONG BootPartition);
//BOOL ConvertBiosDriveToArcName(PUCHAR ArcName, ULONG BiosDriveNumber);
//ULONG ConvertArcNameToBiosDrive(PUCHAR ArcName);
BOOL DissectArcPath(char *ArcPath, char *BootPath, U32* BootDrive, U32* BootPartition);
//BOOL ConvertBiosDriveToArcName(PUCHAR ArcName, U32 BiosDriveNumber);
//U32 ConvertArcNameToBiosDrive(PUCHAR ArcName);
#endif // defined __REACTOS_H

View file

@ -37,17 +37,17 @@ char * strrchr(const char *s, int c);
int strcmp(const char *string1, const char *string2);
int stricmp(const char *string1, const char *string2);
int strncmp(const char *string1, const char *string2, size_t length);
int _strnicmp(const char *string1, const char *string2, size_t length);
int strnicmp(const char *string1, const char *string2, size_t length);
///////////////////////////////////////////////////////////////////////////////////////
//
// Memory Functions
//
///////////////////////////////////////////////////////////////////////////////////////
int RtlCompareMemory(const PVOID Source1, const PVOID Source2, ULONG Length);
VOID RtlCopyMemory(PVOID Destination, const PVOID Source, ULONG Length);
VOID RtlFillMemory(PVOID Destination, ULONG Length, UCHAR Fill);
VOID RtlZeroMemory(PVOID Destination, ULONG Length);
int RtlCompareMemory(const PVOID Source1, const PVOID Source2, U32 Length);
VOID RtlCopyMemory(PVOID Destination, const PVOID Source, U32 Length);
VOID RtlFillMemory(PVOID Destination, U32 Length, UCHAR Fill);
VOID RtlZeroMemory(PVOID Destination, U32 Length);
#define memcmp(buf1, buf2, count) RtlCompareMemory(buf1, buf2, count)
#define memcpy(dest, src, count) RtlCopyMemory(dest, src,count)
@ -117,7 +117,7 @@ PLIST_ITEM RtlListRemoveTail(PLIST_ITEM ListHead); // Removes the entry a
PLIST_ITEM RtlListGetHead(PLIST_ITEM ListHead); // Returns the entry at the head of the list
PLIST_ITEM RtlListGetTail(PLIST_ITEM ListHead); // Returns the entry at the tail of the list
BOOL RtlListIsEmpty(PLIST_ITEM ListHead); // Indicates whether a doubly linked list is empty
ULONG RtlListCountEntries(PLIST_ITEM ListHead); // Counts the entries in a doubly linked list
U32 RtlListCountEntries(PLIST_ITEM ListHead); // Counts the entries in a doubly linked list
PLIST_ITEM RtlListGetPrevious(PLIST_ITEM ListEntry); // Returns the previous item in the list
PLIST_ITEM RtlListGetNext(PLIST_ITEM ListEntry); // Returns the next item in the list
PLIST_ITEM RtlListRemoveEntry(PLIST_ITEM ListEntry); // Removes the entry from the list

View file

@ -21,8 +21,8 @@
#define __UI_H
extern ULONG UiScreenWidth; // Screen Width
extern ULONG UiScreenHeight; // Screen Height
extern U32 UiScreenWidth; // Screen Width
extern U32 UiScreenHeight; // Screen Height
extern UCHAR UiStatusBarFgColor; // Status bar foreground color
extern UCHAR UiStatusBarBgColor; // Status bar background color
@ -53,31 +53,31 @@ extern UCHAR UiMonthNames[12][15];
///////////////////////////////////////////////////////////////////////////////////////
BOOL UiInitialize(VOID); // Initialize User-Interface
VOID UiDrawBackdrop(VOID); // Fills the entire screen with a backdrop
VOID UiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr
VOID UiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom); // Draws a shadow on the bottom and right sides of the area specified
VOID UiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOL Fill, BOOL Shadow, UCHAR Attr); // Draws a box around the area specified
VOID UiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr); // Draws text at coordinates specified
VOID UiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PUCHAR TextString, UCHAR Attr); // Draws centered text at the coordinates specified and clips the edges
VOID UiFillArea(U32 Left, U32 Top, U32 Right, U32 Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr
VOID UiDrawShadow(U32 Left, U32 Top, U32 Right, U32 Bottom); // Draws a shadow on the bottom and right sides of the area specified
VOID UiDrawBox(U32 Left, U32 Top, U32 Right, U32 Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOL Fill, BOOL Shadow, UCHAR Attr); // Draws a box around the area specified
VOID UiDrawText(U32 X, U32 Y, PUCHAR Text, UCHAR Attr); // Draws text at coordinates specified
VOID UiDrawCenteredText(U32 Left, U32 Top, U32 Right, U32 Bottom, PUCHAR TextString, UCHAR Attr); // Draws centered text at the coordinates specified and clips the edges
VOID UiDrawStatusText(PUCHAR StatusText); // Draws text at the very bottom line on the screen
VOID UiUpdateDateTime(VOID); // Updates the date and time
VOID UiMessageBox(PUCHAR MessageText); // Displays a message box on the screen with an ok button
VOID UiMessageBoxCritical(PUCHAR MessageText); // Displays a message box on the screen with an ok button using no system resources
VOID UiMessageLine(PUCHAR MessageText); // Adds a line of text to the message box buffer
VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range); // Draws the progress bar showing nPos percent filled
VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range); // Draws the progress bar showing nPos percent filled
VOID UiDrawProgressBarCenter(U32 Position, U32 Range); // Draws the progress bar showing nPos percent filled
VOID UiDrawProgressBar(U32 Left, U32 Top, U32 Right, U32 Bottom, U32 Position, U32 Range); // Draws the progress bar showing nPos percent filled
VOID UiShowMessageBoxesInSection(PUCHAR SectionName); // Displays all the message boxes in a given section
UCHAR UiTextToColor(PUCHAR ColorText); // Converts the text color into it's equivalent color value
UCHAR UiTextToFillStyle(PUCHAR FillStyleText); // Converts the text fill into it's equivalent fill value
VOID UiTruncateStringEllipsis(PUCHAR StringText, ULONG MaxChars); // Truncates a string to MaxChars by adding an ellipsis on the end '...'
VOID UiTruncateStringEllipsis(PUCHAR StringText, U32 MaxChars); // Truncates a string to MaxChars by adding an ellipsis on the end '...'
///////////////////////////////////////////////////////////////////////////////////////
//
// Menu Functions
//
///////////////////////////////////////////////////////////////////////////////////////
BOOL UiDisplayMenu(PUCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, PULONG SelectedMenuItem);
BOOL UiDisplayMenu(PUCHAR MenuItemList[], U32 MenuItemCount, U32 DefaultMenuItem, S32 MenuTimeOut, U32* SelectedMenuItem);

View file

@ -22,7 +22,7 @@
/* just some stuff */
#define VERSION "FreeLoader v1.6.2"
#define VERSION "FreeLoader v1.7"
#define COPYRIGHT "Copyright (C) 1998-2002 Brian Palmer <brianp@sginet.com>"
#define AUTHOR_EMAIL "<brianp@sginet.com>"
#define BY_AUTHOR "by Brian Palmer"
@ -35,8 +35,8 @@
// If you add major functionality then you increment the major version and zero the minor & patch versions
//
#define FREELOADER_MAJOR_VERSION 1
#define FREELOADER_MINOR_VERSION 6
#define FREELOADER_PATCH_VERSION 2
#define FREELOADER_MINOR_VERSION 7
#define FREELOADER_PATCH_VERSION 0
PUCHAR GetFreeLoaderVersionString(VOID);

View file

@ -38,27 +38,27 @@
#define VIDEOPORT_PALETTE_DATA 0x03C9
#define VIDEOPORT_VERTICAL_RETRACE 0x03DA
VOID BiosSetVideoMode(ULONG VideoMode); // Implemented in biosvid.S
VOID BiosSetVideoMode(U32 VideoMode); // Implemented in biosvid.S
VOID BiosSetVideoFont8x8(VOID); // Implemented in biosvid.S
VOID BiosSetVideoFont8x14(VOID); // Implemented in biosvid.S
VOID BiosSetVideoFont8x16(VOID); // Implemented in biosvid.S
VOID BiosSelectAlternatePrintScreen(VOID); // Implemented in biosvid.S
VOID BiosDisableCursorEmulation(VOID); // Implemented in biosvid.S
VOID BiosDefineCursor(ULONG StartScanLine, ULONG EndScanLine); // Implemented in biosvid.S
ULONG BiosDetectVideoCard(VOID); // Implemented in biosvid.S
VOID BiosDefineCursor(U32 StartScanLine, U32 EndScanLine); // Implemented in biosvid.S
U32 BiosDetectVideoCard(VOID); // Implemented in biosvid.S
VOID BiosSet200ScanLines(VOID); // Implemented in biosvid.S, must be called right before BiosSetVideoMode()
VOID BiosSet350ScanLines(VOID); // Implemented in biosvid.S, must be called right before BiosSetVideoMode()
VOID BiosSet400ScanLines(VOID); // Implemented in biosvid.S, must be called right before BiosSetVideoMode()
VOID BiosSet480ScanLines(VOID); // Implemented in biosvid.S, must be called right after BiosSetVideoMode()
VOID BiosSetVideoDisplayEnd(VOID); // Implemented in biosvid.S
VOID VideoSetTextCursorPosition(ULONG X, ULONG Y); // Implemented in biosvid.S
VOID VideoSetTextCursorPosition(U32 X, U32 Y); // Implemented in biosvid.S
VOID VideoHideTextCursor(VOID); // Implemented in biosvid.S
VOID VideoShowTextCursor(VOID); // Implemented in biosvid.S
ULONG VideoGetTextCursorPositionX(VOID); // Implemented in biosvid.S
ULONG VideoGetTextCursorPositionY(VOID); // Implemented in biosvid.S
U32 VideoGetTextCursorPositionX(VOID); // Implemented in biosvid.S
U32 VideoGetTextCursorPositionY(VOID); // Implemented in biosvid.S
BOOL VideoSetMode(ULONG VideoMode);
BOOL VideoSetMode(U32 VideoMode);
BOOL VideoSetMode80x25(VOID); // Sets 80x25
BOOL VideoSetMode80x50_80x43(VOID); // Sets 80x50 (VGA) or 80x43 (EGA) 8-pixel mode
BOOL VideoSetMode80x28(VOID); // Sets 80x28. Works on all VGA's. Standard 80x25 with 14-point font
@ -66,9 +66,9 @@ BOOL VideoSetMode80x43(VOID); // Sets 80x43. Works on all VGA's. It's a 350
BOOL VideoSetMode80x30(VOID); // Sets 80x30. Works on all VGA's. 480 scanlines, 16-pixel font.
BOOL VideoSetMode80x34(VOID); // Sets 80x34. Works on all VGA's. 480 scanlines, 14-pixel font.
BOOL VideoSetMode80x60(VOID); // Sets 80x60. Works on all VGA's. 480 scanlines, 8-pixel font.
ULONG VideoGetCurrentModeResolutionX(VOID);
ULONG VideoGetCurrentModeResolutionY(VOID);
ULONG VideoGetCurrentMode(VOID);
U32 VideoGetCurrentModeResolutionX(VOID);
U32 VideoGetCurrentModeResolutionY(VOID);
U32 VideoGetCurrentMode(VOID);
VOID VideoClearScreen(VOID);
VOID VideoWaitForVerticalRetrace(VOID);

View file

@ -47,26 +47,26 @@ typedef struct
{
LIST_ITEM ListEntry;
PUCHAR SectionName;
ULONG SectionItemCount;
U32 SectionItemCount;
PINI_SECTION_ITEM SectionItemList;
} INI_SECTION, *PINI_SECTION;
extern PINI_SECTION IniFileSectionListHead;
extern ULONG IniFileSectionListCount;
extern U32 IniFileSectionListCount;
BOOL IniParseFile(PUCHAR IniFileData, ULONG IniFileSize);
ULONG IniGetNextLineSize(PUCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset);
ULONG IniGetNextLine(PUCHAR IniFileData, ULONG IniFileSize, PUCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset);
BOOL IniIsLineEmpty(PUCHAR LineOfText, ULONG TextLength);
BOOL IniIsCommentLine(PUCHAR LineOfText, ULONG TextLength);
BOOL IniIsSectionName(PUCHAR LineOfText, ULONG TextLength);
ULONG IniGetSectionNameSize(PUCHAR SectionNameLine, ULONG LineLength);
VOID IniExtractSectionName(PUCHAR SectionName, PUCHAR SectionNameLine, ULONG LineLength);
BOOL IniIsSetting(PUCHAR LineOfText, ULONG TextLength);
ULONG IniGetSettingNameSize(PUCHAR SettingNameLine, ULONG LineLength);
ULONG IniGetSettingValueSize(PUCHAR SettingValueLine, ULONG LineLength);
VOID IniExtractSettingName(PUCHAR SettingName, PUCHAR SettingNameLine, ULONG LineLength);
VOID IniExtractSettingValue(PUCHAR SettingValue, PUCHAR SettingValueLine, ULONG LineLength);
BOOL IniParseFile(PUCHAR IniFileData, U32 IniFileSize);
U32 IniGetNextLineSize(PUCHAR IniFileData, U32 IniFileSize, U32 CurrentOffset);
U32 IniGetNextLine(PUCHAR IniFileData, U32 IniFileSize, PUCHAR Buffer, U32 BufferSize, U32 CurrentOffset);
BOOL IniIsLineEmpty(PUCHAR LineOfText, U32 TextLength);
BOOL IniIsCommentLine(PUCHAR LineOfText, U32 TextLength);
BOOL IniIsSectionName(PUCHAR LineOfText, U32 TextLength);
U32 IniGetSectionNameSize(PUCHAR SectionNameLine, U32 LineLength);
VOID IniExtractSectionName(PUCHAR SectionName, PUCHAR SectionNameLine, U32 LineLength);
BOOL IniIsSetting(PUCHAR LineOfText, U32 TextLength);
U32 IniGetSettingNameSize(PUCHAR SettingNameLine, U32 LineLength);
U32 IniGetSettingValueSize(PUCHAR SettingValueLine, U32 LineLength);
VOID IniExtractSettingName(PUCHAR SettingName, PUCHAR SettingNameLine, U32 LineLength);
VOID IniExtractSettingValue(PUCHAR SettingValue, PUCHAR SettingValueLine, U32 LineLength);
#endif // defined __INI_H

View file

@ -29,7 +29,7 @@ BOOL IniFileInitialize(VOID)
{
PFILE Freeldr_Ini; // File handle for freeldr.ini
PUCHAR FreeLoaderIniFileData;
ULONG FreeLoaderIniFileSize;
U32 FreeLoaderIniFileSize;
BOOL Success;
// Open the boot drive for file access

View file

@ -23,7 +23,7 @@
#include <rtl.h>
#include <debug.h>
BOOL IniOpenSection(PUCHAR SectionName, PULONG SectionId)
BOOL IniOpenSection(PUCHAR SectionName, U32* SectionId)
{
PINI_SECTION Section;
@ -37,7 +37,7 @@ BOOL IniOpenSection(PUCHAR SectionName, PULONG SectionId)
if (stricmp(SectionName, Section->SectionName) == 0)
{
// We found it
*SectionId = (ULONG)Section;
*SectionId = (U32)Section;
DbgPrint((DPRINT_INIFILE, "IniOpenSection() Found it! SectionId = 0x%x\n", SectionId));
return TRUE;
}
@ -51,7 +51,7 @@ BOOL IniOpenSection(PUCHAR SectionName, PULONG SectionId)
return FALSE;
}
ULONG IniGetNumSectionItems(ULONG SectionId)
U32 IniGetNumSectionItems(U32 SectionId)
{
PINI_SECTION Section = (PINI_SECTION)SectionId;
@ -61,12 +61,12 @@ ULONG IniGetNumSectionItems(ULONG SectionId)
return Section->SectionItemCount;
}
BOOL IniReadSettingByNumber(ULONG SectionId, ULONG SettingNumber, PUCHAR SettingName, ULONG NameSize, PUCHAR SettingValue, ULONG ValueSize)
BOOL IniReadSettingByNumber(U32 SectionId, U32 SettingNumber, PUCHAR SettingName, U32 NameSize, PUCHAR SettingValue, U32 ValueSize)
{
PINI_SECTION Section = (PINI_SECTION)SectionId;
PINI_SECTION_ITEM SectionItem;
#ifdef DEBUG
ULONG RealSettingNumber = SettingNumber;
U32 RealSettingNumber = SettingNumber;
#endif
DbgPrint((DPRINT_INIFILE, "IniReadSettingByNumber() SectionId = 0x%x\n", SectionId));
@ -100,7 +100,7 @@ BOOL IniReadSettingByNumber(ULONG SectionId, ULONG SettingNumber, PUCHAR Setting
return FALSE;
}
BOOL IniReadSettingByName(ULONG SectionId, PUCHAR SettingName, PUCHAR Buffer, ULONG BufferSize)
BOOL IniReadSettingByName(U32 SectionId, PUCHAR SettingName, PUCHAR Buffer, U32 BufferSize)
{
PINI_SECTION Section = (PINI_SECTION)SectionId;
PINI_SECTION_ITEM SectionItem;

View file

@ -25,17 +25,17 @@
PINI_SECTION IniFileSectionListHead = NULL;
ULONG IniFileSectionCount = 0;
ULONG IniFileSettingCount = 0;
U32 IniFileSectionCount = 0;
U32 IniFileSettingCount = 0;
BOOL IniParseFile(PUCHAR IniFileData, ULONG IniFileSize)
BOOL IniParseFile(PUCHAR IniFileData, U32 IniFileSize)
{
ULONG CurrentOffset;
ULONG CurrentLineNumber;
U32 CurrentOffset;
U32 CurrentLineNumber;
PUCHAR IniFileLine;
ULONG IniFileLineSize;
ULONG LineLength;
U32 IniFileLineSize;
U32 LineLength;
PINI_SECTION CurrentSection = NULL;
PINI_SECTION_ITEM CurrentItem = NULL;
@ -185,10 +185,10 @@ BOOL IniParseFile(PUCHAR IniFileData, ULONG IniFileSize)
return TRUE;
}
ULONG IniGetNextLineSize(PUCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset)
U32 IniGetNextLineSize(PUCHAR IniFileData, U32 IniFileSize, U32 CurrentOffset)
{
ULONG Idx;
ULONG LineCharCount = 0;
U32 Idx;
U32 LineCharCount = 0;
// Loop through counting chars until we hit the end of the
// file or we encounter a new line char
@ -212,9 +212,9 @@ ULONG IniGetNextLineSize(PUCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOff
return LineCharCount;
}
ULONG IniGetNextLine(PUCHAR IniFileData, ULONG IniFileSize, PUCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset)
U32 IniGetNextLine(PUCHAR IniFileData, U32 IniFileSize, PUCHAR Buffer, U32 BufferSize, U32 CurrentOffset)
{
ULONG Idx;
U32 Idx;
// Loop through grabbing chars until we hit the end of the
// file or we encounter a new line char
@ -248,9 +248,9 @@ ULONG IniGetNextLine(PUCHAR IniFileData, ULONG IniFileSize, PUCHAR Buffer, ULONG
return CurrentOffset;
}
BOOL IniIsLineEmpty(PUCHAR LineOfText, ULONG TextLength)
BOOL IniIsLineEmpty(PUCHAR LineOfText, U32 TextLength)
{
ULONG Idx;
U32 Idx;
// Check for text (skipping whitespace)
for (Idx=0; Idx<TextLength; Idx++)
@ -271,9 +271,9 @@ BOOL IniIsLineEmpty(PUCHAR LineOfText, ULONG TextLength)
return TRUE;
}
BOOL IniIsCommentLine(PUCHAR LineOfText, ULONG TextLength)
BOOL IniIsCommentLine(PUCHAR LineOfText, U32 TextLength)
{
ULONG Idx;
U32 Idx;
// Check the first character (skipping whitespace)
// and make sure that it is an opening bracket
@ -297,9 +297,9 @@ BOOL IniIsCommentLine(PUCHAR LineOfText, ULONG TextLength)
return FALSE;
}
BOOL IniIsSectionName(PUCHAR LineOfText, ULONG TextLength)
BOOL IniIsSectionName(PUCHAR LineOfText, U32 TextLength)
{
ULONG Idx;
U32 Idx;
// Check the first character (skipping whitespace)
// and make sure that it is an opening bracket
@ -323,10 +323,10 @@ BOOL IniIsSectionName(PUCHAR LineOfText, ULONG TextLength)
return FALSE;
}
ULONG IniGetSectionNameSize(PUCHAR SectionNameLine, ULONG LineLength)
U32 IniGetSectionNameSize(PUCHAR SectionNameLine, U32 LineLength)
{
ULONG Idx;
ULONG NameSize;
U32 Idx;
U32 NameSize;
// Find the opening bracket (skipping whitespace)
for (Idx=0; Idx<LineLength; Idx++)
@ -364,10 +364,10 @@ ULONG IniGetSectionNameSize(PUCHAR SectionNameLine, ULONG LineLength)
return NameSize;
}
VOID IniExtractSectionName(PUCHAR SectionName, PUCHAR SectionNameLine, ULONG LineLength)
VOID IniExtractSectionName(PUCHAR SectionName, PUCHAR SectionNameLine, U32 LineLength)
{
ULONG Idx;
ULONG DestIdx;
U32 Idx;
U32 DestIdx;
// Find the opening bracket (skipping whitespace)
for (Idx=0; Idx<LineLength; Idx++)
@ -404,9 +404,9 @@ VOID IniExtractSectionName(PUCHAR SectionName, PUCHAR SectionNameLine, ULONG Lin
SectionName[DestIdx] = '\0';
}
BOOL IniIsSetting(PUCHAR LineOfText, ULONG TextLength)
BOOL IniIsSetting(PUCHAR LineOfText, U32 TextLength)
{
ULONG Idx;
U32 Idx;
// Basically just check for an '=' equals sign
for (Idx=0; Idx<TextLength; Idx++)
@ -420,10 +420,10 @@ BOOL IniIsSetting(PUCHAR LineOfText, ULONG TextLength)
return FALSE;
}
ULONG IniGetSettingNameSize(PUCHAR SettingNameLine, ULONG LineLength)
U32 IniGetSettingNameSize(PUCHAR SettingNameLine, U32 LineLength)
{
ULONG Idx;
ULONG NameSize;
U32 Idx;
U32 NameSize;
// Skip whitespace
for (Idx=0; Idx<LineLength; Idx++)
@ -458,10 +458,10 @@ ULONG IniGetSettingNameSize(PUCHAR SettingNameLine, ULONG LineLength)
return NameSize;
}
ULONG IniGetSettingValueSize(PUCHAR SettingValueLine, ULONG LineLength)
U32 IniGetSettingValueSize(PUCHAR SettingValueLine, U32 LineLength)
{
ULONG Idx;
ULONG ValueSize;
U32 Idx;
U32 ValueSize;
// Skip whitespace
for (Idx=0; Idx<LineLength; Idx++)
@ -511,10 +511,10 @@ ULONG IniGetSettingValueSize(PUCHAR SettingValueLine, ULONG LineLength)
return ValueSize;
}
VOID IniExtractSettingName(PUCHAR SettingName, PUCHAR SettingNameLine, ULONG LineLength)
VOID IniExtractSettingName(PUCHAR SettingName, PUCHAR SettingNameLine, U32 LineLength)
{
ULONG Idx;
ULONG DestIdx;
U32 Idx;
U32 DestIdx;
// Skip whitespace
for (Idx=0; Idx<LineLength; Idx++)
@ -548,10 +548,10 @@ VOID IniExtractSettingName(PUCHAR SettingName, PUCHAR SettingNameLine, ULONG Lin
SettingName[DestIdx] = '\0';
}
VOID IniExtractSettingValue(PUCHAR SettingValue, PUCHAR SettingValueLine, ULONG LineLength)
VOID IniExtractSettingValue(PUCHAR SettingValue, PUCHAR SettingValueLine, U32 LineLength)
{
ULONG Idx;
ULONG DestIdx;
U32 Idx;
U32 DestIdx;
// Skip whitespace
for (Idx=0; Idx<LineLength; Idx++)

View file

@ -33,14 +33,14 @@
PLINUX_BOOTSECTOR LinuxBootSector = NULL;
PLINUX_SETUPSECTOR LinuxSetupSector = NULL;
ULONG SetupSectorSize = 0;
U32 SetupSectorSize = 0;
BOOL NewStyleLinuxKernel = FALSE;
ULONG LinuxKernelSize = 0;
U32 LinuxKernelSize = 0;
UCHAR LinuxKernelName[260];
UCHAR LinuxInitrdName[260];
BOOL LinuxHasInitrd = FALSE;
UCHAR LinuxCommandLine[260] = "";
ULONG LinuxCommandLineSize = 0;
U32 LinuxCommandLineSize = 0;
PVOID LinuxKernelLoadAddress = NULL;
PVOID LinuxInitrdLoadAddress = NULL;
@ -177,7 +177,7 @@ BOOL LinuxParseIniSection(PUCHAR OperatingSystemName)
{
UCHAR SettingName[260];
UCHAR SettingValue[260];
ULONG SectionId;
U32 SectionId;
// Find all the message box settings and run them
UiShowMessageBoxesInSection(OperatingSystemName);
@ -266,7 +266,7 @@ BOOL LinuxReadBootSector(PFILE LinuxKernelFile)
BOOL LinuxReadSetupSector(PFILE LinuxKernelFile)
{
BYTE TempLinuxSetupSector[512];
U8 TempLinuxSetupSector[512];
LinuxSetupSector = (PLINUX_SETUPSECTOR)TempLinuxSetupSector;
@ -332,7 +332,7 @@ BOOL LinuxReadSetupSector(PFILE LinuxKernelFile)
BOOL LinuxReadKernel(PFILE LinuxKernelFile)
{
ULONG BytesLoaded;
U32 BytesLoaded;
UCHAR StatusText[260];
PVOID LoadAddress;
@ -411,8 +411,8 @@ BOOL LinuxReadInitrd(VOID)
{
PFILE LinuxInitrdFile;
UCHAR TempString[260];
ULONG LinuxInitrdSize;
ULONG BytesLoaded;
U32 LinuxInitrdSize;
U32 BytesLoaded;
UCHAR StatusText[260];
sprintf(StatusText, "Loading %s", LinuxInitrdName);
@ -439,7 +439,7 @@ BOOL LinuxReadInitrd(VOID)
}
// Set the information in the setup struct
LinuxSetupSector->RamdiskAddress = (ULONG)LinuxInitrdLoadAddress;
LinuxSetupSector->RamdiskAddress = (U32)LinuxInitrdLoadAddress;
LinuxSetupSector->RamdiskSize = LinuxInitrdSize;
// Read in the ramdisk

3207
freeldr/freeldr/math/i386.h Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,301 @@
/* Header file for libgcc2.c. */
/* Copyright (C) 2000, 2001
Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef GCC_LIBGCC2_H
#define GCC_LIBGCC2_H
extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t);
extern void __clear_cache (char *, char *);
extern void __eprintf (const char *, const char *, unsigned int, const char *)
__attribute__ ((__noreturn__));
struct bb;
extern void __bb_exit_func (void);
extern void __bb_init_func (struct bb *);
extern void __bb_fork_func (void);
extern void __bb_trace_func (void);
extern void __bb_trace_ret (void);
extern void __bb_init_trace_func (struct bb *, unsigned long);
struct exception_descriptor;
extern short int __get_eh_table_language (struct exception_descriptor *);
extern short int __get_eh_table_version (struct exception_descriptor *);
/* Permit the tm.h file to select the endianness to use just for this
file. This is used when the endianness is determined when the
compiler is run. */
#ifndef LIBGCC2_WORDS_BIG_ENDIAN
#define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
#endif
#ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
#endif
#ifndef MIN_UNITS_PER_WORD
#define MIN_UNITS_PER_WORD UNITS_PER_WORD
#endif
/* In the first part of this file, we are interfacing to calls generated
by the compiler itself. These calls pass values into these routines
which have very specific modes (rather than very specific types), and
these compiler-generated calls also expect any return values to have
very specific modes (rather than very specific types). Thus, we need
to avoid using regular C language type names in this part of the file
because the sizes for those types can be configured to be anything.
Instead we use the following special type names. */
typedef int QItype __attribute__ ((mode (QI)));
typedef unsigned int UQItype __attribute__ ((mode (QI)));
typedef int HItype __attribute__ ((mode (HI)));
typedef unsigned int UHItype __attribute__ ((mode (HI)));
#if MIN_UNITS_PER_WORD > 1
/* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1 */
typedef int SItype __attribute__ ((mode (SI)));
typedef unsigned int USItype __attribute__ ((mode (SI)));
#if LONG_LONG_TYPE_SIZE > 32
/* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2 */
typedef int DItype __attribute__ ((mode (DI)));
typedef unsigned int UDItype __attribute__ ((mode (DI)));
#if MIN_UNITS_PER_WORD > 4
/* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4 */
typedef int TItype __attribute__ ((mode (TI)));
typedef unsigned int UTItype __attribute__ ((mode (TI)));
#endif
#endif
#endif
#if BITS_PER_UNIT == 8
typedef float SFtype __attribute__ ((mode (SF)));
typedef float DFtype __attribute__ ((mode (DF)));
#if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
typedef float XFtype __attribute__ ((mode (XF)));
#endif
#if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
typedef float TFtype __attribute__ ((mode (TF)));
#endif
#else /* BITS_PER_UNIT != 8 */
/* On dsp's there are usually qf/hf/tqf modes used instead of the above.
For now we don't support them in libgcc2.c. */
#undef L_fixdfdi
#undef L_fixsfdi
#undef L_fixtfdi
#undef L_fixunsdfdi
#undef L_fixunsdfsi
#undef L_fixunssfdi
#undef L_fixunssfsi
#undef L_fixunstfdi
#undef L_fixunsxfdi
#undef L_fixunsxfsi
#undef L_fixxfdi
#undef L_floatdidf
#undef L_floatdisf
#undef L_floatditf
#undef L_floatdixf
#endif /* BITS_PER_UNIT != 8 */
typedef int word_type __attribute__ ((mode (__word__)));
/* Make sure that we don't accidentally use any normal C language built-in
type names in the first part of this file. Instead we want to use *only*
the type names defined above. The following macro definitions insure
that if we *do* accidentally use some normal C language built-in type name,
we will get a syntax error. */
#define char bogus_type
#define short bogus_type
#define int bogus_type
#define long bogus_type
#define unsigned bogus_type
#define float bogus_type
#define double bogus_type
#if MIN_UNITS_PER_WORD > 4
#define W_TYPE_SIZE (8 * BITS_PER_UNIT)
#define Wtype DItype
#define UWtype UDItype
#define HWtype DItype
#define UHWtype UDItype
#define DWtype TItype
#define UDWtype UTItype
#define __NW(a,b) __ ## a ## di ## b
#define __NDW(a,b) __ ## a ## ti ## b
#elif MIN_UNITS_PER_WORD > 2 \
|| (MIN_UNITS_PER_WORD > 1 && LONG_LONG_TYPE_SIZE > 32)
#define W_TYPE_SIZE (4 * BITS_PER_UNIT)
#define Wtype SItype
#define UWtype USItype
#define HWtype SItype
#define UHWtype USItype
#define DWtype DItype
#define UDWtype UDItype
#define __NW(a,b) __ ## a ## si ## b
#define __NDW(a,b) __ ## a ## di ## b
#elif MIN_UNITS_PER_WORD > 1
#define W_TYPE_SIZE (2 * BITS_PER_UNIT)
#define Wtype HItype
#define UWtype UHItype
#define HWtype HItype
#define UHWtype UHItype
#define DWtype SItype
#define UDWtype USItype
#define __NW(a,b) __ ## a ## hi ## b
#define __NDW(a,b) __ ## a ## si ## b
#else
#define W_TYPE_SIZE BITS_PER_UNIT
#define Wtype QItype
#define UWtype UQItype
#define HWtype QItype
#define UHWtype UQItype
#define DWtype HItype
#define UDWtype UHItype
#define __NW(a,b) __ ## a ## qi ## b
#define __NDW(a,b) __ ## a ## hi ## b
#endif
#define Wtype_MAX ((Wtype)(((UWtype)1 << (W_TYPE_SIZE - 1)) - 1))
#define Wtype_MIN (- Wtype_MAX - 1)
#define __muldi3 __NDW(mul,3)
#define __divdi3 __NDW(div,3)
#define __udivdi3 __NDW(udiv,3)
#define __moddi3 __NDW(mod,3)
#define __umoddi3 __NDW(umod,3)
#define __negdi2 __NDW(neg,2)
#define __lshrdi3 __NDW(lshr,3)
#define __ashldi3 __NDW(ashl,3)
#define __ashrdi3 __NDW(ashr,3)
#define __ffsdi2 __NDW(ffs,2)
#define __cmpdi2 __NDW(cmp,2)
#define __ucmpdi2 __NDW(ucmp,2)
#define __udivmoddi4 __NDW(udivmod,4)
#define __fixunstfDI __NDW(fixunstf,)
#define __fixtfdi __NDW(fixtf,)
#define __fixunsxfDI __NDW(fixunsxf,)
#define __fixxfdi __NDW(fixxf,)
#define __fixunsdfDI __NDW(fixunsdf,)
#define __fixdfdi __NDW(fixdf,)
#define __fixunssfDI __NDW(fixunssf,)
#define __fixsfdi __NDW(fixsf,)
#define __floatdixf __NDW(float,xf)
#define __floatditf __NDW(float,tf)
#define __floatdidf __NDW(float,df)
#define __floatdisf __NDW(float,sf)
#define __fixunsxfSI __NW(fixunsxf,)
#define __fixunstfSI __NW(fixunstf,)
#define __fixunsdfSI __NW(fixunsdf,)
#define __fixunssfSI __NW(fixunssf,)
extern DWtype __muldi3 (DWtype, DWtype);
extern DWtype __divdi3 (DWtype, DWtype);
extern UDWtype __udivdi3 (UDWtype, UDWtype);
extern UDWtype __umoddi3 (UDWtype, UDWtype);
extern DWtype __moddi3 (DWtype, DWtype);
/* __udivmoddi4 is static inline when building other libgcc2 portions. */
#if (!defined (L_udivdi3) && !defined (L_divdi3) && \
!defined (L_umoddi3) && !defined (L_moddi3))
extern UDWtype __udivmoddi4 (UDWtype, UDWtype, UDWtype *);
#endif
/* __negdi2 is static inline when building other libgcc2 portions. */
#if !defined(L_divdi3) && !defined(L_moddi3)
extern DWtype __negdi2 (DWtype);
#endif
extern DWtype __lshrdi3 (DWtype, word_type);
extern DWtype __ashldi3 (DWtype, word_type);
extern DWtype __ashrdi3 (DWtype, word_type);
extern DWtype __ffsdi2 (DWtype);
/* __udiv_w_sdiv is static inline when building other libgcc2 portions. */
#if (!defined(L_udivdi3) && !defined(L_divdi3) && \
!defined(L_umoddi3) && !defined(L_moddi3))
extern UWtype __udiv_w_sdiv (UWtype *, UWtype, UWtype, UWtype);
#endif
extern word_type __cmpdi2 (DWtype, DWtype);
extern word_type __ucmpdi2 (DWtype, DWtype);
extern Wtype __absvsi2 (Wtype);
extern DWtype __absvdi2 (DWtype);
extern Wtype __addvsi3 (Wtype, Wtype);
extern DWtype __addvdi3 (DWtype, DWtype);
extern Wtype __subvsi3 (Wtype, Wtype);
extern DWtype __subvdi3 (DWtype, DWtype);
extern Wtype __mulvsi3 (Wtype, Wtype);
extern DWtype __mulvdi3 (DWtype, DWtype);
extern Wtype __negvsi2 (Wtype);
extern DWtype __negvdi2 (DWtype);
#if BITS_PER_UNIT == 8
extern DWtype __fixdfdi (DFtype);
extern DWtype __fixsfdi (SFtype);
extern DFtype __floatdidf (DWtype);
extern SFtype __floatdisf (DWtype);
extern UWtype __fixunsdfSI (DFtype);
extern UWtype __fixunssfSI (SFtype);
extern DWtype __fixunsdfDI (DFtype);
extern DWtype __fixunssfDI (SFtype);
#if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
extern DWtype __fixxfdi (XFtype);
extern DWtype __fixunsxfDI (XFtype);
extern XFtype __floatdixf (DWtype);
extern UWtype __fixunsxfSI (XFtype);
#endif
#if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
extern DWtype __fixunstfDI (TFtype);
extern DWtype __fixtfdi (TFtype);
extern TFtype __floatditf (DWtype);
#endif
#endif /* BITS_PER_UNIT == 8 */
/* DWstructs are pairs of Wtype values in the order determined by
LIBGCC2_WORDS_BIG_ENDIAN. */
#if LIBGCC2_WORDS_BIG_ENDIAN
struct DWstruct {Wtype high, low;};
#else
struct DWstruct {Wtype low, high;};
#endif
/* We need this union to unpack/pack DImode values, since we don't have
any arithmetic yet. Incoming DImode parameters are stored into the
`ll' field, and the unpacked result is read from the struct `s'. */
typedef union
{
struct DWstruct s;
DWtype ll;
} DWunion;
#include "longlong.h"
#endif /* ! GCC_LIBGCC2_H */

File diff suppressed because it is too large Load diff

View file

@ -33,9 +33,9 @@ VOID LoadAndBootBootSector(PUCHAR OperatingSystemName)
PFILE FilePointer;
UCHAR SettingName[80];
UCHAR SettingValue[80];
ULONG SectionId;
U32 SectionId;
UCHAR FileName[260];
ULONG BytesRead;
U32 BytesRead;
// Find all the message box settings and run them
UiShowMessageBoxesInSection(OperatingSystemName);
@ -89,7 +89,7 @@ VOID LoadAndBootBootSector(PUCHAR OperatingSystemName)
}
// Check for validity
if (*((PWORD)(0x7c00 + 0x1fe)) != 0xaa55)
if (*((U16*)(0x7c00 + 0x1fe)) != 0xaa55)
{
UiMessageBox("Invalid boot sector magic (0xaa55)");
return;
@ -112,7 +112,7 @@ VOID LoadAndBootPartition(PUCHAR OperatingSystemName)
{
UCHAR SettingName[80];
UCHAR SettingValue[80];
ULONG SectionId;
U32 SectionId;
PARTITION_TABLE_ENTRY PartitionTableEntry;
// Find all the message box settings and run them
@ -158,7 +158,7 @@ VOID LoadAndBootPartition(PUCHAR OperatingSystemName)
}
// Check for validity
if (*((PWORD)(0x7c00 + 0x1fe)) != 0xaa55)
if (*((U16*)(0x7c00 + 0x1fe)) != 0xaa55)
{
UiMessageBox("Invalid boot sector magic (0xaa55)");
return;
@ -181,7 +181,7 @@ VOID LoadAndBootDrive(PUCHAR OperatingSystemName)
{
UCHAR SettingName[80];
UCHAR SettingValue[80];
ULONG SectionId;
U32 SectionId;
// Find all the message box settings and run them
UiShowMessageBoxesInSection(OperatingSystemName);
@ -210,7 +210,7 @@ VOID LoadAndBootDrive(PUCHAR OperatingSystemName)
}
// Check for validity
if (*((PWORD)(0x7c00 + 0x1fe)) != 0xaa55)
if (*((U16*)(0x7c00 + 0x1fe)) != 0xaa55)
{
UiMessageBox("Invalid boot sector magic (0xaa55)");
return;

View file

@ -26,8 +26,8 @@
typedef struct
{
UINT32 PageAllocated; // Zero = free, non-zero = allocated
UINT32 PageAllocationLength; // Number of pages allocated (or zero if this isn't the first page in the chain)
U32 PageAllocated; // Zero = free, non-zero = allocated
U32 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;
//
@ -40,26 +40,26 @@ typedef struct
extern PVOID PageLookupTableAddress;
extern ULONG TotalPagesInLookupTable;
extern ULONG FreePagesInLookupTable;
extern ULONG LastFreePageHint;
extern U32 TotalPagesInLookupTable;
extern U32 FreePagesInLookupTable;
extern U32 LastFreePageHint;
#ifdef DEBUG
PUCHAR MmGetSystemMemoryMapTypeString(ULONG Type);
PUCHAR MmGetSystemMemoryMapTypeString(U32 Type);
#endif
ULONG MmGetPageNumberFromAddress(PVOID Address); // Returns the page number that contains a linear address
PVOID MmGetEndAddressOfAnyMemory(BIOS_MEMORY_MAP BiosMemoryMap[32], ULONG MapCount); // Returns the last address of memory from the memory map
ULONG MmGetAddressablePageCountIncludingHoles(BIOS_MEMORY_MAP BiosMemoryMap[32], ULONG MapCount); // Returns the count of addressable pages from address zero including any memory holes and reserved memory regions
PVOID MmFindLocationForPageLookupTable(BIOS_MEMORY_MAP BiosMemoryMap[32], ULONG MapCount); // Returns the address for a memory chunk big enough to hold the page lookup table (starts search from end of memory)
VOID MmSortBiosMemoryMap(BIOS_MEMORY_MAP BiosMemoryMap[32], ULONG MapCount); // Sorts the BIOS_MEMORY_MAP array so the first element corresponds to the first address in memory
VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount, BIOS_MEMORY_MAP BiosMemoryMap[32], ULONG MapCount); // Inits the page lookup table according to the memory types in the memory map
VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG PageCount, ULONG PageAllocated); // Marks the specified pages as allocated or free in the lookup table
VOID MmAllocatePagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG PageCount); // 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 MmFindAvailablePagesFromEnd(PVOID PageLookupTable, ULONG TotalPageCount, ULONG PagesNeeded); // Returns the page number of the first available page range from the end of memory
VOID MmFixupSystemMemoryMap(BIOS_MEMORY_MAP BiosMemoryMap[32], PULONG MapCount); // Removes entries in the memory map that describe memory above 4G
VOID MmUpdateLastFreePageHint(PVOID PageLookupTable, ULONG TotalPageCount); // Sets the LastFreePageHint to the last usable page of memory
BOOL MmAreMemoryPagesAvailable(PVOID PageLookupTable, ULONG TotalPageCount, PVOID PageAddress, ULONG PageCount); // Returns TRUE if the specified pages of memory are available, otherwise FALSE
U32 MmGetPageNumberFromAddress(PVOID Address); // Returns the page number that contains a linear address
PVOID MmGetEndAddressOfAnyMemory(BIOS_MEMORY_MAP BiosMemoryMap[32], U32 MapCount); // Returns the last address of memory from the memory map
U32 MmGetAddressablePageCountIncludingHoles(BIOS_MEMORY_MAP BiosMemoryMap[32], U32 MapCount); // Returns the count of addressable pages from address zero including any memory holes and reserved memory regions
PVOID MmFindLocationForPageLookupTable(BIOS_MEMORY_MAP BiosMemoryMap[32], U32 MapCount); // Returns the address for a memory chunk big enough to hold the page lookup table (starts search from end of memory)
VOID MmSortBiosMemoryMap(BIOS_MEMORY_MAP BiosMemoryMap[32], U32 MapCount); // Sorts the BIOS_MEMORY_MAP array so the first element corresponds to the first address in memory
VOID MmInitPageLookupTable(PVOID PageLookupTable, U32 TotalPageCount, BIOS_MEMORY_MAP BiosMemoryMap[32], U32 MapCount); // Inits the page lookup table according to the memory types in the memory map
VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, U32 StartPage, U32 PageCount, U32 PageAllocated); // Marks the specified pages as allocated or free in the lookup table
VOID MmAllocatePagesInLookupTable(PVOID PageLookupTable, U32 StartPage, U32 PageCount); // Allocates the specified pages in the lookup table
U32 MmCountFreePagesInLookupTable(PVOID PageLookupTable, U32 TotalPageCount); // Returns the number of free pages in the lookup table
U32 MmFindAvailablePagesFromEnd(PVOID PageLookupTable, U32 TotalPageCount, U32 PagesNeeded); // Returns the page number of the first available page range from the end of memory
VOID MmFixupSystemMemoryMap(BIOS_MEMORY_MAP BiosMemoryMap[32], U32* MapCount); // Removes entries in the memory map that describe memory above 4G
VOID MmUpdateLastFreePageHint(PVOID PageLookupTable, U32 TotalPageCount); // Sets the LastFreePageHint to the last usable page of memory
BOOL MmAreMemoryPagesAvailable(PVOID PageLookupTable, U32 TotalPageCount, PVOID PageAddress, U32 PageCount); // Returns TRUE if the specified pages of memory are available, otherwise FALSE
#endif // defined __MEM_H

View file

@ -29,11 +29,11 @@
#ifdef DEBUG
typedef struct
{
ULONG Type;
U32 Type;
UCHAR TypeString[20];
} MEMORY_TYPE, *PMEMORY_TYPE;
ULONG MemoryTypeCount = 5;
U32 MemoryTypeCount = 5;
MEMORY_TYPE MemoryTypeArray[] =
{
{ 0, "Unknown Memory" },
@ -45,17 +45,17 @@ MEMORY_TYPE MemoryTypeArray[] =
#endif
PVOID PageLookupTableAddress = NULL;
ULONG TotalPagesInLookupTable = 0;
ULONG FreePagesInLookupTable = 0;
ULONG LastFreePageHint = 0;
U32 TotalPagesInLookupTable = 0;
U32 FreePagesInLookupTable = 0;
U32 LastFreePageHint = 0;
BOOL MmInitializeMemoryManager(VOID)
{
BIOS_MEMORY_MAP BiosMemoryMap[32];
ULONG BiosMemoryMapEntryCount;
ULONG ExtendedMemorySize;
ULONG ConventionalMemorySize;
ULONG Index;
U32 BiosMemoryMapEntryCount;
U32 ExtendedMemorySize;
U32 ConventionalMemorySize;
U32 Index;
DbgPrint((DPRINT_MEMORY, "Initializing Memory Manager.\n"));
@ -128,9 +128,9 @@ BOOL MmInitializeMemoryManager(VOID)
}
#ifdef DEBUG
PUCHAR MmGetSystemMemoryMapTypeString(ULONG Type)
PUCHAR MmGetSystemMemoryMapTypeString(U32 Type)
{
ULONG Index;
U32 Index;
for (Index=1; Index<MemoryTypeCount; Index++)
{
@ -144,16 +144,16 @@ PUCHAR MmGetSystemMemoryMapTypeString(ULONG Type)
}
#endif
ULONG MmGetPageNumberFromAddress(PVOID Address)
U32 MmGetPageNumberFromAddress(PVOID Address)
{
return ((ULONG)Address) / MM_PAGE_SIZE;
return ((U32)Address) / MM_PAGE_SIZE;
}
PVOID MmGetEndAddressOfAnyMemory(BIOS_MEMORY_MAP BiosMemoryMap[32], ULONG MapCount)
PVOID MmGetEndAddressOfAnyMemory(BIOS_MEMORY_MAP BiosMemoryMap[32], U32 MapCount)
{
ULONG MaxStartAddressSoFar;
UINT64 EndAddressOfMemory;
ULONG Index;
U32 MaxStartAddressSoFar;
U64 EndAddressOfMemory;
U32 Index;
MaxStartAddressSoFar = 0;
EndAddressOfMemory = 0;
@ -162,7 +162,7 @@ PVOID MmGetEndAddressOfAnyMemory(BIOS_MEMORY_MAP BiosMemoryMap[32], ULONG MapCou
if (MaxStartAddressSoFar < BiosMemoryMap[Index].BaseAddressLow)
{
MaxStartAddressSoFar = BiosMemoryMap[Index].BaseAddressLow;
EndAddressOfMemory = ((UINT64)MaxStartAddressSoFar + (UINT64)BiosMemoryMap[Index].LengthLow);
EndAddressOfMemory = ((U64)MaxStartAddressSoFar + (U64)BiosMemoryMap[Index].LengthLow);
if (EndAddressOfMemory > 0xFFFFFFFF)
{
EndAddressOfMemory = 0xFFFFFFFF;
@ -170,14 +170,14 @@ PVOID MmGetEndAddressOfAnyMemory(BIOS_MEMORY_MAP BiosMemoryMap[32], ULONG MapCou
}
}
DbgPrint((DPRINT_MEMORY, "MmGetEndAddressOfAnyMemory() returning 0x%x\n", (UINT32)EndAddressOfMemory));
DbgPrint((DPRINT_MEMORY, "MmGetEndAddressOfAnyMemory() returning 0x%x\n", (U32)EndAddressOfMemory));
return (PVOID)(UINT32)EndAddressOfMemory;
return (PVOID)(U32)EndAddressOfMemory;
}
ULONG MmGetAddressablePageCountIncludingHoles(BIOS_MEMORY_MAP BiosMemoryMap[32], ULONG MapCount)
U32 MmGetAddressablePageCountIncludingHoles(BIOS_MEMORY_MAP BiosMemoryMap[32], U32 MapCount)
{
ULONG PageCount;
U32 PageCount;
PageCount = MmGetPageNumberFromAddress(MmGetEndAddressOfAnyMemory(BiosMemoryMap, MapCount));
@ -186,10 +186,10 @@ ULONG MmGetAddressablePageCountIncludingHoles(BIOS_MEMORY_MAP BiosMemoryMap[32],
return PageCount;
}
PVOID MmFindLocationForPageLookupTable(BIOS_MEMORY_MAP BiosMemoryMap[32], ULONG MapCount)
PVOID MmFindLocationForPageLookupTable(BIOS_MEMORY_MAP BiosMemoryMap[32], U32 MapCount)
{
ULONG TotalPageCount;
ULONG PageLookupTableSize;
U32 TotalPageCount;
U32 PageLookupTableSize;
PVOID PageLookupTableAddress;
int Index;
BIOS_MEMORY_MAP TempBiosMemoryMap[32];
@ -217,10 +217,10 @@ PVOID MmFindLocationForPageLookupTable(BIOS_MEMORY_MAP BiosMemoryMap[32], ULONG
return PageLookupTableAddress;
}
VOID MmSortBiosMemoryMap(BIOS_MEMORY_MAP BiosMemoryMap[32], ULONG MapCount)
VOID MmSortBiosMemoryMap(BIOS_MEMORY_MAP BiosMemoryMap[32], U32 MapCount)
{
ULONG Index;
ULONG LoopCount;
U32 Index;
U32 LoopCount;
BIOS_MEMORY_MAP TempMapItem;
// Loop once for each entry in the memory map minus one
@ -239,15 +239,15 @@ VOID MmSortBiosMemoryMap(BIOS_MEMORY_MAP BiosMemoryMap[32], ULONG MapCount)
}
}
VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount, BIOS_MEMORY_MAP BiosMemoryMap[32], ULONG MapCount)
VOID MmInitPageLookupTable(PVOID PageLookupTable, U32 TotalPageCount, BIOS_MEMORY_MAP BiosMemoryMap[32], U32 MapCount)
{
ULONG MemoryMapStartPage;
ULONG MemoryMapEndPage;
ULONG MemoryMapPageCount;
ULONG MemoryMapPageAllocated;
ULONG PageLookupTableStartPage;
ULONG PageLookupTablePageCount;
ULONG Index;
U32 MemoryMapStartPage;
U32 MemoryMapEndPage;
U32 MemoryMapPageCount;
U32 MemoryMapPageAllocated;
U32 PageLookupTableStartPage;
U32 PageLookupTablePageCount;
U32 Index;
DbgPrint((DPRINT_MEMORY, "MmInitPageLookupTable()\n"));
@ -277,10 +277,10 @@ VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount, BIOS_MEM
MmMarkPagesInLookupTable(PageLookupTable, PageLookupTableStartPage, PageLookupTablePageCount, MEMTYPE_RESERVED);
}
VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG PageCount, ULONG PageAllocated)
VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, U32 StartPage, U32 PageCount, U32 PageAllocated)
{
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
ULONG Index;
U32 Index;
for (Index=StartPage; Index<(StartPage+PageCount); Index++)
{
@ -289,10 +289,10 @@ VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG Page
}
}
VOID MmAllocatePagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG PageCount)
VOID MmAllocatePagesInLookupTable(PVOID PageLookupTable, U32 StartPage, U32 PageCount)
{
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
ULONG Index;
U32 Index;
for (Index=StartPage; Index<(StartPage+PageCount); Index++)
{
@ -301,11 +301,11 @@ VOID MmAllocatePagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG
}
}
ULONG MmCountFreePagesInLookupTable(PVOID PageLookupTable, ULONG TotalPageCount)
U32 MmCountFreePagesInLookupTable(PVOID PageLookupTable, U32 TotalPageCount)
{
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
ULONG Index;
ULONG FreePageCount;
U32 Index;
U32 FreePageCount;
FreePageCount = 0;
for (Index=0; Index<TotalPageCount; Index++)
@ -319,12 +319,12 @@ ULONG MmCountFreePagesInLookupTable(PVOID PageLookupTable, ULONG TotalPageCount)
return FreePageCount;
}
ULONG MmFindAvailablePagesFromEnd(PVOID PageLookupTable, ULONG TotalPageCount, ULONG PagesNeeded)
U32 MmFindAvailablePagesFromEnd(PVOID PageLookupTable, U32 TotalPageCount, U32 PagesNeeded)
{
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
ULONG AvailablePageStart;
ULONG AvailablePagesSoFar;
ULONG Index;
U32 AvailablePageStart;
U32 AvailablePagesSoFar;
U32 Index;
if (LastFreePageHint > TotalPageCount)
{
@ -354,11 +354,11 @@ ULONG MmFindAvailablePagesFromEnd(PVOID PageLookupTable, ULONG TotalPageCount, U
return 0;
}
VOID MmFixupSystemMemoryMap(BIOS_MEMORY_MAP BiosMemoryMap[32], PULONG MapCount)
VOID MmFixupSystemMemoryMap(BIOS_MEMORY_MAP BiosMemoryMap[32], U32* MapCount)
{
int Index;
int Index2;
UINT64 RealLength;
U64 RealLength;
// Loop through each entry in the array
for (Index=0; Index<*MapCount; Index++)
@ -386,10 +386,10 @@ VOID MmFixupSystemMemoryMap(BIOS_MEMORY_MAP BiosMemoryMap[32], PULONG MapCount)
}
}
VOID MmUpdateLastFreePageHint(PVOID PageLookupTable, ULONG TotalPageCount)
VOID MmUpdateLastFreePageHint(PVOID PageLookupTable, U32 TotalPageCount)
{
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
ULONG Index;
U32 Index;
for (Index=TotalPageCount-1; Index>=0; Index--)
{
@ -401,11 +401,11 @@ VOID MmUpdateLastFreePageHint(PVOID PageLookupTable, ULONG TotalPageCount)
}
}
BOOL MmAreMemoryPagesAvailable(PVOID PageLookupTable, ULONG TotalPageCount, PVOID PageAddress, ULONG PageCount)
BOOL MmAreMemoryPagesAvailable(PVOID PageLookupTable, U32 TotalPageCount, PVOID PageAddress, U32 PageCount)
{
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable;
ULONG StartPage;
ULONG Index;
U32 StartPage;
U32 Index;
StartPage = MmGetPageNumberFromAddress(PageAddress);

View file

@ -26,7 +26,7 @@
#ifdef DEBUG
ULONG AllocationCount = 0;
U32 AllocationCount = 0;
VOID VerifyHeap(VOID);
VOID DumpMemoryAllocMap(VOID);
@ -35,10 +35,10 @@ VOID DecrementAllocationCount(VOID);
VOID MemAllocTest(VOID);
#endif // DEBUG
PVOID MmAllocateMemory(ULONG MemorySize)
PVOID MmAllocateMemory(U32 MemorySize)
{
ULONG PagesNeeded;
ULONG FirstFreePageFromEnd;
U32 PagesNeeded;
U32 FirstFreePageFromEnd;
PVOID MemPointer;
if (MemorySize == 0)
@ -86,10 +86,10 @@ PVOID MmAllocateMemory(ULONG MemorySize)
return MemPointer;
}
PVOID MmAllocateMemoryAtAddress(ULONG MemorySize, PVOID DesiredAddress)
PVOID MmAllocateMemoryAtAddress(U32 MemorySize, PVOID DesiredAddress)
{
ULONG PagesNeeded;
ULONG StartPageNumber;
U32 PagesNeeded;
U32 StartPageNumber;
PVOID MemPointer;
if (MemorySize == 0)
@ -140,9 +140,9 @@ PVOID MmAllocateMemoryAtAddress(ULONG MemorySize, PVOID DesiredAddress)
VOID MmFreeMemory(PVOID MemoryPointer)
{
ULONG PageNumber;
ULONG PageCount;
ULONG Idx;
U32 PageNumber;
U32 PageCount;
U32 Idx;
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTableAddress;
#ifdef DEBUG
@ -197,9 +197,9 @@ VOID MmFreeMemory(PVOID MemoryPointer)
#ifdef DEBUG
VOID VerifyHeap(VOID)
{
ULONG Idx;
ULONG Idx2;
ULONG Count;
U32 Idx;
U32 Idx2;
U32 Count;
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTableAddress;
if (DUMP_MEM_MAP_ON_VERIFY)
@ -257,7 +257,7 @@ VOID VerifyHeap(VOID)
VOID DumpMemoryAllocMap(VOID)
{
ULONG Idx;
U32 Idx;
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTableAddress;
DbgPrint((DPRINT_MEMORY, "----------- Memory Allocation Bitmap -----------\n"));
@ -342,7 +342,7 @@ VOID MemAllocTest(VOID)
}
#endif // DEBUG
ULONG GetSystemMemorySize(VOID)
U32 GetSystemMemorySize(VOID)
{
return (TotalPagesInLookupTable * MM_PAGE_SIZE);
}

View file

@ -33,15 +33,15 @@ module_t* pOpenModule = NULL;
BOOL MultiBootLoadKernel(FILE *KernelImage)
{
PDWORD ImageHeaders;
U32* ImageHeaders;
int Idx;
DWORD dwHeaderChecksum;
DWORD dwFileLoadOffset;
DWORD dwDataSize;
DWORD dwBssSize;
U32 dwHeaderChecksum;
U32 dwFileLoadOffset;
U32 dwDataSize;
U32 dwBssSize;
// Allocate 8192 bytes for multiboot header
ImageHeaders = (PDWORD)MmAllocateMemory(8192);
ImageHeaders = (U32*)MmAllocateMemory(8192);
if (ImageHeaders == NULL)
{
return FALSE;
@ -110,7 +110,7 @@ BOOL MultiBootLoadKernel(FILE *KernelImage)
/*
* Get the file offset, this should be 0, and move the file pointer
*/
dwFileLoadOffset = (Idx * sizeof(DWORD)) - (mb_header.header_addr - mb_header.load_addr);
dwFileLoadOffset = (Idx * sizeof(U32)) - (mb_header.header_addr - mb_header.load_addr);
SetFilePointer(KernelImage, dwFileLoadOffset);
/*
@ -133,7 +133,7 @@ BOOL MultiBootLoadKernel(FILE *KernelImage)
#if 0
BOOL MultiBootLoadModule(FILE *ModuleImage, char *ModuleName)
{
DWORD dwModuleSize;
U32 dwModuleSize;
module_t* pModule;
char* ModuleNameString;
char * TempName;
@ -168,9 +168,9 @@ BOOL MultiBootLoadModule(FILE *ModuleImage, char *ModuleName)
}
#endif
PVOID MultiBootLoadModule(FILE *ModuleImage, char *ModuleName, PULONG ModuleSize)
PVOID MultiBootLoadModule(FILE *ModuleImage, char *ModuleName, U32* ModuleSize)
{
DWORD dwModuleSize;
U32 dwModuleSize;
module_t* pModule;
char* ModuleNameString;
char * TempName;
@ -211,7 +211,7 @@ int GetBootPartition(char *OperatingSystemName)
{
int BootPartitionNumber = -1;
char value[1024];
ULONG SectionId;
U32 SectionId;
if (IniOpenSection(OperatingSystemName, &SectionId))
{
@ -248,7 +248,7 @@ PVOID MultiBootCreateModule(char *ModuleName)
}
BOOL MultiBootCloseModule(PVOID ModuleBase, DWORD dwModuleSize)
BOOL MultiBootCloseModule(PVOID ModuleBase, U32 dwModuleSize)
{
module_t* pModule;

View file

@ -119,7 +119,7 @@ void DoBootOptionsMenu(int BootDriveNum, char *BootDriveText)
}
// Check for validity
if (*((WORD*)(0x7c00 + 0x1fe)) != 0xaa55)
if (*((U16*)(0x7c00 + 0x1fe)) != 0xaa55)
{
MessageBox("Invalid boot sector magic (0xaa55)");
return;
@ -173,7 +173,7 @@ void DoBootPartitionOptionsMenu(int BootDriveNum)
}
// Check for validity
if (*((WORD*)(SectorBuffer + 0x1fe)) != 0xaa55)
if (*((U16*)(SectorBuffer + 0x1fe)) != 0xaa55)
{
MessageBox("Invalid partition table magic (0xaa55)");
return;
@ -231,7 +231,7 @@ void DoBootPartitionOptionsMenu(int BootDriveNum)
}
// Check for validity
if (*((WORD*)(0x7c00 + 0x1fe)) != 0xaa55)
if (*((U16*)(0x7c00 + 0x1fe)) != 0xaa55)
{
MessageBox("Invalid boot sector magic (0xaa55)");
return;

View file

@ -24,16 +24,16 @@
#include <mm.h>
#include <ui.h>
BOOL InitOperatingSystemList(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, PULONG OperatingSystemCountPointer)
BOOL InitOperatingSystemList(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, U32* OperatingSystemCountPointer)
{
ULONG Idx;
ULONG CurrentOperatingSystemIndex;
U32 Idx;
U32 CurrentOperatingSystemIndex;
UCHAR SettingName[260];
UCHAR SettingValue[260];
ULONG OperatingSystemCount;
ULONG SectionId;
ULONG OperatingSystemSectionId;
ULONG SectionSettingCount;
U32 OperatingSystemCount;
U32 SectionId;
U32 OperatingSystemSectionId;
U32 SectionSettingCount;
PUCHAR *OperatingSystemSectionNames;
PUCHAR *OperatingSystemDisplayNames;
@ -104,13 +104,13 @@ BOOL InitOperatingSystemList(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNames
return TRUE;
}
ULONG CountOperatingSystems(ULONG SectionId)
U32 CountOperatingSystems(U32 SectionId)
{
ULONG Idx;
U32 Idx;
UCHAR SettingName[260];
UCHAR SettingValue[260];
ULONG OperatingSystemCount = 0;
ULONG SectionSettingCount;
U32 OperatingSystemCount = 0;
U32 SectionSettingCount;
//
// Loop through and count the operating systems
@ -137,9 +137,9 @@ ULONG CountOperatingSystems(ULONG SectionId)
return OperatingSystemCount;
}
BOOL AllocateListMemory(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, ULONG OperatingSystemCount)
BOOL AllocateListMemory(PUCHAR **SectionNamesPointer, PUCHAR **DisplayNamesPointer, U32 OperatingSystemCount)
{
ULONG Idx;
U32 Idx;
PUCHAR *OperatingSystemSectionNames = NULL;
PUCHAR *OperatingSystemDisplayNames = NULL;

View file

@ -23,15 +23,15 @@
#include <rtl.h>
BOOL DissectArcPath(char *ArcPath, char *BootPath, PULONG BootDrive, PULONG BootPartition)
BOOL DissectArcPath(char *ArcPath, char *BootPath, U32* BootDrive, U32* BootPartition)
{
char *p;
if (_strnicmp(ArcPath, "multi(0)disk(0)", 15) != 0)
if (strnicmp(ArcPath, "multi(0)disk(0)", 15) != 0)
return FALSE;
p = ArcPath + 15;
if (_strnicmp(p, "fdisk(", 6) == 0)
if (strnicmp(p, "fdisk(", 6) == 0)
{
/*
* floppy disk path:
@ -45,7 +45,7 @@ BOOL DissectArcPath(char *ArcPath, char *BootPath, PULONG BootDrive, PULONG Boot
p++;
*BootPartition = 0;
}
else if (_strnicmp(p, "rdisk(", 6) == 0)
else if (strnicmp(p, "rdisk(", 6) == 0)
{
/*
* hard disk path:
@ -54,7 +54,7 @@ BOOL DissectArcPath(char *ArcPath, char *BootPath, PULONG BootDrive, PULONG Boot
p = p + 6;
*BootDrive = atoi(p) + 0x80;
p = strchr(p, ')');
if ((p == NULL) || (_strnicmp(p, ")partition(", 11) != 0))
if ((p == NULL) || (strnicmp(p, ")partition(", 11) != 0))
return FALSE;
p = p + 11;
*BootPartition = atoi(p);

View file

@ -82,7 +82,7 @@ LoadSymbolFile(PCHAR szSystemRoot,
{
CHAR SymbolFileName[1024];
PFILE FilePointer;
DWORD Length;
U32 Length;
PCHAR Start;
PCHAR Ext;
char value[256];
@ -218,19 +218,19 @@ LoadNlsFile(PCHAR szFileName, PCHAR szModuleName)
static VOID
LoadBootDrivers(PCHAR szSystemRoot, int nPos)
{
LONG rc = 0;
S32 rc = 0;
HKEY hGroupKey, hServiceKey, hDriverKey;
char ValueBuffer[512];
char ServiceName[256];
ULONG BufferSize;
ULONG Index;
U32 BufferSize;
U32 Index;
char *GroupName;
ULONG ValueSize;
ULONG ValueType;
ULONG StartValue;
U32 ValueSize;
U32 ValueType;
U32 StartValue;
UCHAR DriverGroup[256];
ULONG DriverGroupSize;
U32 DriverGroupSize;
UCHAR ImagePath[256];
@ -285,7 +285,7 @@ LoadBootDrivers(PCHAR szSystemRoot, int nPos)
/* open driver Key */
rc = RegOpenKey(hServiceKey, ServiceName, &hDriverKey);
ValueSize = sizeof(ULONG);
ValueSize = sizeof(U32);
rc = RegQueryValue(hDriverKey, "Start", &ValueType, (PUCHAR)&StartValue, &ValueSize);
DbgPrint((DPRINT_REACTOS, " Start: %x \n", (int)StartValue));
@ -337,12 +337,12 @@ LoadBootDrivers(PCHAR szSystemRoot, int nPos)
static BOOL
LoadNlsFiles(PCHAR szSystemRoot)
{
LONG rc = ERROR_SUCCESS;
S32 rc = ERROR_SUCCESS;
HKEY hKey;
char szIdBuffer[80];
char szNameBuffer[80];
char szFileName[256];
ULONG BufferSize;
U32 BufferSize;
/* open the codepage key */
rc = RegOpenKey(NULL,
@ -436,10 +436,10 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
// int nNumDriverFiles=0;
// int nNumFilesLoaded=0;
char MsgBuffer[256];
ULONG SectionId;
U32 SectionId;
char* Base;
ULONG Size;
U32 Size;
//

View file

@ -266,7 +266,7 @@ computeKeyValueDataSize (PCHAR regChunk, PCHAR dataFormat)
}
else if (strcmp (dataFormat, "dword") == 0)
{
dataSize = sizeof(DWORD);
dataSize = sizeof(U32);
while (*regChunk != 0 && isxdigit(*regChunk))
{
regChunk++;
@ -335,7 +335,7 @@ static PCHAR
getKeyValueDataFromChunk (PCHAR regChunk, PCHAR dataFormat, PCHAR data)
{
char dataValue;
ULONG ulValue;
U32 ulValue;
PCHAR ptr;
if (strcmp (dataFormat, "string") == 0)
@ -382,7 +382,7 @@ getKeyValueDataFromChunk (PCHAR regChunk, PCHAR dataFormat, PCHAR data)
ulValue = (ulValue << 4) + dataValue;
regChunk++;
}
memcpy(data, &ulValue, sizeof(ULONG));
memcpy(data, &ulValue, sizeof(U32));
}
else if (strcmp (dataFormat, "multi") == 0)
{
@ -434,11 +434,11 @@ getKeyValueDataFromChunk (PCHAR regChunk, PCHAR dataFormat, PCHAR data)
static BOOL
setKeyValue (HKEY currentKey,
PCHAR newValueName,
ULONG keyValueType,
U32 keyValueType,
PVOID data,
ULONG dataSize)
U32 dataSize)
{
LONG status;
S32 status;
DbgPrint((DPRINT_REGISTRY, "Adding value (%s) to current key, with data type %d and size %d\n",
newValueName, (int)keyValueType, (int)dataSize));
@ -459,7 +459,7 @@ setKeyValue (HKEY currentKey,
VOID
RegImportHive(PCHAR ChunkBase,
ULONG ChunkSize)
U32 ChunkSize)
{
HKEY currentKey = INVALID_HANDLE_VALUE;
char *newKeyName = NULL;
@ -477,7 +477,7 @@ RegImportHive(PCHAR ChunkBase,
if (regChunk == 0)
return;
while (regChunk != 0 && *regChunk != 0 && (((ULONG)regChunk-(ULONG)ChunkBase) < ChunkSize))
while (regChunk != 0 && *regChunk != 0 && (((U32)regChunk-(U32)ChunkBase) < ChunkSize))
{
regChunk = skipWhitespaceInChunk (regChunk);
if (regChunk == 0)
@ -581,7 +581,7 @@ RegImportHive(PCHAR ChunkBase,
}
BOOL
RegExportHive(PCHAR ChunkBase, PULONG ChunkSize)
RegExportHive(PCHAR ChunkBase, U32* ChunkSize)
{
return(TRUE);
}

View file

@ -55,7 +55,7 @@ RegInitializeRegistry(VOID)
}
LONG
S32
RegInitCurrentControlSet(BOOL LastKnownGood)
{
CHAR ControlSetKeyName[80];
@ -63,11 +63,11 @@ RegInitCurrentControlSet(BOOL LastKnownGood)
HKEY SystemKey;
HKEY ControlSetKey;
HKEY LinkKey;
ULONG CurrentSet = 0;
ULONG DefaultSet = 0;
ULONG LastKnownGoodSet = 0;
ULONG DataSize;
LONG Error;
U32 CurrentSet = 0;
U32 DefaultSet = 0;
U32 LastKnownGoodSet = 0;
U32 DataSize;
S32 Error;
Error = RegOpenKey(NULL,
"\\Registry\\Machine\\SYSTEM\\Select",
@ -78,7 +78,7 @@ RegInitCurrentControlSet(BOOL LastKnownGood)
return(Error);
}
DataSize = sizeof(ULONG);
DataSize = sizeof(U32);
Error = RegQueryValue(SelectKey,
"Default",
NULL,
@ -90,7 +90,7 @@ RegInitCurrentControlSet(BOOL LastKnownGood)
return(Error);
}
DataSize = sizeof(ULONG);
DataSize = sizeof(U32);
Error = RegQueryValue(SelectKey,
"LastKnownGood",
NULL,
@ -165,7 +165,7 @@ RegInitCurrentControlSet(BOOL LastKnownGood)
}
LONG
S32
RegCreateKey(HKEY ParentKey,
PCHAR KeyName,
PHKEY Key)
@ -285,7 +285,7 @@ RegCreateKey(HKEY ParentKey,
}
LONG
S32
RegDeleteKey(HKEY Key,
PCHAR Name)
{
@ -300,16 +300,16 @@ RegDeleteKey(HKEY Key,
}
LONG
S32
RegEnumKey(HKEY Key,
ULONG Index,
U32 Index,
PCHAR Name,
PULONG NameSize)
U32* NameSize)
{
PLIST_ENTRY Ptr;
HKEY SearchKey;
ULONG Count = 0;
ULONG Size;
U32 Count = 0;
U32 Size;
Ptr = Key->SubKeyList.Flink;
while (Ptr != &Key->SubKeyList)
@ -338,7 +338,7 @@ RegEnumKey(HKEY Key,
}
LONG
S32
RegOpenKey(HKEY ParentKey,
PCHAR KeyName,
PHKEY Key)
@ -438,12 +438,12 @@ RegOpenKey(HKEY ParentKey,
}
LONG
S32
RegSetValue(HKEY Key,
PCHAR ValueName,
ULONG Type,
U32 Type,
PUCHAR Data,
ULONG DataSize)
U32 DataSize)
{
PLIST_ENTRY Ptr;
PVALUE Value = NULL;
@ -536,14 +536,14 @@ RegSetValue(HKEY Key,
}
LONG
S32
RegQueryValue(HKEY Key,
PCHAR ValueName,
PULONG Type,
U32* Type,
PUCHAR Data,
PULONG DataSize)
U32* DataSize)
{
ULONG Size;
U32 Size;
PLIST_ENTRY Ptr;
PVALUE Value = NULL;
@ -623,7 +623,7 @@ RegQueryValue(HKEY Key,
}
LONG
S32
RegDeleteValue(HKEY Key,
PCHAR ValueName)
{
@ -679,18 +679,18 @@ RegDeleteValue(HKEY Key,
}
LONG
S32
RegEnumValue(HKEY Key,
ULONG Index,
U32 Index,
PCHAR ValueName,
PULONG NameSize,
PULONG Type,
U32* NameSize,
U32* Type,
PUCHAR Data,
PULONG DataSize)
U32* DataSize)
{
PLIST_ENTRY Ptr;
PVALUE Value;
ULONG Count = 0;
U32 Count = 0;
if (Key->Data != NULL)
{
@ -736,7 +736,7 @@ RegEnumValue(HKEY Key,
#if 0
LONG
S32
RegQueryMultipleValue(HKEY Key,
...)
{

View file

@ -36,12 +36,12 @@ typedef struct _REG_KEY
LIST_ENTRY SubKeyList;
LIST_ENTRY ValueList;
ULONG NameSize;
U32 NameSize;
PUCHAR Name;
/* default data */
ULONG DataType;
ULONG DataSize;
U32 DataType;
U32 DataSize;
PUCHAR Data;
} KEY, *HKEY, **PHKEY;
@ -51,12 +51,12 @@ typedef struct _REG_VALUE
LIST_ENTRY ValueList;
/* value name */
ULONG NameSize;
U32 NameSize;
PUCHAR Name;
/* value data */
ULONG DataType;
ULONG DataSize;
U32 DataType;
U32 DataSize;
PUCHAR Data;
} VALUE, *PVALUE;
@ -193,7 +193,7 @@ typedef struct _REG_VALUE
/*
* PURPOSE: Returns the byte offset of a field within a structure
*/
#define FIELD_OFFSET(Type,Field) (LONG)(&(((Type *)(0))->Field))
#define FIELD_OFFSET(Type,Field) (S32)(&(((Type *)(0))->Field))
/*
* PURPOSE: Returns the base address structure if the caller knows the
@ -204,7 +204,7 @@ typedef struct _REG_VALUE
* Field = Name of the field whose address is none
*/
#define CONTAINING_RECORD(Address,Type,Field) \
(Type *)(((LONG)Address) - FIELD_OFFSET(Type,Field))
(Type *)(((S32)Address) - FIELD_OFFSET(Type,Field))
#define REG_NONE 0
@ -225,62 +225,62 @@ typedef struct _REG_VALUE
VOID
RegInitializeRegistry(VOID);
LONG
S32
RegInitCurrentControlSet(BOOL LastKnownGood);
LONG
S32
RegCreateKey(HKEY ParentKey,
PCHAR KeyName,
PHKEY Key);
LONG
S32
RegDeleteKey(HKEY Key,
PCHAR Name);
LONG
S32
RegEnumKey(HKEY Key,
ULONG Index,
U32 Index,
PCHAR Name,
PULONG NameSize);
U32* NameSize);
LONG
S32
RegOpenKey(HKEY ParentKey,
PCHAR KeyName,
PHKEY Key);
LONG
S32
RegSetValue(HKEY Key,
PCHAR ValueName,
ULONG Type,
U32 Type,
PUCHAR Data,
ULONG DataSize);
U32 DataSize);
LONG
S32
RegQueryValue(HKEY Key,
PCHAR ValueName,
PULONG Type,
U32* Type,
PUCHAR Data,
PULONG DataSize);
U32* DataSize);
LONG
S32
RegDeleteValue(HKEY Key,
PCHAR ValueName);
LONG
S32
RegEnumValue(HKEY Key,
ULONG Index,
U32 Index,
PCHAR ValueName,
PULONG NameSize,
PULONG Type,
U32* NameSize,
U32* Type,
PUCHAR Data,
PULONG DataSize);
U32* DataSize);
VOID
RegImportHive(PCHAR ChunkBase,
ULONG ChunkSize);
U32 ChunkSize);
#endif /* __REGISTRY_H */

View file

@ -92,9 +92,9 @@ BOOL RtlListIsEmpty(PLIST_ITEM ListHead)
return (ListHead->ListNext == NULL);
}
ULONG RtlListCountEntries(PLIST_ITEM ListHead)
U32 RtlListCountEntries(PLIST_ITEM ListHead)
{
ULONG Count = 0;
U32 Count = 0;
while (ListHead != NULL)
{

View file

@ -19,9 +19,9 @@
#include <freeldr.h>
int RtlCompareMemory(const PVOID Source1, const PVOID Source2, ULONG Length)
int RtlCompareMemory(const PVOID Source1, const PVOID Source2, U32 Length)
{
ULONG i;
U32 i;
const PCHAR buffer1 = Source1;
const PCHAR buffer2 = Source2;
@ -36,9 +36,9 @@ int RtlCompareMemory(const PVOID Source1, const PVOID Source2, ULONG Length)
return 0;
}
VOID RtlCopyMemory(PVOID Destination, const PVOID Source, ULONG Length)
VOID RtlCopyMemory(PVOID Destination, const PVOID Source, U32 Length)
{
ULONG i;
U32 i;
PCHAR buf1 = Destination;
const PCHAR buf2 = Source;
@ -49,9 +49,9 @@ VOID RtlCopyMemory(PVOID Destination, const PVOID Source, ULONG Length)
}
VOID RtlFillMemory(PVOID Destination, ULONG Length, UCHAR Fill)
VOID RtlFillMemory(PVOID Destination, U32 Length, UCHAR Fill)
{
ULONG i;
U32 i;
PUCHAR buf1 = Destination;
for (i=0; i<Length; i++)
@ -61,7 +61,7 @@ VOID RtlFillMemory(PVOID Destination, ULONG Length, UCHAR Fill)
}
VOID RtlZeroMemory(PVOID Destination, ULONG Length)
VOID RtlZeroMemory(PVOID Destination, U32 Length)
{
RtlFillMemory(Destination, Length, 0);
}

View file

@ -49,13 +49,7 @@ void printf(char *format, ... )
}
else
{
c = *(format++);
if (c == 'l')
{
c = *(format++);
}
switch (c)
switch (c = *(format++))
{
case 'd': case 'u': case 'x':
*convert_to_ascii(str, c, *((unsigned long *) dataptr++)) = 0;
@ -78,6 +72,12 @@ void printf(char *format, ... )
putchar(c);
}
break;
case '%':
putchar(c);
break;
default:
printf("\nprintf() invalid format specifier - %%%c\n", c);
break;
}
}
}
@ -100,13 +100,7 @@ void sprintf(char *buffer, char *format, ... )
}
else
{
c = *(format++);
if (c == 'l')
{
c = *(format++);
}
switch (c)
switch (c = *(format++))
{
case 'd': case 'u': case 'x':
*convert_to_ascii(str, c, *((unsigned long *) dataptr++)) = 0;
@ -134,6 +128,13 @@ void sprintf(char *buffer, char *format, ... )
p++;
}
break;
case '%':
*p = c;
p++;
break;
default:
printf("\nsprintf() invalid format specifier - %%%c\n", c);
break;
}
}
}

View file

@ -143,7 +143,7 @@ int stricmp(const char *string1, const char *string2)
return (int)tolower(*string1) - (int)tolower(*string2);
}
int _strnicmp(const char *string1, const char *string2, size_t length)
int strnicmp(const char *string1, const char *string2, size_t length)
{
if (length == 0)
return 0;

View file

@ -30,19 +30,19 @@ VOID GuiDrawBackdrop(VOID)
{
}
VOID GuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */)
VOID GuiFillArea(U32 Left, U32 Top, U32 Right, U32 Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */)
{
}
VOID GuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
VOID GuiDrawShadow(U32 Left, U32 Top, U32 Right, U32 Bottom)
{
}
VOID GuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOL Fill, BOOL Shadow, UCHAR Attr)
VOID GuiDrawBox(U32 Left, U32 Top, U32 Right, U32 Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOL Fill, BOOL Shadow, UCHAR Attr)
{
}
VOID GuiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr)
VOID GuiDrawText(U32 X, U32 Y, PUCHAR Text, UCHAR Attr)
{
}
@ -70,7 +70,7 @@ VOID GuiMessageBoxCritical(PUCHAR MessageText)
{
}
VOID GuiDrawProgressBar(ULONG Position, ULONG Range)
VOID GuiDrawProgressBar(U32 Position, U32 Range)
{
}

View file

@ -29,17 +29,17 @@
//
///////////////////////////////////////////////////////////////////////////////////////
VOID GuiDrawBackdrop(VOID); // Fills the entire screen with a backdrop
VOID GuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr
VOID GuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom); // Draws a shadow on the bottom and right sides of the area specified
VOID GuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOL Fill, BOOL Shadow, UCHAR Attr); // Draws a box around the area specified
VOID GuiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr); // Draws text at coordinates specified
VOID GuiFillArea(U32 Left, U32 Top, U32 Right, U32 Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr
VOID GuiDrawShadow(U32 Left, U32 Top, U32 Right, U32 Bottom); // Draws a shadow on the bottom and right sides of the area specified
VOID GuiDrawBox(U32 Left, U32 Top, U32 Right, U32 Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOL Fill, BOOL Shadow, UCHAR Attr); // Draws a box around the area specified
VOID GuiDrawText(U32 X, U32 Y, PUCHAR Text, UCHAR Attr); // Draws text at coordinates specified
VOID GuiDrawStatusText(PUCHAR StatusText); // Draws text at the very bottom line on the screen
VOID GuiUpdateDateTime(VOID); // Updates the date and time
VOID GuiSaveScreen(PUCHAR Buffer); // Saves the screen so that it can be restored later
VOID GuiRestoreScreen(PUCHAR Buffer); // Restores the screen from a previous save
VOID GuiMessageBox(PUCHAR MessageText); // Displays a message box on the screen with an ok button
VOID GuiMessageBoxCritical(PUCHAR MessageText); // Displays a message box on the screen with an ok button using no system resources
VOID GuiDrawProgressBar(ULONG Position, ULONG Range); // Draws the progress bar showing nPos percent filled
VOID GuiDrawProgressBar(U32 Position, U32 Range); // Draws the progress bar showing nPos percent filled
UCHAR GuiTextToColor(PUCHAR ColorText); // Converts the text color into it's equivalent color value
UCHAR GuiTextToFillStyle(PUCHAR FillStyleText); // Converts the text fill into it's equivalent fill value
@ -49,7 +49,7 @@ UCHAR GuiTextToFillStyle(PUCHAR FillStyleText); // Converts the text fill int
// Menu Functions
//
///////////////////////////////////////////////////////////////////////////////////////
BOOL GuiDisplayMenu(PUCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, PULONG SelectedMenuItem);
BOOL GuiDisplayMenu(PUCHAR MenuItemList[], U32 MenuItemCount, U32 DefaultMenuItem, S32 MenuTimeOut, U32* SelectedMenuItem);

View file

@ -100,10 +100,10 @@ VOID TuiDrawBackdrop(VOID)
* FillArea()
* This function assumes coordinates are zero-based
*/
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */)
VOID TuiFillArea(U32 Left, U32 Top, U32 Right, U32 Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */)
{
PUCHAR ScreenMemory = (PUCHAR)TUI_SCREEN_MEM;
ULONG i, j;
U32 i, j;
// Clip the area to the screen
// FIXME: This code seems to have problems... Uncomment and view ;-)
@ -136,10 +136,10 @@ VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillCha
* DrawShadow()
* This function assumes coordinates are zero-based
*/
VOID TuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
VOID TuiDrawShadow(U32 Left, U32 Top, U32 Right, U32 Bottom)
{
PUCHAR ScreenMemory = (PUCHAR)TUI_SCREEN_MEM;
ULONG Idx;
U32 Idx;
// Shade the bottom of the area
if (Bottom < (UiScreenHeight - 1))
@ -196,7 +196,7 @@ VOID TuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
* DrawBox()
* This function assumes coordinates are zero-based
*/
VOID TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOL Fill, BOOL Shadow, UCHAR Attr)
VOID TuiDrawBox(U32 Left, U32 Top, U32 Right, U32 Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOL Fill, BOOL Shadow, UCHAR Attr)
{
UCHAR ULCorner, URCorner, LLCorner, LRCorner;
@ -268,10 +268,10 @@ VOID TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyl
* DrawText()
* This function assumes coordinates are zero-based
*/
VOID TuiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr)
VOID TuiDrawText(U32 X, U32 Y, PUCHAR Text, UCHAR Attr)
{
PUCHAR ScreenMemory = (PUCHAR)TUI_SCREEN_MEM;
ULONG i, j;
U32 i, j;
// Draw the text
for (i=X, j=0; Text[j] && i<UiScreenWidth; i++,j++)
@ -281,13 +281,13 @@ VOID TuiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr)
}
}
VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PUCHAR TextString, UCHAR Attr)
VOID TuiDrawCenteredText(U32 Left, U32 Top, U32 Right, U32 Bottom, PUCHAR TextString, UCHAR Attr)
{
}
VOID TuiDrawStatusText(PUCHAR StatusText)
{
ULONG i;
U32 i;
TuiDrawText(0, UiScreenHeight-1, " ", ATTR(UiStatusBarFgColor, UiStatusBarBgColor));
TuiDrawText(1, UiScreenHeight-1, StatusText, ATTR(UiStatusBarFgColor, UiStatusBarBgColor));
@ -303,7 +303,7 @@ VOID TuiUpdateDateTime(VOID)
UCHAR DateString[40];
UCHAR TimeString[40];
UCHAR TempString[20];
ULONG Hour, Minute, Second;
U32 Hour, Minute, Second;
BOOL PMHour = FALSE;
// Get the month name
@ -385,7 +385,7 @@ VOID TuiUpdateDateTime(VOID)
VOID TuiSaveScreen(PUCHAR Buffer)
{
PUCHAR ScreenMemory = (PUCHAR)TUI_SCREEN_MEM;
ULONG i;
U32 i;
for (i=0; i < (UiScreenWidth * UiScreenHeight * 2); i++)
{
@ -396,7 +396,7 @@ VOID TuiSaveScreen(PUCHAR Buffer)
VOID TuiRestoreScreen(PUCHAR Buffer)
{
PUCHAR ScreenMemory = (PUCHAR)TUI_SCREEN_MEM;
ULONG i;
U32 i;
for (i=0; i < (UiScreenWidth * UiScreenHeight * 2); i++)
{
@ -505,11 +505,11 @@ VOID TuiMessageBoxCritical(PUCHAR MessageText)
}
VOID TuiDrawProgressBarCenter(ULONG Position, ULONG Range)
VOID TuiDrawProgressBarCenter(U32 Position, U32 Range)
{
ULONG Left, Top, Right, Bottom;
ULONG Width = 50; // Allow for 50 "bars"
ULONG Height = 2;
U32 Left, Top, Right, Bottom;
U32 Width = 50; // Allow for 50 "bars"
U32 Height = 2;
Left = (UiScreenWidth - Width - 4) / 2;
Right = Left + Width + 3;
@ -520,10 +520,10 @@ VOID TuiDrawProgressBarCenter(ULONG Position, ULONG Range)
TuiDrawProgressBar(Left, Top, Right, Bottom, Position, Range);
}
VOID TuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range)
VOID TuiDrawProgressBar(U32 Left, U32 Top, U32 Right, U32 Bottom, U32 Position, U32 Range)
{
ULONG i;
ULONG ProgressBarWidth = (Right - Left) - 3;
U32 i;
U32 ProgressBarWidth = (Right - Left) - 3;
if (Position > Range)
{

View file

@ -29,19 +29,19 @@
//
///////////////////////////////////////////////////////////////////////////////////////
VOID TuiDrawBackdrop(VOID); // Fills the entire screen with a backdrop
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr
VOID TuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom); // Draws a shadow on the bottom and right sides of the area specified
VOID TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOL Fill, BOOL Shadow, UCHAR Attr); // Draws a box around the area specified
VOID TuiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr); // Draws text at coordinates specified
VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PUCHAR TextString, UCHAR Attr); // Draws centered text at the coordinates specified and clips the edges
VOID TuiFillArea(U32 Left, U32 Top, U32 Right, U32 Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr
VOID TuiDrawShadow(U32 Left, U32 Top, U32 Right, U32 Bottom); // Draws a shadow on the bottom and right sides of the area specified
VOID TuiDrawBox(U32 Left, U32 Top, U32 Right, U32 Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOL Fill, BOOL Shadow, UCHAR Attr); // Draws a box around the area specified
VOID TuiDrawText(U32 X, U32 Y, PUCHAR Text, UCHAR Attr); // Draws text at coordinates specified
VOID TuiDrawCenteredText(U32 Left, U32 Top, U32 Right, U32 Bottom, PUCHAR TextString, UCHAR Attr); // Draws centered text at the coordinates specified and clips the edges
VOID TuiDrawStatusText(PUCHAR StatusText); // Draws text at the very bottom line on the screen
VOID TuiUpdateDateTime(VOID); // Updates the date and time
VOID TuiSaveScreen(PUCHAR Buffer); // Saves the screen so that it can be restored later
VOID TuiRestoreScreen(PUCHAR Buffer); // Restores the screen from a previous save
VOID TuiMessageBox(PUCHAR MessageText); // Displays a message box on the screen with an ok button
VOID TuiMessageBoxCritical(PUCHAR MessageText); // Displays a message box on the screen with an ok button using no system resources
VOID TuiDrawProgressBarCenter(ULONG Position, ULONG Range); // Draws the progress bar showing nPos percent filled
VOID TuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range); // Draws the progress bar showing nPos percent filled
VOID TuiDrawProgressBarCenter(U32 Position, U32 Range); // Draws the progress bar showing nPos percent filled
VOID TuiDrawProgressBar(U32 Left, U32 Top, U32 Right, U32 Bottom, U32 Position, U32 Range); // Draws the progress bar showing nPos percent filled
UCHAR TuiTextToColor(PUCHAR ColorText); // Converts the text color into it's equivalent color value
UCHAR TuiTextToFillStyle(PUCHAR FillStyleText); // Converts the text fill into it's equivalent fill value
@ -55,23 +55,23 @@ UCHAR TuiTextToFillStyle(PUCHAR FillStyleText); // Converts the text fill int
typedef struct
{
PUCHAR *MenuItemList;
ULONG MenuItemCount;
LONG MenuTimeRemaining;
ULONG SelectedMenuItem;
U32 MenuItemCount;
S32 MenuTimeRemaining;
U32 SelectedMenuItem;
ULONG Left;
ULONG Top;
ULONG Right;
ULONG Bottom;
U32 Left;
U32 Top;
U32 Right;
U32 Bottom;
} TUI_MENU_INFO, *PTUI_MENU_INFO;
VOID TuiCalcMenuBoxSize(PTUI_MENU_INFO MenuInfo);
VOID TuiDrawMenu(PTUI_MENU_INFO MenuInfo);
VOID TuiDrawMenuBox(PTUI_MENU_INFO MenuInfo);
VOID TuiDrawMenuItem(PTUI_MENU_INFO MenuInfo, ULONG MenuItemNumber);
ULONG TuiProcessMenuKeyboardEvent(PTUI_MENU_INFO MenuInfo);
BOOL TuiDisplayMenu(PUCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, PULONG SelectedMenuItem);
VOID TuiDrawMenuItem(PTUI_MENU_INFO MenuInfo, U32 MenuItemNumber);
U32 TuiProcessMenuKeyboardEvent(PTUI_MENU_INFO MenuInfo);
BOOL TuiDisplayMenu(PUCHAR MenuItemList[], U32 MenuItemCount, U32 DefaultMenuItem, S32 MenuTimeOut, U32* SelectedMenuItem);
/*

View file

@ -26,10 +26,10 @@
#include <mm.h>
BOOL TuiDisplayMenu(PUCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, PULONG SelectedMenuItem)
BOOL TuiDisplayMenu(PUCHAR MenuItemList[], U32 MenuItemCount, U32 DefaultMenuItem, S32 MenuTimeOut, U32* SelectedMenuItem)
{
TUI_MENU_INFO MenuInformation;
ULONG CurrentClockSecond;
U32 CurrentClockSecond;
//
// The first thing we need to check is the timeout
@ -128,10 +128,10 @@ BOOL TuiDisplayMenu(PUCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMen
VOID TuiCalcMenuBoxSize(PTUI_MENU_INFO MenuInfo)
{
ULONG Idx;
ULONG Width;
ULONG Height;
ULONG Length;
U32 Idx;
U32 Width;
U32 Height;
U32 Length;
//
// Height is the menu item count plus 2 (top border & bottom border)
@ -169,7 +169,7 @@ VOID TuiCalcMenuBoxSize(PTUI_MENU_INFO MenuInfo)
VOID TuiDrawMenu(PTUI_MENU_INFO MenuInfo)
{
ULONG Idx;
U32 Idx;
//
// Draw the menu box
@ -225,13 +225,13 @@ VOID TuiDrawMenuBox(PTUI_MENU_INFO MenuInfo)
}
}
VOID TuiDrawMenuItem(PTUI_MENU_INFO MenuInfo, ULONG MenuItemNumber)
VOID TuiDrawMenuItem(PTUI_MENU_INFO MenuInfo, U32 MenuItemNumber)
{
ULONG Idx;
U32 Idx;
UCHAR MenuLineText[80];
ULONG SpaceTotal;
ULONG SpaceLeft;
ULONG SpaceRight;
U32 SpaceTotal;
U32 SpaceLeft;
U32 SpaceRight;
//
// We will want the string centered so calculate
@ -283,9 +283,9 @@ VOID TuiDrawMenuItem(PTUI_MENU_INFO MenuInfo, ULONG MenuItemNumber)
}
}
ULONG TuiProcessMenuKeyboardEvent(PTUI_MENU_INFO MenuInfo)
U32 TuiProcessMenuKeyboardEvent(PTUI_MENU_INFO MenuInfo)
{
ULONG KeyEvent = 0;
U32 KeyEvent = 0;
//
// Check for a keypress

View file

@ -31,8 +31,8 @@
#define DISPLAYMODE_TEXT 0
#define DISPLAYMODE_GRAPHICS 1
ULONG UiScreenWidth = 80; // Screen Width
ULONG UiScreenHeight = 25; // Screen Height
U32 UiScreenWidth = 80; // Screen Width
U32 UiScreenHeight = 25; // Screen Height
UCHAR UiStatusBarFgColor = COLOR_BLACK; // Status bar foreground color
UCHAR UiStatusBarBgColor = COLOR_CYAN; // Status bar background color
@ -62,9 +62,9 @@ UCHAR UiMonthNames[12][15] = { "January ", "February ", "March ", "April ", "May
BOOL UiInitialize(VOID)
{
ULONG SectionId;
U32 SectionId;
UCHAR SettingText[260];
ULONG VideoMode = VIDEOMODE_NORMAL_TEXT;
U32 VideoMode = VIDEOMODE_NORMAL_TEXT;
DbgPrint((DPRINT_UI, "Initializing User Interface.\n"));
@ -207,7 +207,7 @@ VOID UiDrawBackdrop(VOID)
}
}
VOID UiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */)
VOID UiFillArea(U32 Left, U32 Top, U32 Right, U32 Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */)
{
if (UiDisplayMode == DISPLAYMODE_TEXT)
{
@ -220,7 +220,7 @@ VOID UiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar
}
}
VOID UiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
VOID UiDrawShadow(U32 Left, U32 Top, U32 Right, U32 Bottom)
{
if (UiDisplayMode == DISPLAYMODE_TEXT)
{
@ -233,7 +233,7 @@ VOID UiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
}
}
VOID UiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOL Fill, BOOL Shadow, UCHAR Attr)
VOID UiDrawBox(U32 Left, U32 Top, U32 Right, U32 Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOL Fill, BOOL Shadow, UCHAR Attr)
{
if (UiDisplayMode == DISPLAYMODE_TEXT)
{
@ -246,7 +246,7 @@ VOID UiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle
}
}
VOID UiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr)
VOID UiDrawText(U32 X, U32 Y, PUCHAR Text, UCHAR Attr)
{
if (UiDisplayMode == DISPLAYMODE_TEXT)
{
@ -259,7 +259,7 @@ VOID UiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr)
}
}
VOID UiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PUCHAR TextString, UCHAR Attr)
VOID UiDrawCenteredText(U32 Left, U32 Top, U32 Right, U32 Bottom, PUCHAR TextString, UCHAR Attr)
{
if (UiDisplayMode == DISPLAYMODE_TEXT)
{
@ -300,21 +300,20 @@ VOID UiUpdateDateTime(VOID)
VOID UiMessageBox(PUCHAR MessageText)
{
strcat(UiMessageBoxLineText, MessageText);
// We have not yet displayed the user interface
// We are probably still reading the .ini file
// and have encountered an error. Just use printf()
// and return.
if (!UserInterfaceUp)
{
printf("%s\n", UiMessageBoxLineText);
printf("%s\n", MessageText);
printf("Press any key\n");
getch();
return;
}
strcat(UiMessageBoxLineText, MessageText);
if (UiDisplayMode == DISPLAYMODE_TEXT)
{
TuiMessageBox(UiMessageBoxLineText);
@ -387,7 +386,7 @@ UCHAR UiTextToFillStyle(PUCHAR FillStyleText)
}
}
VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range)
VOID UiDrawProgressBarCenter(U32 Position, U32 Range)
{
if (UiDisplayMode == DISPLAYMODE_TEXT)
{
@ -400,7 +399,7 @@ VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range)
}
}
VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range)
VOID UiDrawProgressBar(U32 Left, U32 Top, U32 Right, U32 Bottom, U32 Position, U32 Range)
{
if (UiDisplayMode == DISPLAYMODE_TEXT)
{
@ -415,10 +414,10 @@ VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG P
VOID UiShowMessageBoxesInSection(PUCHAR SectionName)
{
ULONG Idx;
U32 Idx;
UCHAR SettingName[80];
UCHAR SettingValue[80];
ULONG SectionId;
U32 SectionId;
//
// Zero out message line text
@ -455,12 +454,12 @@ VOID UiShowMessageBoxesInSection(PUCHAR SectionName)
strcpy(UiMessageBoxLineText, "");
}
VOID UiTruncateStringEllipsis(PUCHAR StringText, ULONG MaxChars)
VOID UiTruncateStringEllipsis(PUCHAR StringText, U32 MaxChars)
{
UNIMPLEMENTED
}
BOOL UiDisplayMenu(PUCHAR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, PULONG SelectedMenuItem)
BOOL UiDisplayMenu(PUCHAR MenuItemList[], U32 MenuItemCount, U32 DefaultMenuItem, S32 MenuTimeOut, U32* SelectedMenuItem)
{
if (UiDisplayMode == DISPLAYMODE_TEXT)
{

View file

@ -20,11 +20,11 @@
#include <freeldr.h>
#include <video.h>
ULONG CurrentVideoMode = VIDEOMODE_NORMAL_TEXT;
ULONG VideoResolutionX = 80;
ULONG VideoResolutionY = 25;
U32 CurrentVideoMode = VIDEOMODE_NORMAL_TEXT;
U32 VideoResolutionX = 80;
U32 VideoResolutionY = 25;
BOOL VideoSetMode(ULONG VideoMode)
BOOL VideoSetMode(U32 VideoMode)
{
switch (VideoMode)
{
@ -163,17 +163,17 @@ BOOL VideoSetMode80x60(VOID)
return TRUE;
}
ULONG VideoGetCurrentModeResolutionX(VOID)
U32 VideoGetCurrentModeResolutionX(VOID)
{
return VideoResolutionX;
}
ULONG VideoGetCurrentModeResolutionY(VOID)
U32 VideoGetCurrentModeResolutionY(VOID)
{
return VideoResolutionY;
}
ULONG VideoGetCurrentMode(VOID)
U32 VideoGetCurrentMode(VOID)
{
return CurrentVideoMode;
}