FreeLdr Patch. Now fully loads ntoskrnl using a PE Loader, supports /3gb dynamically...
authorAlex Ionescu <aionescu@gmail.com>
Tue, 8 Feb 2005 01:46:01 +0000 (01:46 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Tue, 8 Feb 2005 01:46:01 +0000 (01:46 +0000)
svn path=/trunk/; revision=13462

113 files changed:
reactos/boot/freeldr/freeldr/Makefile
reactos/boot/freeldr/freeldr/arch/i386/archmach.c
reactos/boot/freeldr/freeldr/arch/i386/hardware.c
reactos/boot/freeldr/freeldr/arch/i386/hardware.h
reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c
reactos/boot/freeldr/freeldr/arch/i386/hwapm.c
reactos/boot/freeldr/freeldr/arch/i386/hwcpu.c
reactos/boot/freeldr/freeldr/arch/i386/hwpci.c
reactos/boot/freeldr/freeldr/arch/i386/i386disk.c
reactos/boot/freeldr/freeldr/arch/i386/i386rtl.c
reactos/boot/freeldr/freeldr/arch/i386/i386vid.c
reactos/boot/freeldr/freeldr/arch/i386/machpc.h
reactos/boot/freeldr/freeldr/arch/i386/machxbox.h
reactos/boot/freeldr/freeldr/arch/i386/mb.S
reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c
reactos/boot/freeldr/freeldr/arch/i386/pcmem.c
reactos/boot/freeldr/freeldr/arch/i386/pcrtc.c
reactos/boot/freeldr/freeldr/arch/i386/pcvideo.c
reactos/boot/freeldr/freeldr/arch/i386/portio.c
reactos/boot/freeldr/freeldr/arch/i386/xboxcons.c
reactos/boot/freeldr/freeldr/arch/i386/xboxdisk.c
reactos/boot/freeldr/freeldr/arch/i386/xboxfont.c
reactos/boot/freeldr/freeldr/arch/i386/xboxmem.c
reactos/boot/freeldr/freeldr/arch/i386/xboxrtc.c
reactos/boot/freeldr/freeldr/arch/i386/xboxvideo.c
reactos/boot/freeldr/freeldr/bootmgr.c
reactos/boot/freeldr/freeldr/cache/blocklist.c
reactos/boot/freeldr/freeldr/cache/cache.c
reactos/boot/freeldr/freeldr/cache/cm.h
reactos/boot/freeldr/freeldr/cmdline.c
reactos/boot/freeldr/freeldr/comm/rs232.c
reactos/boot/freeldr/freeldr/custom.c
reactos/boot/freeldr/freeldr/disk/disk.c
reactos/boot/freeldr/freeldr/disk/partition.c
reactos/boot/freeldr/freeldr/drivemap.c
reactos/boot/freeldr/freeldr/fs/ext2.c
reactos/boot/freeldr/freeldr/fs/ext2.h
reactos/boot/freeldr/freeldr/fs/fat.c
reactos/boot/freeldr/freeldr/fs/fat.h
reactos/boot/freeldr/freeldr/fs/fs.c
reactos/boot/freeldr/freeldr/fs/fsrec.c
reactos/boot/freeldr/freeldr/fs/fsrec.h
reactos/boot/freeldr/freeldr/fs/iso.c
reactos/boot/freeldr/freeldr/fs/iso.h
reactos/boot/freeldr/freeldr/fs/ntfs.c
reactos/boot/freeldr/freeldr/fs/ntfs.h
reactos/boot/freeldr/freeldr/include/bootmgr.h
reactos/boot/freeldr/freeldr/include/cache.h
reactos/boot/freeldr/freeldr/include/cmdline.h
reactos/boot/freeldr/freeldr/include/comm.h
reactos/boot/freeldr/freeldr/include/disk.h
reactos/boot/freeldr/freeldr/include/drivemap.h
reactos/boot/freeldr/freeldr/include/freeldr.h
reactos/boot/freeldr/freeldr/include/fs.h
reactos/boot/freeldr/freeldr/include/inffile.h
reactos/boot/freeldr/freeldr/include/inifile.h
reactos/boot/freeldr/freeldr/include/linux.h
reactos/boot/freeldr/freeldr/include/machine.h
reactos/boot/freeldr/freeldr/include/mm.h
reactos/boot/freeldr/freeldr/include/multiboot.h
reactos/boot/freeldr/freeldr/include/oslist.h
reactos/boot/freeldr/freeldr/include/portio.h
reactos/boot/freeldr/freeldr/include/reactos.h
reactos/boot/freeldr/freeldr/include/rtl.h
reactos/boot/freeldr/freeldr/include/ui.h
reactos/boot/freeldr/freeldr/include/video.h
reactos/boot/freeldr/freeldr/inffile/inffile.c
reactos/boot/freeldr/freeldr/inifile/ini.h
reactos/boot/freeldr/freeldr/inifile/ini_init.c
reactos/boot/freeldr/freeldr/inifile/inifile.c
reactos/boot/freeldr/freeldr/inifile/parse.c
reactos/boot/freeldr/freeldr/linuxboot.c
reactos/boot/freeldr/freeldr/machine.c
reactos/boot/freeldr/freeldr/miscboot.c
reactos/boot/freeldr/freeldr/mm/mem.h
reactos/boot/freeldr/freeldr/mm/meminit.c
reactos/boot/freeldr/freeldr/mm/mm.c
reactos/boot/freeldr/freeldr/multiboot.c
reactos/boot/freeldr/freeldr/options.c
reactos/boot/freeldr/freeldr/oslist.c
reactos/boot/freeldr/freeldr/reactos/arcname.c
reactos/boot/freeldr/freeldr/reactos/binhive.c
reactos/boot/freeldr/freeldr/reactos/reactos.c
reactos/boot/freeldr/freeldr/reactos/registry.c
reactos/boot/freeldr/freeldr/reactos/registry.h
reactos/boot/freeldr/freeldr/reactos/setupldr.c
reactos/boot/freeldr/freeldr/rtl/list.c
reactos/boot/freeldr/freeldr/rtl/string.c
reactos/boot/freeldr/freeldr/ui/gui.c
reactos/boot/freeldr/freeldr/ui/gui.h
reactos/boot/freeldr/freeldr/ui/tui.c
reactos/boot/freeldr/freeldr/ui/tui.h
reactos/boot/freeldr/freeldr/ui/tuimenu.c
reactos/boot/freeldr/freeldr/ui/ui.c
reactos/boot/freeldr/freeldr/video/fade.c
reactos/boot/freeldr/freeldr/video/palette.c
reactos/boot/freeldr/freeldr/video/video.c
reactos/hal/halx86/mp/mpsboot.asm
reactos/hal/halx86/mp/processor_mp.c
reactos/include/ntos/types.h
reactos/ntoskrnl/Makefile.i386
reactos/ntoskrnl/dbg/kdb.c
reactos/ntoskrnl/include/internal/i386/ke.h
reactos/ntoskrnl/include/internal/i386/mm.h
reactos/ntoskrnl/ke/i386/exp.c
reactos/ntoskrnl/ke/i386/irq.c
reactos/ntoskrnl/ke/i386/kernel.c
reactos/ntoskrnl/ke/i386/tss.c
reactos/ntoskrnl/ke/kthread.c
reactos/ntoskrnl/ke/main.c
reactos/ntoskrnl/mm/freelist.c
reactos/ntoskrnl/mm/i386/page.c
reactos/ntoskrnl/mm/mminit.c

index 8cde4f7..b44ba98 100644 (file)
@@ -83,7 +83,7 @@ setup_loader : setupldr.sys
        $(CP) setupldr.sys $(BOOTCD_DIR)/disk/loader/setupldr.sys
 
 
-COMPILER_OPTIONS = -Wall -Werror -nostdlib -nostdinc -ffreestanding -fno-builtin -fno-inline \
+COMPILER_OPTIONS = -Wall -Werror -nostdlib -ffreestanding -fno-builtin -fno-inline \
                    -fno-zero-initialized-in-bss -O1 -MD
 # FreeLoader does not use any of the standard libraries, includes, or built-in functions
 
@@ -95,7 +95,7 @@ endif
 
 COMPILER_DEFINES = -D__$(TARGET)__ $(COMPILER_DEBUG_DEFINES)
 
-COMPILER_INCLUDES      =       -I$(SRCDIR)/include -I$(PATH_TO_TOP)/include
+COMPILER_INCLUDES      =       -I$(SRCDIR)/include -I$(PATH_TO_TOP)/w32api/include -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/ntoskrnl/include
 
 CFLAGS = $(COMPILER_OPTIONS) \
          $(COMPILER_DEFINES) \
index ad503bd..347d8f5 100644 (file)
 VOID
 MachInit(VOID)
 {
-  U32 PciId;
+  ULONG PciId;
 
   memset(&MachVtbl, 0, sizeof(MACHVTBL));
 
   /* Check for Xbox by identifying device at PCI 0:0:0, if it's
    * 0x10de/0x02a5 then we're running on an Xbox */
-  WRITE_PORT_ULONG((U32*) 0xcf8, CONFIG_CMD(0, 0, 0));
-  PciId = READ_PORT_ULONG((U32*) 0xcfc);
+  WRITE_PORT_ULONG((ULONG*) 0xcf8, CONFIG_CMD(0, 0, 0));
+  PciId = READ_PORT_ULONG((ULONG*) 0xcfc);
   if (0x02a510de == PciId)
     {
       XboxMachInit();
index ec0b3b7..71876f1 100644 (file)
 #define CONTROLLER_TIMEOUT                              250
 
 
-typedef struct _CM_INT13_DRIVE_PARAMETER
-{
-  U16 DriveSelect;
-  U32 MaxCylinders;
-  U16 SectorsPerTrack;
-  U16 MaxHeads;
-  U16 NumberDrives;
-} CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER;
-
-
 typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA
 {
-  U32 BytesPerSector;
-  U32 NumberOfCylinders;
-  U32 SectorsPerTrack;
-  U32 NumberOfHeads;
+  ULONG BytesPerSector;
+  ULONG NumberOfCylinders;
+  ULONG SectorsPerTrack;
+  ULONG NumberOfHeads;
 } CM_DISK_GEOMETRY_DEVICE_DATA, *PCM_DISK_GEOMETRY_DEVICE_DATA;
 
 
 typedef struct _CM_PNP_BIOS_DEVICE_NODE
 {
-  U16 Size;
-  U8  Node;
-  U32 ProductId;
-  U8  DeviceType[3];
-  U16 DeviceAttributes;
+  USHORT Size;
+  UCHAR  Node;
+  ULONG ProductId;
+  UCHAR  DeviceType[3];
+  USHORT DeviceAttributes;
 } __attribute__((packed)) CM_PNP_BIOS_DEVICE_NODE, *PCM_PNP_BIOS_DEVICE_NODE;
 
 
 typedef struct _CM_PNP_BIOS_INSTALLATION_CHECK
 {
-  U8  Signature[4];
-  U8  Revision;
-  U8  Length;
-  U16 ControlField;
-  U8  Checksum;
-  U32 EventFlagAddress;
-  U16 RealModeEntryOffset;
-  U16 RealModeEntrySegment;
-  U16 ProtectedModeEntryOffset;
-  U32 ProtectedModeCodeBaseAddress;
-  U32 OemDeviceId;
-  U16 RealModeDataBaseAddress;
-  U32 ProtectedModeDataBaseAddress;
+  UCHAR  Signature[4];
+  UCHAR  Revision;
+  UCHAR  Length;
+  USHORT ControlField;
+  UCHAR  Checksum;
+  ULONG EventFlagAddress;
+  USHORT RealModeEntryOffset;
+  USHORT RealModeEntrySegment;
+  USHORT ProtectedModeEntryOffset;
+  ULONG ProtectedModeCodeBaseAddress;
+  ULONG OemDeviceId;
+  USHORT RealModeDataBaseAddress;
+  ULONG ProtectedModeDataBaseAddress;
 } __attribute__((packed)) CM_PNP_BIOS_INSTALLATION_CHECK, *PCM_PNP_BIOS_INSTALLATION_CHECK;
 
 
-typedef struct _CM_SERIAL_DEVICE_DATA
-{
-  U16 Version;
-  U16 Revision;
-  U32 BaudClock;
-} __attribute__((packed)) CM_SERIAL_DEVICE_DATA, *PCM_SERIAL_DEVICE_DATA;
-
-
-typedef struct _CM_FLOPPY_DEVICE_DATA
-{
-  U16 Version;
-  U16 Revision;
-  CHAR Size[8];
-  U32 MaxDensity;
-  U32 MountDensity;
-
-  /* Version 2.0 data */
-  U8 StepRateHeadUnloadTime;
-  U8 HeadLoadTime;
-  U8 MotorOffTime;
-  U8 SectorLengthCode;
-  U8 SectorPerTrack;
-  U8 ReadWriteGapLength;
-  U8 DataTransferLength;
-  U8 FormatGapLength;
-  U8 FormatFillCharacter;
-  U8 HeadSettleTime;
-  U8 MotorSettleTime;
-  U8 MaximumTrackValue;
-  U8 DataTransferRate;
-} __attribute__((packed)) CM_FLOPPY_DEVICE_DATA, *PCM_FLOPPY_DEVICE_DATA;
-
-
-typedef struct _CM_KEYBOARD_DEVICE_DATA
-{
-  U16 Version;
-  U16 Revision;
-  U8 Type;
-  U8 Subtype;
-  U16 KeyboardFlags;
-} __attribute__((packed)) CM_KEYBOARD_DEVICE_DATA, *PCM_KEYBOARD_DEVICE_DATA;
-
-
 static char Hex[] = "0123456789ABCDEF";
 static unsigned int delay_count = 1;
 
@@ -187,28 +134,28 @@ static unsigned int delay_count = 1;
 
 
 static VOID
-__KeStallExecutionProcessor(U32 Loops)
+__StallExecutionProcessor(ULONG Loops)
 {
   register unsigned int i;
   for (i = 0; i < Loops; i++);
 }
 
 
-VOID KeStallExecutionProcessor(U32 Microseconds)
+VOID StallExecutionProcessor(ULONG Microseconds)
 {
-  U64 LoopCount = ((U64)delay_count * (U64)Microseconds) / 1000ULL;
-  __KeStallExecutionProcessor((U32)LoopCount);
+  ULONGLONG LoopCount = ((ULONGLONG)delay_count * (ULONGLONG)Microseconds) / 1000ULL;
+  __StallExecutionProcessor((ULONG)LoopCount);
 }
 
 
-static U32
+static ULONG
 Read8254Timer(VOID)
 {
-  U32 Count;
+  ULONG Count;
 
-  WRITE_PORT_UCHAR((PU8)0x43, 0x00);
-  Count = READ_PORT_UCHAR((PU8)0x40);
-  Count |= READ_PORT_UCHAR((PU8)0x40) << 8;
+  WRITE_PORT_UCHAR((PUCHAR)0x43, 0x00);
+  Count = READ_PORT_UCHAR((PUCHAR)0x40);
+  Count |= READ_PORT_UCHAR((PUCHAR)0x40) << 8;
 
   return Count;
 }
@@ -217,9 +164,9 @@ Read8254Timer(VOID)
 static VOID
 WaitFor8254Wraparound(VOID)
 {
-  U32 CurCount;
-  U32 PrevCount = ~0;
-  S32 Delta;
+  ULONG CurCount;
+  ULONG PrevCount = ~0;
+  LONG Delta;
 
   CurCount = Read8254Timer();
 
@@ -242,14 +189,14 @@ WaitFor8254Wraparound(VOID)
 VOID
 HalpCalibrateStallExecution(VOID)
 {
-  U32 i;
-  U32 calib_bit;
-  U32 CurCount;
+  ULONG i;
+  ULONG calib_bit;
+  ULONG CurCount;
 
   /* Initialise timer interrupt with MILLISECOND ms interval        */
-  WRITE_PORT_UCHAR((PU8)0x43, 0x34);  /* binary, mode 2, LSB/MSB, ch 0 */
-  WRITE_PORT_UCHAR((PU8)0x40, LATCH & 0xff); /* LSB */
-  WRITE_PORT_UCHAR((PU8)0x40, LATCH >> 8); /* MSB */
+  WRITE_PORT_UCHAR((PUCHAR)0x43, 0x34);  /* binary, mode 2, LSB/MSB, ch 0 */
+  WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH & 0xff); /* LSB */
+  WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH >> 8); /* MSB */
   
   /* Stage 1:  Coarse calibration                                   */
   
@@ -262,7 +209,7 @@ HalpCalibrateStallExecution(VOID)
 
     WaitFor8254Wraparound();
   
-    __KeStallExecutionProcessor(delay_count);      /* Do the delay */
+    __StallExecutionProcessor(delay_count);      /* Do the delay */
   
     CurCount = Read8254Timer();
   } while (CurCount > LATCH / 2);
@@ -281,7 +228,7 @@ HalpCalibrateStallExecution(VOID)
   
     WaitFor8254Wraparound();
   
-    __KeStallExecutionProcessor(delay_count);      /* Do the delay */
+    __StallExecutionProcessor(delay_count);      /* Do the delay */
   
     CurCount = Read8254Timer();
     if (CurCount <= LATCH / 2)   /* If a tick has passed, turn the */
@@ -294,13 +241,13 @@ HalpCalibrateStallExecution(VOID)
 
 
 VOID
-SetComponentInformation(HKEY ComponentKey,
-                       U32 Flags,
-                       U32 Key,
-                       U32 Affinity)
+SetComponentInformation(FRLDRHKEY ComponentKey,
+                       ULONG Flags,
+                       ULONG Key,
+                       ULONG Affinity)
 {
   CM_COMPONENT_INFORMATION CompInfo;
-  S32 Error;
+  LONG Error;
 
   CompInfo.Flags = Flags;
   CompInfo.Version = 0;
@@ -311,7 +258,7 @@ SetComponentInformation(HKEY ComponentKey,
   Error = RegSetValue(ComponentKey,
                      "Component Information",
                      REG_BINARY,
-                     (PU8)&CompInfo,
+                     (PUCHAR)&CompInfo,
                      sizeof(CM_COMPONENT_INFORMATION));
   if (Error != ERROR_SUCCESS)
     {
@@ -321,23 +268,23 @@ SetComponentInformation(HKEY ComponentKey,
 
 
 static VOID
-DetectPnpBios(HKEY SystemKey, U32 *BusNumber)
+DetectPnpBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
 {
   PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
   PCM_PNP_BIOS_DEVICE_NODE DeviceNode;
   PCM_PNP_BIOS_INSTALLATION_CHECK InstData;
   char Buffer[80];
-  HKEY BusKey;
-  U32 x;
-  U32 NodeSize = 0;
-  U32 NodeCount = 0;
-  U8 NodeNumber;
-  U32 FoundNodeCount;
+  FRLDRHKEY BusKey;
+  ULONG x;
+  ULONG NodeSize = 0;
+  ULONG NodeCount = 0;
+  UCHAR NodeNumber;
+  ULONG FoundNodeCount;
   int i;
-  U32 PnpBufferSize;
-  U32 Size;
+  ULONG PnpBufferSize;
+  ULONG Size;
   char *Ptr;
-  S32 Error;
+  LONG Error;
 
   InstData = (PCM_PNP_BIOS_INSTALLATION_CHECK)PnpBiosSupported();
   if (InstData == NULL || strncmp(InstData->Signature, "$PnP", 4))
@@ -388,7 +335,7 @@ DetectPnpBios(HKEY SystemKey, U32 *BusNumber)
   Error = RegSetValue(BusKey,
                      "Identifier",
                      REG_SZ,
-                     (PU8)"PNP BIOS",
+                     (PUCHAR)"PNP BIOS",
                      9);
   if (Error != ERROR_SUCCESS)
     {
@@ -428,7 +375,7 @@ DetectPnpBios(HKEY SystemKey, U32 *BusNumber)
   PnpBufferSize = sizeof(CM_PNP_BIOS_INSTALLATION_CHECK);
   for (i = 0; i < 0xFF; i++)
     {
-      NodeNumber = (U8)i;
+      NodeNumber = (UCHAR)i;
 
       x = PnpBiosGetDeviceNode(&NodeNumber, (PVOID)DISKREADBUFFER);
       if (x == 0)
@@ -466,7 +413,7 @@ DetectPnpBios(HKEY SystemKey, U32 *BusNumber)
   Error = RegSetValue(BusKey,
                      "Configuration Data",
                      REG_FULL_RESOURCE_DESCRIPTOR,
-                     (PU8) FullResourceDescriptor,
+                     (PUCHAR) FullResourceDescriptor,
                      Size);
   MmFreeMemory(FullResourceDescriptor);
   if (Error != ERROR_SUCCESS)
@@ -480,15 +427,15 @@ DetectPnpBios(HKEY SystemKey, U32 *BusNumber)
 
 
 static VOID
-SetHarddiskConfigurationData(HKEY DiskKey,
-                            U32 DriveNumber)
+SetHarddiskConfigurationData(FRLDRHKEY DiskKey,
+                            ULONG DriveNumber)
 {
   PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
   PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
   EXTENDED_GEOMETRY ExtGeometry;
   GEOMETRY Geometry;
-  U32 Size;
-  S32 Error;
+  ULONG Size;
+  LONG Error;
 
   /* Set 'Configuration Data' value */
   Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) +
@@ -548,7 +495,7 @@ SetHarddiskConfigurationData(HKEY DiskKey,
   Error = RegSetValue(DiskKey,
                      "Configuration Data",
                      REG_FULL_RESOURCE_DESCRIPTOR,
-                     (PU8) FullResourceDescriptor,
+                     (PUCHAR) FullResourceDescriptor,
                      Size);
   MmFreeMemory(FullResourceDescriptor);
   if (Error != ERROR_SUCCESS)
@@ -561,16 +508,16 @@ SetHarddiskConfigurationData(HKEY DiskKey,
 
 
 static VOID
-SetHarddiskIdentifier(HKEY DiskKey,
-                     U32 DriveNumber)
+SetHarddiskIdentifier(FRLDRHKEY DiskKey,
+                     ULONG DriveNumber)
 {
   PMASTER_BOOT_RECORD Mbr;
-  U32 *Buffer;
-  U32 i;
-  U32 Checksum;
-  U32 Signature;
+  ULONG *Buffer;
+  ULONG i;
+  ULONG Checksum;
+  ULONG Signature;
   char Identifier[20];
-  S32 Error;
+  LONG Error;
 
   /* Read the MBR */
   if (!MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, (PVOID)DISKREADBUFFER))
@@ -579,7 +526,7 @@ SetHarddiskIdentifier(HKEY DiskKey,
       return;
     }
 
-  Buffer = (U32*)DISKREADBUFFER;
+  Buffer = (ULONG*)DISKREADBUFFER;
   Mbr = (PMASTER_BOOT_RECORD)DISKREADBUFFER;
 
   Signature =  Mbr->Signature;
@@ -621,7 +568,7 @@ SetHarddiskIdentifier(HKEY DiskKey,
   Error = RegSetValue(DiskKey,
                      "Identifier",
                      REG_SZ,
-                     (PU8) Identifier,
+                     (PUCHAR) Identifier,
                      20);
   if (Error != ERROR_SUCCESS)
     {
@@ -633,18 +580,18 @@ SetHarddiskIdentifier(HKEY DiskKey,
 
 
 static VOID
-DetectBiosDisks(HKEY SystemKey,
-               HKEY BusKey)
+DetectBiosDisks(FRLDRHKEY SystemKey,
+               FRLDRHKEY BusKey)
 {
   PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
   PCM_INT13_DRIVE_PARAMETER Int13Drives;
   GEOMETRY Geometry;
   CHAR Buffer[80];
-  HKEY DiskKey;
-  U32 DiskCount;
-  U32 Size;
-  U32 i;
-  S32 Error;
+  FRLDRHKEY DiskKey;
+  ULONG DiskCount;
+  ULONG Size;
+  ULONG i;
+  LONG Error;
   BOOL Changed;
 
   /* Count the number of visible drives */
@@ -726,7 +673,7 @@ DetectBiosDisks(HKEY SystemKey,
   Error = RegSetValue(SystemKey,
                      "Configuration Data",
                      REG_FULL_RESOURCE_DESCRIPTOR,
-                     (PU8) FullResourceDescriptor,
+                     (PUCHAR) FullResourceDescriptor,
                      Size);
   MmFreeMemory(FullResourceDescriptor);
   if (Error != ERROR_SUCCESS)
@@ -762,10 +709,10 @@ DetectBiosDisks(HKEY SystemKey,
 }
 
 
-static U32
+static ULONG
 GetFloppyCount(VOID)
 {
-  U8 Data;
+  UCHAR Data;
 
   WRITE_PORT_UCHAR((PUCHAR)0x70, 0x10);
   Data = READ_PORT_UCHAR((PUCHAR)0x71);
@@ -774,10 +721,10 @@ GetFloppyCount(VOID)
 }
 
 
-static U8
-GetFloppyType(U8 DriveNumber)
+static UCHAR
+GetFloppyType(UCHAR DriveNumber)
 {
-  U8 Data;
+  UCHAR Data;
 
   WRITE_PORT_UCHAR((PUCHAR)0x70, 0x10);
   Data = READ_PORT_UCHAR((PUCHAR)0x71);
@@ -794,28 +741,28 @@ GetFloppyType(U8 DriveNumber)
 static PVOID
 GetInt1eTable(VOID)
 {
-  PU16 SegPtr = (PU16)0x7A;
-  PU16 OfsPtr = (PU16)0x78;
+  PUSHORT SegPtr = (PUSHORT)0x7A;
+  PUSHORT OfsPtr = (PUSHORT)0x78;
 
-  return (PVOID)(((U32)(*SegPtr)) << 4) + (U32)(*OfsPtr);
+  return (PVOID)(((ULONG)(*SegPtr)) << 4) + (ULONG)(*OfsPtr);
 }
 
 
 static VOID
-DetectBiosFloppyPeripheral(HKEY ControllerKey)
+DetectBiosFloppyPeripheral(FRLDRHKEY ControllerKey)
 {
   PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
   PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
   PCM_FLOPPY_DEVICE_DATA FloppyData;
   char KeyName[32];
   char Identifier[20];
-  HKEY PeripheralKey;
-  U32 Size;
-  S32 Error;
-  U32 FloppyNumber;
-  U8 FloppyType;
-  U32 MaxDensity[6] = {0, 360, 1200, 720, 1440, 2880};
-  PU8 Ptr;
+  FRLDRHKEY PeripheralKey;
+  ULONG Size;
+  LONG Error;
+  ULONG FloppyNumber;
+  UCHAR FloppyType;
+  ULONG MaxDensity[6] = {0, 360, 1200, 720, 1440, 2880};
+  PUCHAR Ptr;
 
   for (FloppyNumber = 0; FloppyNumber < 2; FloppyNumber++)
   {
@@ -882,7 +829,7 @@ DetectBiosFloppyPeripheral(HKEY ControllerKey)
     Error = RegSetValue(PeripheralKey,
                        "Configuration Data",
                        REG_FULL_RESOURCE_DESCRIPTOR,
-                       (PU8) FullResourceDescriptor,
+                       (PUCHAR) FullResourceDescriptor,
                        Size);
     MmFreeMemory(FullResourceDescriptor);
     if (Error != ERROR_SUCCESS)
@@ -898,7 +845,7 @@ DetectBiosFloppyPeripheral(HKEY ControllerKey)
     Error = RegSetValue(PeripheralKey,
                        "Identifier",
                        REG_SZ,
-                       (PU8)Identifier,
+                       (PUCHAR)Identifier,
                        strlen(Identifier) + 1);
     if (Error != ERROR_SUCCESS)
     {
@@ -911,15 +858,15 @@ DetectBiosFloppyPeripheral(HKEY ControllerKey)
 
 
 static VOID
-DetectBiosFloppyController(HKEY SystemKey,
-                          HKEY BusKey)
+DetectBiosFloppyController(FRLDRHKEY SystemKey,
+                          FRLDRHKEY BusKey)
 {
   PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
   PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
-  HKEY ControllerKey;
-  U32 Size;
-  S32 Error;
-  U32 FloppyCount;
+  FRLDRHKEY ControllerKey;
+  ULONG Size;
+  LONG Error;
+  ULONG FloppyCount;
 
   FloppyCount = GetFloppyCount();
   DbgPrint((DPRINT_HWDETECT,
@@ -967,7 +914,8 @@ DetectBiosFloppyController(HKEY SystemKey,
   PartialDescriptor->Type = CmResourceTypePort;
   PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
   PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
-  PartialDescriptor->u.Port.Start = (U64)0x03F0;
+  PartialDescriptor->u.Port.Start.LowPart = 0x03F0;
+  PartialDescriptor->u.Port.Start.HighPart = 0x0;
   PartialDescriptor->u.Port.Length = 8;
 
   /* Set Interrupt */
@@ -991,7 +939,7 @@ DetectBiosFloppyController(HKEY SystemKey,
   Error = RegSetValue(ControllerKey,
                      "Configuration Data",
                      REG_FULL_RESOURCE_DESCRIPTOR,
-                     (PU8) FullResourceDescriptor,
+                     (PUCHAR) FullResourceDescriptor,
                      Size);
   MmFreeMemory(FullResourceDescriptor);
   if (Error != ERROR_SUCCESS)
@@ -1007,8 +955,8 @@ DetectBiosFloppyController(HKEY SystemKey,
 
 
 static VOID
-InitializeSerialPort(U32 Port,
-                    U32 LineControl)
+InitializeSerialPort(ULONG Port,
+                    ULONG LineControl)
 {
   WRITE_PORT_UCHAR((PUCHAR)Port + 3, 0x80);  /* set DLAB on   */
   WRITE_PORT_UCHAR((PUCHAR)Port,     0x60);  /* speed LO byte */
@@ -1020,18 +968,18 @@ InitializeSerialPort(U32 Port,
 }
 
 
-static U32
-DetectSerialMouse(U32 Port)
+static ULONG
+DetectSerialMouse(ULONG Port)
 {
   CHAR Buffer[4];
-  U32 i;
-  U32 TimeOut = 200;
-  U8 LineControl;
+  ULONG i;
+  ULONG TimeOut = 200;
+  UCHAR LineControl;
 
   /* Shutdown mouse or something like that */
   LineControl = READ_PORT_UCHAR((PUCHAR)Port + 4);
   WRITE_PORT_UCHAR((PUCHAR)Port + 4, (LineControl & ~0x02) | 0x01);
-  KeStallExecutionProcessor(100000);
+  StallExecutionProcessor(100000);
 
   /* Clear buffer */
   while (READ_PORT_UCHAR((PUCHAR)Port + 5) & 0x01)
@@ -1044,14 +992,14 @@ DetectSerialMouse(U32 Port)
   WRITE_PORT_UCHAR((PUCHAR)Port + 4, 0x0b);
 
   /* Wait 10 milliseconds for the mouse getting ready */
-  KeStallExecutionProcessor(10000);
+  StallExecutionProcessor(10000);
 
   /* Read first four bytes, which contains Microsoft Mouse signs */
   for (i = 0; i < 4; i++)
     {
       while (((READ_PORT_UCHAR((PUCHAR)Port + 5) & 1) == 0) && (TimeOut > 0))
        {
-         KeStallExecutionProcessor(1000);
+         StallExecutionProcessor(1000);
          --TimeOut;
          if (TimeOut == 0)
            return MOUSE_TYPE_NONE;
@@ -1107,29 +1055,29 @@ DetectSerialMouse(U32 Port)
 }
 
 
-static U32
-GetSerialMousePnpId(U32 Port, char *Buffer)
+static ULONG
+GetSerialMousePnpId(ULONG Port, char *Buffer)
 {
-  U32 TimeOut;
-  U32 i = 0;
+  ULONG TimeOut;
+  ULONG i = 0;
   char c;
   char x;
 
   WRITE_PORT_UCHAR((PUCHAR)Port + 4, 0x09);
 
   /* Wait 10 milliseconds for the mouse getting ready */
-  KeStallExecutionProcessor(10000);
+  StallExecutionProcessor(10000);
 
   WRITE_PORT_UCHAR((PUCHAR)Port + 4, 0x0b);
 
-  KeStallExecutionProcessor(10000);
+  StallExecutionProcessor(10000);
 
   for (;;)
     {
       TimeOut = 200;
       while (((READ_PORT_UCHAR((PUCHAR)Port + 5) & 1) == 0) && (TimeOut > 0))
        {
-         KeStallExecutionProcessor(1000);
+         StallExecutionProcessor(1000);
          --TimeOut;
          if (TimeOut == 0)
            {
@@ -1150,7 +1098,7 @@ GetSerialMousePnpId(U32 Port, char *Buffer)
       TimeOut = 200;
       while (((READ_PORT_UCHAR((PUCHAR)Port + 5) & 1) == 0) && (TimeOut > 0))
        {
-         KeStallExecutionProcessor(1000);
+         StallExecutionProcessor(1000);
          --TimeOut;
          if (TimeOut == 0)
            return 0;
@@ -1168,18 +1116,18 @@ GetSerialMousePnpId(U32 Port, char *Buffer)
 
 
 static VOID
-DetectSerialPointerPeripheral(HKEY ControllerKey,
-                             U32 Base)
+DetectSerialPointerPeripheral(FRLDRHKEY ControllerKey,
+                             ULONG Base)
 {
   CM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
   char Buffer[256];
   char Identifier[256];
-  HKEY PeripheralKey;
-  U32 MouseType;
-  U32 Length;
-  U32 i;
-  U32 j;
-  S32 Error;
+  FRLDRHKEY PeripheralKey;
+  ULONG MouseType;
+  ULONG Length;
+  ULONG i;
+  ULONG j;
+  LONG Error;
 
   DbgPrint((DPRINT_HWDETECT,
            "DetectSerialPointerPeripheral()\n"));
@@ -1332,7 +1280,7 @@ DetectSerialPointerPeripheral(HKEY ControllerKey,
       Error = RegSetValue(PeripheralKey,
                          "Configuration Data",
                          REG_FULL_RESOURCE_DESCRIPTOR,
-                         (PU8)&FullResourceDescriptor,
+                         (PUCHAR)&FullResourceDescriptor,
                          sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
                          sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
       if (Error != ERROR_SUCCESS)
@@ -1346,7 +1294,7 @@ DetectSerialPointerPeripheral(HKEY ControllerKey,
       Error = RegSetValue(PeripheralKey,
                          "Identifier",
                          REG_SZ,
-                         (PU8)Identifier,
+                         (PUCHAR)Identifier,
                          strlen(Identifier) + 1);
       if (Error != ERROR_SUCCESS)
        {
@@ -1359,28 +1307,28 @@ DetectSerialPointerPeripheral(HKEY ControllerKey,
 
 
 static VOID
-DetectSerialPorts(HKEY BusKey)
+DetectSerialPorts(FRLDRHKEY BusKey)
 {
   PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
   PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
   PCM_SERIAL_DEVICE_DATA SerialDeviceData;
-  U32 Irq[4] = {4, 3, 4, 3};
-  U32 Base;
+  ULONG Irq[4] = {4, 3, 4, 3};
+  ULONG Base;
   char Buffer[80];
-  PU16 BasePtr;
-  U32 ControllerNumber = 0;
-  HKEY ControllerKey;
-  U32 i;
-  S32 Error;
-  U32 Size;
+  PUSHORT BasePtr;
+  ULONG ControllerNumber = 0;
+  FRLDRHKEY ControllerKey;
+  ULONG i;
+  LONG Error;
+  ULONG Size;
 
   DbgPrint((DPRINT_HWDETECT, "DetectSerialPorts()\n"));
 
   ControllerNumber = 0;
-  BasePtr = (PU16)0x400;
+  BasePtr = (PUSHORT)0x400;
   for (i = 0; i < 4; i++, BasePtr++)
     {
-      Base = (U32)*BasePtr;
+      Base = (ULONG)*BasePtr;
       if (Base == 0)
         continue;
 
@@ -1433,7 +1381,8 @@ DetectSerialPorts(HKEY BusKey)
       PartialDescriptor->Type = CmResourceTypePort;
       PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
       PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
-      PartialDescriptor->u.Port.Start = (U64)Base;
+      PartialDescriptor->u.Port.Start.LowPart = Base;
+      PartialDescriptor->u.Port.Start.HighPart = 0x0;
       PartialDescriptor->u.Port.Length = 7;
 
       /* Set Interrupt */
@@ -1460,7 +1409,7 @@ DetectSerialPorts(HKEY BusKey)
       Error = RegSetValue(ControllerKey,
                          "Configuration Data",
                          REG_FULL_RESOURCE_DESCRIPTOR,
-                         (PU8) FullResourceDescriptor,
+                         (PUCHAR) FullResourceDescriptor,
                          Size);
       MmFreeMemory(FullResourceDescriptor);
       if (Error != ERROR_SUCCESS)
@@ -1477,7 +1426,7 @@ DetectSerialPorts(HKEY BusKey)
       Error = RegSetValue(ControllerKey,
                          "Identifier",
                          REG_SZ,
-                         (PU8)Buffer,
+                         (PUCHAR)Buffer,
                          strlen(Buffer) + 1);
       if (Error != ERROR_SUCCESS)
        {
@@ -1499,27 +1448,27 @@ DetectSerialPorts(HKEY BusKey)
 
 
 static VOID
-DetectParallelPorts(HKEY BusKey)
+DetectParallelPorts(FRLDRHKEY BusKey)
 {
   PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
   PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
-  U32 Irq[3] = {7, 5, (U32)-1};
+  ULONG Irq[3] = {7, 5, (ULONG)-1};
   char Buffer[80];
-  HKEY ControllerKey;
-  PU16 BasePtr;
-  U32 Base;
-  U32 ControllerNumber;
-  U32 i;
-  S32 Error;
-  U32 Size;
+  FRLDRHKEY ControllerKey;
+  PUSHORT BasePtr;
+  ULONG Base;
+  ULONG ControllerNumber;
+  ULONG i;
+  LONG Error;
+  ULONG Size;
 
   DbgPrint((DPRINT_HWDETECT, "DetectParallelPorts() called\n"));
 
   ControllerNumber = 0;
-  BasePtr = (PU16)0x408;
+  BasePtr = (PUSHORT)0x408;
   for (i = 0; i < 3; i++, BasePtr++)
     {
-      Base = (U32)*BasePtr;
+      Base = (ULONG)*BasePtr;
       if (Base == 0)
         continue;
 
@@ -1551,7 +1500,7 @@ DetectParallelPorts(HKEY BusKey)
 
       /* Build full device descriptor */
       Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
-      if (Irq[i] != (U32)-1)
+      if (Irq[i] != (ULONG)-1)
        Size += sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
 
       FullResourceDescriptor = MmAllocateMemory(Size);
@@ -1566,18 +1515,19 @@ DetectParallelPorts(HKEY BusKey)
       /* Initialize resource descriptor */
       FullResourceDescriptor->InterfaceType = Isa;
       FullResourceDescriptor->BusNumber = 0;
-      FullResourceDescriptor->PartialResourceList.Count = (Irq[i] != (U32)-1) ? 2 : 1;
+      FullResourceDescriptor->PartialResourceList.Count = (Irq[i] != (ULONG)-1) ? 2 : 1;
 
       /* Set IO Port */
       PartialDescriptor = &FullResourceDescriptor->PartialResourceList.PartialDescriptors[0];
       PartialDescriptor->Type = CmResourceTypePort;
       PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
       PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
-      PartialDescriptor->u.Port.Start = (U64)Base;
+      PartialDescriptor->u.Port.Start.LowPart = Base;
+      PartialDescriptor->u.Port.Start.HighPart = 0x0;
       PartialDescriptor->u.Port.Length = 3;
 
       /* Set Interrupt */
-      if (Irq[i] != (U32)-1)
+      if (Irq[i] != (ULONG)-1)
        {
          PartialDescriptor = &FullResourceDescriptor->PartialResourceList.PartialDescriptors[1];
          PartialDescriptor->Type = CmResourceTypeInterrupt;
@@ -1592,7 +1542,7 @@ DetectParallelPorts(HKEY BusKey)
       Error = RegSetValue(ControllerKey,
                          "Configuration Data",
                          REG_FULL_RESOURCE_DESCRIPTOR,
-                         (PU8) FullResourceDescriptor,
+                         (PUCHAR) FullResourceDescriptor,
                          Size);
       MmFreeMemory(FullResourceDescriptor);
       if (Error != ERROR_SUCCESS)
@@ -1609,7 +1559,7 @@ DetectParallelPorts(HKEY BusKey)
       Error = RegSetValue(ControllerKey,
                          "Identifier",
                          REG_SZ,
-                         (PU8)Buffer,
+                         (PUCHAR)Buffer,
                          strlen(Buffer) + 1);
       if (Error != ERROR_SUCCESS)
        {
@@ -1638,7 +1588,7 @@ DetectKeyboardDevice(VOID)
   WRITE_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_DATA,
                   0xF2);
 
-  KeStallExecutionProcessor(10000);
+  StallExecutionProcessor(10000);
 
   Status = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_STATUS);
   if ((Status & 0x01) != 0x01)
@@ -1654,7 +1604,7 @@ DetectKeyboardDevice(VOID)
       return FALSE;
     }
 
-  KeStallExecutionProcessor(10000);
+  StallExecutionProcessor(10000);
   Status = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_STATUS);
   if ((Status & 0x01) != 0x01)
     {
@@ -1669,7 +1619,7 @@ DetectKeyboardDevice(VOID)
       return FALSE;
     }
 
-  KeStallExecutionProcessor(10000);
+  StallExecutionProcessor(10000);
   Status = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_STATUS);
   if ((Status & 0x01) != 0x01)
     {
@@ -1690,15 +1640,15 @@ DetectKeyboardDevice(VOID)
 
 
 static VOID
-DetectKeyboardPeripheral(HKEY ControllerKey)
+DetectKeyboardPeripheral(FRLDRHKEY ControllerKey)
 {
   PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
   PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
   PCM_KEYBOARD_DEVICE_DATA KeyboardData;
-  HKEY PeripheralKey;
+  FRLDRHKEY PeripheralKey;
   char Buffer[80];
-  U32 Size;
-  S32 Error;
+  ULONG Size;
+  LONG Error;
 
   if (DetectKeyboardDevice())
   {
@@ -1752,7 +1702,7 @@ DetectKeyboardPeripheral(HKEY ControllerKey)
     Error = RegSetValue(PeripheralKey,
                        "Configuration Data",
                        REG_FULL_RESOURCE_DESCRIPTOR,
-                       (PU8)FullResourceDescriptor,
+                       (PUCHAR)FullResourceDescriptor,
                        Size);
     MmFreeMemory(FullResourceDescriptor);
     if (Error != ERROR_SUCCESS)
@@ -1768,7 +1718,7 @@ DetectKeyboardPeripheral(HKEY ControllerKey)
     Error = RegSetValue(ControllerKey,
                        "Identifier",
                        REG_SZ,
-                       (PU8)Buffer,
+                       (PUCHAR)Buffer,
                        strlen(Buffer) + 1);
     if (Error != ERROR_SUCCESS)
     {
@@ -1781,13 +1731,13 @@ DetectKeyboardPeripheral(HKEY ControllerKey)
 
 
 static VOID
-DetectKeyboardController(HKEY BusKey)
+DetectKeyboardController(FRLDRHKEY BusKey)
 {
   PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
   PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
-  HKEY ControllerKey;
-  U32 Size;
-  S32 Error;
+  FRLDRHKEY ControllerKey;
+  ULONG Size;
+  LONG Error;
 
   /* Create controller key */
   Error = RegCreateKey(BusKey,
@@ -1837,7 +1787,8 @@ DetectKeyboardController(HKEY BusKey)
   PartialDescriptor->Type = CmResourceTypePort;
   PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
   PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
-  PartialDescriptor->u.Port.Start = (U64)0x60;
+  PartialDescriptor->u.Port.Start.LowPart = 0x60;
+  PartialDescriptor->u.Port.Start.HighPart = 0x0;
   PartialDescriptor->u.Port.Length = 1;
 
   /* Set IO Port 0x64 */
@@ -1845,14 +1796,15 @@ DetectKeyboardController(HKEY BusKey)
   PartialDescriptor->Type = CmResourceTypePort;
   PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
   PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
-  PartialDescriptor->u.Port.Start = (U64)0x64;
+  PartialDescriptor->u.Port.Start.LowPart = 0x64;
+  PartialDescriptor->u.Port.Start.HighPart = 0x0;
   PartialDescriptor->u.Port.Length = 1;
 
   /* Set 'Configuration Data' value */
   Error = RegSetValue(ControllerKey,
                      "Configuration Data",
                      REG_FULL_RESOURCE_DESCRIPTOR,
-                     (PU8)FullResourceDescriptor,
+                     (PUCHAR)FullResourceDescriptor,
                      Size);
   MmFreeMemory(FullResourceDescriptor);
   if (Error != ERROR_SUCCESS)
@@ -1870,8 +1822,8 @@ DetectKeyboardController(HKEY BusKey)
 static VOID
 PS2ControllerWait(VOID)
 {
-  U32 Timeout;
-  U8 Status;
+  ULONG Timeout;
+  UCHAR Status;
 
   for (Timeout = 0; Timeout < CONTROLLER_TIMEOUT; Timeout++)
     {
@@ -1880,7 +1832,7 @@ PS2ControllerWait(VOID)
        return;
 
       /* Sleep for one millisecond */
-      KeStallExecutionProcessor(1000);
+      StallExecutionProcessor(1000);
     }
 }
 
@@ -1888,9 +1840,9 @@ PS2ControllerWait(VOID)
 static BOOLEAN
 DetectPS2AuxPort(VOID)
 {
-  U32 Loops;
-  U8 Scancode;
-  U8 Status;
+  ULONG Loops;
+  UCHAR Scancode;
+  UCHAR Status;
 
   /* Put the value 0x5A in the output buffer using the
    * "WriteAuxiliary Device Output Buffer" command (0xD3).
@@ -1922,7 +1874,7 @@ DetectPS2AuxPort(VOID)
          break;
        }
 
-      KeStallExecutionProcessor(10000);
+      StallExecutionProcessor(10000);
     }
 
   return FALSE;
@@ -1932,8 +1884,8 @@ DetectPS2AuxPort(VOID)
 static BOOLEAN
 DetectPS2AuxDevice(VOID)
 {
-  U8 Scancode;
-  U8 Status;
+  UCHAR Scancode;
+  UCHAR Status;
 
   PS2ControllerWait();
   WRITE_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_CONTROL,
@@ -1944,7 +1896,7 @@ DetectPS2AuxDevice(VOID)
   WRITE_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_DATA,
                   0xF2);
 
-  KeStallExecutionProcessor(10000);
+  StallExecutionProcessor(10000);
 
   Status = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_STATUS);
   if ((Status & CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL) == 0)
@@ -1956,7 +1908,7 @@ DetectPS2AuxDevice(VOID)
   if (Scancode != 0xFA)
     return FALSE;
 
-  KeStallExecutionProcessor(10000);
+  StallExecutionProcessor(10000);
 
   Status = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_STATUS);
   if ((Status & CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL) == 0)
@@ -1973,12 +1925,12 @@ DetectPS2AuxDevice(VOID)
 
 
 static VOID
-DetectPS2Mouse(HKEY BusKey)
+DetectPS2Mouse(FRLDRHKEY BusKey)
 {
   CM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
-  HKEY ControllerKey;
-  HKEY PeripheralKey;
-  S32 Error;
+  FRLDRHKEY ControllerKey;
+  FRLDRHKEY PeripheralKey;
+  LONG Error;
 
   if (DetectPS2AuxPort())
     {
@@ -2020,7 +1972,7 @@ DetectPS2Mouse(HKEY BusKey)
       Error = RegSetValue(ControllerKey,
                          "Configuration Data",
                          REG_FULL_RESOURCE_DESCRIPTOR,
-                         (PU8)&FullResourceDescriptor,
+                         (PUCHAR)&FullResourceDescriptor,
                          sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
       if (Error != ERROR_SUCCESS)
        {
@@ -2062,7 +2014,7 @@ DetectPS2Mouse(HKEY BusKey)
          Error = RegSetValue(PeripheralKey,
                              "Configuration Data",
                              REG_FULL_RESOURCE_DESCRIPTOR,
-                             (PU8)&FullResourceDescriptor,
+                             (PUCHAR)&FullResourceDescriptor,
                              sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
                              sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
          if (Error != ERROR_SUCCESS)
@@ -2077,7 +2029,7 @@ DetectPS2Mouse(HKEY BusKey)
          Error = RegSetValue(PeripheralKey,
                              "Identifier",
                              REG_SZ,
-                             (PU8)"MICROSOFT PS2 MOUSE",
+                             (PUCHAR)"MICROSOFT PS2 MOUSE",
                              20);
          if (Error != ERROR_SUCCESS)
            {
@@ -2092,12 +2044,12 @@ DetectPS2Mouse(HKEY BusKey)
 
 
 static VOID
-DetectDisplayController(HKEY BusKey)
+DetectDisplayController(FRLDRHKEY BusKey)
 {
   CHAR Buffer[80];
-  HKEY ControllerKey;
-  U16 VesaVersion;
-  S32 Error;
+  FRLDRHKEY ControllerKey;
+  USHORT VesaVersion;
+  LONG Error;
 
   Error = RegCreateKey(BusKey,
                       "DisplayController\\0",
@@ -2146,7 +2098,7 @@ DetectDisplayController(HKEY BusKey)
   Error = RegSetValue(ControllerKey,
                      "Identifier",
                      REG_SZ,
-                     (PU8)Buffer,
+                     (PUCHAR)Buffer,
                      strlen(Buffer) + 1);
   if (Error != ERROR_SUCCESS)
     {
@@ -2161,13 +2113,13 @@ DetectDisplayController(HKEY BusKey)
 
 
 static VOID
-DetectIsaBios(HKEY SystemKey, U32 *BusNumber)
+DetectIsaBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
 {
   PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
   char Buffer[80];
-  HKEY BusKey;
-  U32 Size;
-  S32 Error;
+  FRLDRHKEY BusKey;
+  ULONG Size;
+  LONG Error;
 
   /* Create new bus key */
   sprintf(Buffer,
@@ -2194,7 +2146,7 @@ DetectIsaBios(HKEY SystemKey, U32 *BusNumber)
   Error = RegSetValue(BusKey,
                      "Identifier",
                      REG_SZ,
-                     (PU8)"ISA",
+                     (PUCHAR)"ISA",
                      4);
   if (Error != ERROR_SUCCESS)
     {
@@ -2223,7 +2175,7 @@ DetectIsaBios(HKEY SystemKey, U32 *BusNumber)
   Error = RegSetValue(BusKey,
                      "Configuration Data",
                      REG_FULL_RESOURCE_DESCRIPTOR,
-                     (PU8) FullResourceDescriptor,
+                     (PUCHAR) FullResourceDescriptor,
                      Size);
   MmFreeMemory(FullResourceDescriptor);
   if (Error != ERROR_SUCCESS)
@@ -2256,9 +2208,9 @@ DetectIsaBios(HKEY SystemKey, U32 *BusNumber)
 VOID
 PcHwDetect(VOID)
 {
-  HKEY SystemKey;
-  U32 BusNumber = 0;
-  S32 Error;
+  FRLDRHKEY SystemKey;
+  ULONG BusNumber = 0;
+  LONG Error;
 
   DbgPrint((DPRINT_HWDETECT, "DetectHardware()\n"));
 
index fe5720a..49a39dd 100644 (file)
 #include "../../reactos/registry.h"
 #endif
 
-typedef enum
-{
-  InterfaceTypeUndefined = -1,
-  Internal,
-  Isa,
-  Eisa,
-  MicroChannel,
-  TurboChannel,
-  PCIBus,
-  VMEBus,
-  NuBus,
-  PCMCIABus,
-  CBus,
-  MPIBus,
-  MPSABus,
-  ProcessorInternal,
-  InternalPowerBus,
-  PNPISABus,
-  MaximumInterfaceType
-} INTERFACE_TYPE, *PINTERFACE_TYPE;
-
-
-typedef enum _CM_RESOURCE_TYPE
-{
-  CmResourceTypeNull = 0,
-  CmResourceTypePort,
-  CmResourceTypeInterrupt,
-  CmResourceTypeMemory,
-  CmResourceTypeDma,
-  CmResourceTypeDeviceSpecific,
-  CmResourceTypeMaximum
-} CM_RESOURCE_TYPE;
-
-
-typedef enum _CM_SHARE_DISPOSITION
-{
-  CmResourceShareUndetermined = 0,
-  CmResourceShareDeviceExclusive,
-  CmResourceShareDriverExclusive,
-  CmResourceShareShared
-} CM_SHARE_DISPOSITION;
-
-
-typedef U64 PHYSICAL_ADDRESS;
-
-
-typedef struct
-{
-  U8 Type;
-  U8 ShareDisposition;
-  U16 Flags;
-  union
-    {
-      struct
-       {
-         PHYSICAL_ADDRESS Start;
-         U32 Length;
-       } __attribute__((packed)) Port;
-      struct
-       {
-         U32 Level;
-         U32 Vector;
-         U32 Affinity;
-       } __attribute__((packed)) Interrupt;
-      struct
-       {
-         PHYSICAL_ADDRESS Start;
-         U32 Length;
-       } __attribute__((packed)) Memory;
-      struct
-       {
-         U32 Channel;
-         U32 Port;
-         U32 Reserved1;
-       } __attribute__((packed)) Dma;
-      struct
-       {
-         U32 DataSize;
-         U32 Reserved1;
-         U32 Reserved2;
-       } __attribute__((packed)) DeviceSpecificData;
-    } __attribute__((packed)) u;
-} __attribute__((packed)) CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
-
-
 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags */
 #define CM_RESOURCE_PORT_MEMORY               0x0000
 #define CM_RESOURCE_PORT_IO                   0x0001
@@ -117,30 +32,12 @@ typedef struct
 #define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0x0000
 #define CM_RESOURCE_INTERRUPT_LATCHED         0x0001
 
-
-typedef struct
-{
-  U16 Version;
-  U16 Revision;
-  U32 Count;
-  CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
-} __attribute__((packed))CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
-
-
-typedef struct
-{
-  INTERFACE_TYPE InterfaceType;
-  U32 BusNumber;
-  CM_PARTIAL_RESOURCE_LIST PartialResourceList;
-} __attribute__((packed)) CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
-
-
 typedef struct _CM_COMPONENT_INFORMATION
 {
-  U32 Flags;
-  U32 Version;
-  U32 Key;
-  U32 Affinity;
+  ULONG Flags;
+  ULONG Version;
+  ULONG Key;
+  ULONG Affinity;
 } __attribute__((packed)) CM_COMPONENT_INFORMATION, *PCM_COMPONENT_INFORMATION;
 
 
@@ -154,46 +51,48 @@ typedef struct _CM_COMPONENT_INFORMATION
 #define Output      0x00000040
 
 #define CONFIG_CMD(bus, dev_fn, where) \
-       (0x80000000 | (((U32)(bus)) << 16) | (((dev_fn) & 0x1F) << 11) | (((dev_fn) & 0xE0) << 3) | ((where) & ~3))
+       (0x80000000 | (((ULONG)(bus)) << 16) | (((dev_fn) & 0x1F) << 11) | (((dev_fn) & 0xE0) << 3) | ((where) & ~3))
 
 /* PROTOTYPES ***************************************************************/
 
 /* hardware.c */
+
+VOID StallExecutionProcessor(ULONG Microseconds);
+
 VOID HalpCalibrateStallExecution(VOID);
-VOID KeStallExecutionProcessor(U32 Microseconds);
 
-VOID SetComponentInformation(HKEY ComponentKey,
-                            U32 Flags,
-                            U32 Key,
-                            U32 Affinity);
+VOID SetComponentInformation(FRLDRHKEY ComponentKey,
+                            ULONG Flags,
+                            ULONG Key,
+                            ULONG Affinity);
 
 /* hwacpi.c */
-VOID DetectAcpiBios(HKEY SystemKey, U32 *BusNumber);
+VOID DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber);
 
 /* hwapm.c */
-VOID DetectApmBios(HKEY SystemKey, U32 *BusNumber);
+VOID DetectApmBios(FRLDRHKEY SystemKey, ULONG *BusNumber);
 
 /* hwcpu.c */
-VOID DetectCPUs(HKEY SystemKey);
+VOID DetectCPUs(FRLDRHKEY SystemKey);
 
 /* hwpci.c */
-VOID DetectPciBios(HKEY SystemKey, U32 *BusNumber);
+VOID DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber);
 
 /* i386cpu.S */
-U32 CpuidSupported(VOID);
-VOID GetCpuid(U32 Level,
-             U32 *eax,
-             U32 *ebx,
-             U32 *ecx,
-             U32 *edx);
-U64 RDTSC(VOID);
+ULONG CpuidSupported(VOID);
+VOID GetCpuid(ULONG Level,
+             ULONG *eax,
+             ULONG *ebx,
+             ULONG *ecx,
+             ULONG *edx);
+ULONGLONG RDTSC(VOID);
 
 /* i386pnp.S */
-U32 PnpBiosSupported(VOID);
-U32 PnpBiosGetDeviceNodeCount(U32 *NodeSize,
-                             U32 *NodeCount);
-U32 PnpBiosGetDeviceNode(U8 *NodeId,
-                        U8 *NodeBuffer);
+ULONG PnpBiosSupported(VOID);
+ULONG PnpBiosGetDeviceNodeCount(ULONG *NodeSize,
+                             ULONG *NodeCount);
+ULONG PnpBiosGetDeviceNode(UCHAR *NodeId,
+                        UCHAR *NodeBuffer);
 
 #endif /* __I386_HARDWARE_H_ */
 
index c8dacbc..733f71a 100644 (file)
 static BOOL
 FindAcpiBios(VOID)
 {
-  PU8 Ptr;
+  PUCHAR Ptr;
 
   /* Find the 'Root System Descriptor Table Pointer' */
-  Ptr = (PU8)0xE0000;
-  while ((U32)Ptr < 0x100000)
+  Ptr = (PUCHAR)0xE0000;
+  while ((ULONG)Ptr < 0x100000)
     {
       if (!memcmp(Ptr, "RSD PTR ", 8))
        {
@@ -45,7 +45,7 @@ FindAcpiBios(VOID)
          return TRUE;
        }
 
-      Ptr = (PU8)((U32)Ptr + 0x10);
+      Ptr = (PUCHAR)((ULONG)Ptr + 0x10);
     }
 
   DbgPrint((DPRINT_HWDETECT, "ACPI not supported\n"));
@@ -55,11 +55,11 @@ FindAcpiBios(VOID)
 
 
 VOID
-DetectAcpiBios(HKEY SystemKey, U32 *BusNumber)
+DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
 {
   char Buffer[80];
-  HKEY BiosKey;
-  S32 Error;
+  FRLDRHKEY BiosKey;
+  LONG Error;
 
   if (FindAcpiBios())
     {
@@ -90,7 +90,7 @@ DetectAcpiBios(HKEY SystemKey, U32 *BusNumber)
       Error = RegSetValue(BiosKey,
                          "Identifier",
                          REG_SZ,
-                         (PU8)"ACPI BIOS",
+                         (PUCHAR)"ACPI BIOS",
                          10);
       if (Error != ERROR_SUCCESS)
        {
index 7da6d7d..a4c43b1 100644 (file)
@@ -60,11 +60,11 @@ FindApmBios(VOID)
 
 
 VOID
-DetectApmBios(HKEY SystemKey, U32 *BusNumber)
+DetectApmBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
 {
   char Buffer[80];
-  HKEY BiosKey;
-  S32 Error;
+  FRLDRHKEY BiosKey;
+  LONG Error;
 
   if (FindApmBios())
     {
@@ -95,7 +95,7 @@ DetectApmBios(HKEY SystemKey, U32 *BusNumber)
       Error = RegSetValue(BiosKey,
                          "Identifier",
                          REG_SZ,
-                         (PU8)"APM",
+                         (PUCHAR)"APM",
                          4);
       if (Error != ERROR_SUCCESS)
        {
index 80ed3f4..072d60d 100644 (file)
 
 typedef struct _MP_FLOATING_POINT_TABLE
 {
-  U32 Signature;                       /* "_MP_" */
-  U32 PhysicalAddressPointer;
-  U8  Length;
-  U8  SpecRev;
-  U8  Checksum;
-  U8  FeatureByte[5];
+  ULONG Signature;                     /* "_MP_" */
+  ULONG PhysicalAddressPointer;
+  UCHAR  Length;
+  UCHAR  SpecRev;
+  UCHAR  Checksum;
+  UCHAR  FeatureByte[5];
 } PACKED MP_FLOATING_POINT_TABLE, *PMP_FLOATING_POINT_TABLE;
 
 
 typedef struct _MPS_CONFIG_TABLE_HEADER
 {
-  U32 Signature;                       /* "PCMP" */
-  U16 BaseTableLength;
-  U8  SpecRev;
-  U8  Checksum;
-  U8  OemIdString[8];
-  U8  ProductIdString[12];
-  U32 OemTablePointer;
-  U16 OemTableLength;
-  U16 EntryCount;
-  U32 AddressOfLocalAPIC;
-  U16 ExtendedTableLength;
-  U8  ExtendedTableChecksum;
-  U8  Reserved;
+  ULONG Signature;                     /* "PCMP" */
+  USHORT BaseTableLength;
+  UCHAR  SpecRev;
+  UCHAR  Checksum;
+  UCHAR  OemIdString[8];
+  UCHAR  ProductIdString[12];
+  ULONG OemTablePointer;
+  USHORT OemTableLength;
+  USHORT EntryCount;
+  ULONG AddressOfLocalAPIC;
+  USHORT ExtendedTableLength;
+  UCHAR  ExtendedTableChecksum;
+  UCHAR  Reserved;
 } PACKED MP_CONFIGURATION_TABLE, *PMP_CONFIGURATION_TABLE;
 
 
 typedef struct _MP_PROCESSOR_ENTRY
 {
-  U8  EntryType;
-  U8  LocalApicId;
-  U8  LocalApicVersion;
-  U8  CpuFlags;
-  U32 CpuSignature;
-  U32 FeatureFlags;
-  U32 Reserved1;
-  U32 Reserved2;
+  UCHAR  EntryType;
+  UCHAR  LocalApicId;
+  UCHAR  LocalApicVersion;
+  UCHAR  CpuFlags;
+  ULONG CpuSignature;
+  ULONG FeatureFlags;
+  ULONG Reserved1;
+  ULONG Reserved2;
 } PACKED MP_PROCESSOR_ENTRY, *PMP_PROCESSOR_ENTRY;
 
 
 /* FUNCTIONS ****************************************************************/
 
-static U32
+static ULONG
 GetCpuSpeed(VOID)
 {
-  U64 Timestamp1;
-  U64 Timestamp2;
-  U64 Diff;
+  ULONGLONG Timestamp1;
+  ULONGLONG Timestamp2;
+  ULONGLONG Diff;
 
   /* Read TSC (Time Stamp Counter) */
   Timestamp1 = RDTSC();
 
   /* Wait for 0.1 seconds (= 100 milliseconds = 100000 microseconds)*/
-  KeStallExecutionProcessor(100000);
+  StallExecutionProcessor(100000);
 
   /* Read TSC (Time Stamp Counter) again */
   Timestamp2 = RDTSC();
@@ -100,30 +100,30 @@ GetCpuSpeed(VOID)
     }
   else
     {
-      Diff = Timestamp2 + (((U64)-1) - Timestamp1);
+      Diff = Timestamp2 + (((ULONGLONG)-1) - Timestamp1);
     }
 
-  return (U32)(Diff / 100000);
+  return (ULONG)(Diff / 100000);
 }
 
 
 static VOID
-DetectCPU(HKEY CpuKey,
-         HKEY FpuKey)
+DetectCPU(FRLDRHKEY CpuKey,
+         FRLDRHKEY FpuKey)
 {
   char VendorIdentifier[13];
   char Identifier[64];
-  U32 FeatureSet;
-  HKEY CpuInstKey;
-  HKEY FpuInstKey;
-  U32 eax = 0;
-  U32 ebx = 0;
-  U32 ecx = 0;
-  U32 edx = 0;
-  U32 *Ptr;
-  S32 Error;
+  ULONG FeatureSet;
+  FRLDRHKEY CpuInstKey;
+  FRLDRHKEY FpuInstKey;
+  ULONG eax = 0;
+  ULONG ebx = 0;
+  ULONG ecx = 0;
+  ULONG edx = 0;
+  ULONG *Ptr;
+  LONG Error;
   BOOL SupportTSC = FALSE;
-  U32 CpuSpeed;
+  ULONG CpuSpeed;
 
 
   /* Create the CPU instance key */
@@ -154,7 +154,7 @@ DetectCPU(HKEY CpuKey,
       /* Get vendor identifier */
       GetCpuid(0, &eax, &ebx, &ecx, &edx);
       VendorIdentifier[12] = 0;
-      Ptr = (U32*)&VendorIdentifier[0];
+      Ptr = (ULONG*)&VendorIdentifier[0];
       *Ptr = ebx;
       Ptr++;
       *Ptr = edx;
@@ -195,8 +195,8 @@ DetectCPU(HKEY CpuKey,
   Error = RegSetValue(CpuInstKey,
                      "FeatureSet",
                      REG_DWORD,
-                     (PU8)&FeatureSet,
-                     sizeof(U32));
+                     (PUCHAR)&FeatureSet,
+                     sizeof(ULONG));
   if (Error != ERROR_SUCCESS)
     {
       DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
@@ -208,7 +208,7 @@ DetectCPU(HKEY CpuKey,
   Error = RegSetValue(CpuInstKey,
                      "Identifier",
                      REG_SZ,
-                     (PU8)Identifier,
+                     (PUCHAR)Identifier,
                      strlen(Identifier) + 1);
   if (Error != ERROR_SUCCESS)
     {
@@ -218,7 +218,7 @@ DetectCPU(HKEY CpuKey,
   Error = RegSetValue(FpuInstKey,
                      "Identifier",
                      REG_SZ,
-                     (PU8)Identifier,
+                     (PUCHAR)Identifier,
                      strlen(Identifier) + 1);
   if (Error != ERROR_SUCCESS)
     {
@@ -231,7 +231,7 @@ DetectCPU(HKEY CpuKey,
   Error = RegSetValue(CpuInstKey,
                      "VendorIdentifier",
                      REG_SZ,
-                     (PU8)VendorIdentifier,
+                     (PUCHAR)VendorIdentifier,
                      strlen(VendorIdentifier) + 1);
   if (Error != ERROR_SUCCESS)
     {
@@ -250,8 +250,8 @@ DetectCPU(HKEY CpuKey,
       Error = RegSetValue(CpuInstKey,
                          "~MHz",
                          REG_DWORD,
-                         (PU8)&CpuSpeed,
-                         sizeof(U32));
+                         (PUCHAR)&CpuSpeed,
+                         sizeof(ULONG));
       if (Error != ERROR_SUCCESS)
        {
          DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
@@ -261,23 +261,23 @@ DetectCPU(HKEY CpuKey,
 
 
 static VOID
-SetMpsProcessor(HKEY CpuKey,
-               HKEY FpuKey,
+SetMpsProcessor(FRLDRHKEY CpuKey,
+               FRLDRHKEY FpuKey,
                PMP_PROCESSOR_ENTRY CpuEntry)
 {
   char VendorIdentifier[13];
   char Identifier[64];
   char Buffer[8];
-  U32 FeatureSet;
-  HKEY CpuInstKey;
-  HKEY FpuInstKey;
-  U32 eax = 0;
-  U32 ebx = 0;
-  U32 ecx = 0;
-  U32 edx = 0;
-  U32 *Ptr;
-  S32 Error;
-  U32 CpuSpeed;
+  ULONG FeatureSet;
+  FRLDRHKEY CpuInstKey;
+  FRLDRHKEY FpuInstKey;
+  ULONG eax = 0;
+  ULONG ebx = 0;
+  ULONG ecx = 0;
+  ULONG edx = 0;
+  ULONG *Ptr;
+  LONG Error;
+  ULONG CpuSpeed;
 
   /* Get processor instance number */
   sprintf(Buffer, "%u", CpuEntry->LocalApicId);
@@ -305,7 +305,7 @@ SetMpsProcessor(HKEY CpuKey,
   /* Get 'VendorIdentifier' */
   GetCpuid(0, &eax, &ebx, &ecx, &edx);
   VendorIdentifier[12] = 0;
-  Ptr = (U32*)&VendorIdentifier[0];
+  Ptr = (ULONG*)&VendorIdentifier[0];
   *Ptr = ebx;
   Ptr++;
   *Ptr = edx;
@@ -315,9 +315,9 @@ SetMpsProcessor(HKEY CpuKey,
   /* Get 'Identifier' */
   sprintf(Identifier,
          "x86 Family %u Model %u Stepping %u",
-         (U32)((CpuEntry->CpuSignature >> 8) & 0x0F),
-         (U32)((CpuEntry->CpuSignature >> 4) & 0x0F),
-         (U32)(CpuEntry->CpuSignature & 0x0F));
+         (ULONG)((CpuEntry->CpuSignature >> 8) & 0x0F),
+         (ULONG)((CpuEntry->CpuSignature >> 4) & 0x0F),
+         (ULONG)(CpuEntry->CpuSignature & 0x0F));
 
   /* Get FeatureSet */
   FeatureSet = CpuEntry->FeatureFlags;
@@ -339,8 +339,8 @@ SetMpsProcessor(HKEY CpuKey,
   Error = RegSetValue(CpuInstKey,
                      "FeatureSet",
                      REG_DWORD,
-                     (PU8)&FeatureSet,
-                     sizeof(U32));
+                     (PUCHAR)&FeatureSet,
+                     sizeof(ULONG));
   if (Error != ERROR_SUCCESS)
     {
       DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
@@ -352,7 +352,7 @@ SetMpsProcessor(HKEY CpuKey,
   Error = RegSetValue(CpuInstKey,
                      "Identifier",
                      REG_SZ,
-                     (PU8)Identifier,
+                     (PUCHAR)Identifier,
                      strlen(Identifier) + 1);
   if (Error != ERROR_SUCCESS)
     {
@@ -362,7 +362,7 @@ SetMpsProcessor(HKEY CpuKey,
   Error = RegSetValue(FpuInstKey,
                      "Identifier",
                      REG_SZ,
-                     (PU8)Identifier,
+                     (PUCHAR)Identifier,
                      strlen(Identifier) + 1);
   if (Error != ERROR_SUCCESS)
     {
@@ -375,7 +375,7 @@ SetMpsProcessor(HKEY CpuKey,
   Error = RegSetValue(CpuInstKey,
                      "VendorIdentifier",
                      REG_SZ,
-                     (PU8)VendorIdentifier,
+                     (PUCHAR)VendorIdentifier,
                      strlen(VendorIdentifier) + 1);
   if (Error != ERROR_SUCCESS)
     {
@@ -394,8 +394,8 @@ SetMpsProcessor(HKEY CpuKey,
       Error = RegSetValue(CpuInstKey,
                          "~MHz",
                          REG_DWORD,
-                         (PU8)&CpuSpeed,
-                         sizeof(U32));
+                         (PUCHAR)&CpuSpeed,
+                         sizeof(ULONG));
       if (Error != ERROR_SUCCESS)
        {
          DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
@@ -409,12 +409,12 @@ GetMpFloatingPointTable(VOID)
 {
   PMP_FLOATING_POINT_TABLE FpTable;
   char *Ptr;
-  U8 Sum;
-  U32 Length;
-  U32 i;
+  UCHAR Sum;
+  ULONG Length;
+  ULONG i;
 
   FpTable = (PMP_FLOATING_POINT_TABLE)0xF0000;
-  while ((U32)FpTable < 0x100000)
+  while ((ULONG)FpTable < 0x100000)
     {
       if (FpTable->Signature == MP_FP_SIGNATURE)
        {
@@ -440,7 +440,7 @@ GetMpFloatingPointTable(VOID)
          return FpTable;
        }
 
-      FpTable = (PMP_FLOATING_POINT_TABLE)((U32)FpTable + 0x10);
+      FpTable = (PMP_FLOATING_POINT_TABLE)((ULONG)FpTable + 0x10);
     }
 
   return NULL;
@@ -452,9 +452,9 @@ GetMpConfigurationTable(PMP_FLOATING_POINT_TABLE FpTable)
 {
   PMP_CONFIGURATION_TABLE ConfigTable;
   char *Ptr;
-  U8 Sum;
-  U32 Length;
-  U32 i;
+  UCHAR Sum;
+  ULONG Length;
+  ULONG i;
 
   if (FpTable->FeatureByte[0] != 0 ||
       FpTable->PhysicalAddressPointer == 0)
@@ -466,7 +466,7 @@ GetMpConfigurationTable(PMP_FLOATING_POINT_TABLE FpTable)
 
   DbgPrint((DPRINT_HWDETECT, 
            "MP Configuration Table at: %x\n",
-           (U32)ConfigTable));
+           (ULONG)ConfigTable));
 
   /* Calculate base table checksum */
   Length = ConfigTable->BaseTableLength;
@@ -498,14 +498,14 @@ GetMpConfigurationTable(PMP_FLOATING_POINT_TABLE FpTable)
 
 
 static BOOL
-DetectMps(HKEY CpuKey,
-         HKEY FpuKey)
+DetectMps(FRLDRHKEY CpuKey,
+         FRLDRHKEY FpuKey)
 {
   PMP_FLOATING_POINT_TABLE FpTable;
   PMP_CONFIGURATION_TABLE ConfigTable;
   PMP_PROCESSOR_ENTRY CpuEntry;
   char *Ptr;
-  U32 Offset;
+  ULONG Offset;
 
   /* Get floating point table */
   FpTable = GetMpFloatingPointTable();
@@ -514,7 +514,7 @@ DetectMps(HKEY CpuKey,
 
   DbgPrint((DPRINT_HWDETECT,
            "MP Floating Point Table at: %x\n",
-           (U32)FpTable));
+           (ULONG)FpTable));
 
   if (FpTable->FeatureByte[0] == 0)
     {
@@ -530,7 +530,7 @@ DetectMps(HKEY CpuKey,
       Offset = sizeof(MP_CONFIGURATION_TABLE);
       while (Offset < ConfigTable->BaseTableLength)
        {
-         Ptr = (char*)((U32)ConfigTable + Offset);
+         Ptr = (char*)((ULONG)ConfigTable + Offset);
 
          switch (*Ptr)
            {
@@ -548,9 +548,9 @@ DetectMps(HKEY CpuKey,
                DbgPrint((DPRINT_HWDETECT,
                          "Processor %u: x86 Family %u Model %u Stepping %u\n",
                          CpuEntry->LocalApicId,
-                         (U32)((CpuEntry->CpuSignature >> 8) & 0x0F),
-                         (U32)((CpuEntry->CpuSignature >> 4) & 0x0F),
-                         (U32)(CpuEntry->CpuSignature & 0x0F)));
+                         (ULONG)((CpuEntry->CpuSignature >> 8) & 0x0F),
+                         (ULONG)((CpuEntry->CpuSignature >> 4) & 0x0F),
+                         (ULONG)(CpuEntry->CpuSignature & 0x0F)));
 
                SetMpsProcessor(CpuKey, FpuKey, CpuEntry);
                Offset += 0x14;
@@ -577,7 +577,7 @@ DetectMps(HKEY CpuKey,
                break;
 
              default:
-               DbgPrint((DPRINT_HWDETECT, "Unknown Entry %u\n",(U32)*Ptr));
+               DbgPrint((DPRINT_HWDETECT, "Unknown Entry %u\n",(ULONG)*Ptr));
                return FALSE;
            }
        }
@@ -599,11 +599,11 @@ DetectMps(HKEY CpuKey,
 
 
 VOID
-DetectCPUs(HKEY SystemKey)
+DetectCPUs(FRLDRHKEY SystemKey)
 {
-  HKEY CpuKey;
-  HKEY FpuKey;
-  S32 Error;
+  FRLDRHKEY CpuKey;
+  FRLDRHKEY FpuKey;
+  LONG Error;
 
   /* Create the 'CentralProcessor' key */
   Error = RegCreateKey(SystemKey,
index 2285a7f..c4cba0a 100644 (file)
 
 typedef struct _ROUTING_SLOT
 {
-  U8  BusNumber;
-  U8  DeviceNumber;
-  U8  LinkA;
-  U16 BitmapA;
-  U8  LinkB;
-  U16 BitmapB;
-  U8  LinkC;
-  U16 BitmapC;
-  U8  LinkD;
-  U16 BitmapD;
-  U8  SlotNumber;
-  U8  Reserved;
+  UCHAR  BusNumber;
+  UCHAR  DeviceNumber;
+  UCHAR  LinkA;
+  USHORT BitmapA;
+  UCHAR  LinkB;
+  USHORT BitmapB;
+  UCHAR  LinkC;
+  USHORT BitmapC;
+  UCHAR  LinkD;
+  USHORT BitmapD;
+  UCHAR  SlotNumber;
+  UCHAR  Reserved;
 } __attribute__((packed)) ROUTING_SLOT, *PROUTING_SLOT;
 
 typedef struct _PCI_IRQ_ROUTING_TABLE
 {
-  U32 Signature;
-  U16 Version;
-  U16 Size;
-  U8  RouterBus;
-  U8  RouterSlot;
-  U16 ExclusiveIRQs;
-  U32 CompatibleRouter;
-  U32 MiniportData;
-  U8  Reserved[11];
-  U8  Checksum;
+  ULONG Signature;
+  USHORT Version;
+  USHORT Size;
+  UCHAR  RouterBus;
+  UCHAR  RouterSlot;
+  USHORT ExclusiveIRQs;
+  ULONG CompatibleRouter;
+  ULONG MiniportData;
+  UCHAR  Reserved[11];
+  UCHAR  Checksum;
   ROUTING_SLOT Slot[1];
 } __attribute__((packed)) PCI_IRQ_ROUTING_TABLE, *PPCI_IRQ_ROUTING_TABLE;
 
 typedef struct _CM_PCI_BUS_DATA
 {
-  U8  BusCount;
-  U16 PciVersion;
-  U8  HardwareMechanism;
+  UCHAR  BusCount;
+  USHORT PciVersion;
+  UCHAR  HardwareMechanism;
 } __attribute__((packed)) CM_PCI_BUS_DATA, *PCM_PCI_BUS_DATA;
 
 
@@ -71,19 +71,19 @@ static PPCI_IRQ_ROUTING_TABLE
 GetPciIrqRoutingTable(VOID)
 {
   PPCI_IRQ_ROUTING_TABLE Table;
-  PU8 Ptr;
-  U32 Sum;
-  U32 i;
+  PUCHAR Ptr;
+  ULONG Sum;
+  ULONG i;
 
   Table = (PPCI_IRQ_ROUTING_TABLE)0xF0000;
-  while ((U32)Table < 0x100000)
+  while ((ULONG)Table < 0x100000)
     {
       if (Table->Signature == 0x52495024)
        {
          DbgPrint((DPRINT_HWDETECT,
                    "Found signature\n"));
 
-         Ptr = (PU8)Table;
+         Ptr = (PUCHAR)Table;
          Sum = 0;
          for (i = 0; i < Table->Size; i++)
            {
@@ -103,7 +103,7 @@ GetPciIrqRoutingTable(VOID)
          return Table;
        }
 
-      Table = (PPCI_IRQ_ROUTING_TABLE)((U32)Table + 0x10);
+      Table = (PPCI_IRQ_ROUTING_TABLE)((ULONG)Table + 0x10);
     }
 
   return NULL;
@@ -145,14 +145,14 @@ FindPciBios(PCM_PCI_BUS_DATA BusData)
 
 
 static VOID
-DetectPciIrqRoutingTable(HKEY BusKey)
+DetectPciIrqRoutingTable(FRLDRHKEY BusKey)
 {
   PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
   PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
   PPCI_IRQ_ROUTING_TABLE Table;
-  HKEY TableKey;
-  U32 Size;
-  S32 Error;
+  FRLDRHKEY TableKey;
+  ULONG Size;
+  LONG Error;
 
   Table = GetPciIrqRoutingTable();
   if (Table != NULL)
@@ -178,7 +178,7 @@ DetectPciIrqRoutingTable(HKEY BusKey)
       Error = RegSetValue(TableKey,
                          "Identifier",
                          REG_SZ,
-                         (PU8)"PCI Real-mode IRQ Routing Table",
+                         (PUCHAR)"PCI Real-mode IRQ Routing Table",
                          32);
       if (Error != ERROR_SUCCESS)
        {
@@ -216,7 +216,7 @@ DetectPciIrqRoutingTable(HKEY BusKey)
       Error = RegSetValue(TableKey,
                          "Configuration Data",
                          REG_FULL_RESOURCE_DESCRIPTOR,
-                         (PU8) FullResourceDescriptor,
+                         (PUCHAR) FullResourceDescriptor,
                          Size);
       MmFreeMemory(FullResourceDescriptor);
       if (Error != ERROR_SUCCESS)
@@ -231,17 +231,17 @@ DetectPciIrqRoutingTable(HKEY BusKey)
 
 
 VOID
-DetectPciBios(HKEY SystemKey, U32 *BusNumber)
+DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
 {
   PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
   CM_PCI_BUS_DATA BusData;
   char Buffer[80];
-  HKEY BiosKey;
-  U32 Size;
-  S32 Error;
+  FRLDRHKEY BiosKey;
+  ULONG Size;
+  LONG Error;
 #if 0
-  HKEY BusKey;
-  U32 i;
+  FRLDRHKEY BusKey;
+  ULONG i;
 #endif
 
   /* Report the PCI BIOS */
@@ -272,7 +272,7 @@ DetectPciBios(HKEY SystemKey, U32 *BusNumber)
       Error = RegSetValue(BiosKey,
                          "Identifier",
                          REG_SZ,
-                         (PU8)"PCI BIOS",
+                         (PUCHAR)"PCI BIOS",
                          9);
       if (Error != ERROR_SUCCESS)
        {
@@ -301,7 +301,7 @@ DetectPciBios(HKEY SystemKey, U32 *BusNumber)
       Error = RegSetValue(BiosKey,
                          "Configuration Data",
                          REG_FULL_RESOURCE_DESCRIPTOR,
-                         (PU8) FullResourceDescriptor,
+                         (PUCHAR) FullResourceDescriptor,
                          Size);
       MmFreeMemory(FullResourceDescriptor);
       if (Error != ERROR_SUCCESS)
@@ -322,7 +322,7 @@ DetectPciBios(HKEY SystemKey, U32 *BusNumber)
        */
 
       /* Report PCI buses */
-      for (i = 0; i < (U32)BusData.BusCount; i++)
+      for (i = 0; i < (ULONG)BusData.BusCount; i++)
        {
          sprintf(Buffer,
                  "MultifunctionAdapter\\%u", *BusNumber);
@@ -350,7 +350,7 @@ DetectPciBios(HKEY SystemKey, U32 *BusNumber)
          Error = RegSetValue(BusKey,
                              "Identifier",
                              REG_SZ,
-                             (PU8)"PCI",
+                             (PUCHAR)"PCI",
                              4);
          if (Error != ERROR_SUCCESS)
            {
index 46c3116..cc0bdb3 100644 (file)
  */
 
 #include "freeldr.h"
-#include "disk.h"
-#include "rtl.h"
-#include "arch.h"
 #include "debug.h"
-#include "portio.h"
-#include "machine.h"
-
 
 /////////////////////////////////////////////////////////////////////////////////////////////
 // FUNCTIONS
@@ -32,7 +26,7 @@
 
 #ifdef __i386__
 
-BOOL DiskResetController(U32 DriveNumber)
+BOOL DiskResetController(ULONG DriveNumber)
 {
        REGS    RegsIn;
        REGS    RegsOut;
@@ -55,7 +49,7 @@ BOOL DiskResetController(U32 DriveNumber)
        return INT386_SUCCESS(RegsOut);
 }
 
-BOOL DiskInt13ExtensionsSupported(U32 DriveNumber)
+BOOL DiskInt13ExtensionsSupported(ULONG DriveNumber)
 {
        REGS    RegsIn;
        REGS    RegsOut;
@@ -133,11 +127,11 @@ VOID DiskStopFloppyMotor(VOID)
        WRITE_PORT_UCHAR((PUCHAR)0x3F2, 0);
 }
 
-BOOL DiskGetExtendedDriveParameters(U32 DriveNumber, PVOID Buffer, U16 BufferSize)
+BOOL DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT BufferSize)
 {
        REGS    RegsIn;
        REGS    RegsOut;
-       PU16    Ptr = (PU16)(BIOSCALLBUFFER);
+       PUSHORT Ptr = (PUSHORT)(BIOSCALLBUFFER);
 
        DbgPrint((DPRINT_DISK, "DiskGetExtendedDriveParameters()\n"));
 
index 281ffa3..0612ace 100644 (file)
@@ -18,9 +18,6 @@
  */
 
 #include <freeldr.h>
-#include <arch.h>
-#include <rtl.h>
-#include <portio.h>
 
 void beep(void)
 {
index 59f5af2..6ee0e0a 100644 (file)
 
 typedef struct
 {
-       U8      Signature[4];                           // (ret) signature ("VESA")
+       UCHAR   Signature[4];                           // (ret) signature ("VESA")
                                                                        // (call) VESA 2.0 request signature ("VBE2"), required to receive
                                                                        // version 2.0 info
-       U16     VesaVersion;                            // VESA version number (one-digit minor version -- 0102h = v1.2)
-       U32 OemNamePtr;                                 // pointer to OEM name
+       USHORT  VesaVersion;                            // VESA version number (one-digit minor version -- 0102h = v1.2)
+       ULONG OemNamePtr;                                       // pointer to OEM name
                                                                        // "761295520" for ATI
-       U32     Capabilities;                           // capabilities flags (see #00078)
-       U32     SupportedModeListPtr;           // pointer to list of supported VESA and OEM video modes
+       ULONG   Capabilities;                           // capabilities flags (see #00078)
+       ULONG   SupportedModeListPtr;           // pointer to list of supported VESA and OEM video modes
                                                                        // (list of words terminated with FFFFh)
-       U16     TotalVideoMemory;                       // total amount of video memory in 64K blocks
+       USHORT  TotalVideoMemory;                       // total amount of video memory in 64K blocks
 
        // ---VBE v1.x ---
-       //U8    Reserved[236];
+       //UCHAR Reserved[236];
 
        // ---VBE v2.0 ---
-       U16     OemSoftwareVersion;                     // OEM software version (BCD, high byte = major, low byte = minor)
-       U32     VendorNamePtr;                          // pointer to vendor name
-       U32     ProductNamePtr;                         // pointer to product name
-       U32     ProductRevisionStringPtr;       // pointer to product revision string
-       U16     VBE_AF_Version;                         // (if capabilities bit 3 set) VBE/AF version (BCD)
+       USHORT  OemSoftwareVersion;                     // OEM software version (BCD, high byte = major, low byte = minor)
+       ULONG   VendorNamePtr;                          // pointer to vendor name
+       ULONG   ProductNamePtr;                         // pointer to product name
+       ULONG   ProductRevisionStringPtr;       // pointer to product revision string
+       USHORT  VBE_AF_Version;                         // (if capabilities bit 3 set) VBE/AF version (BCD)
                                                                        // 0100h for v1.0P
-       U32     AcceleratedModeListPtr;         // (if capabilities bit 3 set) pointer to list of supported
+       ULONG   AcceleratedModeListPtr;         // (if capabilities bit 3 set) pointer to list of supported
                                                                        // accelerated video modes (list of words terminated with FFFFh)
-       U8      Reserved[216];                          // reserved for VBE implementation
-       U8      ScratchPad[256];                        // OEM scratchpad (for OEM strings, etc.)
+       UCHAR   Reserved[216];                          // reserved for VBE implementation
+       UCHAR   ScratchPad[256];                        // OEM scratchpad (for OEM strings, etc.)
 } PACKED VESA_SVGA_INFO, *PVESA_SVGA_INFO;
 
 // Bitfields for VESA capabilities:
@@ -106,11 +106,11 @@ VOID BiosSetVideoFont8x16(VOID)
        Int386(0x10, &Regs, &Regs);
 }
 
-VOID VideoSetTextCursorPosition(U32 X, U32 Y)
+VOID VideoSetTextCursorPosition(ULONG X, ULONG Y)
 {
 }
 
-U32 VideoGetTextCursorPositionX(VOID)
+ULONG VideoGetTextCursorPositionX(VOID)
 {
        REGS    Regs;
 
@@ -135,7 +135,7 @@ U32 VideoGetTextCursorPositionX(VOID)
        return Regs.b.dl;
 }
 
-U32 VideoGetTextCursorPositionY(VOID)
+ULONG VideoGetTextCursorPositionY(VOID)
 {
        REGS    Regs;
 
@@ -160,13 +160,13 @@ U32 VideoGetTextCursorPositionY(VOID)
        return Regs.b.dh;
 }
 
-U16 BiosIsVesaSupported(VOID)
+USHORT BiosIsVesaSupported(VOID)
 {
        REGS                    Regs;
        PVESA_SVGA_INFO SvgaInfo = (PVESA_SVGA_INFO)BIOSCALLBUFFER;
 #ifdef DEBUG
-       //U16*                  VideoModes;
-       //U16                   Index;
+       //USHORT*                       VideoModes;
+       //USHORT                        Index;
 #endif // defined DEBUG
 
        DbgPrint((DPRINT_UI, "BiosIsVesaSupported()\n"));
@@ -227,7 +227,7 @@ U16 BiosIsVesaSupported(VOID)
        DbgPrint((DPRINT_UI, "SvgaInfo->VBE/AF Version = 0x%x (BCD WORD)\n", SvgaInfo->VBE_AF_Version));
 
        //DbgPrint((DPRINT_UI, "\nSupported VESA and OEM video modes:\n"));
-       //VideoModes = (U16*)SvgaInfo->SupportedModeListPtr;
+       //VideoModes = (USHORT*)SvgaInfo->SupportedModeListPtr;
        //for (Index=0; VideoModes[Index]!=0xFFFF; Index++)
        //{
        //      DbgPrint((DPRINT_UI, "Mode %d: 0x%x\n", Index, VideoModes[Index]));
@@ -236,7 +236,7 @@ U16 BiosIsVesaSupported(VOID)
        //if (SvgaInfo->VesaVersion >= 0x0200)
        //{
        //      DbgPrint((DPRINT_UI, "\nSupported accelerated video modes (VESA v2.0):\n"));
-       //      VideoModes = (U16*)SvgaInfo->AcceleratedModeListPtr;
+       //      VideoModes = (USHORT*)SvgaInfo->AcceleratedModeListPtr;
        //      for (Index=0; VideoModes[Index]!=0xFFFF; Index++)
        //      {
        //              DbgPrint((DPRINT_UI, "Mode %d: 0x%x\n", Index, VideoModes[Index]));
index 656bf45..5462a10 100644 (file)
@@ -32,28 +32,28 @@ VOID PcConsPutChar(int Ch);
 BOOL PcConsKbHit();
 int PcConsGetCh();
 
-VOID PcVideoClearScreen(U8 Attr);
+VOID PcVideoClearScreen(UCHAR Attr);
 VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayMode, BOOL Init);
-VOID PcVideoGetDisplaySize(PU32 Width, PU32 Height, PU32 Depth);
-U32 PcVideoGetBufferSize(VOID);
-VOID PcVideoSetTextCursorPosition(U32 X, U32 Y);
+VOID PcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth);
+ULONG PcVideoGetBufferSize(VOID);
+VOID PcVideoSetTextCursorPosition(ULONG X, ULONG Y);
 VOID PcVideoHideShowTextCursor(BOOL Show);
-VOID PcVideoPutChar(int Ch, U8 Attr, unsigned X, unsigned Y);
+VOID PcVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y);
 VOID PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer);
 BOOL PcVideoIsPaletteFixed(VOID);
-VOID PcVideoSetPaletteColor(U8 Color, U8 Red, U8 Green, U8 Blue);
-VOID PcVideoGetPaletteColor(U8 Color, U8* Red, U8* Green, U8* Blue);
+VOID PcVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
+VOID PcVideoGetPaletteColor(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue);
 VOID PcVideoSync(VOID);
 VOID PcVideoPrepareForReactOS(VOID);
 
-U32 PcMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, U32 MaxMemoryMapSize);
+ULONG PcMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize);
 
-BOOL PcDiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, PVOID Buffer);
-BOOL PcDiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
-BOOL PcDiskGetDriveGeometry(U32 DriveNumber, PGEOMETRY DriveGeometry);
-U32 PcDiskGetCacheableBlockCount(U32 DriveNumber);
+BOOL PcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
+BOOL PcDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
+BOOL PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry);
+ULONG PcDiskGetCacheableBlockCount(ULONG DriveNumber);
 
-VOID PcRTCGetCurrentDateTime(PU32 Year, PU32 Month, PU32 Day, PU32 Hour, PU32 Minute, PU32 Second);
+VOID PcRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG Minute, PULONG Second);
 
 VOID PcHwDetect(VOID);
 
index 13ce64c..845f242 100644 (file)
@@ -24,7 +24,7 @@
 #include "mm.h"
 #endif
 
-U8 XboxFont8x16[256 * 16];
+UCHAR XboxFont8x16[256 * 16];
 
 VOID XboxMachInit(VOID);
 
@@ -33,30 +33,30 @@ BOOL XboxConsKbHit();
 int XboxConsGetCh();
 
 VOID XboxVideoInit(VOID);
-VOID XboxVideoClearScreen(U8 Attr);
+VOID XboxVideoClearScreen(UCHAR Attr);
 VIDEODISPLAYMODE XboxVideoSetDisplayMode(char *DisplayModem, BOOL Init);
-VOID XboxVideoGetDisplaySize(PU32 Width, PU32 Height, PU32 Depth);
-U32 XboxVideoGetBufferSize(VOID);
-VOID XboxVideoSetTextCursorPosition(U32 X, U32 Y);
+VOID XboxVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth);
+ULONG XboxVideoGetBufferSize(VOID);
+VOID XboxVideoSetTextCursorPosition(ULONG X, ULONG Y);
 VOID XboxVideoHideShowTextCursor(BOOL Show);
-VOID XboxVideoPutChar(int Ch, U8 Attr, unsigned X, unsigned Y);
+VOID XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y);
 VOID XboxVideoCopyOffScreenBufferToVRAM(PVOID Buffer);
 BOOL XboxVideoIsPaletteFixed(VOID);
-VOID XboxVideoSetPaletteColor(U8 Color, U8 Red, U8 Green, U8 Blue);
-VOID XboxVideoGetPaletteColor(U8 Color, U8* Red, U8* Green, U8* Blue);
+VOID XboxVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
+VOID XboxVideoGetPaletteColor(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue);
 VOID XboxVideoSync(VOID);
 VOID XboxVideoPrepareForReactOS(VOID);
 
 VOID XboxMemInit(VOID);
-PVOID XboxMemReserveMemory(U32 MbToReserve);
-U32 XboxMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, U32 MaxMemoryMapSize);
+PVOID XboxMemReserveMemory(ULONG MbToReserve);
+ULONG XboxMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize);
 
-BOOL XboxDiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, PVOID Buffer);
-BOOL XboxDiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
-BOOL XboxDiskGetDriveGeometry(U32 DriveNumber, PGEOMETRY DriveGeometry);
-U32 XboxDiskGetCacheableBlockCount(U32 DriveNumber);
+BOOL XboxDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
+BOOL XboxDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
+BOOL XboxDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry);
+ULONG XboxDiskGetCacheableBlockCount(ULONG DriveNumber);
 
-VOID XboxRTCGetCurrentDateTime(PU32 Year, PU32 Month, PU32 Day, PU32 Hour, PU32 Minute, PU32 Second);
+VOID XboxRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG Minute, PULONG Second);
 
 VOID XboxHwDetect(VOID);
 
index e77b380..78a3f49 100644 (file)
         * This boots the kernel
         */
        .code32
-EXTERN(_boot_reactos)
-       call    _MachVideoPrepareForReactOS
-
-       call    _multi_boot
-
-       // Should never get here
-       cli
-bootloop:
-       hlt
-       jmp     bootloop
-
-
-       /*
-        * After you have setup the _mb_header and _mb_info structures
-        * then call this routine to transfer control to the kernel.
-        */
-EXTERN(_multi_boot)
-
-       cli
-
-       /*
-        * Load the absolute address of the multiboot information structure
-        */
-       movl    $_mb_info,%ebx
-
-       /*
-        * Initalize eflags
-        */
-       pushl   $0
-       popfl   
-
-       /*
-        * Load the multiboot magic value into eax
-        */     
-       movl    $0x2badb002,%eax
-
-       /*
-        * Jump to start of 32 bit code at 0xc0000000 + 0x1000
-        */
-
-       pushl   $KERNEL_CS
-       pushl   _mb_entry_addr
-       lretl
-
-
-EXTERN(_mb_header)
-_mb_magic:
-       .long   0               // unsigned long magic;
-_mb_flags:
-       .long   0               // unsigned long flags;
-_mb_checksum:
-       .long   0               // unsigned long checksum;
-_mb_header_addr:
-       .long   0               // unsigned long header_addr;
-_mb_load_addr:
-       .long   0               // unsigned long load_addr;
-_mb_load_end_addr:
-       .long   0               // unsigned long load_end_addr;
-_mb_bss_end_addr:
-       .long   0               // unsigned long bss_end_addr;
-_mb_entry_addr:
-       .long   0               // unsigned long entry_addr;
+    .globl _PageDirectoryStart
+    
+    .globl _startup_pagedirectory
+    .globl _lowmem_pagetable
+    .globl _kernel_pagetable
+    .globl _hyperspace_pagetable
+    .globl _apic_pagetable
+    .globl _kpcr_pagetable
+
+    .globl _startup_pagedirectorytable_pae
+    .globl _startup_pagedirectory_pae
+    .globl _lowmem_pagetable_pae
+    .globl _kernel_pagetable_pae
+    .globl _hyperspace_pagetable_pae
+    .globl _apic_pagetable_pae
+    .globl _kpcr_pagetable_pae
+    
+    .globl _PageDirectoryEnd
 
        //
        // Boot information structure
        //
 
-EXTERN(_mb_info)
-_multiboot_flags:
-       .long   0
-_multiboot_mem_lower:
-       .long   0
-_multiboot_mem_upper:
-       .long   0
-_multiboot_boot_device:
-       .long   0
-_multiboot_cmdline:    
-       .long   0
-_multiboot_mods_count:
-       .long   0
-_multiboot_mods_addr:
-       .long   0
-_multiboot_syms:
-       .rept   12
-       .byte   0
-       .endr
-_multiboot_mmap_length:
-       .long   0
-_multiboot_mmap_addr:
-       .long   0
-_multiboot_drives_count:
-       .long   0
-_multiboot_drives_addr:
-       .long   0
-_multiboot_config_table:
-       .long   0
-_multiboot_boot_loader_name:
-       .long   0
-_multiboot_apm_table:
-       .long   0
-
-EXTERN(_multiboot_modules)
-       .rept   (64 * /*multiboot_module_size*/ 16)
-       .byte   0
-       .endr
-EXTERN(_multiboot_module_strings)
-       .rept   (64*256)
-       .byte   0
-       .endr
-
 EXTERN(_multiboot_memory_map_descriptor_size)
        .long   0
 
@@ -147,7 +60,44 @@ EXTERN(_multiboot_memory_map)
        .byte   0
        .endr
 
-EXTERN(_multiboot_kernel_cmdline)
-       .rept   255
-       .byte   0
-       .endr
+.bss
+_PageDirectoryStart:
+_startup_pagedirectory:
+       .fill 4096, 1, 0
+
+_lowmem_pagetable:
+       .fill 4096, 1, 0
+
+_kernel_pagetable:
+       .fill 2*4096, 1, 0
+
+_hyperspace_pagetable:
+       .fill 4096, 1, 0
+       
+_apic_pagetable:
+       .fill 4096, 1, 0
+
+_kpcr_pagetable:
+       .fill 4096, 1, 0   
+
+_startup_pagedirectory_pae:
+       .fill 4 * 4096, 1, 0
+
+_lowmem_pagetable_pae:
+       .fill 2 * 4096, 1, 0
+
+_kernel_pagetable_pae:
+       .fill 3*4096, 1, 0
+
+_hyperspace_pagetable_pae:
+       .fill 2*4096, 1, 0
+       
+_apic_pagetable_pae:
+       .fill 2*4096, 1, 0
+
+_kpcr_pagetable_pae:
+       .fill 4*4096, 1, 0   
+       
+_startup_pagedirectorytable_pae:
+       .fill 4096, 1, 0        
+_PageDirectoryEnd:
index af2a893..5e344bb 100644 (file)
 
 typedef struct
 {
-       U8              PacketSize;                             // 00h - Size of packet (10h or 18h)
-       U8              Reserved;                               // 01h - Reserved (0)
-       U16             LBABlockCount;                  // 02h - Number of blocks to transfer (max 007Fh for Phoenix EDD)
-       U16             TransferBufferOffset;   // 04h - Transfer buffer offset (seg:off)
-       U16             TransferBufferSegment;  //       Transfer buffer segment (seg:off)
-       U64             LBAStartBlock;                  // 08h - Starting absolute block number
-       U64             TransferBuffer64;               // 10h - (EDD-3.0, optional) 64-bit flat address of transfer buffer
+       UCHAR           PacketSize;                             // 00h - Size of packet (10h or 18h)
+       UCHAR           Reserved;                               // 01h - Reserved (0)
+       USHORT          LBABlockCount;                  // 02h - Number of blocks to transfer (max 007Fh for Phoenix EDD)
+       USHORT          TransferBufferOffset;   // 04h - Transfer buffer offset (seg:off)
+       USHORT          TransferBufferSegment;  //       Transfer buffer segment (seg:off)
+       ULONGLONG               LBAStartBlock;                  // 08h - Starting absolute block number
+       ULONGLONG               TransferBuffer64;               // 10h - (EDD-3.0, optional) 64-bit flat address of transfer buffer
                                                                        //       used if DWORD at 04h is FFFFh:FFFFh
 } PACKED I386_DISK_ADDRESS_PACKET, *PI386_DISK_ADDRESS_PACKET;
 
@@ -43,7 +43,7 @@ typedef struct
 // FUNCTIONS
 /////////////////////////////////////////////////////////////////////////////////////////////
 
-static BOOL PcDiskResetController(U32 DriveNumber)
+static BOOL PcDiskResetController(ULONG DriveNumber)
 {
        REGS    RegsIn;
        REGS    RegsOut;
@@ -66,11 +66,11 @@ static BOOL PcDiskResetController(U32 DriveNumber)
        return INT386_SUCCESS(RegsOut);
 }
 
-static BOOL PcDiskReadLogicalSectorsLBA(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, PVOID Buffer)
+static BOOL PcDiskReadLogicalSectorsLBA(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
 {
        REGS                                            RegsIn;
        REGS                                            RegsOut;
-       U32                                                     RetryCount;
+       ULONG                                                   RetryCount;
        PI386_DISK_ADDRESS_PACKET       Packet = (PI386_DISK_ADDRESS_PACKET)(BIOSCALLBUFFER);
 
        DbgPrint((DPRINT_DISK, "PcDiskReadLogicalSectorsLBA() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer));
@@ -86,8 +86,8 @@ static BOOL PcDiskReadLogicalSectorsLBA(U32 DriveNumber, U64 SectorNumber, U32 S
        Packet->PacketSize = sizeof(I386_DISK_ADDRESS_PACKET);
        Packet->Reserved = 0;
        Packet->LBABlockCount = SectorCount;
-       Packet->TransferBufferOffset = ((U32)Buffer) & 0x0F;
-       Packet->TransferBufferSegment = ((U32)Buffer) >> 4;
+       Packet->TransferBufferOffset = ((ULONG)Buffer) & 0x0F;
+       Packet->TransferBufferSegment = ((ULONG)Buffer) >> 4;
        Packet->LBAStartBlock = SectorNumber;
        Packet->TransferBuffer64 = 0;
 
@@ -130,16 +130,16 @@ static BOOL PcDiskReadLogicalSectorsLBA(U32 DriveNumber, U64 SectorNumber, U32 S
        return FALSE;
 }
 
-static BOOL PcDiskReadLogicalSectorsCHS(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, PVOID Buffer)
+static BOOL PcDiskReadLogicalSectorsCHS(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
 {
-       U32                     PhysicalSector;
-       U32                     PhysicalHead;
-       U32                     PhysicalTrack;
+       ULONG                   PhysicalSector;
+       ULONG                   PhysicalHead;
+       ULONG                   PhysicalTrack;
        GEOMETRY        DriveGeometry;
-       U32                     NumberOfSectorsToRead;
+       ULONG                   NumberOfSectorsToRead;
        REGS            RegsIn;
        REGS            RegsOut;
-       U32                     RetryCount;
+       ULONG                   RetryCount;
 
        DbgPrint((DPRINT_DISK, "PcDiskReadLogicalSectorsCHS()\n"));
 
@@ -215,8 +215,8 @@ static BOOL PcDiskReadLogicalSectorsCHS(U32 DriveNumber, U64 SectorNumber, U32 S
                RegsIn.b.cl = (PhysicalSector + ((PhysicalTrack & 0x300) >> 2));
                RegsIn.b.dh = PhysicalHead;
                RegsIn.b.dl = DriveNumber;
-               RegsIn.w.es = ((U32)Buffer) >> 4;
-               RegsIn.w.bx = ((U32)Buffer) & 0x0F;
+               RegsIn.w.es = ((ULONG)Buffer) >> 4;
+               RegsIn.w.bx = ((ULONG)Buffer) & 0x0F;
 
                //
                // Perform the read
@@ -266,9 +266,9 @@ static BOOL PcDiskReadLogicalSectorsCHS(U32 DriveNumber, U64 SectorNumber, U32 S
        return TRUE;
 }
 
-static BOOL PcDiskInt13ExtensionsSupported(U32 DriveNumber)
+static BOOL PcDiskInt13ExtensionsSupported(ULONG DriveNumber)
 {
-       static U32      LastDriveNumber = 0xffffffff;
+       static ULONG    LastDriveNumber = 0xffffffff;
        static BOOL     LastSupported;
        REGS    RegsIn;
        REGS    RegsOut;
@@ -355,7 +355,7 @@ static BOOL PcDiskInt13ExtensionsSupported(U32 DriveNumber)
        return TRUE;
 }
 
-BOOL PcDiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, PVOID Buffer)
+BOOL PcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
 {
 
        DbgPrint((DPRINT_DISK, "PcDiskReadLogicalSectors() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer));
@@ -385,18 +385,18 @@ BOOL PcDiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount
 }
 
 BOOL
-PcDiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
+PcDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
 {
   /* Just use the standard routine */
   return DiskGetPartitionEntry(DriveNumber, PartitionNumber, PartitionTableEntry);
 }
 
 BOOL
-PcDiskGetDriveGeometry(U32 DriveNumber, PGEOMETRY Geometry)
+PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry)
 {
   REGS RegsIn;
   REGS RegsOut;
-  U32 Cylinders;
+  ULONG Cylinders;
 
   DbgPrint((DPRINT_DISK, "DiskGetDriveGeometry()\n"));
 
@@ -442,8 +442,8 @@ PcDiskGetDriveGeometry(U32 DriveNumber, PGEOMETRY Geometry)
   return TRUE;
 }
 
-U32
-PcDiskGetCacheableBlockCount(U32 DriveNumber)
+ULONG
+PcDiskGetCacheableBlockCount(ULONG DriveNumber)
 {
   GEOMETRY     Geometry;
 
index bb5b409..e9da602 100644 (file)
 #include "portio.h"
 #include "rtl.h"
 
-static U32
+static ULONG
 PcMemGetExtendedMemorySize(VOID)
 {
   REGS RegsIn;
   REGS RegsOut;
-  U32 MemorySize;
+  ULONG MemorySize;
 
   DbgPrint((DPRINT_MEMORY, "GetExtendedMemorySize()\n"));
 
@@ -119,7 +119,7 @@ PcMemGetExtendedMemorySize(VOID)
   return MemorySize;
 }
 
-static U32
+static ULONG
 PcMemGetConventionalMemorySize(VOID)
 {
   REGS Regs;
@@ -141,14 +141,14 @@ PcMemGetConventionalMemorySize(VOID)
   DbgPrint((DPRINT_MEMORY, "Int12h\n"));
   DbgPrint((DPRINT_MEMORY, "AX = 0x%x\n\n", Regs.w.ax));
 
-  return (U32)Regs.w.ax;
+  return (ULONG)Regs.w.ax;
 }
 
-static U32
-PcMemGetBiosMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, U32 MaxMemoryMapSize)
+static ULONG
+PcMemGetBiosMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
 {
   REGS Regs;
-  U32 MapCount;
+  ULONG MapCount;
 
   DbgPrint((DPRINT_MEMORY, "GetBiosMemoryMap()\n"));
 
@@ -225,10 +225,10 @@ PcMemGetBiosMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, U32 MaxMemoryMapSize)
   return MapCount;
 }
 
-U32
-PcMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, U32 MaxMemoryMapSize)
+ULONG
+PcMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
 {
-  U32 EntryCount;
+  ULONG EntryCount;
 
   EntryCount = PcMemGetBiosMemoryMap(BiosMemoryMap, MaxMemoryMapSize);
 
index aba3656..aad7698 100644 (file)
@@ -25,7 +25,7 @@
 #define BCD_INT(bcd) (((bcd & 0xf0) >> 4) * 10 + (bcd &0x0f))
 
 VOID
-PcRTCGetCurrentDateTime(PU32 Year, PU32 Month, PU32 Day, PU32 Hour, PU32 Minute, PU32 Second)
+PcRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG Minute, PULONG Second)
 {
   REGS Regs;
 
index a4bf820..2baac36 100644 (file)
 
 typedef struct
 {
-  U16 ModeAttributes;             /* mode attributes (see #00080) */
-  U8  WindowAttributesA;          /* window attributes, window A (see #00081) */
-  U8  WindowsAttributesB;         /* window attributes, window B (see #00081) */
-  U16 WindowGranularity;          /* window granularity in KB */
-  U16 WindowSize;                 /* window size in KB */
-  U16 WindowAStartSegment;        /* start segment of window A (0000h if not supported) */
-  U16 WindowBStartSegment;        /* start segment of window B (0000h if not supported) */
-  U32 WindowPositioningFunction;  /* -> FAR window positioning function (equivalent to AX=4F05h) */
-  U16 BytesPerScanLine;           /* bytes per scan line */
+  USHORT ModeAttributes;             /* mode attributes (see #00080) */
+  UCHAR  WindowAttributesA;          /* window attributes, window A (see #00081) */
+  UCHAR  WindowsAttributesB;         /* window attributes, window B (see #00081) */
+  USHORT WindowGranularity;          /* window granularity in KB */
+  USHORT WindowSize;                 /* window size in KB */
+  USHORT WindowAStartSegment;        /* start segment of window A (0000h if not supported) */
+  USHORT WindowBStartSegment;        /* start segment of window B (0000h if not supported) */
+  ULONG WindowPositioningFunction;  /* -> FAR window positioning function (equivalent to AX=4F05h) */
+  USHORT BytesPerScanLine;           /* bytes per scan line */
   /* ---remainder is optional for VESA modes in v1.0/1.1, needed for OEM modes--- */
-  U16 WidthInPixels;              /* width in pixels (graphics) or characters (text) */
-  U16 HeightInPixels;             /* height in pixels (graphics) or characters (text) */
-  U8  CharacterWidthInPixels;     /* width of character cell in pixels */
-  U8  CharacterHeightInPixels;    /* height of character cell in pixels */
-  U8  NumberOfMemoryPlanes;       /* number of memory planes */
-  U8  BitsPerPixel;               /* number of bits per pixel */
-  U8  NumberOfBanks;              /* number of banks */
-  U8  MemoryModel;                /* memory model type (see #00082) */
-  U8  BankSize;                   /* size of bank in KB */
-  U8  NumberOfImagePanes;         /* number of image pages (less one) that will fit in video RAM */
-  U8  Reserved1;                  /* reserved (00h for VBE 1.0-2.0, 01h for VBE 3.0) */
+  USHORT WidthInPixels;              /* width in pixels (graphics) or characters (text) */
+  USHORT HeightInPixels;             /* height in pixels (graphics) or characters (text) */
+  UCHAR  CharacterWidthInPixels;     /* width of character cell in pixels */
+  UCHAR  CharacterHeightInPixels;    /* height of character cell in pixels */
+  UCHAR  NumberOfMemoryPlanes;       /* number of memory planes */
+  UCHAR  BitsPerPixel;               /* number of bits per pixel */
+  UCHAR  NumberOfBanks;              /* number of banks */
+  UCHAR  MemoryModel;                /* memory model type (see #00082) */
+  UCHAR  BankSize;                   /* size of bank in KB */
+  UCHAR  NumberOfImagePanes;         /* number of image pages (less one) that will fit in video RAM */
+  UCHAR  Reserved1;                  /* reserved (00h for VBE 1.0-2.0, 01h for VBE 3.0) */
   /* ---VBE v1.2+ --- */
-  U8  RedMaskSize;                /* red mask size */
-  U8  RedMaskPosition;            /* red field position */
-  U8  GreenMaskSize;              /* green mask size */
-  U8  GreenMaskPosition;          /* green field size */
-  U8  BlueMaskSize;               /* blue mask size */
-  U8  BlueMaskPosition;           /* blue field size */
-  U8  ReservedMaskSize;           /* reserved mask size */
-  U8  ReservedMaskPosition;       /* reserved mask position */
-  U8  DirectColorModeInfo;        /* direct color mode info */
+  UCHAR  RedMaskSize;                /* red mask size */
+  UCHAR  RedMaskPosition;            /* red field position */
+  UCHAR  GreenMaskSize;              /* green mask size */
+  UCHAR  GreenMaskPosition;          /* green field size */
+  UCHAR  BlueMaskSize;               /* blue mask size */
+  UCHAR  BlueMaskPosition;           /* blue field size */
+  UCHAR  ReservedMaskSize;           /* reserved mask size */
+  UCHAR  ReservedMaskPosition;       /* reserved mask position */
+  UCHAR  DirectColorModeInfo;        /* direct color mode info */
                                   /* bit 0:Color ramp is programmable */
                                   /* bit 1:Bytes in reserved field may be used by application */
   /* ---VBE v2.0+ --- */
-  U32 LinearVideoBufferAddress;   /* physical address of linear video buffer */
-  U32 OffscreenMemoryPointer;     /* pointer to start of offscreen memory */
-  U16 OffscreenMemorySize;        /* KB of offscreen memory */
+  ULONG LinearVideoBufferAddress;   /* physical address of linear video buffer */
+  ULONG OffscreenMemoryPointer;     /* pointer to start of offscreen memory */
+  USHORT OffscreenMemorySize;        /* KB of offscreen memory */
   /* ---VBE v3.0 --- */
-  U16 LinearBytesPerScanLine;     /* bytes per scan line in linear modes */
-  U8  BankedNumberOfImages;       /* number of images (less one) for banked video modes */
-  U8  LinearNumberOfImages;       /* number of images (less one) for linear video modes */
-  U8  LinearRedMaskSize;          /* linear modes:Size of direct color red mask (in bits) */
-  U8  LinearRedMaskPosition;      /* linear modes:Bit position of red mask LSB (e.g. shift count) */
-  U8  LinearGreenMaskSize;        /* linear modes:Size of direct color green mask (in bits) */
-  U8  LinearGreenMaskPosition;    /* linear modes:Bit position of green mask LSB (e.g. shift count) */
-  U8  LinearBlueMaskSize;         /* linear modes:Size of direct color blue mask (in bits) */
-  U8  LinearBlueMaskPosition;     /* linear modes:Bit position of blue mask LSB (e.g. shift count) */
-  U8  LinearReservedMaskSize;     /* linear modes:Size of direct color reserved mask (in bits) */
-  U8  LinearReservedMaskPosition; /* linear modes:Bit position of reserved mask LSB */
-  U32 MaximumPixelClock;          /* maximum pixel clock for graphics video mode, in Hz */
-  U8  Reserved2[190];             /* 190 BYTEs  reserved (0) */
+  USHORT LinearBytesPerScanLine;     /* bytes per scan line in linear modes */
+  UCHAR  BankedNumberOfImages;       /* number of images (less one) for banked video modes */
+  UCHAR  LinearNumberOfImages;       /* number of images (less one) for linear video modes */
+  UCHAR  LinearRedMaskSize;          /* linear modes:Size of direct color red mask (in bits) */
+  UCHAR  LinearRedMaskPosition;      /* linear modes:Bit position of red mask LSB (e.g. shift count) */
+  UCHAR  LinearGreenMaskSize;        /* linear modes:Size of direct color green mask (in bits) */
+  UCHAR  LinearGreenMaskPosition;    /* linear modes:Bit position of green mask LSB (e.g. shift count) */
+  UCHAR  LinearBlueMaskSize;         /* linear modes:Size of direct color blue mask (in bits) */
+  UCHAR  LinearBlueMaskPosition;     /* linear modes:Bit position of blue mask LSB (e.g. shift count) */
+  UCHAR  LinearReservedMaskSize;     /* linear modes:Size of direct color reserved mask (in bits) */
+  UCHAR  LinearReservedMaskPosition; /* linear modes:Bit position of reserved mask LSB */
+  ULONG MaximumPixelClock;          /* maximum pixel clock for graphics video mode, in Hz */
+  UCHAR  Reserved2[190];             /* 190 BYTEs  reserved (0) */
 } PACKED SVGA_MODE_INFORMATION, *PSVGA_MODE_INFORMATION;
 
-static U32 BiosVideoMode;                              /* Current video mode as known by BIOS */
-static U32 ScreenWidth = 80;                          /* Screen Width in characters */
-static U32 ScreenHeight = 25;                          /* Screen Height in characters */
-static U32 BytesPerScanLine = 160;                     /* Number of bytes per scanline (delta) */
+static ULONG BiosVideoMode;                              /* Current video mode as known by BIOS */
+static ULONG ScreenWidth = 80;                        /* Screen Width in characters */
+static ULONG ScreenHeight = 25;                          /* Screen Height in characters */
+static ULONG BytesPerScanLine = 160;                     /* Number of bytes per scanline (delta) */
 static VIDEODISPLAYMODE DisplayMode = VideoTextMode;   /* Current display mode */
 static BOOL VesaVideoMode = FALSE;                     /* Are we using a VESA mode? */
 static SVGA_MODE_INFORMATION VesaVideoModeInformation; /* Only valid when in VESA mode */
-static U32 CurrentMemoryBank = 0;                      /* Currently selected VESA bank */
+static ULONG CurrentMemoryBank = 0;                      /* Currently selected VESA bank */
 
-static U32
+static ULONG
 PcVideoDetectVideoCard(VOID)
 {
   REGS Regs;
@@ -192,7 +192,7 @@ PcVideoDetectVideoCard(VOID)
     }
 }
 
-static VOID PcVideoSetBiosMode(U32 VideoMode)
+static VOID PcVideoSetBiosMode(ULONG VideoMode)
 {
   REGS Regs;
 
@@ -297,7 +297,7 @@ VOID PcVideoDisableCursorEmulation(VOID)
 }
 
 static VOID
-PcVideoDefineCursor(U32 StartScanLine, U32 EndScanLine)
+PcVideoDefineCursor(ULONG StartScanLine, ULONG EndScanLine)
 {
   REGS Regs;
 
@@ -333,7 +333,7 @@ PcVideoDefineCursor(U32 StartScanLine, U32 EndScanLine)
 }
 
 static VOID
-PcVideoSetVerticalResolution(U32 ScanLines)
+PcVideoSetVerticalResolution(ULONG ScanLines)
 {
   REGS Regs;
 
@@ -439,7 +439,7 @@ PcVideoSetDisplayEnd(VOID)
 }
 
 static BOOL
-PcVideoVesaGetSVGAModeInformation(U16 Mode, PSVGA_MODE_INFORMATION ModeInformation)
+PcVideoVesaGetSVGAModeInformation(USHORT Mode, PSVGA_MODE_INFORMATION ModeInformation)
 {
   REGS Regs;
 
@@ -511,7 +511,7 @@ PcVideoVesaGetSVGAModeInformation(U16 Mode, PSVGA_MODE_INFORMATION ModeInformati
 }
 
 static BOOL
-PcVideoSetBiosVesaMode(U16 Mode)
+PcVideoSetBiosVesaMode(USHORT Mode)
 {
   REGS Regs;
 
@@ -697,7 +697,7 @@ PcVideoSetMode80x60(VOID)
 }
 
 static BOOL
-PcVideoSetMode(U32 NewMode)
+PcVideoSetMode(ULONG NewMode)
 {
   CurrentMemoryBank = 0;
 
@@ -735,7 +735,7 @@ PcVideoSetMode(U32 NewMode)
     {
       /* 640x480x16 */
       PcVideoSetBiosMode(NewMode);
-      WRITE_PORT_USHORT((U16*)0x03CE, 0x0F01); /* For some reason this is necessary? */
+      WRITE_PORT_USHORT((USHORT*)0x03CE, 0x0F01); /* For some reason this is necessary? */
       ScreenWidth = 640;
       ScreenHeight = 480;
       BytesPerScanLine = 80;
@@ -830,7 +830,7 @@ PcVideoSetBlinkBit(BOOL Enable)
 }
 
 static VOID
-PcVideoSetMemoryBank(U16 BankNumber)
+PcVideoSetMemoryBank(USHORT BankNumber)
 {
   REGS Regs;
 
@@ -870,7 +870,7 @@ PcVideoSetMemoryBank(U16 BankNumber)
 VIDEODISPLAYMODE
 PcVideoSetDisplayMode(char *DisplayModeName, BOOL Init)
 {
-  U32 VideoMode = VIDEOMODE_NORMAL_TEXT;
+  ULONG VideoMode = VIDEOMODE_NORMAL_TEXT;
 
   if (NULL == DisplayModeName || '\0' == *DisplayModeName)
     {
@@ -927,7 +927,7 @@ PcVideoSetDisplayMode(char *DisplayModeName, BOOL Init)
 }
 
 VOID
-PcVideoGetDisplaySize(PU32 Width, PU32 Height, PU32 Depth)
+PcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
 {
   *Width = ScreenWidth;
   *Height = ScreenHeight;
@@ -950,14 +950,14 @@ PcVideoGetDisplaySize(PU32 Width, PU32 Height, PU32 Depth)
     }
 }
 
-U32
+ULONG
 PcVideoGetBufferSize(VOID)
 {
   return ScreenHeight * BytesPerScanLine;
 }
 
 VOID
-PcVideoSetTextCursorPosition(U32 X, U32 Y)
+PcVideoSetTextCursorPosition(ULONG X, ULONG Y)
 {
   REGS Regs;
 
@@ -997,10 +997,10 @@ PcVideoHideShowTextCursor(BOOL Show)
 VOID
 PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
 {
-  U32 BanksToCopy;
-  U32 BytesInLastBank;
-  U32 CurrentBank;
-  U32 BankSize;
+  ULONG BanksToCopy;
+  ULONG BytesInLastBank;
+  ULONG CurrentBank;
+  ULONG BankSize;
 
   /* PcVideoWaitForVerticalRetrace(); */
 
@@ -1036,14 +1036,14 @@ PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
 }
 
 VOID
-PcVideoClearScreen(U8 Attr)
+PcVideoClearScreen(UCHAR Attr)
 {
-  U16 AttrChar;
-  U16 *BufPtr;
+  USHORT AttrChar;
+  USHORT *BufPtr;
 
-  AttrChar = ((U16) Attr << 8) | ' ';
-  for (BufPtr = (U16 *) VIDEOTEXT_MEM_ADDRESS;
-       BufPtr < (U16 *) (VIDEOTEXT_MEM_ADDRESS + VIDEOTEXT_MEM_SIZE);
+  AttrChar = ((USHORT) Attr << 8) | ' ';
+  for (BufPtr = (USHORT *) VIDEOTEXT_MEM_ADDRESS;
+       BufPtr < (USHORT *) (VIDEOTEXT_MEM_ADDRESS + VIDEOTEXT_MEM_SIZE);
        BufPtr++)
     {
       *BufPtr = AttrChar;
@@ -1051,12 +1051,12 @@ PcVideoClearScreen(U8 Attr)
 }
 
 VOID
-PcVideoPutChar(int Ch, U8 Attr, unsigned X, unsigned Y)
+PcVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
 {
-  U16 *BufPtr;
+  USHORT *BufPtr;
 
-  BufPtr = (U16 *) (VIDEOTEXT_MEM_ADDRESS + Y * BytesPerScanLine + X * 2);
-  *BufPtr = ((U16) Attr << 8) | (Ch & 0xff);
+  BufPtr = (USHORT *) (VIDEOTEXT_MEM_ADDRESS + Y * BytesPerScanLine + X * 2);
+  *BufPtr = ((USHORT) Attr << 8) | (Ch & 0xff);
 }
 
 BOOL
@@ -1066,27 +1066,27 @@ PcVideoIsPaletteFixed(VOID)
 }
 
 VOID
-PcVideoSetPaletteColor(U8 Color, U8 Red, U8 Green, U8 Blue)
+PcVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
 {
-  WRITE_PORT_UCHAR((U8*) VIDEOPORT_PALETTE_WRITE, Color);
-  WRITE_PORT_UCHAR((U8*) VIDEOPORT_PALETTE_DATA, Red);
-  WRITE_PORT_UCHAR((U8*) VIDEOPORT_PALETTE_DATA, Green);
-  WRITE_PORT_UCHAR((U8*) VIDEOPORT_PALETTE_DATA, Blue);
+  WRITE_PORT_UCHAR((UCHAR*) VIDEOPORT_PALETTE_WRITE, Color);
+  WRITE_PORT_UCHAR((UCHAR*) VIDEOPORT_PALETTE_DATA, Red);
+  WRITE_PORT_UCHAR((UCHAR*) VIDEOPORT_PALETTE_DATA, Green);
+  WRITE_PORT_UCHAR((UCHAR*) VIDEOPORT_PALETTE_DATA, Blue);
 }
 
 VOID
-PcVideoGetPaletteColor(U8 Color, U8* Red, U8* Green, U8* Blue)
+PcVideoGetPaletteColor(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue)
 {
-  WRITE_PORT_UCHAR((U8*) VIDEOPORT_PALETTE_READ, Color);
-  *Red = READ_PORT_UCHAR((U8*) VIDEOPORT_PALETTE_DATA);
-  *Green = READ_PORT_UCHAR((U8*) VIDEOPORT_PALETTE_DATA);
-  *Blue = READ_PORT_UCHAR((U8*) VIDEOPORT_PALETTE_DATA);
+  WRITE_PORT_UCHAR((UCHAR*) VIDEOPORT_PALETTE_READ, Color);
+  *Red = READ_PORT_UCHAR((UCHAR*) VIDEOPORT_PALETTE_DATA);
+  *Green = READ_PORT_UCHAR((UCHAR*) VIDEOPORT_PALETTE_DATA);
+  *Blue = READ_PORT_UCHAR((UCHAR*) VIDEOPORT_PALETTE_DATA);
 }
 
 VOID
 PcVideoSync(VOID)
 {
-  while (1 == (READ_PORT_UCHAR((U8*)VIDEOPORT_VERTICAL_RETRACE) & 0x08))
+  while (1 == (READ_PORT_UCHAR((UCHAR*)VIDEOPORT_VERTICAL_RETRACE) & 0x08))
     {
       /*
        * Keep reading the port until bit 3 is clear
@@ -1096,7 +1096,7 @@ PcVideoSync(VOID)
        */
     }
 
-  while (0 == (READ_PORT_UCHAR((U8*)VIDEOPORT_VERTICAL_RETRACE) & 0x08))
+  while (0 == (READ_PORT_UCHAR((UCHAR*)VIDEOPORT_VERTICAL_RETRACE) & 0x08))
     {
       /*
        * Keep reading the port until bit 3 is set
index ba3361a..feebd22 100644 (file)
 #define SLOW_DOWN_IO __SLOW_DOWN_IO
 #endif
 
-VOID /*STDCALL*/
+#undef READ_PORT_BUFFER_UCHAR
+VOID
+STDCALL
 READ_PORT_BUFFER_UCHAR (PUCHAR Port,
                         PUCHAR Buffer,
-                        U32 Count)
+                        ULONG Count)
 {
    __asm__ __volatile__ ("cld ; rep ; insb\n\t" 
                         : "=D" (Buffer), "=c" (Count) 
                         : "d" (Port),"0" (Buffer),"1" (Count));
 }
 
-VOID /*STDCALL*/
-READ_PORT_BUFFER_USHORT (U16* Port,
-                         U16* Buffer,
-                         U32 Count)
+#undef READ_PORT_BUFFER_USHORT
+VOID
+STDCALL
+READ_PORT_BUFFER_USHORT (USHORT* Port,
+                         USHORT* Buffer,
+                         ULONG Count)
 {
    __asm__ __volatile__ ("cld ; rep ; insw"
                         : "=D" (Buffer), "=c" (Count) 
                         : "d" (Port),"0" (Buffer),"1" (Count));
 }
 
-VOID /*STDCALL*/
-READ_PORT_BUFFER_ULONG (U32* Port,
-                        U32* Buffer,
-                        U32 Count)
+#undef READ_PORT_BUFFER_ULONG
+VOID
+STDCALL
+READ_PORT_BUFFER_ULONG (ULONG* Port,
+                        ULONG* Buffer,
+                        ULONG Count)
 {
    __asm__ __volatile__ ("cld ; rep ; insl"
                         : "=D" (Buffer), "=c" (Count) 
                         : "d" (Port),"0" (Buffer),"1" (Count));
 }
 
-UCHAR /*STDCALL*/
+#undef READ_PORT_UCHAR
+UCHAR 
+STDCALL
 READ_PORT_UCHAR (PUCHAR Port)
 {
    UCHAR Value;
@@ -93,10 +101,12 @@ READ_PORT_UCHAR (PUCHAR Port)
    return(Value);
 }
 
-U16 /*STDCALL*/
-READ_PORT_USHORT (U16* Port)
+#undef READ_PORT_USHORT
+USHORT
+STDCALL
+READ_PORT_USHORT (USHORT* Port)
 {
-   U16 Value;
+   USHORT Value;
    
    __asm__("inw %w1, %0\n\t"
           : "=a" (Value)
@@ -105,10 +115,12 @@ READ_PORT_USHORT (U16* Port)
    return(Value);
 }
 
-U32 /*STDCALL*/
-READ_PORT_ULONG (U32* Port)
+#undef READ_PORT_ULONG
+ULONG
+STDCALL
+READ_PORT_ULONG (ULONG* Port)
 {
-   U32 Value;
+   ULONG Value;
    
    __asm__("inl %w1, %0\n\t"
           : "=a" (Value)
@@ -117,37 +129,45 @@ READ_PORT_ULONG (U32* Port)
    return(Value);
 }
 
-VOID /*STDCALL*/
+#undef WRITE_PORT_BUFFER_UCHAR
+VOID 
+STDCALL
 WRITE_PORT_BUFFER_UCHAR (PUCHAR Port,
                          PUCHAR Buffer,
-                         U32 Count)
+                         ULONG Count)
 {
    __asm__ __volatile__ ("cld ; rep ; outsb" 
                         : "=S" (Buffer), "=c" (Count) 
                         : "d" (Port),"0" (Buffer),"1" (Count));
 }
 
-VOID /*STDCALL*/
-WRITE_PORT_BUFFER_USHORT (U16* Port,
-                          U16* Buffer,
-                          U32 Count)
+#undef WRITE_PORT_BUFFER_USHORT
+VOID
+STDCALL
+WRITE_PORT_BUFFER_USHORT (USHORT* Port,
+                          USHORT* Buffer,
+                          ULONG Count)
 {
    __asm__ __volatile__ ("cld ; rep ; outsw"
                         : "=S" (Buffer), "=c" (Count) 
                         : "d" (Port),"0" (Buffer),"1" (Count));
 }
 
-VOID /*STDCALL*/
-WRITE_PORT_BUFFER_ULONG (U32* Port,
-                         U32* Buffer,
-                         U32 Count)
+#undef WRITE_PORT_BUFFER_ULONG
+VOID
+STDCALL
+WRITE_PORT_BUFFER_ULONG (ULONG* Port,
+                         ULONG* Buffer,
+                         ULONG Count)
 {
    __asm__ __volatile__ ("cld ; rep ; outsl" 
                         : "=S" (Buffer), "=c" (Count) 
                         : "d" (Port),"0" (Buffer),"1" (Count));
 }
 
-VOID /*STDCALL*/
+#undef WRITE_PORT_UCHAR
+VOID
+STDCALL
 WRITE_PORT_UCHAR (PUCHAR Port,
                   UCHAR Value)
 {
@@ -158,9 +178,11 @@ WRITE_PORT_UCHAR (PUCHAR Port,
    SLOW_DOWN_IO;
 }
 
-VOID /*STDCALL*/
-WRITE_PORT_USHORT (U16* Port,
-                   U16 Value)
+#undef WRITE_PORT_USHORT
+VOID
+STDCALL
+WRITE_PORT_USHORT (USHORT* Port,
+                   USHORT Value)
 {
    __asm__("outw %0, %w1\n\t"
           : 
@@ -169,9 +191,11 @@ WRITE_PORT_USHORT (U16* Port,
    SLOW_DOWN_IO;
 }
 
-VOID /*STDCALL*/
-WRITE_PORT_ULONG (U32* Port,
-                  U32 Value)
+#undef WRITE_PORT_ULONG
+VOID
+STDCALL
+WRITE_PORT_ULONG (ULONG* Port,
+                  ULONG Value)
 {
    __asm__("outl %0, %w1\n\t"
           : 
index 179b9f8..d803144 100644 (file)
@@ -28,9 +28,9 @@ static unsigned CurrentAttr = 0x0f;
 VOID
 XboxConsPutChar(int c)
 {
-  U32 Width;
-  U32 Height;
-  U32 Depth;
+  ULONG Width;
+  ULONG Height;
+  ULONG Depth;
 
   if ('\r' == c)
     {
index 7fb1cd6..68d805b 100644 (file)
@@ -38,9 +38,9 @@
 
 static struct
 {
-  U32 SectorCountBeforePartition;
-  U32 PartitionSectorCount;
-  U8 SystemIndicator;
+  ULONG SectorCountBeforePartition;
+  ULONG PartitionSectorCount;
+  UCHAR SystemIndicator;
 } XboxPartitions[] =
 {
   /* This is in the \Device\Harddisk0\Partition.. order used by the Xbox kernel */
@@ -155,17 +155,17 @@ static struct
  *  Data block read and write commands
  */
 #define IDEReadBlock(Address, Buffer, Count) \
-  (READ_PORT_BUFFER_USHORT((PU16)((Address) + IDE_REG_DATA_PORT), (PU16)(Buffer), (Count) / 2))
+  (READ_PORT_BUFFER_USHORT((PUSHORT)((Address) + IDE_REG_DATA_PORT), (PUSHORT)(Buffer), (Count) / 2))
 #define IDEWriteBlock(Address, Buffer, Count) \
-  (WRITE_PORT_BUFFER_USHORT((PU16)((Address) + IDE_REG_DATA_PORT), (PU16)(Buffer), (Count) / 2))
+  (WRITE_PORT_BUFFER_USHORT((PUSHORT)((Address) + IDE_REG_DATA_PORT), (PUSHORT)(Buffer), (Count) / 2))
 
 #define IDEReadBlock32(Address, Buffer, Count) \
-  (READ_PORT_BUFFER_ULONG((PU32)((Address) + IDE_REG_DATA_PORT), (PU32)(Buffer), (Count) / 4))
+  (READ_PORT_BUFFER_ULONG((PULONG)((Address) + IDE_REG_DATA_PORT), (PULONG)(Buffer), (Count) / 4))
 #define IDEWriteBlock32(Address, Buffer, Count) \
-  (WRITE_PORT_BUFFER_ULONG((PU32)((Address) + IDE_REG_DATA_PORT), (PU32)(Buffer), (Count) / 4))
+  (WRITE_PORT_BUFFER_ULONG((PULONG)((Address) + IDE_REG_DATA_PORT), (PULONG)(Buffer), (Count) / 4))
 
 #define IDEReadWord(Address) \
-  (READ_PORT_USHORT((PU16)((Address) + IDE_REG_DATA_PORT)))
+  (READ_PORT_USHORT((PUSHORT)((Address) + IDE_REG_DATA_PORT)))
 
 /*
  *  Access macros for control registers
@@ -180,64 +180,64 @@ static struct
 
 typedef struct _IDE_DRIVE_IDENTIFY
 {
-  U16   ConfigBits;          /*00*/
-  U16   LogicalCyls;         /*01*/
-  U16   Reserved02;          /*02*/
-  U16   LogicalHeads;        /*03*/
-  U16   BytesPerTrack;       /*04*/
-  U16   BytesPerSector;      /*05*/
-  U16   SectorsPerTrack;     /*06*/
-  U8    InterSectorGap;      /*07*/
-  U8    InterSectorGapSize;
-  U8    Reserved08H;         /*08*/
-  U8    BytesInPLO;
-  U16   VendorUniqueCnt;     /*09*/
+  USHORT   ConfigBits;          /*00*/
+  USHORT   LogicalCyls;         /*01*/
+  USHORT   Reserved02;          /*02*/
+  USHORT   LogicalHeads;        /*03*/
+  USHORT   BytesPerTrack;       /*04*/
+  USHORT   BytesPerSector;      /*05*/
+  USHORT   SectorsPerTrack;     /*06*/
+  UCHAR    InterSectorGap;      /*07*/
+  UCHAR    InterSectorGapSize;
+  UCHAR    Reserved08H;         /*08*/
+  UCHAR    BytesInPLO;
+  USHORT   VendorUniqueCnt;     /*09*/
   char  SerialNumber[20];    /*10*/
-  U16   ControllerType;      /*20*/
-  U16   BufferSize;          /*21*/
-  U16   ECCByteCnt;          /*22*/
+  USHORT   ControllerType;      /*20*/
+  USHORT   BufferSize;          /*21*/
+  USHORT   ECCByteCnt;          /*22*/
   char  FirmwareRev[8];      /*23*/
   char  ModelNumber[40];     /*27*/
-  U16   RWMultImplemented;   /*47*/
-  U16   DWordIo;            /*48*/
-  U16   Capabilities;        /*49*/
+  USHORT   RWMultImplemented;   /*47*/
+  USHORT   DWordIo;         /*48*/
+  USHORT   Capabilities;        /*49*/
 #define IDE_DRID_STBY_SUPPORTED   0x2000
 #define IDE_DRID_IORDY_SUPPORTED  0x0800
 #define IDE_DRID_IORDY_DISABLE    0x0400
 #define IDE_DRID_LBA_SUPPORTED    0x0200
 #define IDE_DRID_DMA_SUPPORTED    0x0100
-  U16   Reserved50;          /*50*/
-  U16   MinPIOTransTime;     /*51*/
-  U16   MinDMATransTime;     /*52*/
-  U16   TMFieldsValid;       /*53*/
-  U16   TMCylinders;         /*54*/
-  U16   TMHeads;             /*55*/
-  U16   TMSectorsPerTrk;     /*56*/
-  U16   TMCapacityLo;        /*57*/
-  U16   TMCapacityHi;        /*58*/
-  U16   RWMultCurrent;       /*59*/
-  U16   TMSectorCountLo;     /*60*/
-  U16   TMSectorCountHi;     /*61*/
-  U16   DmaModes;            /*62*/
-  U16   MultiDmaModes;       /*63*/
-  U16   Reserved64[5];       /*64*/
-  U16   Reserved69[2];       /*69*/
-  U16   Reserved71[4];       /*71*/
-  U16   MaxQueueDepth;       /*75*/
-  U16   Reserved76[4];       /*76*/
-  U16   MajorRevision;       /*80*/
-  U16   MinorRevision;       /*81*/
-  U16   SupportedFeatures82; /*82*/
-  U16   SupportedFeatures83; /*83*/
-  U16   SupportedFeatures84; /*84*/
-  U16   EnabledFeatures85;   /*85*/
-  U16   EnabledFeatures86;   /*86*/
-  U16   EnabledFeatures87;   /*87*/
-  U16   UltraDmaModes;       /*88*/
-  U16   Reserved89[11];      /*89*/
-  U16   Max48BitAddress[4];  /*100*/
-  U16   Reserved104[151];    /*104*/
-  U16   Checksum;            /*255*/
+  USHORT   Reserved50;          /*50*/
+  USHORT   MinPIOTransTime;     /*51*/
+  USHORT   MinDMATransTime;     /*52*/
+  USHORT   TMFieldsValid;       /*53*/
+  USHORT   TMCylinders;         /*54*/
+  USHORT   TMHeads;             /*55*/
+  USHORT   TMSectorsPerTrk;     /*56*/
+  USHORT   TMCapacityLo;        /*57*/
+  USHORT   TMCapacityHi;        /*58*/
+  USHORT   RWMultCurrent;       /*59*/
+  USHORT   TMSectorCountLo;     /*60*/
+  USHORT   TMSectorCountHi;     /*61*/
+  USHORT   DmaModes;            /*62*/
+  USHORT   MultiDmaModes;       /*63*/
+  USHORT   Reserved64[5];       /*64*/
+  USHORT   Reserved69[2];       /*69*/
+  USHORT   Reserved71[4];       /*71*/
+  USHORT   MaxQueueDepth;       /*75*/
+  USHORT   Reserved76[4];       /*76*/
+  USHORT   MajorRevision;       /*80*/
+  USHORT   MinorRevision;       /*81*/
+  USHORT   SupportedFeatures82; /*82*/
+  USHORT   SupportedFeatures83; /*83*/
+  USHORT   SupportedFeatures84; /*84*/
+  USHORT   EnabledFeatures85;   /*85*/
+  USHORT   EnabledFeatures86;   /*86*/
+  USHORT   EnabledFeatures87;   /*87*/
+  USHORT   UltraDmaModes;       /*88*/
+  USHORT   Reserved89[11];      /*89*/
+  USHORT   Max48BitAddress[4];  /*100*/
+  USHORT   Reserved104[151];    /*104*/
+  USHORT   Checksum;            /*255*/
 } IDE_DRIVE_IDENTIFY, *PIDE_DRIVE_IDENTIFY;
 
 /*  XboxDiskPolledRead
@@ -249,15 +249,15 @@ typedef struct _IDE_DRIVE_IDENTIFY
  *    PASSIVE_LEVEL
  *
  *  ARGUMENTS:
- *    U32   CommandPort   Address of command port for drive
- *    U32   ControlPort   Address of control port for drive
- *    U8    PreComp       Value to write to precomp register
- *    U8    SectorCnt     Value to write to sectorCnt register
- *    U8    SectorNum     Value to write to sectorNum register
- *    U8    CylinderLow   Value to write to CylinderLow register
- *    U8    CylinderHigh  Value to write to CylinderHigh register
- *    U8    DrvHead       Value to write to Drive/Head register
- *    U8    Command       Value to write to Command register
+ *    ULONG   CommandPort   Address of command port for drive
+ *    ULONG   ControlPort   Address of control port for drive
+ *    UCHAR    PreComp       Value to write to precomp register
+ *    UCHAR    SectorCnt     Value to write to sectorCnt register
+ *    UCHAR    SectorNum     Value to write to sectorNum register
+ *    UCHAR    CylinderLow   Value to write to CylinderLow register
+ *    UCHAR    CylinderHigh  Value to write to CylinderHigh register
+ *    UCHAR    DrvHead       Value to write to Drive/Head register
+ *    UCHAR    Command       Value to write to Command register
  *    PVOID Buffer        Buffer for output data
  *
  *  RETURNS:
@@ -265,21 +265,21 @@ typedef struct _IDE_DRIVE_IDENTIFY
  */
 
 static BOOL
-XboxDiskPolledRead(U32 CommandPort,
-                   U32 ControlPort,
-                   U8 PreComp,
-                   U8 SectorCnt,
-                   U8 SectorNum,
-                   U8 CylinderLow,
-                   U8 CylinderHigh,
-                   U8 DrvHead,
-                   U8 Command,
+XboxDiskPolledRead(ULONG CommandPort,
+                   ULONG ControlPort,
+                   UCHAR PreComp,
+                   UCHAR SectorCnt,
+                   UCHAR SectorNum,
+                   UCHAR CylinderLow,
+                   UCHAR CylinderHigh,
+                   UCHAR DrvHead,
+                   UCHAR Command,
                    PVOID Buffer)
 {
-  U32 SectorCount = 0;
-  U32 RetryCount;
+  ULONG SectorCount = 0;
+  ULONG RetryCount;
   BOOL Junk = FALSE;
-  U8 Status;
+  UCHAR Status;
 
   /* Wait for BUSY to clear */
   for (RetryCount = 0; RetryCount < IDE_MAX_BUSY_RETRIES; RetryCount++)
@@ -289,7 +289,7 @@ XboxDiskPolledRead(U32 CommandPort,
         {
           break;
         }
-      KeStallExecutionProcessor(10);
+      StallExecutionProcessor(10);
     }
   DbgPrint((DPRINT_DISK, "status=0x%x\n", Status));
   DbgPrint((DPRINT_DISK, "waited %d usecs for busy to clear\n", RetryCount * 10));
@@ -301,11 +301,11 @@ XboxDiskPolledRead(U32 CommandPort,
 
   /*  Write Drive/Head to select drive  */
   IDEWriteDriveHead(CommandPort, IDE_DH_FIXED | DrvHead);
-  KeStallExecutionProcessor(500);
+  StallExecutionProcessor(500);
 
   /* Disable interrupts */
   IDEWriteDriveControl(ControlPort, IDE_DC_nIEN);
-  KeStallExecutionProcessor(500);
+  StallExecutionProcessor(500);
 
   /*  Issue command to drive  */
   if (DrvHead & IDE_DH_LBA)
@@ -338,7 +338,7 @@ XboxDiskPolledRead(U32 CommandPort,
 
   /*  Issue the command  */
   IDEWriteCommand(CommandPort, Command);
-  KeStallExecutionProcessor(50);
+  StallExecutionProcessor(50);
 
   /*  wait for DRQ or error  */
   for (RetryCount = 0; RetryCount < IDE_MAX_POLL_RETRIES; RetryCount++)
@@ -349,7 +349,7 @@ XboxDiskPolledRead(U32 CommandPort,
          if (Status & IDE_SR_ERR)
            {
              IDEWriteDriveControl(ControlPort, 0);
-             KeStallExecutionProcessor(50);
+             StallExecutionProcessor(50);
              IDEReadStatus(CommandPort);
 
              return FALSE;
@@ -362,20 +362,20 @@ XboxDiskPolledRead(U32 CommandPort,
          else
            {
              IDEWriteDriveControl(ControlPort, 0);
-             KeStallExecutionProcessor(50);
+             StallExecutionProcessor(50);
              IDEReadStatus(CommandPort);
 
              return FALSE;
            }
        }
-      KeStallExecutionProcessor(10);
+      StallExecutionProcessor(10);
     }
 
   /*  timed out  */
   if (RetryCount >= IDE_MAX_POLL_RETRIES)
     {
       IDEWriteDriveControl(ControlPort, 0);
-      KeStallExecutionProcessor(50);
+      StallExecutionProcessor(50);
       IDEReadStatus(CommandPort);
 
       return FALSE;
@@ -405,7 +405,7 @@ XboxDiskPolledRead(U32 CommandPort,
              if (Status & IDE_SR_ERR)
                {
                  IDEWriteDriveControl(ControlPort, 0);
-                 KeStallExecutionProcessor(50);
+                 StallExecutionProcessor(50);
                  IDEReadStatus(CommandPort);
 
                  return FALSE;
@@ -427,7 +427,7 @@ XboxDiskPolledRead(U32 CommandPort,
                                 SectorCount - SectorCnt));
                    }
                  IDEWriteDriveControl(ControlPort, 0);
-                 KeStallExecutionProcessor(50);
+                 StallExecutionProcessor(50);
                  IDEReadStatus(CommandPort);
 
                  return TRUE;
@@ -438,10 +438,10 @@ XboxDiskPolledRead(U32 CommandPort,
 }
 
 BOOL
-XboxDiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, PVOID Buffer)
+XboxDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
 {
-  U32 StartSector;
-  U8 Count;
+  ULONG StartSector;
+  UCHAR Count;
 
   if (DriveNumber < 0x80 || 2 <= (DriveNumber & 0x0f))
     {
@@ -456,7 +456,7 @@ XboxDiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, P
       return FALSE;
     }
 
-  StartSector = (U32) SectorNumber;
+  StartSector = (ULONG) SectorNumber;
   while (0 < SectorCount)
     {
       Count = (SectorCount <= 255 ? SectorCount : 255);
@@ -481,9 +481,9 @@ XboxDiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, P
 }
 
 BOOL
-XboxDiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
+XboxDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
 {
-  U8 SectorData[IDE_SECTOR_BUF_SZ];
+  UCHAR SectorData[IDE_SECTOR_BUF_SZ];
 
   /* This is the Xbox, chances are that there is a Xbox-standard partitionless
    * disk in it so let's check that first */
@@ -491,7 +491,7 @@ XboxDiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE
   if (1 <= PartitionNumber && PartitionNumber <= sizeof(XboxPartitions) / sizeof(XboxPartitions[0]) &&
       MachDiskReadLogicalSectors(DriveNumber, XBOX_SIGNATURE_SECTOR, 1, SectorData))
     {
-      if (*((PU32) SectorData) == XBOX_SIGNATURE)
+      if (*((PULONG) SectorData) == XBOX_SIGNATURE)
         {
           memset(PartitionTableEntry, 0, sizeof(PARTITION_TABLE_ENTRY));
           PartitionTableEntry->SystemIndicator = XboxPartitions[PartitionNumber - 1].SystemIndicator;
@@ -506,10 +506,10 @@ XboxDiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE
 }
 
 BOOL
-XboxDiskGetDriveGeometry(U32 DriveNumber, PGEOMETRY Geometry)
+XboxDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry)
 {
   IDE_DRIVE_IDENTIFY DrvParms;
-  U32 i;
+  ULONG i;
   BOOL Atapi;
 
   Atapi = FALSE; /* FIXME */
@@ -565,8 +565,8 @@ XboxDiskGetDriveGeometry(U32 DriveNumber, PGEOMETRY Geometry)
   return TRUE;
 }
 
-U32
-XboxDiskGetCacheableBlockCount(U32 DriveNumber)
+ULONG
+XboxDiskGetCacheableBlockCount(ULONG DriveNumber)
 {
   /* 64 seems a nice number, it is used by the machpc code for LBA devices */
   return 64;
index 359baac..b07a81b 100644 (file)
@@ -23,7 +23,7 @@
 #include "machine.h"
 #include "machxbox.h"
 
-U8 XboxFont8x16[256 * 16] =
+UCHAR XboxFont8x16[256 * 16] =
 {
   0x00,0x00,0x00,0x7c,0xc6,0xc6,0xde,0xde,0xde,0xdc,0xc0,0x7c,0x00,0x00,0x00,0x00, /* 0x00 */
   0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xa5,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00, /* 0x01 */
index 1f5aad5..67e244a 100644 (file)
@@ -29,8 +29,8 @@
 #include "machxbox.h"
 #include "portio.h"
 
-static U32 InstalledMemoryMb = 0;
-static U32 AvailableMemoryMb = 0;
+static ULONG InstalledMemoryMb = 0;
+static ULONG AvailableMemoryMb = 0;
 
 #define TEST_SIZE     0x200
 #define TEST_PATTERN1 0xaa
@@ -39,15 +39,15 @@ static U32 AvailableMemoryMb = 0;
 VOID
 XboxMemInit(VOID)
 {
-  U8 ControlRegion[TEST_SIZE];
+  UCHAR ControlRegion[TEST_SIZE];
   PVOID MembaseTop = (PVOID)(64 * 1024 * 1024);
   PVOID MembaseLow = (PVOID)0;
 
-  (*(PU32)(0xfd000000 + 0x100200)) = 0x03070103 ;
-  (*(PU32)(0xfd000000 + 0x100204)) = 0x11448000 ;
+  (*(PULONG)(0xfd000000 + 0x100200)) = 0x03070103 ;
+  (*(PULONG)(0xfd000000 + 0x100204)) = 0x11448000 ;
 
-  WRITE_PORT_ULONG((U32*) 0xcf8, CONFIG_CMD(0, 0, 0x84));
-  WRITE_PORT_ULONG((U32*) 0xcfc, 0x7ffffff);             /* Prep hardware for 128 Mb */
+  WRITE_PORT_ULONG((ULONG*) 0xcf8, CONFIG_CMD(0, 0, 0x84));
+  WRITE_PORT_ULONG((ULONG*) 0xcfc, 0x7ffffff);             /* Prep hardware for 128 Mb */
 
   InstalledMemoryMb = 64;
   memset(ControlRegion, TEST_PATTERN1, TEST_SIZE);
@@ -76,16 +76,16 @@ XboxMemInit(VOID)
     }
 
   /* Set hardware for amount of memory detected */
-  WRITE_PORT_ULONG((U32*) 0xcf8, CONFIG_CMD(0, 0, 0x84));
-  WRITE_PORT_ULONG((U32*) 0xcfc, InstalledMemoryMb * 1024 * 1024 - 1);
+  WRITE_PORT_ULONG((ULONG*) 0xcf8, CONFIG_CMD(0, 0, 0x84));
+  WRITE_PORT_ULONG((ULONG*) 0xcfc, InstalledMemoryMb * 1024 * 1024 - 1);
 
   AvailableMemoryMb = InstalledMemoryMb;
 }
 
-U32
-XboxMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, U32 MaxMemoryMapSize)
+ULONG
+XboxMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
 {
-  U32 EntryCount = 0;
+  ULONG EntryCount = 0;
 
   /* Synthesize memory map */
   if (1 <= MaxMemoryMapSize)
@@ -110,7 +110,7 @@ XboxMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, U32 MaxMemoryMapSize)
 }
 
 PVOID
-XboxMemReserveMemory(U32 MbToReserve)
+XboxMemReserveMemory(ULONG MbToReserve)
 {
   if (0 == InstalledMemoryMb)
     {
index 0e86984..d6000b7 100644 (file)
@@ -41,7 +41,7 @@ HalpQueryCMOS(UCHAR Reg)
 }
 
 VOID
-XboxRTCGetCurrentDateTime(PU32 Year, PU32 Month, PU32 Day, PU32 Hour, PU32 Minute, PU32 Second)
+XboxRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG Minute, PULONG Second)
 {
   while (HalpQueryCMOS (RTC_REGISTER_A) & RTC_REG_A_UIP)
     {
index 8457b2b..fdcb67a 100644 (file)
 #define I2C_IO_BASE 0xc000
 
 static PVOID FrameBuffer;
-static U32 ScreenWidth;
-static U32 ScreenHeight;
-static U32 BytesPerPixel;
-static U32 Delta;
+static ULONG ScreenWidth;
+static ULONG ScreenHeight;
+static ULONG BytesPerPixel;
+static ULONG Delta;
 
 #define CHAR_WIDTH  8
 #define CHAR_HEIGHT 16
@@ -45,16 +45,16 @@ static U32 Delta;
 #define MAKE_COLOR(Red, Green, Blue) (0xff000000 | (((Red) & 0xff) << 16) | (((Green) & 0xff) << 8) | ((Blue) & 0xff))
 
 static VOID
-XboxVideoOutputChar(U8 Char, unsigned X, unsigned Y, U32 FgColor, U32 BgColor)
+XboxVideoOutputChar(UCHAR Char, unsigned X, unsigned Y, ULONG FgColor, ULONG BgColor)
 {
-  PU8 FontPtr;
-  PU32 Pixel;
-  U8 Mask;
+  PUCHAR FontPtr;
+  PULONG Pixel;
+  UCHAR Mask;
   unsigned Line;
   unsigned Col;
 
   FontPtr = XboxFont8x16 + Char * 16;
-  Pixel = (PU32) ((char *) FrameBuffer + (Y * CHAR_HEIGHT + TOP_BOTTOM_LINES) * Delta
+  Pixel = (PULONG) ((char *) FrameBuffer + (Y * CHAR_HEIGHT + TOP_BOTTOM_LINES) * Delta
                   + X * CHAR_WIDTH * BytesPerPixel);
   for (Line = 0; Line < CHAR_HEIGHT; Line++)
     {
@@ -64,14 +64,14 @@ XboxVideoOutputChar(U8 Char, unsigned X, unsigned Y, U32 FgColor, U32 BgColor)
           Pixel[Col] = (0 != (FontPtr[Line] & Mask) ? FgColor : BgColor);
           Mask = Mask >> 1;
         }
-      Pixel = (PU32) ((char *) Pixel + Delta);
+      Pixel = (PULONG) ((char *) Pixel + Delta);
     }
 }
 
-static U32
-XboxVideoAttrToSingleColor(U8 Attr)
+static ULONG
+XboxVideoAttrToSingleColor(UCHAR Attr)
 {
-  U8 Intensity;
+  UCHAR Intensity;
 
   Intensity = (0 == (Attr & 0x08) ? 127 : 255);
 
@@ -82,21 +82,21 @@ XboxVideoAttrToSingleColor(U8 Attr)
 }
 
 static VOID
-XboxVideoAttrToColors(U8 Attr, U32 *FgColor, U32 *BgColor)
+XboxVideoAttrToColors(UCHAR Attr, ULONG *FgColor, ULONG *BgColor)
 {
   *FgColor = XboxVideoAttrToSingleColor(Attr & 0xf);
   *BgColor = XboxVideoAttrToSingleColor((Attr >> 4) & 0xf);
 }
 
 static VOID
-XboxVideoClearScreenColor(U32 Color, BOOL FullScreen)
+XboxVideoClearScreenColor(ULONG Color, BOOL FullScreen)
 {
-  U32 Line, Col;
-  PU32 p;
+  ULONG Line, Col;
+  PULONG p;
 
   for (Line = 0; Line < ScreenHeight - (FullScreen ? 0 : 2 * TOP_BOTTOM_LINES); Line++)
     {
-      p = (PU32) ((char *) FrameBuffer + (Line + (FullScreen ? 0 : TOP_BOTTOM_LINES)) * Delta);
+      p = (PULONG) ((char *) FrameBuffer + (Line + (FullScreen ? 0 : TOP_BOTTOM_LINES)) * Delta);
       for (Col = 0; Col < ScreenWidth; Col++)
         {
           *p++ = Color;
@@ -105,9 +105,9 @@ XboxVideoClearScreenColor(U32 Color, BOOL FullScreen)
 }
 
 VOID
-XboxVideoClearScreen(U8 Attr)
+XboxVideoClearScreen(UCHAR Attr)
 {
-  U32 FgColor, BgColor;
+  ULONG FgColor, BgColor;
 
   XboxVideoAttrToColors(Attr, &FgColor, &BgColor);
 
@@ -115,9 +115,9 @@ XboxVideoClearScreen(U8 Attr)
 }
 
 VOID
-XboxVideoPutChar(int Ch, U8 Attr, unsigned X, unsigned Y)
+XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
 {
-  U32 FgColor, BgColor;
+  ULONG FgColor, BgColor;
 
   XboxVideoAttrToColors(Attr, &FgColor, &BgColor);
 
@@ -125,11 +125,11 @@ XboxVideoPutChar(int Ch, U8 Attr, unsigned X, unsigned Y)
 }
 
 static BOOL
-ReadfromSMBus(UCHAR Address, UCHAR bRegister, UCHAR Size, U32 *Data_to_smbus)
+ReadfromSMBus(UCHAR Address, UCHAR bRegister, UCHAR Size, ULONG *Data_to_smbus)
 {
   int nRetriesToLive=50;
 
-  while (0 != (READ_PORT_USHORT((PU16) (I2C_IO_BASE + 0)) & 0x0800))
+  while (0 != (READ_PORT_USHORT((PUSHORT) (I2C_IO_BASE + 0)) & 0x0800))
     {
       ;  /* Franz's spin while bus busy with any master traffic */
     }
@@ -142,8 +142,8 @@ ReadfromSMBus(UCHAR Address, UCHAR bRegister, UCHAR Size, U32 *Data_to_smbus)
       WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 4), (Address << 1) | 1);
       WRITE_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 8), bRegister);
 
-      temp = READ_PORT_USHORT((U16 *) (I2C_IO_BASE + 0));
-      WRITE_PORT_USHORT((PU16) (I2C_IO_BASE + 0), temp);  /* clear down all preexisting errors */
+      temp = READ_PORT_USHORT((USHORT *) (I2C_IO_BASE + 0));
+      WRITE_PORT_USHORT((PUSHORT) (I2C_IO_BASE + 0), temp);  /* clear down all preexisting errors */
 
       switch (Size)
         {
@@ -186,7 +186,7 @@ ReadfromSMBus(UCHAR Address, UCHAR bRegister, UCHAR Size, U32 *Data_to_smbus)
                 READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 9));
                 break;
               case 2:
-                *Data_to_smbus = READ_PORT_USHORT((U16 *) (I2C_IO_BASE + 6));
+                *Data_to_smbus = READ_PORT_USHORT((USHORT *) (I2C_IO_BASE + 6));
                 break;
               default:
                 *Data_to_smbus = READ_PORT_UCHAR((PUCHAR) (I2C_IO_BASE + 6));
@@ -203,7 +203,7 @@ ReadfromSMBus(UCHAR Address, UCHAR bRegister, UCHAR Size, U32 *Data_to_smbus)
 
 
 static BOOL
-I2CTransmitByteGetReturn(UCHAR bPicAddressI2cFormat, UCHAR bDataToWrite, U32 *Return)
+I2CTransmitByteGetReturn(UCHAR bPicAddressI2cFormat, UCHAR bDataToWrite, ULONG *Return)
 {
   return ReadfromSMBus(bPicAddressI2cFormat, bDataToWrite, 1, Return);
 }
@@ -212,9 +212,9 @@ I2CTransmitByteGetReturn(UCHAR bPicAddressI2cFormat, UCHAR bDataToWrite, U32 *Re
 VOID
 XboxVideoInit(VOID)
 {
-  U32 AvMode;
+  ULONG AvMode;
 
-  FrameBuffer = (PVOID)((U32) XboxMemReserveMemory(FB_SIZE_MB) | 0xf0000000);
+  FrameBuffer = (PVOID)((ULONG) XboxMemReserveMemory(FB_SIZE_MB) | 0xf0000000);
 
   if (I2CTransmitByteGetReturn(0x10, 0x04, &AvMode))
     {
@@ -247,7 +247,7 @@ XboxVideoInit(VOID)
   XboxVideoClearScreenColor(MAKE_COLOR(0, 0, 0), TRUE);
 
   /* Tell the nVidia controller about the framebuffer */
-  *((PU32) 0xfd600800) = (U32) FrameBuffer;
+  *((PULONG) 0xfd600800) = (ULONG) FrameBuffer;
 }
 
 VIDEODISPLAYMODE
@@ -258,21 +258,21 @@ XboxVideoSetDisplayMode(char *DisplayMode, BOOL Init)
 }
 
 VOID
-XboxVideoGetDisplaySize(PU32 Width, PU32 Height, PU32 Depth)
+XboxVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
 {
   *Width = ScreenWidth / CHAR_WIDTH;
   *Height = (ScreenHeight - 2 * TOP_BOTTOM_LINES) / CHAR_HEIGHT;
   *Depth = 0;
 }
 
-U32
+ULONG
 XboxVideoGetBufferSize(VOID)
 {
   return (ScreenHeight - 2 * TOP_BOTTOM_LINES) / CHAR_HEIGHT * (ScreenWidth / CHAR_WIDTH) * 2;
 }
 
 VOID
-XboxVideoSetTextCursorPosition(U32 X, U32 Y)
+XboxVideoSetTextCursorPosition(ULONG X, ULONG Y)
 {
   /* We don't have a cursor yet */
 }
@@ -286,8 +286,8 @@ XboxVideoHideShowTextCursor(BOOL Show)
 VOID
 XboxVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
 {
-  PU8 OffScreenBuffer = (PU8) Buffer;
-  U32 Col, Line;
+  PUCHAR OffScreenBuffer = (PUCHAR) Buffer;
+  ULONG Col, Line;
 
   for (Line = 0; Line < (ScreenHeight - 2 * TOP_BOTTOM_LINES) / CHAR_HEIGHT; Line++)
     {
@@ -306,13 +306,13 @@ XboxVideoIsPaletteFixed(VOID)
 }
 
 VOID
-XboxVideoSetPaletteColor(U8 Color, U8 Red, U8 Green, U8 Blue)
+XboxVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
 {
   /* Not supported */
 }
 
 VOID
-XboxVideoGetPaletteColor(U8 Color, U8* Red, U8* Green, U8* Blue)
+XboxVideoGetPaletteColor(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue)
 {
   /* Not supported */
 }
index d00d3c8..01cd521 100644 (file)
@@ -41,13 +41,13 @@ VOID RunLoader(VOID)
 {
        UCHAR   SettingName[80];
        UCHAR   SettingValue[80];
-       U32             SectionId;
-       U32             OperatingSystemCount;
+       ULONG           SectionId;
+       ULONG           OperatingSystemCount;
        PUCHAR  *OperatingSystemSectionNames;
        PUCHAR  *OperatingSystemDisplayNames;
-       U32             DefaultOperatingSystem;
-       S32             TimeOut;
-       U32             SelectedOperatingSystem;
+       ULONG           DefaultOperatingSystem;
+       LONG            TimeOut;
+       ULONG           SelectedOperatingSystem;
 
        if (!IniFileInitialize())
        {
@@ -159,13 +159,13 @@ reboot:
        return;
 }
 
-U32     GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], U32     OperatingSystemCount)
+ULONG   GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG   OperatingSystemCount)
 {
        UCHAR   DefaultOSText[80];
        char*   DefaultOSName;
-       U32     SectionId;
-       U32     DefaultOS = 0;
-       U32     Idx;
+       ULONG   SectionId;
+       ULONG   DefaultOS = 0;
+       ULONG   Idx;
 
        if (!IniOpenSection("FreeLoader", &SectionId))
        {
@@ -196,11 +196,11 @@ U32        GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], U32     OperatingSyste
        return DefaultOS;
 }
 
-S32 GetTimeOut(VOID)
+LONG GetTimeOut(VOID)
 {
        UCHAR   TimeOutText[20];
-       S32             TimeOut;
-       U32             SectionId;
+       LONG            TimeOut;
+       ULONG           SectionId;
 
        TimeOut = CmdLineGetTimeOut();
        if (0 <= TimeOut)
@@ -225,7 +225,7 @@ S32 GetTimeOut(VOID)
        return TimeOut;
 }
 
-BOOL MainBootMenuKeyPressFilter(U32 KeyPress)
+BOOL MainBootMenuKeyPressFilter(ULONG KeyPress)
 {
        if (KeyPress == KEY_F8)
        {
index 2a9cb6a..81b3cb6 100644 (file)
@@ -30,7 +30,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, U32 BlockNumber)
+PCACHE_BLOCK CacheInternalGetBlockPointer(PCACHE_DRIVE CacheDrive, ULONG BlockNumber)
 {
        PCACHE_BLOCK    CacheBlock = NULL;
 
@@ -55,7 +55,7 @@ PCACHE_BLOCK CacheInternalGetBlockPointer(PCACHE_DRIVE CacheDrive, U32 BlockNumb
        return CacheBlock;
 }
 
-PCACHE_BLOCK CacheInternalFindBlock(PCACHE_DRIVE CacheDrive, U32 BlockNumber)
+PCACHE_BLOCK CacheInternalFindBlock(PCACHE_DRIVE CacheDrive, ULONG BlockNumber)
 {
        PCACHE_BLOCK    CacheBlock = NULL;
 
@@ -93,7 +93,7 @@ PCACHE_BLOCK CacheInternalFindBlock(PCACHE_DRIVE CacheDrive, U32 BlockNumber)
        return NULL;
 }
 
-PCACHE_BLOCK CacheInternalAddBlockToCache(PCACHE_DRIVE CacheDrive, U32 BlockNumber)
+PCACHE_BLOCK CacheInternalAddBlockToCache(PCACHE_DRIVE CacheDrive, ULONG BlockNumber)
 {
        PCACHE_BLOCK    CacheBlock = NULL;
 
@@ -195,7 +195,7 @@ BOOL CacheInternalFreeBlock(PCACHE_DRIVE CacheDrive)
 
 VOID CacheInternalCheckCacheSizeLimits(PCACHE_DRIVE CacheDrive)
 {
-       U32             NewCacheSize;
+       ULONG           NewCacheSize;
 
        DbgPrint((DPRINT_CACHE, "CacheInternalCheckCacheSizeLimits()\n"));
 
index 363653f..2344e1e 100644 (file)
 CACHE_DRIVE            CacheManagerDrive;
 BOOL                   CacheManagerInitialized = FALSE;
 BOOL                   CacheManagerDataInvalid = FALSE;
-U32                    CacheBlockCount = 0;
-U32                    CacheSizeLimit = 0;
-U32                    CacheSizeCurrent = 0;
+ULONG                  CacheBlockCount = 0;
+ULONG                  CacheSizeLimit = 0;
+ULONG                  CacheSizeCurrent = 0;
 
-BOOL CacheInitializeDrive(U32 DriveNumber)
+BOOL CacheInitializeDrive(ULONG DriveNumber)
 {
        PCACHE_BLOCK    NextCacheBlock;
        GEOMETRY        DriveGeometry;
@@ -116,16 +116,16 @@ VOID CacheInvalidateCacheData(VOID)
        CacheManagerDataInvalid = TRUE;
 }
 
-BOOL CacheReadDiskSectors(U32 DiskNumber, U32 StartSector, U32 SectorCount, PVOID Buffer)
+BOOL CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount, PVOID Buffer)
 {
        PCACHE_BLOCK    CacheBlock;
-       U32                             StartBlock;
-       U32                             SectorOffsetInStartBlock;
-       U32                             CopyLengthInStartBlock;
-       U32                             EndBlock;
-       U32                             SectorOffsetInEndBlock;
-       U32                             BlockCount;
-       U32                             Idx;
+       ULONG                           StartBlock;
+       ULONG                           SectorOffsetInStartBlock;
+       ULONG                           CopyLengthInStartBlock;
+       ULONG                           EndBlock;
+       ULONG                           SectorOffsetInEndBlock;
+       ULONG                           BlockCount;
+       ULONG                           Idx;
 
        DbgPrint((DPRINT_CACHE, "CacheReadDiskSectors() DiskNumber: 0x%x StartSector: %d SectorCount: %d Buffer: 0x%x\n", DiskNumber, StartSector, SectorCount, Buffer));
 
@@ -248,13 +248,13 @@ BOOL CacheReadDiskSectors(U32 DiskNumber, U32 StartSector, U32 SectorCount, PVOI
        return TRUE;
 }
 
-BOOL CacheForceDiskSectorsIntoCache(U32 DiskNumber, U32 StartSector, U32 SectorCount)
+BOOL CacheForceDiskSectorsIntoCache(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount)
 {
        PCACHE_BLOCK    CacheBlock;
-       U32                             StartBlock;
-       U32                             EndBlock;
-       U32                             BlockCount;
-       U32                             Idx;
+       ULONG                           StartBlock;
+       ULONG                           EndBlock;
+       ULONG                           BlockCount;
+       ULONG                           Idx;
 
        DbgPrint((DPRINT_CACHE, "CacheForceDiskSectorsIntoCache() DiskNumber: 0x%x StartSector: %d SectorCount: %d\n", DiskNumber, StartSector, SectorCount));
 
@@ -294,9 +294,9 @@ BOOL CacheForceDiskSectorsIntoCache(U32 DiskNumber, U32 StartSector, U32 SectorC
        return TRUE;
 }
 
-BOOL CacheReleaseMemory(U32 MinimumAmountToRelease)
+BOOL CacheReleaseMemory(ULONG MinimumAmountToRelease)
 {
-       U32                             AmountReleased;
+       ULONG                           AmountReleased;
 
        DbgPrint((DPRINT_CACHE, "CacheReleaseMemory() MinimumAmountToRelease = %d\n", MinimumAmountToRelease));
 
index 6780fff..fd47241 100644 (file)
@@ -38,9 +38,9 @@ typedef struct
 {
        LIST_ITEM       ListEntry;                                      // Doubly linked list synchronization member
 
-       U32                     BlockNumber;                            // Track index for CHS, 64k block index for LBA
+       ULONG                   BlockNumber;                            // Track index for CHS, 64k block index for LBA
        BOOL            LockedInCache;                          // Indicates that this block is locked in cache memory
-       U32                     AccessCount;                            // Access count for this block
+       ULONG                   AccessCount;                            // Access count for this block
 
        PVOID           BlockData;                                      // Pointer to block data
 
@@ -55,10 +55,10 @@ typedef struct
 ///////////////////////////////////////////////////////////////////////////////////////
 typedef struct
 {
-       U32                     DriveNumber;
-       U32                     BytesPerSector;
+       ULONG                   DriveNumber;
+       ULONG                   BytesPerSector;
 
-       U32                     BlockSize;                      // Block size (in sectors)
+       ULONG                   BlockSize;                      // Block size (in sectors)
        PCACHE_BLOCK            CacheBlockHead;
 
 } CACHE_DRIVE, *PCACHE_DRIVE;
@@ -71,18 +71,18 @@ typedef struct
 ///////////////////////////////////////////////////////////////////////////////////////
 extern CACHE_DRIVE             CacheManagerDrive;
 extern BOOL                    CacheManagerInitialized;
-extern U32                             CacheBlockCount;
-extern U32                             CacheSizeLimit;
-extern U32                             CacheSizeCurrent;
+extern ULONG                           CacheBlockCount;
+extern ULONG                           CacheSizeLimit;
+extern ULONG                           CacheSizeCurrent;
 
 ///////////////////////////////////////////////////////////////////////////////////////
 //
 // Internal functions
 //
 ///////////////////////////////////////////////////////////////////////////////////////
-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
+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
 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
index f45a1cf..a18002c 100644 (file)
@@ -112,7 +112,7 @@ CmdLineGetDefaultOS(void)
   return CmdLineInfo.DefaultOperatingSystem;
 }
 
-S32
+LONG
 CmdLineGetTimeOut(void)
 {
   return CmdLineInfo.TimeOut;
index f203655..e814b03 100644 (file)
@@ -61,8 +61,8 @@
 
 /* STATIC VARIABLES *********************************************************/
 
-static U32 Rs232ComPort = 0;
-static U32 Rs232BaudRate = 0;
+static ULONG Rs232ComPort = 0;
+static ULONG Rs232BaudRate = 0;
 static PUCHAR Rs232PortBase = (PUCHAR)0;
 
 /* The com port must only be initialized once! */
@@ -73,8 +73,8 @@ static BOOLEAN PortInitialized = FALSE;
 static BOOL Rs232DoesComPortExist(PUCHAR BaseAddress)
 {
         BOOLEAN found;
-        U8 mcr;
-        U8 msr;
+        UCHAR mcr;
+        UCHAR msr;
 
         found = FALSE;
 
@@ -118,12 +118,12 @@ static BOOL Rs232DoesComPortExist(PUCHAR BaseAddress)
 
 /* FUNCTIONS *********************************************************/
 
-BOOL Rs232PortInitialize(U32 ComPort, U32 BaudRate)
+BOOL Rs232PortInitialize(ULONG ComPort, ULONG BaudRate)
 {
-        U32 BaseArray[5] = {0, 0x3F8, 0x2F8, 0x3E8, 0x2E8};
+        ULONG BaseArray[5] = {0, 0x3F8, 0x2F8, 0x3E8, 0x2E8};
         //char buffer[80];
-        U32 divisor;
-        U8 lcr;
+        ULONG divisor;
+        UCHAR lcr;
 
         if (PortInitialized == FALSE)
         {
@@ -146,7 +146,7 @@ BOOL Rs232PortInitialize(U32 ComPort, U32 BaudRate)
                                 sprintf (buffer,
                                          "\nSerial port COM%ld found at 0x%lx\n",
                                          ComPort,
-                                         (U32)PortBase);
+                                         (ULONG)PortBase);
                                 HalDisplayString (buffer);
 #endif*/ /* NDEBUG */
                         }
@@ -158,7 +158,7 @@ BOOL Rs232PortInitialize(U32 ComPort, U32 BaudRate)
                                 sprintf (buffer,
                                          "\nSerial port COM%ld found at 0x%lx\n",
                                          ComPort,
-                                         (U32)PortBase);
+                                         (ULONG)PortBase);
                                 HalDisplayString (buffer);
 #endif*/ /* NDEBUG */
                         }
@@ -180,7 +180,7 @@ BOOL Rs232PortInitialize(U32 ComPort, U32 BaudRate)
                                 sprintf (buffer,
                                          "\nSerial port COM%ld found at 0x%lx\n",
                                          ComPort,
-                                         (U32)PortBase);
+                                         (ULONG)PortBase);
                                 HalDisplayString (buffer);
 #endif*/ /* NDEBUG */
                         }
@@ -222,7 +222,7 @@ BOOL Rs232PortInitialize(U32 ComPort, U32 BaudRate)
         /*
          * set global info
          */
-        //KdComPortInUse = (U32)PortBase;
+        //KdComPortInUse = (ULONG)PortBase;
 
         /*
          * print message to blue screen
@@ -230,7 +230,7 @@ BOOL Rs232PortInitialize(U32 ComPort, U32 BaudRate)
         /*sprintf (buffer,
                  "\nKernel Debugger: COM%ld (Port 0x%lx) BaudRate %ld\n\n",
                  ComPort,
-                 (U32)PortBase,
+                 (ULONG)PortBase,
                  BaudRate);
 
         HalDisplayString (buffer);*/
index f3899ba..da0da41 100644 (file)
@@ -46,8 +46,8 @@ UCHAR CustomBootPrompt[] = "Press ENTER to boot your custom boot setup.";
 VOID OptionMenuCustomBoot(VOID)
 {
        PUCHAR  CustomBootMenuList[] = { "Disk", "Partition", "Boot Sector File", "ReactOS", "Linux" };
-       U32             CustomBootMenuCount = sizeof(CustomBootMenuList) / sizeof(CustomBootMenuList[0]);
-       U32             SelectedMenuItem;
+       ULONG           CustomBootMenuCount = sizeof(CustomBootMenuList) / sizeof(CustomBootMenuList[0]);
+       ULONG           SelectedMenuItem;
 
        if (!UiDisplayMenu(CustomBootMenuList, CustomBootMenuCount, 0, -1, &SelectedMenuItem, TRUE, NULL))
        {
@@ -79,8 +79,8 @@ VOID OptionMenuCustomBootDisk(VOID)
 {
        UCHAR   SectionName[100];
        UCHAR   BootDriveString[20];
-       U32     SectionId;
-       U32     Year, Month, Day, Hour, Minute, Second;
+       ULONG   SectionId;
+       ULONG   Year, Month, Day, Hour, Minute, Second;
 
        RtlZeroMemory(SectionName, sizeof(SectionName));
        RtlZeroMemory(BootDriveString, sizeof(BootDriveString));
@@ -122,8 +122,8 @@ VOID OptionMenuCustomBootPartition(VOID)
        UCHAR   SectionName[100];
        UCHAR   BootDriveString[20];
        UCHAR   BootPartitionString[20];
-       U32     SectionId;
-       U32     Year, Month, Day, Hour, Minute, Second;
+       ULONG   SectionId;
+       ULONG   Year, Month, Day, Hour, Minute, Second;
 
        RtlZeroMemory(SectionName, sizeof(SectionName));
        RtlZeroMemory(BootDriveString, sizeof(BootDriveString));
@@ -178,8 +178,8 @@ VOID OptionMenuCustomBootBootSectorFile(VOID)
        UCHAR   BootDriveString[20];
        UCHAR   BootPartitionString[20];
        UCHAR   BootSectorFileString[200];
-       U32     SectionId;
-       U32     Year, Month, Day, Hour, Minute, Second;
+       ULONG   SectionId;
+       ULONG   Year, Month, Day, Hour, Minute, Second;
 
        RtlZeroMemory(SectionName, sizeof(SectionName));
        RtlZeroMemory(BootDriveString, sizeof(BootDriveString));
@@ -248,8 +248,8 @@ VOID OptionMenuCustomBootReactOS(VOID)
        UCHAR   ReactOSSystemPath[200];
        UCHAR   ReactOSARCPath[200];
        UCHAR   ReactOSOptions[200];
-       U32     SectionId;
-       U32     Year, Month, Day, Hour, Minute, Second;
+       ULONG   SectionId;
+       ULONG   Year, Month, Day, Hour, Minute, Second;
 
        RtlZeroMemory(SectionName, sizeof(SectionName));
        RtlZeroMemory(BootDriveString, sizeof(BootDriveString));
@@ -321,8 +321,8 @@ VOID OptionMenuCustomBootLinux(VOID)
        UCHAR   LinuxKernelString[200];
        UCHAR   LinuxInitrdString[200];
        UCHAR   LinuxCommandLineString[200];
-       U32     SectionId;
-       U32     Year, Month, Day, Hour, Minute, Second;
+       ULONG   SectionId;
+       ULONG   Year, Month, Day, Hour, Minute, Second;
 
        RtlZeroMemory(SectionName, sizeof(SectionName));
        RtlZeroMemory(BootDriveString, sizeof(BootDriveString));
index c298b51..9a3e683 100644 (file)
@@ -39,7 +39,7 @@ VOID DiskReportError (BOOL bError)
        bReportError = bError;
 }
 
-VOID DiskError(PUCHAR ErrorString, U32 ErrorCode)
+VOID DiskError(PUCHAR ErrorString, ULONG ErrorCode)
 {
        UCHAR   ErrorCodeString[200];
 
@@ -53,7 +53,7 @@ VOID DiskError(PUCHAR ErrorString, U32 ErrorCode)
        UiMessageBox(ErrorCodeString);
 }
 
-PUCHAR DiskGetErrorCodeString(U32 ErrorCode)
+PUCHAR DiskGetErrorCodeString(ULONG ErrorCode)
 {
        switch (ErrorCode)
        {
@@ -89,9 +89,9 @@ PUCHAR DiskGetErrorCodeString(U32 ErrorCode)
 }
 
 // This function is in arch/i386/i386disk.c
-//BOOL DiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, PVOID Buffer)
+//BOOL DiskReadLogicalSectors(ULONG DriveNumber, U64 SectorNumber, ULONG SectorCount, PVOID Buffer)
 
-BOOL DiskIsDriveRemovable(U32 DriveNumber)
+BOOL DiskIsDriveRemovable(ULONG DriveNumber)
 {
        // Hard disks use drive numbers >= 0x80
        // So if the drive number indicates a hard disk
@@ -109,4 +109,4 @@ BOOL DiskIsDriveRemovable(U32 DriveNumber)
 //VOID DiskStopFloppyMotor(VOID)
 
 // This function is in arch/i386/i386disk.c
-//U32 DiskGetCacheableBlockCount(U32 DriveNumber)
+//ULONG DiskGetCacheableBlockCount(ULONG DriveNumber)
index 0a0e4e4..4c1aa01 100644 (file)
@@ -26,9 +26,9 @@
 #include <machine.h>
 
 
-BOOL DiskGetActivePartitionEntry(U32 DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
+BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
 {
-       U32                                     BootablePartitionCount = 0;
+       ULONG                                   BootablePartitionCount = 0;
        MASTER_BOOT_RECORD      MasterBootRecord;
 
        // Read master boot record
@@ -77,13 +77,13 @@ BOOL DiskGetActivePartitionEntry(U32 DriveNumber, PPARTITION_TABLE_ENTRY Partiti
        return TRUE;
 }
 
-BOOL DiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
+BOOL DiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
 {
        MASTER_BOOT_RECORD              MasterBootRecord;
        PARTITION_TABLE_ENTRY   ExtendedPartitionTableEntry;
-       U32                                             ExtendedPartitionNumber;
-       U32                                             ExtendedPartitionOffset;
-       U32                                             Index;
+       ULONG                                           ExtendedPartitionNumber;
+       ULONG                                           ExtendedPartitionOffset;
+       ULONG                                           Index;
 
        // Read master boot record
        if (!DiskReadBootRecord(DriveNumber, 0, &MasterBootRecord))
@@ -157,7 +157,7 @@ BOOL DiskGetPartitionEntry(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABL
 
 BOOL DiskGetFirstPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry)
 {
-       U32             Index;
+       ULONG           Index;
 
        for (Index=0; Index<4; Index++)
        {
@@ -178,7 +178,7 @@ BOOL DiskGetFirstPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION
 
 BOOL DiskGetFirstExtendedPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry)
 {
-       U32             Index;
+       ULONG           Index;
 
        for (Index=0; Index<4; Index++)
        {
@@ -195,11 +195,11 @@ BOOL DiskGetFirstExtendedPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PP
        return FALSE;
 }
 
-BOOL DiskReadBootRecord(U32 DriveNumber, U64 LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord)
+BOOL DiskReadBootRecord(ULONG DriveNumber, ULONGLONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord)
 {
        char            ErrMsg[64];
 #ifdef DEBUG
-       U32             Index;
+       ULONG           Index;
 #endif
 
        // Read master boot record
index f32fd71..5a5ff3d 100644 (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
-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
+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
 
 VOID DriveMapMapDrivesInSection(PUCHAR SectionName)
 {
@@ -37,10 +37,10 @@ VOID DriveMapMapDrivesInSection(PUCHAR SectionName)
        UCHAR                   ErrorText[260];
        UCHAR                   Drive1[80];
        UCHAR                   Drive2[80];
-       U32                             SectionId;
-       U32                             SectionItemCount;
-       U32                             Index;
-       U32                             Index2;
+       ULONG                           SectionId;
+       ULONG                           SectionItemCount;
+       ULONG                           Index;
+       ULONG                           Index2;
        DRIVE_MAP_LIST  DriveMapList;
 
        RtlZeroMemory(&DriveMapList, sizeof(DRIVE_MAP_LIST));
@@ -119,7 +119,7 @@ VOID DriveMapMapDrivesInSection(PUCHAR SectionName)
 
 BOOL DriveMapIsValidDriveString(PUCHAR DriveString)
 {
-       U32             Index;
+       ULONG           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;
 }
 
-U32 DriveMapGetBiosDriveNumber(PUCHAR DeviceName)
+ULONG DriveMapGetBiosDriveNumber(PUCHAR DeviceName)
 {
-       U32             BiosDriveNumber = 0;
+       ULONG           BiosDriveNumber = 0;
 
        // If they passed in a number string then just
        // convert it to decimal and return it
@@ -174,8 +174,8 @@ U32 DriveMapGetBiosDriveNumber(PUCHAR DeviceName)
 
 VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap)
 {
-       U32*    RealModeIVT = (U32*)0x00000000;
-       U16*    BiosLowMemorySize = (U16*)0x00000413;
+       ULONG*  RealModeIVT = (ULONG*)0x00000000;
+       USHORT* BiosLowMemorySize = (USHORT*)0x00000413;
 
        if (!DriveMapInstalled)
        {
@@ -186,7 +186,7 @@ VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap)
                (*BiosLowMemorySize)--;
 
                // Get linear address for drive map handler
-               DriveMapHandlerAddress = (U32)(*BiosLowMemorySize) << 10;
+               DriveMapHandlerAddress = (ULONG)(*BiosLowMemorySize) << 10;
 
                // Convert to segment:offset style address
                DriveMapHandlerSegOff = (DriveMapHandlerAddress << 12) & 0xffff0000;
@@ -199,7 +199,7 @@ VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap)
        DriveMapOldInt13HandlerAddress = OldInt13HandlerAddress;
 
        // Copy the code to our reserved area
-       RtlCopyMemory((PVOID)DriveMapHandlerAddress, &DriveMapInt13HandlerStart, ((U32)&DriveMapInt13HandlerEnd - (U32)&DriveMapInt13HandlerStart));
+       RtlCopyMemory((PVOID)DriveMapHandlerAddress, &DriveMapInt13HandlerStart, ((ULONG)&DriveMapInt13HandlerEnd - (ULONG)&DriveMapInt13HandlerStart));
 
        // Update the IVT
        RealModeIVT[0x13] = DriveMapHandlerSegOff;
@@ -210,8 +210,8 @@ VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap)
 
 VOID DriveMapRemoveInt13Handler(VOID)
 {
-       U32*    RealModeIVT = (U32*)0x00000000;
-       U16*    BiosLowMemorySize = (U16*)0x00000413;
+       ULONG*  RealModeIVT = (ULONG*)0x00000000;
+       USHORT* BiosLowMemorySize = (USHORT*)0x00000413;
 
        if (DriveMapInstalled)
        {
index 0710196..8825c87 100644 (file)
@@ -35,17 +35,17 @@ GEOMETRY                    Ext2DiskGeometry;                               // Ext2 file system disk geometry
 PEXT2_SUPER_BLOCK      Ext2SuperBlock = NULL;                  // Ext2 file system super block
 PEXT2_GROUP_DESC       Ext2GroupDescriptors = NULL;    // Ext2 file system group descriptors
 
-U8                                     Ext2DriveNumber = 0;                    // Ext2 file system drive number
-U64                                    Ext2VolumeStartSector = 0;              // Ext2 file system starting sector
-U32                                    Ext2BlockSizeInBytes = 0;               // Block size in bytes
-U32                                    Ext2BlockSizeInSectors = 0;             // Block size in sectors
-U32                                    Ext2FragmentSizeInBytes = 0;    // Fragment size in bytes
-U32                                    Ext2FragmentSizeInSectors = 0;  // Fragment size in sectors
-U32                                    Ext2GroupCount = 0;                             // Number of groups in this file system
-U32                                    Ext2InodesPerBlock = 0;                 // Number of inodes in one block
-U32                                    Ext2GroupDescPerBlock = 0;              // Number of group descriptors in one block
-
-BOOL Ext2OpenVolume(U8 DriveNumber, U64 VolumeStartSector)
+UCHAR                                  Ext2DriveNumber = 0;                    // Ext2 file system drive number
+ULONGLONG                                      Ext2VolumeStartSector = 0;              // Ext2 file system starting sector
+ULONG                                  Ext2BlockSizeInBytes = 0;               // Block size in bytes
+ULONG                                  Ext2BlockSizeInSectors = 0;             // Block size in sectors
+ULONG                                  Ext2FragmentSizeInBytes = 0;    // Fragment size in bytes
+ULONG                                  Ext2FragmentSizeInSectors = 0;  // Fragment size in sectors
+ULONG                                  Ext2GroupCount = 0;                             // Number of groups in this file system
+ULONG                                  Ext2InodesPerBlock = 0;                 // Number of inodes in one block
+ULONG                                  Ext2GroupDescPerBlock = 0;              // Number of group descriptors in one block
+
+BOOL Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector)
 {
 
        DbgPrint((DPRINT_FILESYSTEM, "Ext2OpenVolume() DriveNumber = 0x%x VolumeStartSector = %d\n", DriveNumber, VolumeStartSector));
@@ -93,7 +93,7 @@ FILE* Ext2OpenFile(PUCHAR FileName)
        PEXT2_FILE_INFO         FileHandle;
        UCHAR                           SymLinkPath[EXT3_NAME_LEN];
        UCHAR                           FullPath[EXT3_NAME_LEN * 2];
-       U32                                     Index;
+       ULONG                                   Index;
 
        DbgPrint((DPRINT_FILESYSTEM, "Ext2OpenFile() FileName = %s\n", FileName));
 
@@ -193,10 +193,10 @@ FILE* Ext2OpenFile(PUCHAR FileName)
 BOOL Ext2LookupFile(PUCHAR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer)
 {
        int                             i;
-       U32                             NumberOfPathParts;
+       ULONG                           NumberOfPathParts;
        UCHAR                   PathPart[261];
        PVOID                   DirectoryBuffer;
-       U32                             DirectoryInode = EXT3_ROOT_INO;
+       ULONG                           DirectoryInode = EXT3_ROOT_INO;
        EXT2_INODE              InodeData;
        EXT2_DIR_ENTRY  DirectoryEntry;
 
@@ -238,7 +238,7 @@ BOOL Ext2LookupFile(PUCHAR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer)
                //
                // Search for file name in directory
                //
-               if (!Ext2SearchDirectoryBufferForFile(DirectoryBuffer, (U32)Ext2GetInodeFileSize(&InodeData), PathPart, &DirectoryEntry))
+               if (!Ext2SearchDirectoryBufferForFile(DirectoryBuffer, (ULONG)Ext2GetInodeFileSize(&InodeData), PathPart, &DirectoryEntry))
                {
                        MmFreeMemory(DirectoryBuffer);
                        return FALSE;
@@ -289,9 +289,9 @@ BOOL Ext2LookupFile(PUCHAR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer)
        return TRUE;
 }
 
-BOOL Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, U32 DirectorySize, PUCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry)
+BOOL Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PUCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry)
 {
-       U32                             CurrentOffset;
+       ULONG                           CurrentOffset;
        PEXT2_DIR_ENTRY CurrentDirectoryEntry;
 
        DbgPrint((DPRINT_FILESYSTEM, "Ext2SearchDirectoryBufferForFile() DirectoryBuffer = 0x%x DirectorySize = %d FileName = %s\n", DirectoryBuffer, DirectorySize, FileName));
@@ -345,16 +345,16 @@ BOOL Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, U32 DirectorySize,
  * Reads BytesToRead from open file and
  * returns the number of bytes read in BytesRead
  */
-BOOL Ext2ReadFile(FILE *FileHandle, U64 BytesToRead, U64* BytesRead, PVOID Buffer)
+BOOL Ext2ReadFile(FILE *FileHandle, ULONGLONG BytesToRead, ULONGLONG* BytesRead, PVOID Buffer)
 {
        PEXT2_FILE_INFO Ext2FileInfo = (PEXT2_FILE_INFO)FileHandle;
-       U32                             BlockNumber;
-       U32                             BlockNumberIndex;
-       U32                             OffsetInBlock;
-       U32                             LengthInBlock;
-       U32                             NumberOfBlocks;
+       ULONG                           BlockNumber;
+       ULONG                           BlockNumberIndex;
+       ULONG                           OffsetInBlock;
+       ULONG                           LengthInBlock;
+       ULONG                           NumberOfBlocks;
 
-       DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadFile() BytesToRead = %d Buffer = 0x%x\n", (U32)BytesToRead, Buffer));
+       DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadFile() BytesToRead = %d Buffer = 0x%x\n", (ULONG)BytesToRead, Buffer));
 
        if (BytesRead != NULL)
        {
@@ -529,7 +529,7 @@ BOOL Ext2ReadFile(FILE *FileHandle, U64 BytesToRead, U64* BytesRead, PVOID Buffe
        return TRUE;
 }
 
-U64 Ext2GetFileSize(FILE *FileHandle)
+ULONGLONG Ext2GetFileSize(FILE *FileHandle)
 {
        PEXT2_FILE_INFO Ext2FileHandle = (PEXT2_FILE_INFO)FileHandle;
 
@@ -538,7 +538,7 @@ U64 Ext2GetFileSize(FILE *FileHandle)
        return Ext2FileHandle->FileSize;
 }
 
-VOID Ext2SetFilePointer(FILE *FileHandle, U64 NewFilePointer)
+VOID Ext2SetFilePointer(FILE *FileHandle, ULONGLONG NewFilePointer)
 {
        PEXT2_FILE_INFO Ext2FileHandle = (PEXT2_FILE_INFO)FileHandle;
 
@@ -547,7 +547,7 @@ VOID Ext2SetFilePointer(FILE *FileHandle, U64 NewFilePointer)
        Ext2FileHandle->FilePointer = NewFilePointer;
 }
 
-U64 Ext2GetFilePointer(FILE *FileHandle)
+ULONGLONG Ext2GetFilePointer(FILE *FileHandle)
 {
        PEXT2_FILE_INFO Ext2FileHandle = (PEXT2_FILE_INFO)FileHandle;
 
@@ -556,7 +556,7 @@ U64 Ext2GetFilePointer(FILE *FileHandle)
        return Ext2FileHandle->FilePointer;
 }
 
-BOOL Ext2ReadVolumeSectors(U8 DriveNumber, U64 SectorNumber, U64 SectorCount, PVOID Buffer)
+BOOL Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONGLONG SectorCount, PVOID Buffer)
 {
        //GEOMETRY      DiskGeometry;
        //BOOL          ReturnValue;
@@ -734,8 +734,8 @@ BOOL Ext2ReadSuperBlock(VOID)
 
 BOOL Ext2ReadGroupDescriptors(VOID)
 {
-       U32             GroupDescBlockCount;
-       U32             CurrentGroupDescBlock;
+       ULONG           GroupDescBlockCount;
+       ULONG           CurrentGroupDescBlock;
 
        DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadGroupDescriptors()\n"));
 
@@ -778,7 +778,7 @@ BOOL Ext2ReadGroupDescriptors(VOID)
        return TRUE;
 }
 
-BOOL Ext2ReadDirectory(U32 Inode, PVOID* DirectoryBuffer, PEXT2_INODE InodePointer)
+BOOL Ext2ReadDirectory(ULONG Inode, PVOID* DirectoryBuffer, PEXT2_INODE InodePointer)
 {
        EXT2_FILE_INFO  DirectoryFileInfo;
 
@@ -837,7 +837,7 @@ BOOL Ext2ReadDirectory(U32 Inode, PVOID* DirectoryBuffer, PEXT2_INODE InodePoint
        return TRUE;
 }
 
-BOOL Ext2ReadBlock(U32 BlockNumber, PVOID Buffer)
+BOOL Ext2ReadBlock(ULONG BlockNumber, PVOID Buffer)
 {
        UCHAR                   ErrorString[80];
 
@@ -861,14 +861,14 @@ BOOL Ext2ReadBlock(U32 BlockNumber, PVOID Buffer)
                return TRUE;
        }
 
-       return Ext2ReadVolumeSectors(Ext2DriveNumber, (U64)BlockNumber * Ext2BlockSizeInSectors, Ext2BlockSizeInSectors, Buffer);
+       return Ext2ReadVolumeSectors(Ext2DriveNumber, (ULONGLONG)BlockNumber * Ext2BlockSizeInSectors, Ext2BlockSizeInSectors, Buffer);
 }
 
 /*
  * Ext2ReadPartialBlock()
  * Reads part of a block into memory
  */
-BOOL Ext2ReadPartialBlock(U32 BlockNumber, U32 StartingOffset, U32 Length, PVOID Buffer)
+BOOL Ext2ReadPartialBlock(ULONG BlockNumber, ULONG StartingOffset, ULONG Length, PVOID Buffer)
 {
 
        DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadPartialBlock() BlockNumber = %d StartingOffset = %d Length = %d Buffer = 0x%x\n", BlockNumber, StartingOffset, Length, Buffer));
@@ -883,36 +883,36 @@ BOOL Ext2ReadPartialBlock(U32 BlockNumber, U32 StartingOffset, U32 Length, PVOID
        return TRUE;
 }
 
-U32 Ext2GetGroupDescBlockNumber(U32 Group)
+ULONG Ext2GetGroupDescBlockNumber(ULONG Group)
 {
        return (((Group * sizeof(EXT2_GROUP_DESC)) / Ext2GroupDescPerBlock) + Ext2SuperBlock->s_first_data_block + 1);
 }
 
-U32 Ext2GetGroupDescOffsetInBlock(U32 Group)
+ULONG Ext2GetGroupDescOffsetInBlock(ULONG Group)
 {
        return ((Group * sizeof(EXT2_GROUP_DESC)) % Ext2GroupDescPerBlock);
 }
 
-U32 Ext2GetInodeGroupNumber(U32 Inode)
+ULONG Ext2GetInodeGroupNumber(ULONG Inode)
 {
        return ((Inode - 1) / Ext2SuperBlock->s_inodes_per_group);
 }
 
-U32 Ext2GetInodeBlockNumber(U32 Inode)
+ULONG Ext2GetInodeBlockNumber(ULONG Inode)
 {
        return (((Inode - 1) % Ext2SuperBlock->s_inodes_per_group) / Ext2InodesPerBlock);
 }
 
-U32 Ext2GetInodeOffsetInBlock(U32 Inode)
+ULONG Ext2GetInodeOffsetInBlock(ULONG Inode)
 {
        return (((Inode - 1) % Ext2SuperBlock->s_inodes_per_group) % Ext2InodesPerBlock);
 }
 
-BOOL Ext2ReadInode(U32 Inode, PEXT2_INODE InodeBuffer)
+BOOL Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer)
 {
-       U32                             InodeGroupNumber;
-       U32                             InodeBlockNumber;
-       U32                             InodeOffsetInBlock;
+       ULONG                           InodeGroupNumber;
+       ULONG                           InodeBlockNumber;
+       ULONG                           InodeOffsetInBlock;
        UCHAR                   ErrorString[80];
        EXT2_GROUP_DESC GroupDescriptor;
 
@@ -978,7 +978,7 @@ BOOL Ext2ReadInode(U32 Inode, PEXT2_INODE InodeBuffer)
        return TRUE;
 }
 
-BOOL Ext2ReadGroupDescriptor(U32 Group, PEXT2_GROUP_DESC GroupBuffer)
+BOOL Ext2ReadGroupDescriptor(ULONG Group, PEXT2_GROUP_DESC GroupBuffer)
 {
        DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadGroupDescriptor()\n"));
 
@@ -1002,13 +1002,13 @@ BOOL Ext2ReadGroupDescriptor(U32 Group, PEXT2_GROUP_DESC GroupBuffer)
        return TRUE;
 }
 
-U32* Ext2ReadBlockPointerList(PEXT2_INODE Inode)
+ULONG* Ext2ReadBlockPointerList(PEXT2_INODE Inode)
 {
-       U64             FileSize;
-       U32             BlockCount;
-       U32*    BlockList;
-       U32             CurrentBlockInList;
-       U32             CurrentBlock;
+       ULONGLONG               FileSize;
+       ULONG           BlockCount;
+       ULONG*  BlockList;
+       ULONG           CurrentBlockInList;
+       ULONG           CurrentBlock;
 
        DbgPrint((DPRINT_FILESYSTEM, "Ext2ReadBlockPointerList()\n"));
 
@@ -1023,13 +1023,13 @@ U32* Ext2ReadBlockPointerList(PEXT2_INODE Inode)
        BlockCount = (FileSize / Ext2BlockSizeInBytes);
 
        // Allocate the memory for the block list
-       BlockList = MmAllocateMemory(BlockCount * sizeof(U32));
+       BlockList = MmAllocateMemory(BlockCount * sizeof(ULONG));
        if (BlockList == NULL)
        {
                return NULL;
        }
 
-       RtlZeroMemory(BlockList, BlockCount * sizeof(U32));
+       RtlZeroMemory(BlockList, BlockCount * sizeof(ULONG));
        CurrentBlockInList = 0;
 
        // Copy the direct block pointers
@@ -1072,27 +1072,27 @@ U32* Ext2ReadBlockPointerList(PEXT2_INODE Inode)
        return BlockList;
 }
 
-U64 Ext2GetInodeFileSize(PEXT2_INODE Inode)
+ULONGLONG Ext2GetInodeFileSize(PEXT2_INODE Inode)
 {
        if ((Inode->i_mode & EXT2_S_IFMT) == EXT2_S_IFDIR)
        {
-               return (U64)(Inode->i_size);
+               return (ULONGLONG)(Inode->i_size);
        }
        else
        {
-               return ((U64)(Inode->i_size) | ((U64)(Inode->i_dir_acl) << 32));
+               return ((ULONGLONG)(Inode->i_size) | ((ULONGLONG)(Inode->i_dir_acl) << 32));
        }
 }
 
-BOOL Ext2CopyIndirectBlockPointers(U32* BlockList, U32* CurrentBlockInList, U32 BlockCount, U32 IndirectBlock)
+BOOL Ext2CopyIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG IndirectBlock)
 {
-       U32*    BlockBuffer = (U32*)FILESYSBUFFER;
-       U32             CurrentBlock;
-       U32             BlockPointersPerBlock;
+       ULONG*  BlockBuffer = (ULONG*)FILESYSBUFFER;
+       ULONG           CurrentBlock;
+       ULONG           BlockPointersPerBlock;
 
        DbgPrint((DPRINT_FILESYSTEM, "Ext2CopyIndirectBlockPointers() BlockCount = %d\n", BlockCount));
 
-       BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(U32);
+       BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(ULONG);
 
        if (!Ext2ReadBlock(IndirectBlock, BlockBuffer))
        {
@@ -1108,17 +1108,17 @@ BOOL Ext2CopyIndirectBlockPointers(U32* BlockList, U32* CurrentBlockInList, U32
        return TRUE;
 }
 
-BOOL Ext2CopyDoubleIndirectBlockPointers(U32* BlockList, U32* CurrentBlockInList, U32 BlockCount, U32 DoubleIndirectBlock)
+BOOL Ext2CopyDoubleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG DoubleIndirectBlock)
 {
-       U32*    BlockBuffer;
-       U32             CurrentBlock;
-       U32             BlockPointersPerBlock;
+       ULONG*  BlockBuffer;
+       ULONG           CurrentBlock;
+       ULONG           BlockPointersPerBlock;
 
        DbgPrint((DPRINT_FILESYSTEM, "Ext2CopyDoubleIndirectBlockPointers() BlockCount = %d\n", BlockCount));
 
-       BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(U32);
+       BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(ULONG);
 
-       BlockBuffer = (U32*)MmAllocateMemory(Ext2BlockSizeInBytes);
+       BlockBuffer = (ULONG*)MmAllocateMemory(Ext2BlockSizeInBytes);
        if (BlockBuffer == NULL)
        {
                return FALSE;
@@ -1143,17 +1143,17 @@ BOOL Ext2CopyDoubleIndirectBlockPointers(U32* BlockList, U32* CurrentBlockInList
        return TRUE;
 }
 
-BOOL Ext2CopyTripleIndirectBlockPointers(U32* BlockList, U32* CurrentBlockInList, U32 BlockCount, U32 TripleIndirectBlock)
+BOOL Ext2CopyTripleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG TripleIndirectBlock)
 {
-       U32*    BlockBuffer;
-       U32             CurrentBlock;
-       U32             BlockPointersPerBlock;
+       ULONG*  BlockBuffer;
+       ULONG           CurrentBlock;
+       ULONG           BlockPointersPerBlock;
 
        DbgPrint((DPRINT_FILESYSTEM, "Ext2CopyTripleIndirectBlockPointers() BlockCount = %d\n", BlockCount));
 
-       BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(U32);
+       BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(ULONG);
 
-       BlockBuffer = (U32*)MmAllocateMemory(Ext2BlockSizeInBytes);
+       BlockBuffer = (ULONG*)MmAllocateMemory(Ext2BlockSizeInBytes);
        if (BlockBuffer == NULL)
        {
                return FALSE;
index 8204f1e..5f3f02d 100644 (file)
 # 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))
+#define        EXT3_ADDR_PER_BLOCK(s)          (EXT3_BLOCK_SIZE(s) / sizeof (ULONG))
 #ifdef __KERNEL__
 # define EXT3_BLOCK_SIZE_BITS(s)       ((s)->s_blocksize_bits)
 #else
  */
 struct ext3_acl_header /* Header of Access Control Lists */
 {
-       __u32   aclh_size;
-       __u32   aclh_file_count;
-       __u32   aclh_acle_count;
-       __u32   aclh_first_acle;
+       ULONG   aclh_size;
+       ULONG   aclh_file_count;
+       ULONG   aclh_acle_count;
+       ULONG   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 */
+       ULONG   acle_size;
+       USHORT  acle_perms;     /* Access permissions */
+       USHORT  acle_type;      /* Type of entry */
+       USHORT  acle_tag;       /* User or group identity */
+       USHORT  acle_pad1;
+       ULONG   acle_next;      /* Pointer on next entry for the */
                                        /* same inode or on next free entry */
 };
 
@@ -173,14 +173,14 @@ struct ext3_acl_entry     /* Access Control List Entry */
  */
 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];
+       ULONG   bg_block_bitmap;                /* Blocks bitmap block */
+       ULONG   bg_inode_bitmap;                /* Inodes bitmap block */
+       ULONG   bg_inode_table;         /* Inodes table block */
+       USHORT  bg_free_blocks_count;   /* Free blocks count */
+       USHORT  bg_free_inodes_count;   /* Free inodes count */
+       USHORT  bg_used_dirs_count;     /* Directories count */
+       USHORT  bg_pad;
+       ULONG   bg_reserved[3];
 };
 
 /*
@@ -254,55 +254,55 @@ struct ext3_group_desc
  * 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 */
+       USHORT  i_mode;         /* File mode */
+       USHORT  i_uid;          /* Low 16 bits of Owner Uid */
+       ULONG   i_size;         /* Size in bytes */
+       ULONG   i_atime;        /* Access time */
+       ULONG   i_ctime;        /* Creation time */
+       ULONG   i_mtime;        /* Modification time */
+       ULONG   i_dtime;        /* Deletion Time */
+       USHORT  i_gid;          /* Low 16 bits of Group Id */
+       USHORT  i_links_count;  /* Links count */
+       ULONG   i_blocks;       /* Blocks count */
+       ULONG   i_flags;        /* File flags */
        union {
                struct {
-                       __u32  l_i_reserved1;
+                       ULONG  l_i_reserved1;
                } linux1;
                struct {
-                       __u32  h_i_translator;
+                       ULONG  h_i_translator;
                } hurd1;
                struct {
-                       __u32  m_i_reserved1;
+                       ULONG  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 */
+       ULONG   i_block[EXT3_N_BLOCKS];/* Pointers to blocks */
+       ULONG   i_generation;   /* File version (for NFS) */
+       ULONG   i_file_acl;     /* File ACL */
+       ULONG   i_dir_acl;      /* Directory ACL */
+       ULONG   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;
+                       UCHAR   l_i_frag;       /* Fragment number */
+                       UCHAR   l_i_fsize;      /* Fragment size */
+                       USHORT  i_pad1;
+                       USHORT  l_i_uid_high;   /* these 2 fields    */
+                       USHORT  l_i_gid_high;   /* were reserved2[0] */
+                       ULONG   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;
+                       UCHAR   h_i_frag;       /* Fragment number */
+                       UCHAR   h_i_fsize;      /* Fragment size */
+                       USHORT  h_i_mode_high;
+                       USHORT  h_i_uid_high;
+                       USHORT  h_i_gid_high;
+                       ULONG   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];
+                       UCHAR   m_i_frag;       /* Fragment number */
+                       UCHAR   m_i_fsize;      /* Fragment size */
+                       USHORT  m_pad1;
+                       ULONG   m_i_reserved2[2];
                } masix2;
        } osd2;                         /* OS dependent 2 */
 };
@@ -398,31 +398,31 @@ struct ext3_inode {
  * 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 */
+/*00*/ ULONG   s_inodes_count;         /* Inodes count */
+       ULONG   s_blocks_count;         /* Blocks count */
+       ULONG   s_r_blocks_count;       /* Reserved blocks count */
+       ULONG   s_free_blocks_count;    /* Free blocks count */
+/*10*/ ULONG   s_free_inodes_count;    /* Free inodes count */
+       ULONG   s_first_data_block;     /* First Data Block */
+       ULONG   s_log_block_size;       /* Block size */
+       LONG    s_log_frag_size;        /* Fragment size */
+/*20*/ ULONG   s_blocks_per_group;     /* # Blocks per group */
+       ULONG   s_frags_per_group;      /* # Fragments per group */
+       ULONG   s_inodes_per_group;     /* # Inodes per group */
+       ULONG   s_mtime;                /* Mount time */
+/*30*/ ULONG   s_wtime;                /* Write time */
+       USHORT  s_mnt_count;            /* Mount count */
+       SHORT   s_max_mnt_count;        /* Maximal mount count */
+       USHORT  s_magic;                /* Magic signature */
+       USHORT  s_state;                /* File system state */
+       USHORT  s_errors;               /* Behaviour when detecting errors */
+       USHORT  s_minor_rev_level;      /* minor revision level */
+/*40*/ ULONG   s_lastcheck;            /* time of last check */
+       ULONG   s_checkinterval;        /* max. time between checks */
+       ULONG   s_creator_os;           /* OS */
+       ULONG   s_rev_level;            /* Revision level */
+/*50*/ USHORT  s_def_resuid;           /* Default uid for reserved blocks */
+       USHORT  s_def_resgid;           /* Default gid for reserved blocks */
        /*
         * These fields are for EXT3_DYNAMIC_REV superblocks only.
         *
@@ -436,32 +436,32 @@ struct ext3_super_block {
         * 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 */
+       ULONG   s_first_ino;            /* First non-reserved inode */
+       USHORT   s_inode_size;          /* size of inode structure */
+       USHORT  s_block_group_nr;       /* block group # of this superblock */
+       ULONG   s_feature_compat;       /* compatible feature set */
+/*60*/ ULONG   s_feature_incompat;     /* incompatible feature set */
+       ULONG   s_feature_ro_compat;    /* readonly-compatible feature set */
+/*68*/ UCHAR   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 */
+/*C8*/ ULONG   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;
+       UCHAR   s_prealloc_blocks;      /* Nr of blocks to try to preallocate*/
+       UCHAR   s_prealloc_dir_blocks;  /* Nr to preallocate for dirs */
+       USHORT  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 */
+/*D0*/ UCHAR   s_journal_uuid[16];     /* uuid of journal superblock */
+/*E0*/ ULONG   s_journal_inum;         /* inode number of journal file */
+       ULONG   s_journal_dev;          /* device number of journal file */
+       ULONG   s_last_orphan;          /* start of list of inodes to delete */
 
-/*EC*/ __u32   s_reserved[197];        /* Padding to the end of the block */
+/*EC*/ ULONG   s_reserved[197];        /* Padding to the end of the block */
 };
 
 #ifdef __KERNEL__
@@ -555,9 +555,9 @@ struct ext3_super_block {
 #define EXT3_NAME_LEN 255
 
 struct ext3_dir_entry {
-       __u32   inode;                  /* Inode number */
-       __u16   rec_len;                /* Directory entry length */
-       __u16   name_len;               /* Name length */
+       ULONG   inode;                  /* Inode number */
+       USHORT  rec_len;                /* Directory entry length */
+       USHORT  name_len;               /* Name length */
        char    name[EXT3_NAME_LEN];    /* File name */
 };
 
@@ -568,10 +568,10 @@ struct ext3_dir_entry {
  * 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;
+       ULONG   inode;                  /* Inode number */
+       USHORT  rec_len;                /* Directory entry length */
+       UCHAR   name_len;               /* Name length */
+       UCHAR   file_type;
        char    name[EXT3_NAME_LEN];    /* File name */
 };
 
@@ -653,45 +653,45 @@ typedef struct ext3_dir_entry_2   EXT2_DIR_ENTRY, *PEXT2_DIR_ENTRY;
 #define EXT2_S_IFLNK   0xA000  // Symbolic link
 #define EXT2_S_IFSOCK  0xC000  // Socket
 
-#define FAST_SYMLINK_MAX_NAME_SIZE     (EXT3_N_BLOCKS * sizeof(U32)) /* 60 bytes */
+#define FAST_SYMLINK_MAX_NAME_SIZE     (EXT3_N_BLOCKS * sizeof(ULONG)) /* 60 bytes */
 
 typedef struct
 {
-       U64                     FileSize;                       // File size
-       U64                     FilePointer;            // File pointer
-       U32*            FileBlockList;          // File block list
-       U8                      DriveNumber;            // Drive number of open file
+       ULONGLONG                       FileSize;                       // File size
+       ULONGLONG                       FilePointer;            // File pointer
+       ULONG*          FileBlockList;          // File block list
+       UCHAR                   DriveNumber;            // Drive number of open file
        EXT2_INODE      Inode;                          // File's inode
 } EXT2_FILE_INFO, * PEXT2_FILE_INFO;
 
 
 
-BOOL   Ext2OpenVolume(U8 DriveNumber, U64 VolumeStartSector);
+BOOL   Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG 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   Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PUCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry);
+BOOL   Ext2ReadFile(FILE *FileHandle, ULONGLONG BytesToRead, ULONGLONG* BytesRead, PVOID Buffer);
+ULONGLONG              Ext2GetFileSize(FILE *FileHandle);
+VOID   Ext2SetFilePointer(FILE *FileHandle, ULONGLONG NewFilePointer);
+ULONGLONG              Ext2GetFilePointer(FILE *FileHandle);
+BOOL   Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONGLONG 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* BlockList, U32* CurrentBlockInList, U32 BlockCount, U32 IndirectBlock);
-BOOL   Ext2CopyDoubleIndirectBlockPointers(U32* BlockList, U32* CurrentBlockInList, U32 BlockCount, U32 DoubleIndirectBlock);
-BOOL   Ext2CopyTripleIndirectBlockPointers(U32* BlockList, U32* CurrentBlockInList, U32 BlockCount, U32 TripleIndirectBlock);
+BOOL   Ext2ReadDirectory(ULONG Inode, PVOID* DirectoryBuffer, PEXT2_INODE InodePointer);
+BOOL   Ext2ReadBlock(ULONG BlockNumber, PVOID Buffer);
+BOOL   Ext2ReadPartialBlock(ULONG BlockNumber, ULONG StartingOffset, ULONG Length, PVOID Buffer);
+ULONG          Ext2GetGroupDescBlockNumber(ULONG Group);
+ULONG          Ext2GetGroupDescOffsetInBlock(ULONG Group);
+ULONG          Ext2GetInodeGroupNumber(ULONG Inode);
+ULONG          Ext2GetInodeBlockNumber(ULONG Inode);
+ULONG          Ext2GetInodeOffsetInBlock(ULONG Inode);
+BOOL   Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer);
+BOOL   Ext2ReadGroupDescriptor(ULONG Group, PEXT2_GROUP_DESC GroupBuffer);
+ULONG* Ext2ReadBlockPointerList(PEXT2_INODE Inode);
+ULONGLONG              Ext2GetInodeFileSize(PEXT2_INODE Inode);
+BOOL   Ext2CopyIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG IndirectBlock);
+BOOL   Ext2CopyDoubleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG DoubleIndirectBlock);
+BOOL   Ext2CopyTripleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInList, ULONG BlockCount, ULONG TripleIndirectBlock);
 
 #endif // #defined __EXT2_H
index 65f8a95..973cf55 100644 (file)
 #include <cache.h>
 #include <machine.h>
 
-U32                    BytesPerSector;                 /* Number of bytes per sector */
-U32                    SectorsPerCluster;              /* Number of sectors per cluster */
-U32                    FatVolumeStartSector;           /* Absolute starting sector of the partition */
-U32                    FatSectorStart;                 /* Starting sector of 1st FAT table */
-U32                    ActiveFatSectorStart;           /* Starting sector of active FAT table */
-U32                    NumberOfFats;                   /* Number of FAT tables */
-U32                    SectorsPerFat;                  /* Sectors per FAT table */
-U32                    RootDirSectorStart;             /* Starting sector of the root directory (non-fat32) */
-U32                    RootDirSectors;                 /* Number of sectors of the root directory (non-fat32) */
-U32                    RootDirStartCluster;            /* Starting cluster number of the root directory (fat32 only) */
-U32                    DataSectorStart;                /* Starting sector of the data area */
-
-U32                    FatType = 0;                    /* FAT12, FAT16, FAT32, FATX16 or FATX32 */
-U32                    FatDriveNumber = 0;
-
-BOOL FatOpenVolume(U32 DriveNumber, U32 VolumeStartSector, U32 PartitionSectorCount)
+ULONG                  BytesPerSector;                 /* Number of bytes per sector */
+ULONG                  SectorsPerCluster;              /* Number of sectors per cluster */
+ULONG                  FatVolumeStartSector;           /* Absolute starting sector of the partition */
+ULONG                  FatSectorStart;                 /* Starting sector of 1st FAT table */
+ULONG                  ActiveFatSectorStart;           /* Starting sector of active FAT table */
+ULONG                  NumberOfFats;                   /* Number of FAT tables */
+ULONG                  SectorsPerFat;                  /* Sectors per FAT table */
+ULONG                  RootDirSectorStart;             /* Starting sector of the root directory (non-fat32) */
+ULONG                  RootDirSectors;                 /* Number of sectors of the root directory (non-fat32) */
+ULONG                  RootDirStartCluster;            /* Starting cluster number of the root directory (fat32 only) */
+ULONG                  DataSectorStart;                /* Starting sector of the data area */
+
+ULONG                  FatType = 0;                    /* FAT12, FAT16, FAT32, FATX16 or FATX32 */
+ULONG                  FatDriveNumber = 0;
+
+BOOL FatOpenVolume(ULONG DriveNumber, ULONG VolumeStartSector, ULONG PartitionSectorCount)
 {
        char ErrMsg[80];
-       U32 FatSize;
+       ULONG FatSize;
        PFAT_BOOTSECTOR FatVolumeBootSector;
        PFAT32_BOOTSECTOR Fat32VolumeBootSector;
        PFATX_BOOTSECTOR FatXVolumeBootSector;
@@ -288,13 +288,13 @@ BOOL FatOpenVolume(U32 DriveNumber, U32 VolumeStartSector, U32 PartitionSectorCo
        return TRUE;
 }
 
-U32 FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, U32 PartitionSectorCount)
+ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCount)
 {
-       U32                     RootDirSectors;
-       U32                     DataSectorCount;
-       U32                     SectorsPerFat;
-       U32                     TotalSectors;
-       U32                     CountOfClusters;
+       ULONG                   RootDirSectors;
+       ULONG                   DataSectorCount;
+       ULONG                   SectorsPerFat;
+       ULONG                   TotalSectors;
+       ULONG                   CountOfClusters;
        PFAT32_BOOTSECTOR       Fat32BootSector = (PFAT32_BOOTSECTOR)FatBootSector;
        PFATX_BOOTSECTOR        FatXBootSector = (PFATX_BOOTSECTOR)FatBootSector;
 
@@ -343,7 +343,7 @@ U32 FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, U32 PartitionSectorCount)
        }
 }
 
-PVOID FatBufferDirectory(U32 DirectoryStartCluster, U32 *DirectorySize, BOOL RootDirectory)
+PVOID FatBufferDirectory(ULONG DirectoryStartCluster, ULONG *DirectorySize, BOOL RootDirectory)
 {
        PVOID   DirectoryBuffer;
 
@@ -405,15 +405,15 @@ PVOID FatBufferDirectory(U32 DirectoryStartCluster, U32 *DirectorySize, BOOL Roo
        return DirectoryBuffer;
 }
 
-BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, U32 DirectorySize, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
+BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
 {
-       U32             EntryCount;
-       U32             CurrentEntry;
+       ULONG           EntryCount;
+       ULONG           CurrentEntry;
        PDIRENTRY       DirEntry;
        PLFN_DIRENTRY   LfnDirEntry;
        UCHAR           LfnNameBuffer[265];
        UCHAR           ShortNameBuffer[20];
-       U32             StartCluster;
+       ULONG           StartCluster;
 
        EntryCount = DirectorySize / sizeof(DIRENTRY);
 
@@ -590,7 +590,7 @@ BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, U32 DirectorySize, P
                        //
                        // Get the cluster chain
                        //
-                       StartCluster = ((U32)DirEntry->ClusterHigh << 16) + DirEntry->ClusterLow;
+                       StartCluster = ((ULONG)DirEntry->ClusterHigh << 16) + DirEntry->ClusterLow;
                        DbgPrint((DPRINT_FILESYSTEM, "StartCluster = 0x%x\n", StartCluster));
                        FatFileInfoPointer->FileFatChain = FatGetClusterChainArray(StartCluster);
 
@@ -616,12 +616,12 @@ BOOL FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, U32 DirectorySize, P
        return FALSE;
 }
 
-BOOL FatXSearchDirectoryBufferForFile(PVOID DirectoryBuffer, U32 DirectorySize, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
+BOOL FatXSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
 {
-       U32             EntryCount;
-       U32             CurrentEntry;
+       ULONG           EntryCount;
+       ULONG           CurrentEntry;
        PFATX_DIRENTRY  DirEntry;
-       U32             FileNameLen;
+       ULONG           FileNameLen;
 
        EntryCount = DirectorySize / sizeof(FATX_DIRENTRY);
 
@@ -690,11 +690,11 @@ BOOL FatXSearchDirectoryBufferForFile(PVOID DirectoryBuffer, U32 DirectorySize,
 BOOL FatLookupFile(PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
 {
        int             i;
-       U32             NumberOfPathParts;
+       ULONG           NumberOfPathParts;
        UCHAR           PathPart[261];
        PVOID           DirectoryBuffer;
-       U32             DirectoryStartCluster = 0;
-       U32             DirectorySize;
+       ULONG           DirectoryStartCluster = 0;
+       ULONG           DirectorySize;
        FAT_FILE_INFO   FatFileInfo;
 
        DbgPrint((DPRINT_FILESYSTEM, "FatLookupFile() FileName = %s\n", FileName));
@@ -779,7 +779,7 @@ BOOL FatLookupFile(PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer)
  */
 void FatParseShortFileName(PUCHAR Buffer, PDIRENTRY DirEntry)
 {
-       U32             Idx;
+       ULONG           Idx;
 
        Idx = 0;
        RtlZeroMemory(Buffer, 13);
@@ -824,9 +824,9 @@ void FatParseShortFileName(PUCHAR Buffer, PDIRENTRY DirEntry)
  * FatGetFatEntry()
  * returns the Fat entry for a given cluster number
  */
-BOOL FatGetFatEntry(U32 Cluster, U32* ClusterPointer)
+BOOL FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer)
 {
-       U32             fat = 0;
+       ULONG           fat = 0;
        int             FatOffset;
        int             ThisFatSecNum;
        int             ThisFatEntOffset;
@@ -860,7 +860,7 @@ BOOL FatGetFatEntry(U32 Cluster, U32* ClusterPointer)
                        }
                }
 
-               fat = *((U16 *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset));
+               fat = *((USHORT *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset));
                if (Cluster & 0x0001) 
                        fat = fat >> 4; /* Cluster number is ODD */
                else
@@ -880,7 +880,7 @@ BOOL FatGetFatEntry(U32 Cluster, U32* ClusterPointer)
                        return FALSE;
                }
 
-               fat = *((U16 *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset));
+               fat = *((USHORT *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset));
 
                break;
 
@@ -897,7 +897,7 @@ BOOL FatGetFatEntry(U32 Cluster, U32* ClusterPointer)
                }
 
                // Get the fat entry
-               fat = (*((U32 *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset))) & 0x0FFFFFFF;
+               fat = (*((ULONG *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset))) & 0x0FFFFFFF;
 
                break;
 
@@ -939,9 +939,9 @@ FILE* FatOpenFile(PUCHAR FileName)
        return (FILE*)FileHandle;
 }
 
-U32 FatCountClustersInChain(U32 StartCluster)
+ULONG FatCountClustersInChain(ULONG StartCluster)
 {
-       U32     ClusterCount = 0;
+       ULONG   ClusterCount = 0;
 
        DbgPrint((DPRINT_FILESYSTEM, "FatCountClustersInChain() StartCluster = %d\n", StartCluster));
 
@@ -976,17 +976,17 @@ U32 FatCountClustersInChain(U32 StartCluster)
        return ClusterCount;
 }
 
-U32* FatGetClusterChainArray(U32 StartCluster)
+ULONG* FatGetClusterChainArray(ULONG StartCluster)
 {
-       U32     ClusterCount;
-       U32             ArraySize;
-       U32*    ArrayPointer;
-       U32             Idx;
+       ULONG   ClusterCount;
+       ULONG           ArraySize;
+       ULONG*  ArrayPointer;
+       ULONG           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(U32);
+       ArraySize = ClusterCount * sizeof(ULONG);
 
        //
        // Allocate array memory
@@ -1036,9 +1036,9 @@ U32* FatGetClusterChainArray(U32 StartCluster)
  * FatReadCluster()
  * Reads the specified cluster into memory
  */
-BOOL FatReadCluster(U32 ClusterNumber, PVOID Buffer)
+BOOL FatReadCluster(ULONG ClusterNumber, PVOID Buffer)
 {
-       U32             ClusterStartSector;
+       ULONG           ClusterStartSector;
 
        ClusterStartSector = ((ClusterNumber - 2) * SectorsPerCluster) + DataSectorStart;
 
@@ -1058,9 +1058,9 @@ BOOL FatReadCluster(U32 ClusterNumber, PVOID Buffer)
  * FatReadClusterChain()
  * Reads the specified clusters into memory
  */
-BOOL FatReadClusterChain(U32 StartClusterNumber, U32 NumberOfClusters, PVOID Buffer)
+BOOL FatReadClusterChain(ULONG StartClusterNumber, ULONG NumberOfClusters, PVOID Buffer)
 {
-       U32             ClusterStartSector;
+       ULONG           ClusterStartSector;
 
        DbgPrint((DPRINT_FILESYSTEM, "FatReadClusterChain() StartClusterNumber = %d NumberOfClusters = %d Buffer = 0x%x\n", StartClusterNumber, NumberOfClusters, Buffer));
 
@@ -1119,9 +1119,9 @@ BOOL FatReadClusterChain(U32 StartClusterNumber, U32 NumberOfClusters, PVOID Buf
  * FatReadPartialCluster()
  * Reads part of a cluster into memory
  */
-BOOL FatReadPartialCluster(U32 ClusterNumber, U32 StartingOffset, U32 Length, PVOID Buffer)
+BOOL FatReadPartialCluster(ULONG ClusterNumber, ULONG StartingOffset, ULONG Length, PVOID Buffer)
 {
-       U32             ClusterStartSector;
+       ULONG           ClusterStartSector;
 
        DbgPrint((DPRINT_FILESYSTEM, "FatReadPartialCluster() ClusterNumber = %d StartingOffset = %d Length = %d Buffer = 0x%x\n", ClusterNumber, StartingOffset, Length, Buffer));
 
@@ -1142,14 +1142,14 @@ BOOL FatReadPartialCluster(U32 ClusterNumber, U32 StartingOffset, U32 Length, PV
  * Reads BytesToRead from open file and
  * returns the number of bytes read in BytesRead
  */
-BOOL FatReadFile(FILE *FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer)
+BOOL FatReadFile(FILE *FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer)
 {
        PFAT_FILE_INFO  FatFileInfo = (PFAT_FILE_INFO)FileHandle;
-       U32                     ClusterNumber;
-       U32                     OffsetInCluster;
-       U32                     LengthInCluster;
-       U32                     NumberOfClusters;
-       U32                     BytesPerCluster;
+       ULONG                   ClusterNumber;
+       ULONG                   OffsetInCluster;
+       ULONG                   LengthInCluster;
+       ULONG                   NumberOfClusters;
+       ULONG                   BytesPerCluster;
 
        DbgPrint((DPRINT_FILESYSTEM, "FatReadFile() BytesToRead = %d Buffer = 0x%x\n", BytesToRead, Buffer));
 
@@ -1296,7 +1296,7 @@ BOOL FatReadFile(FILE *FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer
        return TRUE;
 }
 
-U32 FatGetFileSize(FILE *FileHandle)
+ULONG FatGetFileSize(FILE *FileHandle)
 {
        PFAT_FILE_INFO  FatFileHandle = (PFAT_FILE_INFO)FileHandle;
 
@@ -1305,7 +1305,7 @@ U32 FatGetFileSize(FILE *FileHandle)
        return FatFileHandle->FileSize;
 }
 
-VOID FatSetFilePointer(FILE *FileHandle, U32 NewFilePointer)
+VOID FatSetFilePointer(FILE *FileHandle, ULONG NewFilePointer)
 {
        PFAT_FILE_INFO  FatFileHandle = (PFAT_FILE_INFO)FileHandle;
 
@@ -1314,7 +1314,7 @@ VOID FatSetFilePointer(FILE *FileHandle, U32 NewFilePointer)
        FatFileHandle->FilePointer = NewFilePointer;
 }
 
-U32 FatGetFilePointer(FILE *FileHandle)
+ULONG FatGetFilePointer(FILE *FileHandle)
 {
        PFAT_FILE_INFO  FatFileHandle = (PFAT_FILE_INFO)FileHandle;
 
@@ -1323,7 +1323,7 @@ U32 FatGetFilePointer(FILE *FileHandle)
        return FatFileHandle->FilePointer;
 }
 
-BOOL FatReadVolumeSectors(U32 DriveNumber, U32 SectorNumber, U32 SectorCount, PVOID Buffer)
+BOOL FatReadVolumeSectors(ULONG DriveNumber, ULONG SectorNumber, ULONG SectorCount, PVOID Buffer)
 {
        return CacheReadDiskSectors(DriveNumber, SectorNumber + FatVolumeStartSector, SectorCount, Buffer);
 }
index db21e0f..d697e48 100644 (file)
 
 typedef struct _FAT_BOOTSECTOR
 {
-       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     "
-
-       U8              BootCodeAndData[448];           // The remainder of the boot sector
-
-       U16             BootSectorMagic;                        // 0xAA55
+       UCHAR           JumpBoot[3];                            // Jump instruction to boot code
+       UCHAR           OemName[8];                                     // "MSWIN4.1" for MS formatted volumes
+       USHORT          BytesPerSector;                         // Bytes per sector
+       UCHAR           SectorsPerCluster;                      // Number of sectors in a cluster
+       USHORT          ReservedSectors;                        // Reserved sectors, usually 1 (the bootsector)
+       UCHAR           NumberOfFats;                           // Number of FAT tables
+       USHORT          RootDirEntries;                         // Number of root directory entries (fat12/16)
+       USHORT          TotalSectors;                           // Number of total sectors on the drive, 16-bit
+       UCHAR           MediaDescriptor;                        // Media descriptor byte
+       USHORT          SectorsPerFat;                          // Sectors per FAT table (fat12/16)
+       USHORT          SectorsPerTrack;                        // Number of sectors in a track
+       USHORT          NumberOfHeads;                          // Number of heads on the disk
+       ULONG           HiddenSectors;                          // Hidden sectors (sectors before the partition start like the partition table)
+       ULONG           TotalSectorsBig;                        // This field is the new 32-bit total count of sectors on the volume
+       UCHAR           DriveNumber;                            // Int 0x13 drive number (e.g. 0x80)
+       UCHAR           Reserved1;                                      // Reserved (used by Windows NT). Code that formats FAT volumes should always set this byte to 0.
+       UCHAR           BootSignature;                          // Extended boot signature (0x29). This is a signature byte that indicates that the following three fields in the boot sector are present.
+       ULONG           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     "
+
+       UCHAR           BootCodeAndData[448];           // The remainder of the boot sector
+
+       USHORT          BootSectorMagic;                        // 0xAA55
        
 } PACKED FAT_BOOTSECTOR, *PFAT_BOOTSECTOR;
 
 typedef struct _FAT32_BOOTSECTOR
 {
-       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   "
-
-       U8              BootCodeAndData[420];           // The remainder of the boot sector
-
-       U16             BootSectorMagic;                        // 0xAA55
+       UCHAR           JumpBoot[3];                            // Jump instruction to boot code
+       UCHAR           OemName[8];                                     // "MSWIN4.1" for MS formatted volumes
+       USHORT          BytesPerSector;                         // Bytes per sector
+       UCHAR           SectorsPerCluster;                      // Number of sectors in a cluster
+       USHORT          ReservedSectors;                        // Reserved sectors, usually 1 (the bootsector)
+       UCHAR           NumberOfFats;                           // Number of FAT tables
+       USHORT          RootDirEntries;                         // Number of root directory entries (fat12/16)
+       USHORT          TotalSectors;                           // Number of total sectors on the drive, 16-bit
+       UCHAR           MediaDescriptor;                        // Media descriptor byte
+       USHORT          SectorsPerFat;                          // Sectors per FAT table (fat12/16)
+       USHORT          SectorsPerTrack;                        // Number of sectors in a track
+       USHORT          NumberOfHeads;                          // Number of heads on the disk
+       ULONG           HiddenSectors;                          // Hidden sectors (sectors before the partition start like the partition table)
+       ULONG           TotalSectorsBig;                        // This field is the new 32-bit total count of sectors on the volume
+       ULONG           SectorsPerFatBig;                       // This field is the FAT32 32-bit count of sectors occupied by ONE FAT. BPB_FATSz16 must be 0
+       USHORT          ExtendedFlags;                          // Extended flags (fat32)
+       USHORT          FileSystemVersion;                      // File system version (fat32)
+       ULONG           RootDirStartCluster;            // Starting cluster of the root directory (fat32)
+       USHORT          FsInfo;                                         // Sector number of FSINFO structure in the reserved area of the FAT32 volume. Usually 1.
+       USHORT          BackupBootSector;                       // If non-zero, indicates the sector number in the reserved area of the volume of a copy of the boot record. Usually 6.
+       UCHAR           Reserved[12];                           // Reserved for future expansion
+       UCHAR           DriveNumber;                            // Int 0x13 drive number (e.g. 0x80)
+       UCHAR           Reserved1;                                      // Reserved (used by Windows NT). Code that formats FAT volumes should always set this byte to 0.
+       UCHAR           BootSignature;                          // Extended boot signature (0x29). This is a signature byte that indicates that the following three fields in the boot sector are present.
+       ULONG           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   "
+
+       UCHAR           BootCodeAndData[420];           // The remainder of the boot sector
+
+       USHORT          BootSectorMagic;                        // 0xAA55
        
 } PACKED FAT32_BOOTSECTOR, *PFAT32_BOOTSECTOR;
 
 typedef struct _FATX_BOOTSECTOR
 {
-       U8              FileSystemType[4];                      /* String "FATX" */
-       U32             VolumeSerialNumber;                     /* Volume serial number */
-       U32             SectorsPerCluster;                      /* Number of sectors in a cluster */
-       U16             NumberOfFats;                           /* Number of FAT tables */
-       U32             Unknown;                                /* Always 0? */
-       U8              Unused[494];                            /* Actually size should be 4078 (boot block is 4096 bytes) */
+       UCHAR           FileSystemType[4];                      /* String "FATX" */
+       ULONG           VolumeSerialNumber;                     /* Volume serial number */
+       ULONG           SectorsPerCluster;                      /* Number of sectors in a cluster */
+       USHORT          NumberOfFats;                           /* Number of FAT tables */
+       ULONG           Unknown;                                /* Always 0? */
+       UCHAR           Unused[494];                            /* Actually size should be 4078 (boot block is 4096 bytes) */
        
 } PACKED FATX_BOOTSECTOR, *PFATX_BOOTSECTOR;
 
@@ -102,74 +102,74 @@ typedef struct _FATX_BOOTSECTOR
 typedef struct //_DIRENTRY
 {
        UCHAR   FileName[11];   /* Filename + extension */
-       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 */
+       UCHAR   Attr;           /* File attributes */
+       UCHAR   ReservedNT;     /* Reserved for use by Windows NT */
+       UCHAR   TimeInTenths;   /* Millisecond stamp at file creation */
+       USHORT  CreateTime;     /* Time file was created */
+       USHORT  CreateDate;     /* Date file was created */
+       USHORT  LastAccessDate; /* Date file was last accessed */
+       USHORT  ClusterHigh;    /* High word of this entry's start cluster */
+       USHORT  Time;           /* Time last modified */
+       USHORT  Date;           /* Date last modified */
+       USHORT  ClusterLow;     /* First cluster number low word */
+       ULONG   Size;           /* File size */
 } PACKED DIRENTRY, * PDIRENTRY;
 
 typedef struct
 {
-       U8      SequenceNumber;         /* Sequence number for slot */
+       UCHAR   SequenceNumber;         /* Sequence number for slot */
        WCHAR   Name0_4[5];             /* First 5 characters in name */
-       U8      EntryAttributes;        /* Attribute byte */
-       U8      Reserved;               /* Always 0 */
-       U8      AliasChecksum;          /* Checksum for 8.3 alias */
+       UCHAR   EntryAttributes;        /* Attribute byte */
+       UCHAR   Reserved;               /* Always 0 */
+       UCHAR   AliasChecksum;          /* Checksum for 8.3 alias */
        WCHAR   Name5_10[6];            /* 6 more characters in name */
-       U16     StartCluster;           /* Starting cluster number */
+       USHORT  StartCluster;           /* Starting cluster number */
        WCHAR   Name11_12[2];           /* Last 2 characters in name */
 } PACKED LFN_DIRENTRY, * PLFN_DIRENTRY;
 
 typedef struct
 {
-       U8      FileNameSize;   /* Size of filename (max 42) */
-       U8      Attr;           /* File attributes */
+       UCHAR   FileNameSize;   /* Size of filename (max 42) */
+       UCHAR   Attr;           /* File attributes */
        UCHAR   FileName[42];   /* Filename in ASCII, padded with 0xff (not zero-terminated) */
-       U32     StartCluster;   /* Starting cluster number */
-       U32     Size;           /* File size */
-       U16     Time;           /* Time last modified */
-       U16     Date;           /* Date last modified */
-       U16     CreateTime;     /* Time file was created */
-       U16     CreateDate;     /* Date file was created */
-       U16     LastAccessTime; /* Time file was last accessed */
-       U16     LastAccessDate; /* Date file was last accessed */
+       ULONG   StartCluster;   /* Starting cluster number */
+       ULONG   Size;           /* File size */
+       USHORT  Time;           /* Time last modified */
+       USHORT  Date;           /* Date last modified */
+       USHORT  CreateTime;     /* Time file was created */
+       USHORT  CreateDate;     /* Date file was created */
+       USHORT  LastAccessTime; /* Time file was last accessed */
+       USHORT  LastAccessDate; /* Date file was last accessed */
 } PACKED FATX_DIRENTRY, * PFATX_DIRENTRY;
 
 typedef struct
 {
-       U32     FileSize;               /* File size */
-       U32     FilePointer;            /* File pointer */
-       U32*    FileFatChain;           /* File fat chain array */
-       U32     DriveNumber;
+       ULONG   FileSize;               /* File size */
+       ULONG   FilePointer;            /* File pointer */
+       ULONG*  FileFatChain;           /* File fat chain array */
+       ULONG   DriveNumber;
 } FAT_FILE_INFO, * PFAT_FILE_INFO;
 
 
 
-BOOL   FatOpenVolume(U32 DriveNumber, U32 VolumeStartSector, U32 PartitionSectorCount);
-U32    FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, U32 PartitionSectorCount);
-PVOID  FatBufferDirectory(U32 DirectoryStartCluster, U32* EntryCountPointer, BOOL RootDirectory);
-BOOL   FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, U32 EntryCount, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer);
+BOOL   FatOpenVolume(ULONG DriveNumber, ULONG VolumeStartSector, ULONG PartitionSectorCount);
+ULONG  FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCount);
+PVOID  FatBufferDirectory(ULONG DirectoryStartCluster, ULONG* EntryCountPointer, BOOL RootDirectory);
+BOOL   FatSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG EntryCount, PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer);
 BOOL   FatLookupFile(PUCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer);
 void   FatParseShortFileName(PUCHAR Buffer, PDIRENTRY DirEntry);
-BOOL   FatGetFatEntry(U32 Cluster, U32* ClusterPointer);
+BOOL   FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer);
 FILE*  FatOpenFile(PUCHAR FileName);
-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);
+ULONG  FatCountClustersInChain(ULONG StartCluster);
+ULONG* FatGetClusterChainArray(ULONG 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, ULONG* 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);
 
 
 #define        ATTR_NORMAL             0x00
index 22aa1e6..c91813f 100644 (file)
@@ -36,7 +36,7 @@
 // DATA
 /////////////////////////////////////////////////////////////////////////////////////////////
 
-U32                    FileSystemType = 0;     // Type of filesystem on boot device, set by FsOpenVolume()
+ULONG                  FsType = 0;     // Type of filesystem on boot device, set by FsOpenVolume()
 
 /////////////////////////////////////////////////////////////////////////////////////////////
 // FUNCTIONS
@@ -51,7 +51,7 @@ VOID FileSystemError(PUCHAR ErrorString)
 
 /*
  *
- * BOOL FsOpenVolume(U32 DriveNumber, U32 PartitionNumber);
+ * BOOL FsOpenVolume(ULONG DriveNumber, ULONG PartitionNumber);
  *
  * This function is called to open a disk volume for file access.
  * It must be called before any of the file functions will work.
@@ -64,11 +64,11 @@ VOID FileSystemError(PUCHAR ErrorString)
  *            If it is zero then it opens the active (bootable) partition
  *
  */
-BOOL FsOpenVolume(U32 DriveNumber, U32 PartitionNumber)
+BOOL FsOpenVolume(ULONG DriveNumber, ULONG PartitionNumber)
 {
        PARTITION_TABLE_ENTRY   PartitionTableEntry;
        UCHAR                                   ErrorText[80];
-       U8                                              VolumeType;
+       UCHAR                                           VolumeType;
 
        DbgPrint((DPRINT_FILESYSTEM, "FsOpenVolume() DriveNumber: 0x%x PartitionNumber: 0x%x\n", DriveNumber, PartitionNumber));
 
@@ -78,7 +78,7 @@ BOOL FsOpenVolume(U32 DriveNumber, U32 PartitionNumber)
        {
                DbgPrint((DPRINT_FILESYSTEM, "Drive is a floppy diskette drive. Assuming FAT12 file system.\n"));
 
-               FileSystemType = FS_FAT;
+               FsType = FS_FAT;
                return FatOpenVolume(DriveNumber, 0, 0);
        }
 
@@ -87,7 +87,7 @@ BOOL FsOpenVolume(U32 DriveNumber, U32 PartitionNumber)
        {
                DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n"));
 
-               FileSystemType = FS_ISO9660;
+               FsType = FS_ISO9660;
                return IsoOpenVolume(DriveNumber);
        }
 
@@ -137,16 +137,16 @@ BOOL FsOpenVolume(U32 DriveNumber, U32 PartitionNumber)
        case PARTITION_XINT13:
        case PARTITION_FAT32:
        case PARTITION_FAT32_XINT13:
-               FileSystemType = FS_FAT;
+               FsType = FS_FAT;
                return FatOpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition, PartitionTableEntry.PartitionSectorCount);
        case PARTITION_EXT2:
-               FileSystemType = FS_EXT2;
+               FsType = FS_EXT2;
                return Ext2OpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition);
        case PARTITION_NTFS:
-               FileSystemType = FS_NTFS;
+               FsType = FS_NTFS;
                return NtfsOpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition);
        default:
-               FileSystemType = 0;
+               FsType = 0;
                sprintf(ErrorText, "Unsupported file system. Type: 0x%x", VolumeType);
                FileSystemError(ErrorText);
                return FALSE;
@@ -175,7 +175,7 @@ PFILE FsOpenFile(PUCHAR FileName)
        //
        // Check file system type and pass off to appropriate handler
        //
-       switch (FileSystemType)
+       switch (FsType)
        {
        case FS_FAT:
                FileHandle = FatOpenFile(FileName);
@@ -219,9 +219,9 @@ VOID FsCloseFile(PFILE FileHandle)
  * ReadFile()
  * returns number of bytes read or EOF
  */
-BOOL FsReadFile(PFILE FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer)
+BOOL FsReadFile(PFILE FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer)
 {
-       U64             BytesReadBig;
+       ULONGLONG               BytesReadBig;
        BOOL    Success;
 
        //
@@ -232,7 +232,7 @@ BOOL FsReadFile(PFILE FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer)
                *BytesRead = 0;
        }
 
-       switch (FileSystemType)
+       switch (FsType)
        {
        case FS_FAT:
 
@@ -246,7 +246,7 @@ BOOL FsReadFile(PFILE FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer)
 
                //return Ext2ReadFile(FileHandle, BytesToRead, BytesRead, Buffer);
                Success = Ext2ReadFile(FileHandle, BytesToRead, &BytesReadBig, Buffer);
-               *BytesRead = (U32)BytesReadBig;
+               *BytesRead = (ULONG)BytesReadBig;
                return Success;
 
        case FS_NTFS:
@@ -262,9 +262,9 @@ BOOL FsReadFile(PFILE FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer)
        return FALSE;
 }
 
-U32 FsGetFileSize(PFILE FileHandle)
+ULONG FsGetFileSize(PFILE FileHandle)
 {
-       switch (FileSystemType)
+       switch (FsType)
        {
        case FS_FAT:
 
@@ -290,9 +290,9 @@ U32 FsGetFileSize(PFILE FileHandle)
        return 0;
 }
 
-VOID FsSetFilePointer(PFILE FileHandle, U32 NewFilePointer)
+VOID FsSetFilePointer(PFILE FileHandle, ULONG NewFilePointer)
 {
-       switch (FileSystemType)
+       switch (FsType)
        {
        case FS_FAT:
 
@@ -320,9 +320,9 @@ VOID FsSetFilePointer(PFILE FileHandle, U32 NewFilePointer)
        }
 }
 
-U32 FsGetFilePointer(PFILE FileHandle)
+ULONG FsGetFilePointer(PFILE FileHandle)
 {
-       switch (FileSystemType)
+       switch (FsType)
        {
        case FS_FAT:
 
@@ -369,10 +369,10 @@ BOOL FsIsEndOfFile(PFILE FileHandle)
  * 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)
+ULONG FsGetNumPathParts(PUCHAR Path)
 {
-       U32             i;
-       U32             num;
+       ULONG           i;
+       ULONG           num;
 
        for (i=0,num=0; i<(int)strlen(Path); i++)
        {
@@ -396,7 +396,7 @@ U32 FsGetNumPathParts(PUCHAR Path)
  */
 VOID FsGetFirstNameFromPath(PUCHAR Buffer, PUCHAR Path)
 {
-       U32             i;
+       ULONG           i;
 
        // Copy all the characters up to the end of the
        // string or until we hit a '\' character
index b3c8406..8c0a2e6 100644 (file)
 
 /*
  *
- * BOOL FsRecognizeVolume(U32 DriveNumber, U32 VolumeStartSector, U8* VolumeType);
+ * BOOL FsRecognizeVolume(ULONG DriveNumber, ULONG VolumeStartSector, UCHAR* VolumeType);
  *
  */
-BOOL FsRecognizeVolume(U32 DriveNumber, U32 VolumeStartSector, U8* VolumeType)
+BOOL FsRecognizeVolume(ULONG DriveNumber, ULONG VolumeStartSector, UCHAR* VolumeType)
 {
 
        DbgPrint((DPRINT_FILESYSTEM, "FsRecognizeVolume() DriveNumber: 0x%x VolumeStartSector: %d\n", DriveNumber, VolumeStartSector));
@@ -66,7 +66,7 @@ BOOL FsRecognizeVolume(U32 DriveNumber, U32 VolumeStartSector, U8* VolumeType)
        return FALSE;
 }
 
-BOOL FsRecIsIso9660(U32 DriveNumber)
+BOOL FsRecIsIso9660(ULONG DriveNumber)
 {
        PUCHAR Sector = (PUCHAR)DISKREADBUFFER;
 
@@ -84,7 +84,7 @@ BOOL FsRecIsIso9660(U32 DriveNumber)
                Sector[5] == '1');
 }
 
-BOOL FsRecIsExt2(U32 DriveNumber, U32 VolumeStartSector)
+BOOL FsRecIsExt2(ULONG DriveNumber, ULONG VolumeStartSector)
 {
        PEXT2_SUPER_BLOCK       SuperBlock = (PEXT2_SUPER_BLOCK)DISKREADBUFFER;
 
@@ -102,7 +102,7 @@ BOOL FsRecIsExt2(U32 DriveNumber, U32 VolumeStartSector)
        return FALSE;
 }
 
-BOOL FsRecIsFat(U32 DriveNumber, U32 VolumeStartSector)
+BOOL FsRecIsFat(ULONG DriveNumber, ULONG VolumeStartSector)
 {
        PFAT_BOOTSECTOR BootSector = (PFAT_BOOTSECTOR)DISKREADBUFFER;
        PFAT32_BOOTSECTOR BootSector32 = (PFAT32_BOOTSECTOR)DISKREADBUFFER;
@@ -124,7 +124,7 @@ BOOL FsRecIsFat(U32 DriveNumber, U32 VolumeStartSector)
        return FALSE;
 }
 
-BOOL FsRecIsNtfs(U32 DriveNumber, U32 VolumeStartSector)
+BOOL FsRecIsNtfs(ULONG DriveNumber, ULONG VolumeStartSector)
 {
        PNTFS_BOOTSECTOR BootSector = (PNTFS_BOOTSECTOR)DISKREADBUFFER;
        if (!MachDiskReadLogicalSectors(DriveNumber, VolumeStartSector, 1, BootSector))
index 210a4ac..2f8dd0b 100644 (file)
 #ifndef __FSREC_H
 #define __FSREC_H
 
-BOOL   FsRecognizeVolume(U32 DriveNumber, U32 VolumeStartSector, U8* VolumeType);
-BOOL   FsRecIsIso9660(U32 DriveNumber);
-BOOL   FsRecIsExt2(U32 DriveNumber, U32 VolumeStartS