[FREELDR]

- Fix all MSVC warnings

svn path=/trunk/; revision=52526
This commit is contained in:
Rafal Harabien 2011-07-03 23:01:39 +00:00
parent 56f5c1f824
commit 8d25697873
36 changed files with 248 additions and 235 deletions

View file

@ -77,8 +77,8 @@ ArcGetMemoryDescriptor(const MEMORY_DESCRIPTOR* Current)
// Copy this memory descriptor // Copy this memory descriptor
// //
BiosMemoryDescriptors[j].m.MemoryType = MemoryFree; BiosMemoryDescriptors[j].m.MemoryType = MemoryFree;
BiosMemoryDescriptors[j].m.BasePage = BiosMemoryMap[i].BaseAddress / MM_PAGE_SIZE; BiosMemoryDescriptors[j].m.BasePage = (ULONG)(BiosMemoryMap[i].BaseAddress / MM_PAGE_SIZE);
BiosMemoryDescriptors[j].m.PageCount = BiosMemoryMap[i].Length / MM_PAGE_SIZE; BiosMemoryDescriptors[j].m.PageCount = (ULONG)(BiosMemoryMap[i].Length / MM_PAGE_SIZE);
BiosMemoryDescriptors[j].Index = j; BiosMemoryDescriptors[j].Index = j;
BiosMemoryDescriptors[j].GeneratedDescriptor = TRUE; BiosMemoryDescriptors[j].GeneratedDescriptor = TRUE;
j++; j++;

View file

@ -28,9 +28,8 @@ RealEntryPoint:
/* Setup a real mode stack */ /* Setup a real mode stack */
mov sp, stack16 mov sp, stack16
/* Zero BootDrive and BootPartition */ /* Zero BootPartition */
xor eax, eax xor eax, eax
mov FrldrBootDrive, eax
mov FrldrBootPartition, eax mov FrldrBootPartition, eax
/* Store the boot drive */ /* Store the boot drive */
@ -408,7 +407,7 @@ gdtptr:
.global FrldrBootDrive .global FrldrBootDrive
FrldrBootDrive: FrldrBootDrive:
.long 0 .byte 0
.global FrldrBootPartition .global FrldrBootPartition
FrldrBootPartition: FrldrBootPartition:

View file

@ -47,9 +47,8 @@ EXTERN(_RealEntryPoint)
.code32 .code32
/* Zero BootDrive and BootPartition */ /* Zero BootPartition */
xor eax, eax xor eax, eax
mov dword ptr [_FrldrBootDrive], eax
mov dword ptr [_FrldrBootPartition], eax mov dword ptr [_FrldrBootPartition], eax
/* Store the boot drive */ /* Store the boot drive */
@ -498,7 +497,7 @@ cmdline:
.fill CMDLINE_SIZE, 1, 0 .fill CMDLINE_SIZE, 1, 0
EXTERN(_FrldrBootDrive) EXTERN(_FrldrBootDrive)
.long 0 .byte 0
EXTERN(_FrldrBootPartition) EXTERN(_FrldrBootPartition)
.long 0 .long 0

View file

@ -144,9 +144,9 @@ BOOLEAN DriveMapIsValidDriveString(PCSTR DriveString)
} }
#endif #endif
ULONG DriveMapGetBiosDriveNumber(PCSTR DeviceName) UCHAR DriveMapGetBiosDriveNumber(PCSTR DeviceName)
{ {
ULONG BiosDriveNumber = 0; UCHAR BiosDriveNumber = 0;
// If they passed in a number string then just // If they passed in a number string then just
// convert it to decimal and return it // convert it to decimal and return it

View file

@ -58,9 +58,8 @@ ContinueAddress:
_FrldrStartup: _FrldrStartup:
/* Store BootDrive and BootPartition */ /* Store BootDrive and BootPartition */
mov byte ptr ds:[_FrldrBootDrive], dl
xor eax, eax xor eax, eax
mov al, dl
mov dword ptr ds:[_FrldrBootDrive], eax
mov al, dh mov al, dh
mov dword ptr ds:[_FrldrBootPartition], eax mov dword ptr ds:[_FrldrBootPartition], eax
@ -294,7 +293,7 @@ i386idtptr:
PUBLIC _FrldrBootDrive PUBLIC _FrldrBootDrive
_FrldrBootDrive: _FrldrBootDrive:
.long 0 .byte 0
PUBLIC _FrldrBootPartition PUBLIC _FrldrBootPartition
_FrldrBootPartition: _FrldrBootPartition:

View file

@ -33,7 +33,7 @@ NTAPI
xHalVectorToIDTEntry(IN ULONG Vector) xHalVectorToIDTEntry(IN ULONG Vector)
{ {
/* Return the vector */ /* Return the vector */
return Vector; return (UCHAR)Vector;
} }
VOID VOID

View file

@ -323,7 +323,7 @@ DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
static PCM_PARTIAL_RESOURCE_LIST static PCM_PARTIAL_RESOURCE_LIST
GetHarddiskConfigurationData(ULONG DriveNumber, ULONG* pSize) GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize)
{ {
PCM_PARTIAL_RESOURCE_LIST PartialResourceList; PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry; PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
@ -400,7 +400,7 @@ GetHarddiskConfigurationData(ULONG DriveNumber, ULONG* pSize)
typedef struct tagDISKCONTEXT typedef struct tagDISKCONTEXT
{ {
ULONG DriveNumber; UCHAR DriveNumber;
ULONG SectorSize; ULONG SectorSize;
ULONGLONG SectorOffset; ULONGLONG SectorOffset;
ULONGLONG SectorCount; ULONGLONG SectorCount;
@ -421,7 +421,7 @@ static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
RtlZeroMemory(Information, sizeof(FILEINFORMATION)); RtlZeroMemory(Information, sizeof(FILEINFORMATION));
Information->EndingAddress.QuadPart = (Context->SectorOffset + Context->SectorCount) * Context->SectorSize; Information->EndingAddress.QuadPart = (Context->SectorOffset + Context->SectorCount) * Context->SectorSize;
Information->CurrentAddress.LowPart = (Context->SectorOffset + Context->SectorNumber) * Context->SectorSize; Information->CurrentAddress.QuadPart = (Context->SectorOffset + Context->SectorNumber) * Context->SectorSize;
return ESUCCESS; return ESUCCESS;
} }
@ -429,7 +429,8 @@ static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
{ {
DISKCONTEXT* Context; DISKCONTEXT* Context;
ULONG DriveNumber, DrivePartition, SectorSize; UCHAR DriveNumber;
ULONG DrivePartition, SectorSize;
ULONGLONG SectorOffset = 0; ULONGLONG SectorOffset = 0;
ULONGLONG SectorCount = 0; ULONGLONG SectorCount = 0;
PARTITION_TABLE_ENTRY PartitionTableEntry; PARTITION_TABLE_ENTRY PartitionTableEntry;
@ -527,7 +528,7 @@ static const DEVVTBL DiskVtbl = {
static VOID static VOID
GetHarddiskIdentifier(PCHAR Identifier, GetHarddiskIdentifier(PCHAR Identifier,
ULONG DriveNumber) UCHAR DriveNumber)
{ {
PMASTER_BOOT_RECORD Mbr; PMASTER_BOOT_RECORD Mbr;
ULONG *Buffer; ULONG *Buffer;
@ -568,7 +569,7 @@ GetHarddiskIdentifier(PCHAR Identifier,
reactos_arc_strings[reactos_disk_count]; reactos_arc_strings[reactos_disk_count];
reactos_disk_count++; reactos_disk_count++;
sprintf(ArcName, "multi(0)disk(0)rdisk(%lu)partition(0)", DriveNumber - 0x80); sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(0)", DriveNumber - 0x80);
FsRegisterDevice(ArcName, &DiskVtbl); FsRegisterDevice(ArcName, &DiskVtbl);
/* Add partitions */ /* Add partitions */
@ -578,7 +579,7 @@ GetHarddiskIdentifier(PCHAR Identifier,
{ {
if (PartitionTableEntry.SystemIndicator != PARTITION_ENTRY_UNUSED) if (PartitionTableEntry.SystemIndicator != PARTITION_ENTRY_UNUSED)
{ {
sprintf(ArcName, "multi(0)disk(0)rdisk(%lu)partition(%lu)", DriveNumber - 0x80, i); sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(%lu)", DriveNumber - 0x80, i);
FsRegisterDevice(ArcName, &DiskVtbl); FsRegisterDevice(ArcName, &DiskVtbl);
} }
i++; i++;
@ -609,7 +610,7 @@ GetHarddiskIdentifier(PCHAR Identifier,
DPRINTM(DPRINT_HWDETECT, "Identifier: %s\n", Identifier); DPRINTM(DPRINT_HWDETECT, "Identifier: %s\n", Identifier);
} }
static ULONG static UCHAR
GetFloppyCount(VOID) GetFloppyCount(VOID)
{ {
UCHAR Data; UCHAR Data;
@ -657,7 +658,7 @@ DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
CHAR Identifier[20]; CHAR Identifier[20];
PCONFIGURATION_COMPONENT_DATA PeripheralKey; PCONFIGURATION_COMPONENT_DATA PeripheralKey;
ULONG Size; ULONG Size;
ULONG FloppyNumber; UCHAR FloppyNumber;
UCHAR FloppyType; UCHAR FloppyType;
ULONG MaxDensity[6] = {0, 360, 1200, 720, 1440, 2880}; ULONG MaxDensity[6] = {0, 360, 1200, 720, 1440, 2880};
PUCHAR Ptr; PUCHAR Ptr;
@ -674,7 +675,7 @@ DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
Ptr = GetInt1eTable(); Ptr = GetInt1eTable();
/* Set 'Identifier' value */ /* Set 'Identifier' value */
sprintf(Identifier, "FLOPPY%ld", FloppyNumber + 1); sprintf(Identifier, "FLOPPY%d", FloppyNumber + 1);
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
sizeof(CM_FLOPPY_DEVICE_DATA); sizeof(CM_FLOPPY_DEVICE_DATA);
@ -804,9 +805,8 @@ DetectSystem(VOID)
PCM_PARTIAL_RESOURCE_LIST PartialResourceList; PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
PCM_INT13_DRIVE_PARAMETER Int13Drives; PCM_INT13_DRIVE_PARAMETER Int13Drives;
GEOMETRY Geometry; GEOMETRY Geometry;
ULONG DiskCount; UCHAR DiskCount, i;
ULONG Size; ULONG Size;
ULONG i;
BOOLEAN Changed; BOOLEAN Changed;
/* Count the number of visible drives */ /* Count the number of visible drives */
@ -869,8 +869,8 @@ DetectSystem(VOID)
{ {
Int13Drives[i].DriveSelect = 0x80 + i; Int13Drives[i].DriveSelect = 0x80 + i;
Int13Drives[i].MaxCylinders = Geometry.Cylinders - 1; Int13Drives[i].MaxCylinders = Geometry.Cylinders - 1;
Int13Drives[i].SectorsPerTrack = Geometry.Sectors; Int13Drives[i].SectorsPerTrack = (USHORT)Geometry.Sectors;
Int13Drives[i].MaxHeads = Geometry.Heads - 1; Int13Drives[i].MaxHeads = (USHORT)Geometry.Heads - 1;
Int13Drives[i].NumberDrives = DiskCount; Int13Drives[i].NumberDrives = DiskCount;
DPRINTM(DPRINT_HWDETECT, DPRINTM(DPRINT_HWDETECT,
@ -899,12 +899,12 @@ DetectSystem(VOID)
return SystemKey; return SystemKey;
} }
static ULONG static UCHAR
GetDiskCount(PCONFIGURATION_COMPONENT_DATA BusKey) GetDiskCount(PCONFIGURATION_COMPONENT_DATA BusKey)
{ {
PCONFIGURATION_COMPONENT_DATA System; PCONFIGURATION_COMPONENT_DATA System;
ULONG ConfigurationDataLength; ULONG ConfigurationDataLength;
ULONG DiskCount = 0; UCHAR DiskCount = 0;
// //
// Get root component // Get root component
@ -924,8 +924,8 @@ GetDiskCount(PCONFIGURATION_COMPONENT_DATA BusKey)
// by n entries of CM_INT13_DRIVE_PARAMETER // by n entries of CM_INT13_DRIVE_PARAMETER
// //
if (ConfigurationDataLength > 0) if (ConfigurationDataLength > 0)
DiskCount = (ConfigurationDataLength - sizeof(CM_PARTIAL_RESOURCE_LIST)) DiskCount = (UCHAR)((ConfigurationDataLength - sizeof(CM_PARTIAL_RESOURCE_LIST))
/ sizeof(CM_INT13_DRIVE_PARAMETER); / sizeof(CM_INT13_DRIVE_PARAMETER));
// //
// Return number of disks // Return number of disks
@ -940,7 +940,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA BusKey)
PCONFIGURATION_COMPONENT_DATA DiskKey, ControllerKey; PCONFIGURATION_COMPONENT_DATA DiskKey, ControllerKey;
BOOLEAN BootDriveReported = FALSE; BOOLEAN BootDriveReported = FALSE;
ULONG i; ULONG i;
ULONG DiskCount = GetDiskCount(BusKey); UCHAR DiskCount = GetDiskCount(BusKey);
CHAR BootPath[512]; CHAR BootPath[512];
FldrCreateComponentKey(BusKey, FldrCreateComponentKey(BusKey,
@ -961,13 +961,14 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA BusKey)
PCM_PARTIAL_RESOURCE_LIST PartialResourceList; PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
ULONG Size; ULONG Size;
CHAR Identifier[20]; CHAR Identifier[20];
UCHAR DriveNumber = 0x80 + (UCHAR)i;
if (FrldrBootDrive == 0x80 + i) if (FrldrBootDrive == DriveNumber)
BootDriveReported = TRUE; BootDriveReported = TRUE;
/* Get disk values */ /* Get disk values */
PartialResourceList = GetHarddiskConfigurationData(0x80 + i, &Size); PartialResourceList = GetHarddiskConfigurationData(DriveNumber, &Size);
GetHarddiskIdentifier(Identifier, 0x80 + i); GetHarddiskIdentifier(Identifier, DriveNumber);
/* Create disk key */ /* Create disk key */
FldrCreateComponentKey(ControllerKey, FldrCreateComponentKey(ControllerKey,
@ -1020,7 +1021,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA BusKey)
static VOID static VOID
InitializeSerialPort(PUCHAR Port, InitializeSerialPort(PUCHAR Port,
ULONG LineControl) UCHAR LineControl)
{ {
WRITE_PORT_UCHAR(Port + 3, 0x80); /* set DLAB on */ WRITE_PORT_UCHAR(Port + 3, 0x80); /* set DLAB on */
WRITE_PORT_UCHAR(Port, 0x60); /* speed LO byte */ WRITE_PORT_UCHAR(Port, 0x60); /* speed LO byte */

View file

@ -26,7 +26,7 @@
// FUNCTIONS // FUNCTIONS
///////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
BOOLEAN DiskResetController(ULONG DriveNumber) BOOLEAN DiskResetController(UCHAR DriveNumber)
{ {
REGS RegsIn; REGS RegsIn;
REGS RegsOut; REGS RegsOut;
@ -49,9 +49,9 @@ BOOLEAN DiskResetController(ULONG DriveNumber)
return INT386_SUCCESS(RegsOut); return INT386_SUCCESS(RegsOut);
} }
BOOLEAN DiskInt13ExtensionsSupported(ULONG DriveNumber) BOOLEAN DiskInt13ExtensionsSupported(UCHAR DriveNumber)
{ {
static ULONG LastDriveNumber = 0xffffffff; static UCHAR LastDriveNumber = 0xff;
static BOOLEAN LastSupported; static BOOLEAN LastSupported;
REGS RegsIn; REGS RegsIn;
REGS RegsOut; REGS RegsOut;
@ -141,7 +141,7 @@ VOID DiskStopFloppyMotor(VOID)
WRITE_PORT_UCHAR((PUCHAR)0x3F2, 0); WRITE_PORT_UCHAR((PUCHAR)0x3F2, 0);
} }
BOOLEAN DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT BufferSize) BOOLEAN DiskGetExtendedDriveParameters(UCHAR DriveNumber, PVOID Buffer, USHORT BufferSize)
{ {
REGS RegsIn; REGS RegsIn;
REGS RegsOut; REGS RegsOut;

View file

@ -85,7 +85,7 @@ VOID LoadAndBootPartition(PCSTR OperatingSystemName)
CHAR SettingValue[80]; CHAR SettingValue[80];
ULONG SectionId; ULONG SectionId;
PARTITION_TABLE_ENTRY PartitionTableEntry; PARTITION_TABLE_ENTRY PartitionTableEntry;
ULONG DriveNumber; UCHAR DriveNumber;
ULONG PartitionNumber; ULONG PartitionNumber;
// Find all the message box settings and run them // Find all the message box settings and run them
@ -156,7 +156,7 @@ VOID LoadAndBootDrive(PCSTR OperatingSystemName)
CHAR SettingName[80]; CHAR SettingName[80];
CHAR SettingValue[80]; CHAR SettingValue[80];
ULONG SectionId; ULONG SectionId;
ULONG DriveNumber; UCHAR DriveNumber;
// Find all the message box settings and run them // Find all the message box settings and run them
UiShowMessageBoxesInSection(OperatingSystemName); UiShowMessageBoxesInSection(OperatingSystemName);

View file

@ -42,7 +42,7 @@ typedef struct
// FUNCTIONS // FUNCTIONS
///////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
static BOOLEAN PcDiskResetController(ULONG DriveNumber) static BOOLEAN PcDiskResetController(UCHAR DriveNumber)
{ {
REGS RegsIn; REGS RegsIn;
REGS RegsOut; REGS RegsOut;
@ -65,7 +65,7 @@ static BOOLEAN PcDiskResetController(ULONG DriveNumber)
return INT386_SUCCESS(RegsOut); return INT386_SUCCESS(RegsOut);
} }
static BOOLEAN PcDiskReadLogicalSectorsLBA(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) static BOOLEAN PcDiskReadLogicalSectorsLBA(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
{ {
REGS RegsIn; REGS RegsIn;
REGS RegsOut; REGS RegsOut;
@ -73,6 +73,7 @@ static BOOLEAN PcDiskReadLogicalSectorsLBA(ULONG DriveNumber, ULONGLONG SectorNu
PI386_DISK_ADDRESS_PACKET Packet = (PI386_DISK_ADDRESS_PACKET)(BIOSCALLBUFFER); PI386_DISK_ADDRESS_PACKET Packet = (PI386_DISK_ADDRESS_PACKET)(BIOSCALLBUFFER);
DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectorsLBA() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer); DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectorsLBA() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer);
ASSERT(((ULONG_PTR)Buffer) <= 0xFFFFF);
// BIOS int 0x13, function 42h - IBM/MS INT 13 Extensions - EXTENDED READ // BIOS int 0x13, function 42h - IBM/MS INT 13 Extensions - EXTENDED READ
RegsIn.b.ah = 0x42; // Subfunction 42h RegsIn.b.ah = 0x42; // Subfunction 42h
@ -84,9 +85,11 @@ static BOOLEAN PcDiskReadLogicalSectorsLBA(ULONG DriveNumber, ULONGLONG SectorNu
RtlZeroMemory(Packet, sizeof(I386_DISK_ADDRESS_PACKET)); RtlZeroMemory(Packet, sizeof(I386_DISK_ADDRESS_PACKET));
Packet->PacketSize = sizeof(I386_DISK_ADDRESS_PACKET); Packet->PacketSize = sizeof(I386_DISK_ADDRESS_PACKET);
Packet->Reserved = 0; Packet->Reserved = 0;
Packet->LBABlockCount = SectorCount; Packet->LBABlockCount = (USHORT)SectorCount;
ASSERT(Packet->LBABlockCount == SectorCount);
DbgPrint("here\n");
Packet->TransferBufferOffset = ((ULONG_PTR)Buffer) & 0x0F; Packet->TransferBufferOffset = ((ULONG_PTR)Buffer) & 0x0F;
Packet->TransferBufferSegment = ((ULONG_PTR)Buffer) >> 4; Packet->TransferBufferSegment = (USHORT)(((ULONG_PTR)Buffer) >> 4);
Packet->LBAStartBlock = SectorNumber; Packet->LBAStartBlock = SectorNumber;
// BIOS int 0x13, function 42h - IBM/MS INT 13 Extensions - EXTENDED READ // BIOS int 0x13, function 42h - IBM/MS INT 13 Extensions - EXTENDED READ
@ -100,17 +103,17 @@ static BOOLEAN PcDiskReadLogicalSectorsLBA(ULONG DriveNumber, ULONGLONG SectorNu
// Retry 3 times // Retry 3 times
for (RetryCount=0; RetryCount<3; RetryCount++) for (RetryCount=0; RetryCount<3; RetryCount++)
{ {DPRINTM(DPRINT_DISK, "retry\n");
Int386(0x13, &RegsIn, &RegsOut); Int386(0x13, &RegsIn, &RegsOut);
// If it worked return TRUE // If it worked return TRUE
if (INT386_SUCCESS(RegsOut)) if (INT386_SUCCESS(RegsOut))
{ {DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectorsLBA() success\n");
return TRUE; return TRUE;
} }
// If it was a corrected ECC error then the data is still good // If it was a corrected ECC error then the data is still good
else if (RegsOut.b.ah == 0x11) else if (RegsOut.b.ah == 0x11)
{ {DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectorsLBA() success\n");
return TRUE; return TRUE;
} }
// If it failed the do the next retry // If it failed the do the next retry
@ -128,10 +131,10 @@ static BOOLEAN PcDiskReadLogicalSectorsLBA(ULONG DriveNumber, ULONGLONG SectorNu
return FALSE; return FALSE;
} }
static BOOLEAN PcDiskReadLogicalSectorsCHS(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) static BOOLEAN PcDiskReadLogicalSectorsCHS(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
{ {
ULONG PhysicalSector; UCHAR PhysicalSector;
ULONG PhysicalHead; UCHAR PhysicalHead;
ULONG PhysicalTrack; ULONG PhysicalTrack;
GEOMETRY DriveGeometry; GEOMETRY DriveGeometry;
ULONG NumberOfSectorsToRead; ULONG NumberOfSectorsToRead;
@ -156,10 +159,11 @@ static BOOLEAN PcDiskReadLogicalSectorsCHS(ULONG DriveNumber, ULONGLONG SectorNu
// //
// Calculate the physical disk offsets // Calculate the physical disk offsets
// Note: DriveGeometry.Sectors < 64
// //
PhysicalSector = 1 + (SectorNumber % DriveGeometry.Sectors); PhysicalSector = 1 + (UCHAR)(SectorNumber % DriveGeometry.Sectors);
PhysicalHead = (SectorNumber / DriveGeometry.Sectors) % DriveGeometry.Heads; PhysicalHead = (UCHAR)((SectorNumber / DriveGeometry.Sectors) % DriveGeometry.Heads);
PhysicalTrack = (SectorNumber / DriveGeometry.Sectors) / DriveGeometry.Heads; PhysicalTrack = (ULONG)((SectorNumber / DriveGeometry.Sectors) / DriveGeometry.Heads);
// //
// Calculate how many sectors we need to read this round // Calculate how many sectors we need to read this round
@ -208,12 +212,12 @@ static BOOLEAN PcDiskReadLogicalSectorsCHS(ULONG DriveNumber, ULONGLONG SectorNu
// AL = number of sectors transferred // AL = number of sectors transferred
// (only valid if CF set for some BIOSes) // (only valid if CF set for some BIOSes)
RegsIn.b.ah = 0x02; RegsIn.b.ah = 0x02;
RegsIn.b.al = NumberOfSectorsToRead; RegsIn.b.al = (UCHAR)NumberOfSectorsToRead;
RegsIn.b.ch = (PhysicalTrack & 0xFF); RegsIn.b.ch = (PhysicalTrack & 0xFF);
RegsIn.b.cl = (PhysicalSector + ((PhysicalTrack & 0x300) >> 2)); RegsIn.b.cl = (UCHAR)(PhysicalSector + ((PhysicalTrack & 0x300) >> 2));
RegsIn.b.dh = PhysicalHead; RegsIn.b.dh = PhysicalHead;
RegsIn.b.dl = DriveNumber; RegsIn.b.dl = DriveNumber;
RegsIn.w.es = ((ULONG_PTR)Buffer) >> 4; RegsIn.w.es = (USHORT)(((ULONG_PTR)Buffer) >> 4);
RegsIn.w.bx = ((ULONG_PTR)Buffer) & 0x0F; RegsIn.w.bx = ((ULONG_PTR)Buffer) & 0x0F;
// //
@ -264,7 +268,7 @@ static BOOLEAN PcDiskReadLogicalSectorsCHS(ULONG DriveNumber, ULONGLONG SectorNu
return TRUE; return TRUE;
} }
BOOLEAN PcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) BOOLEAN PcDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
{ {
DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectors() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer); DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectors() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer);
@ -294,7 +298,7 @@ BOOLEAN PcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULON
} }
BOOLEAN BOOLEAN
PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry) PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
{ {
REGS RegsIn; REGS RegsIn;
REGS RegsOut; REGS RegsOut;
@ -345,7 +349,7 @@ PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry)
} }
ULONG ULONG
PcDiskGetCacheableBlockCount(ULONG DriveNumber) PcDiskGetCacheableBlockCount(UCHAR DriveNumber)
{ {
GEOMETRY Geometry; GEOMETRY Geometry;

View file

@ -108,7 +108,7 @@ typedef struct
} SVGA_MODE_INFORMATION, *PSVGA_MODE_INFORMATION; } SVGA_MODE_INFORMATION, *PSVGA_MODE_INFORMATION;
#include <poppack.h> #include <poppack.h>
static ULONG BiosVideoMode; /* Current video mode as known by BIOS */ static USHORT BiosVideoMode; /* Current video mode as known by BIOS */
static ULONG ScreenWidth = 80; /* Screen Width in characters */ static ULONG ScreenWidth = 80; /* Screen Width in characters */
static ULONG ScreenHeight = 25; /* Screen Height in characters */ static ULONG ScreenHeight = 25; /* Screen Height in characters */
static ULONG BytesPerScanLine = 160; /* Number of bytes per scanline (delta) */ static ULONG BytesPerScanLine = 160; /* Number of bytes per scanline (delta) */
@ -191,7 +191,7 @@ PcVideoDetectVideoCard(VOID)
} }
} }
static VOID PcVideoSetBiosMode(ULONG VideoMode) static VOID PcVideoSetBiosMode(UCHAR VideoMode)
{ {
REGS Regs; REGS Regs;
@ -298,7 +298,7 @@ PcVideoDisableCursorEmulation(VOID)
} }
static VOID static VOID
PcVideoDefineCursor(ULONG StartScanLine, ULONG EndScanLine) PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
{ {
REGS Regs; REGS Regs;
@ -334,7 +334,7 @@ PcVideoDefineCursor(ULONG StartScanLine, ULONG EndScanLine)
} }
static VOID static VOID
PcVideoSetVerticalResolution(ULONG ScanLines) PcVideoSetVerticalResolution(UCHAR VerticalResolutionMode)
{ {
REGS Regs; REGS Regs;
@ -356,7 +356,7 @@ PcVideoSetVerticalResolution(ULONG ScanLines)
*/ */
Regs.b.ah = 0x12; Regs.b.ah = 0x12;
Regs.b.bl = 0x30; Regs.b.bl = 0x30;
Regs.b.al = ScanLines; Regs.b.al = VerticalResolutionMode;
Int386(0x10, &Regs, &Regs); Int386(0x10, &Regs, &Regs);
} }
@ -698,7 +698,7 @@ PcVideoSetMode80x60(VOID)
} }
static BOOLEAN static BOOLEAN
PcVideoSetMode(ULONG NewMode) PcVideoSetMode(USHORT NewMode)
{ {
CurrentMemoryBank = 0; CurrentMemoryBank = 0;
@ -735,7 +735,7 @@ PcVideoSetMode(ULONG NewMode)
if (0x12 == NewMode) if (0x12 == NewMode)
{ {
/* 640x480x16 */ /* 640x480x16 */
PcVideoSetBiosMode(NewMode); PcVideoSetBiosMode((UCHAR)NewMode);
WRITE_PORT_USHORT((USHORT*)0x03CE, 0x0F01); /* For some reason this is necessary? */ WRITE_PORT_USHORT((USHORT*)0x03CE, 0x0F01); /* For some reason this is necessary? */
ScreenWidth = 640; ScreenWidth = 640;
ScreenHeight = 480; ScreenHeight = 480;
@ -748,7 +748,7 @@ PcVideoSetMode(ULONG NewMode)
else if (0x13 == NewMode) else if (0x13 == NewMode)
{ {
/* 320x200x256 */ /* 320x200x256 */
PcVideoSetBiosMode(NewMode); PcVideoSetBiosMode((UCHAR)NewMode);
ScreenWidth = 320; ScreenWidth = 320;
ScreenHeight = 200; ScreenHeight = 200;
BytesPerScanLine = 320; BytesPerScanLine = 320;
@ -871,7 +871,7 @@ PcVideoSetMemoryBank(USHORT BankNumber)
VIDEODISPLAYMODE VIDEODISPLAYMODE
PcVideoSetDisplayMode(char *DisplayModeName, BOOLEAN Init) PcVideoSetDisplayMode(char *DisplayModeName, BOOLEAN Init)
{ {
ULONG VideoMode = VIDEOMODE_NORMAL_TEXT; USHORT VideoMode = VIDEOMODE_NORMAL_TEXT;
if (NULL == DisplayModeName || '\0' == *DisplayModeName) if (NULL == DisplayModeName || '\0' == *DisplayModeName)
{ {
@ -923,7 +923,7 @@ PcVideoSetDisplayMode(char *DisplayModeName, BOOLEAN Init)
PcVideoSetBlinkBit(! Init); PcVideoSetBlinkBit(! Init);
DbgBreakPoint();
return DisplayMode; return DisplayMode;
} }
@ -958,7 +958,7 @@ PcVideoGetBufferSize(VOID)
} }
VOID VOID
PcVideoSetTextCursorPosition(ULONG X, ULONG Y) PcVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
{ {
REGS Regs; REGS Regs;
@ -998,9 +998,9 @@ PcVideoHideShowTextCursor(BOOLEAN Show)
VOID VOID
PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer) PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
{ {
ULONG BanksToCopy; USHORT BanksToCopy;
ULONG BytesInLastBank; ULONG BytesInLastBank;
ULONG CurrentBank; USHORT CurrentBank;
ULONG BankSize; ULONG BankSize;
/* PcVideoWaitForVerticalRetrace(); */ /* PcVideoWaitForVerticalRetrace(); */
@ -1014,7 +1014,7 @@ PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
else if (VideoGraphicsMode == DisplayMode && VesaVideoMode) else if (VideoGraphicsMode == DisplayMode && VesaVideoMode)
{ {
BankSize = VesaVideoModeInformation.WindowGranularity << 10; BankSize = VesaVideoModeInformation.WindowGranularity << 10;
BanksToCopy = (VesaVideoModeInformation.HeightInPixels * VesaVideoModeInformation.BytesPerScanLine) / BankSize; BanksToCopy = (USHORT)((VesaVideoModeInformation.HeightInPixels * VesaVideoModeInformation.BytesPerScanLine) / BankSize);
BytesInLastBank = (VesaVideoModeInformation.HeightInPixels * VesaVideoModeInformation.BytesPerScanLine) % BankSize; BytesInLastBank = (VesaVideoModeInformation.HeightInPixels * VesaVideoModeInformation.BytesPerScanLine) % BankSize;
/* Copy all the banks but the last one because /* Copy all the banks but the last one because

View file

@ -152,7 +152,7 @@ static struct
* Data block read and write commands * Data block read and write commands
*/ */
#define IDEReadBlock(Address, Buffer, Count) \ #define IDEReadBlock(Address, Buffer, Count) \
(__inwordstring(((Address) + IDE_REG_DATA_PORT), (PUSHORT)(Buffer), (Count) / 2)) (READ_PORT_BUFFER_USHORT((PUSHORT)((Address) + IDE_REG_DATA_PORT), (PUSHORT)(Buffer), (Count) / 2))
#define IDEWriteBlock(Address, Buffer, Count) \ #define IDEWriteBlock(Address, Buffer, Count) \
(WRITE_PORT_BUFFER_USHORT((PUSHORT)((Address) + IDE_REG_DATA_PORT), (PUSHORT)(Buffer), (Count) / 2)) (WRITE_PORT_BUFFER_USHORT((PUSHORT)((Address) + IDE_REG_DATA_PORT), (PUSHORT)(Buffer), (Count) / 2))
@ -435,7 +435,7 @@ XboxDiskPolledRead(ULONG CommandPort,
} }
BOOLEAN BOOLEAN
XboxDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) XboxDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
{ {
ULONG StartSector; ULONG StartSector;
UCHAR Count; UCHAR Count;
@ -456,7 +456,7 @@ XboxDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG Sect
StartSector = (ULONG) SectorNumber; StartSector = (ULONG) SectorNumber;
while (0 < SectorCount) while (0 < SectorCount)
{ {
Count = (SectorCount <= 255 ? SectorCount : 255); Count = (SectorCount <= 255 ? (UCHAR)SectorCount : 255);
if (! XboxDiskPolledRead(XBOX_IDE_COMMAND_PORT, if (! XboxDiskPolledRead(XBOX_IDE_COMMAND_PORT,
XBOX_IDE_CONTROL_PORT, XBOX_IDE_CONTROL_PORT,
0, Count, 0, Count,
@ -478,7 +478,7 @@ XboxDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG Sect
} }
BOOLEAN BOOLEAN
XboxDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry) XboxDiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
{ {
UCHAR SectorData[IDE_SECTOR_BUF_SZ]; UCHAR SectorData[IDE_SECTOR_BUF_SZ];
@ -503,7 +503,7 @@ XboxDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_T
} }
BOOLEAN BOOLEAN
XboxDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry) XboxDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
{ {
IDE_DRIVE_IDENTIFY DrvParms; IDE_DRIVE_IDENTIFY DrvParms;
ULONG i; ULONG i;
@ -563,7 +563,7 @@ XboxDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry)
} }
ULONG ULONG
XboxDiskGetCacheableBlockCount(ULONG DriveNumber) XboxDiskGetCacheableBlockCount(UCHAR DriveNumber)
{ {
/* 64 seems a nice number, it is used by the machpc code for LBA devices */ /* 64 seems a nice number, it is used by the machpc code for LBA devices */
return 64; return 64;

View file

@ -30,7 +30,7 @@ extern ARC_DISK_SIGNATURE reactos_arc_disk_info[];
extern char reactos_arc_strings[32][256]; extern char reactos_arc_strings[32][256];
static PCM_PARTIAL_RESOURCE_LIST static PCM_PARTIAL_RESOURCE_LIST
GetHarddiskConfigurationData(ULONG DriveNumber, ULONG* pSize) GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize)
{ {
PCM_PARTIAL_RESOURCE_LIST PartialResourceList; PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry; PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
@ -101,7 +101,7 @@ GetHarddiskConfigurationData(ULONG DriveNumber, ULONG* pSize)
typedef struct tagDISKCONTEXT typedef struct tagDISKCONTEXT
{ {
ULONG DriveNumber; UCHAR DriveNumber;
ULONG SectorSize; ULONG SectorSize;
ULONGLONG SectorOffset; ULONGLONG SectorOffset;
ULONGLONG SectorCount; ULONGLONG SectorCount;
@ -122,7 +122,7 @@ static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
RtlZeroMemory(Information, sizeof(FILEINFORMATION)); RtlZeroMemory(Information, sizeof(FILEINFORMATION));
Information->EndingAddress.QuadPart = (Context->SectorOffset + Context->SectorCount) * Context->SectorSize; Information->EndingAddress.QuadPart = (Context->SectorOffset + Context->SectorCount) * Context->SectorSize;
Information->CurrentAddress.LowPart = (Context->SectorOffset + Context->SectorNumber) * Context->SectorSize; Information->CurrentAddress.QuadPart = (Context->SectorOffset + Context->SectorNumber) * Context->SectorSize;
return ESUCCESS; return ESUCCESS;
} }
@ -130,7 +130,8 @@ static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
{ {
DISKCONTEXT* Context; DISKCONTEXT* Context;
ULONG DriveNumber, DrivePartition, SectorSize; ULONG DrivePartition, SectorSize;
UCHAR DriveNumber;
ULONGLONG SectorOffset = 0; ULONGLONG SectorOffset = 0;
ULONGLONG SectorCount = 0; ULONGLONG SectorCount = 0;
PARTITION_TABLE_ENTRY PartitionTableEntry; PARTITION_TABLE_ENTRY PartitionTableEntry;
@ -233,7 +234,7 @@ static const DEVVTBL DiskVtbl = {
static VOID static VOID
GetHarddiskIdentifier(PCHAR Identifier, GetHarddiskIdentifier(PCHAR Identifier,
ULONG DriveNumber) UCHAR DriveNumber)
{ {
PMASTER_BOOT_RECORD Mbr; PMASTER_BOOT_RECORD Mbr;
ULONG *Buffer; ULONG *Buffer;
@ -274,7 +275,7 @@ GetHarddiskIdentifier(PCHAR Identifier,
reactos_arc_strings[reactos_disk_count]; reactos_arc_strings[reactos_disk_count];
reactos_disk_count++; reactos_disk_count++;
sprintf(ArcName, "multi(0)disk(0)rdisk(%lu)partition(0)", DriveNumber - 0x80); sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(0)", DriveNumber - 0x80);
FsRegisterDevice(ArcName, &DiskVtbl); FsRegisterDevice(ArcName, &DiskVtbl);
/* Add partitions */ /* Add partitions */
@ -284,7 +285,7 @@ GetHarddiskIdentifier(PCHAR Identifier,
{ {
if (PartitionTableEntry.SystemIndicator != PARTITION_ENTRY_UNUSED) if (PartitionTableEntry.SystemIndicator != PARTITION_ENTRY_UNUSED)
{ {
sprintf(ArcName, "multi(0)disk(0)rdisk(%lu)partition(%lu)", DriveNumber - 0x80, i); sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(%lu)", DriveNumber - 0x80, i);
FsRegisterDevice(ArcName, &DiskVtbl); FsRegisterDevice(ArcName, &DiskVtbl);
} }
i++; i++;
@ -323,9 +324,8 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
PCM_INT13_DRIVE_PARAMETER Int13Drives; PCM_INT13_DRIVE_PARAMETER Int13Drives;
GEOMETRY Geometry; GEOMETRY Geometry;
PCONFIGURATION_COMPONENT_DATA DiskKey, ControllerKey; PCONFIGURATION_COMPONENT_DATA DiskKey, ControllerKey;
ULONG DiskCount; UCHAR DiskCount, i;
ULONG Size; ULONG Size;
ULONG i;
BOOLEAN Changed; BOOLEAN Changed;
/* Count the number of visible drives */ /* Count the number of visible drives */
@ -390,8 +390,8 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
{ {
Int13Drives[i].DriveSelect = 0x80 + i; Int13Drives[i].DriveSelect = 0x80 + i;
Int13Drives[i].MaxCylinders = Geometry.Cylinders - 1; Int13Drives[i].MaxCylinders = Geometry.Cylinders - 1;
Int13Drives[i].SectorsPerTrack = Geometry.Sectors; Int13Drives[i].SectorsPerTrack = (USHORT)Geometry.Sectors;
Int13Drives[i].MaxHeads = Geometry.Heads - 1; Int13Drives[i].MaxHeads = (USHORT)Geometry.Heads - 1;
Int13Drives[i].NumberDrives = DiskCount; Int13Drives[i].NumberDrives = DiskCount;
DPRINTM(DPRINT_HWDETECT, DPRINTM(DPRINT_HWDETECT,

View file

@ -182,7 +182,7 @@ XboxVideoGetBufferSize(VOID)
} }
VOID VOID
XboxVideoSetTextCursorPosition(ULONG X, ULONG Y) XboxVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
{ {
/* We don't have a cursor yet */ /* We don't have a cursor yet */
} }

View file

@ -32,7 +32,7 @@ ULONG CacheBlockCount = 0;
ULONG CacheSizeLimit = 0; ULONG CacheSizeLimit = 0;
ULONG CacheSizeCurrent = 0; ULONG CacheSizeCurrent = 0;
BOOLEAN CacheInitializeDrive(ULONG DriveNumber) BOOLEAN CacheInitializeDrive(UCHAR DriveNumber)
{ {
PCACHE_BLOCK NextCacheBlock; PCACHE_BLOCK NextCacheBlock;
GEOMETRY DriveGeometry; GEOMETRY DriveGeometry;
@ -111,7 +111,7 @@ VOID CacheInvalidateCacheData(VOID)
CacheManagerDataInvalid = TRUE; CacheManagerDataInvalid = TRUE;
} }
BOOLEAN CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount, PVOID Buffer) BOOLEAN CacheReadDiskSectors(UCHAR DiskNumber, ULONGLONG StartSector, ULONG SectorCount, PVOID Buffer)
{ {
PCACHE_BLOCK CacheBlock; PCACHE_BLOCK CacheBlock;
ULONG StartBlock; ULONG StartBlock;
@ -122,7 +122,7 @@ BOOLEAN CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCo
ULONG BlockCount; ULONG BlockCount;
ULONG Idx; ULONG Idx;
DPRINTM(DPRINT_CACHE, "CacheReadDiskSectors() DiskNumber: 0x%x StartSector: %d SectorCount: %d Buffer: 0x%x\n", DiskNumber, StartSector, SectorCount, Buffer); DPRINTM(DPRINT_CACHE, "CacheReadDiskSectors() DiskNumber: 0x%x StartSector: %I64d SectorCount: %d Buffer: 0x%x\n", DiskNumber, StartSector, SectorCount, Buffer);
// If we aren't initialized yet then they can't do this // If we aren't initialized yet then they can't do this
if (CacheManagerInitialized == FALSE) if (CacheManagerInitialized == FALSE)
@ -133,11 +133,11 @@ BOOLEAN CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCo
// //
// Caculate which blocks we must cache // Caculate which blocks we must cache
// //
StartBlock = StartSector / CacheManagerDrive.BlockSize; StartBlock = (ULONG)(StartSector / CacheManagerDrive.BlockSize);
SectorOffsetInStartBlock = StartSector % CacheManagerDrive.BlockSize; SectorOffsetInStartBlock = (ULONG)(StartSector % CacheManagerDrive.BlockSize);
CopyLengthInStartBlock = (SectorCount > (CacheManagerDrive.BlockSize - SectorOffsetInStartBlock)) ? (CacheManagerDrive.BlockSize - SectorOffsetInStartBlock) : SectorCount; CopyLengthInStartBlock = (ULONG)((SectorCount > (CacheManagerDrive.BlockSize - SectorOffsetInStartBlock)) ? (CacheManagerDrive.BlockSize - SectorOffsetInStartBlock) : SectorCount);
EndBlock = (StartSector + (SectorCount - 1)) / CacheManagerDrive.BlockSize; EndBlock = (ULONG)((StartSector + (SectorCount - 1)) / CacheManagerDrive.BlockSize);
SectorOffsetInEndBlock = 1 + (StartSector + (SectorCount - 1)) % CacheManagerDrive.BlockSize; SectorOffsetInEndBlock = (ULONG)(1 + (StartSector + (SectorCount - 1)) % CacheManagerDrive.BlockSize);
BlockCount = (EndBlock - StartBlock) + 1; BlockCount = (EndBlock - StartBlock) + 1;
DPRINTM(DPRINT_CACHE, "StartBlock: %d SectorOffsetInStartBlock: %d CopyLengthInStartBlock: %d EndBlock: %d SectorOffsetInEndBlock: %d BlockCount: %d\n", StartBlock, SectorOffsetInStartBlock, CopyLengthInStartBlock, EndBlock, SectorOffsetInEndBlock, BlockCount); DPRINTM(DPRINT_CACHE, "StartBlock: %d SectorOffsetInStartBlock: %d CopyLengthInStartBlock: %d EndBlock: %d SectorOffsetInEndBlock: %d BlockCount: %d\n", StartBlock, SectorOffsetInStartBlock, CopyLengthInStartBlock, EndBlock, SectorOffsetInEndBlock, BlockCount);
@ -244,7 +244,7 @@ BOOLEAN CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCo
} }
#if 0 #if 0
BOOLEAN CacheForceDiskSectorsIntoCache(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount) BOOLEAN CacheForceDiskSectorsIntoCache(UCHAR DiskNumber, ULONGLONG StartSector, ULONG SectorCount)
{ {
PCACHE_BLOCK CacheBlock; PCACHE_BLOCK CacheBlock;
ULONG StartBlock; ULONG StartBlock;

View file

@ -87,7 +87,7 @@ PCSTR DiskGetErrorCodeString(ULONG ErrorCode)
// This function is in arch/i386/i386disk.c // This function is in arch/i386/i386disk.c
//BOOLEAN DiskReadLogicalSectors(ULONG DriveNumber, U64 SectorNumber, ULONG SectorCount, PVOID Buffer) //BOOLEAN DiskReadLogicalSectors(ULONG DriveNumber, U64 SectorNumber, ULONG SectorCount, PVOID Buffer)
BOOLEAN DiskIsDriveRemovable(ULONG DriveNumber) BOOLEAN DiskIsDriveRemovable(UCHAR DriveNumber)
{ {
// Hard disks use drive numbers >= 0x80 // Hard disks use drive numbers >= 0x80
// So if the drive number indicates a hard disk // So if the drive number indicates a hard disk
@ -188,6 +188,6 @@ DiskGetBootPath(char *BootPath, unsigned Size)
//VOID DiskStopFloppyMotor(VOID) //VOID DiskStopFloppyMotor(VOID)
// This function is in arch/i386/i386disk.c // This function is in arch/i386/i386disk.c
//ULONG DiskGetCacheableBlockCount(ULONG DriveNumber) //ULONG DiskGetCacheableBlockCount(UCHAR DriveNumber)
#endif #endif

View file

@ -21,7 +21,7 @@
#include <freeldr.h> #include <freeldr.h>
#include <debug.h> #include <debug.h>
BOOLEAN DiskGetActivePartitionEntry(ULONG DriveNumber, BOOLEAN DiskGetActivePartitionEntry(UCHAR DriveNumber,
PPARTITION_TABLE_ENTRY PartitionTableEntry, PPARTITION_TABLE_ENTRY PartitionTableEntry,
ULONG *ActivePartition) ULONG *ActivePartition)
{ {
@ -77,7 +77,7 @@ BOOLEAN DiskGetActivePartitionEntry(ULONG DriveNumber,
return TRUE; return TRUE;
} }
BOOLEAN DiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry) BOOLEAN DiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
{ {
MASTER_BOOT_RECORD MasterBootRecord; MASTER_BOOT_RECORD MasterBootRecord;
PARTITION_TABLE_ENTRY ExtendedPartitionTableEntry; PARTITION_TABLE_ENTRY ExtendedPartitionTableEntry;
@ -195,7 +195,7 @@ BOOLEAN DiskGetFirstExtendedPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord,
return FALSE; return FALSE;
} }
BOOLEAN DiskReadBootRecord(ULONG DriveNumber, ULONGLONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord) BOOLEAN DiskReadBootRecord(UCHAR DriveNumber, ULONGLONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord)
{ {
ULONG Index; ULONG Index;

View file

@ -137,9 +137,9 @@ typedef struct tagDISKCONTEXT
{ {
/* Device ID */ /* Device ID */
PSCSI_PORT_DEVICE_EXTENSION DeviceExtension; PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
ULONG PathId; UCHAR PathId;
ULONG TargetId; UCHAR TargetId;
ULONG Lun; UCHAR Lun;
/* Device characteristics */ /* Device characteristics */
ULONG SectorSize; ULONG SectorSize;
@ -162,7 +162,7 @@ static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
RtlZeroMemory(Information, sizeof(FILEINFORMATION)); RtlZeroMemory(Information, sizeof(FILEINFORMATION));
Information->EndingAddress.QuadPart = Context->SectorCount * Context->SectorSize; Information->EndingAddress.QuadPart = Context->SectorCount * Context->SectorSize;
Information->CurrentAddress.LowPart = Context->SectorNumber * Context->SectorSize; Information->CurrentAddress.QuadPart = Context->SectorNumber * Context->SectorSize;
return ESUCCESS; return ESUCCESS;
} }
@ -195,9 +195,9 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
RtlZeroMemory(Srb, sizeof(SCSI_REQUEST_BLOCK)); RtlZeroMemory(Srb, sizeof(SCSI_REQUEST_BLOCK));
Srb->Length = sizeof(SCSI_REQUEST_BLOCK); Srb->Length = sizeof(SCSI_REQUEST_BLOCK);
Srb->Function = SRB_FUNCTION_EXECUTE_SCSI; Srb->Function = SRB_FUNCTION_EXECUTE_SCSI;
Srb->PathId = PathId; Srb->PathId = (UCHAR)PathId;
Srb->TargetId = TargetId; Srb->TargetId = (UCHAR)TargetId;
Srb->Lun = Lun; Srb->Lun = (UCHAR)Lun;
Srb->CdbLength = 10; Srb->CdbLength = 10;
Srb->SrbFlags = SRB_FLAGS_DATA_IN; Srb->SrbFlags = SRB_FLAGS_DATA_IN;
Srb->DataTransferLength = sizeof(READ_CAPACITY_DATA); Srb->DataTransferLength = sizeof(READ_CAPACITY_DATA);
@ -225,9 +225,9 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
if (!Context) if (!Context)
return ENOMEM; return ENOMEM;
Context->DeviceExtension = DeviceExtension; Context->DeviceExtension = DeviceExtension;
Context->PathId = PathId; Context->PathId = (UCHAR)PathId;
Context->TargetId = TargetId; Context->TargetId = (UCHAR)TargetId;
Context->Lun = Lun; Context->Lun = (UCHAR)Lun;
Context->SectorSize = SectorSize; Context->SectorSize = SectorSize;
Context->SectorOffset = SectorOffset; Context->SectorOffset = SectorOffset;
Context->SectorCount = SectorCount; Context->SectorCount = SectorCount;
@ -258,7 +258,8 @@ static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
return EINVAL; return EINVAL;
/* Read full sectors */ /* Read full sectors */
Lba = Context->SectorNumber; ASSERT(Context->SectorNumber < 0xFFFFFFFF);
Lba = (ULONG)Context->SectorNumber;
if (FullSectors > 0) if (FullSectors > 0)
{ {
Srb = ExAllocatePool(PagedPool, sizeof(SCSI_REQUEST_BLOCK)); Srb = ExAllocatePool(PagedPool, sizeof(SCSI_REQUEST_BLOCK));
@ -810,14 +811,14 @@ VOID
SpiScanAdapter( SpiScanAdapter(
IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
IN ULONG ScsiBus, IN ULONG ScsiBus,
IN ULONG PathId) IN UCHAR PathId)
{ {
CHAR ArcName[64]; CHAR ArcName[64];
PSCSI_REQUEST_BLOCK Srb; PSCSI_REQUEST_BLOCK Srb;
PCDB Cdb; PCDB Cdb;
INQUIRYDATA InquiryBuffer; INQUIRYDATA InquiryBuffer;
ULONG TargetId; UCHAR TargetId;
ULONG Lun; UCHAR Lun;
if (!DeviceExtension->HwResetBus(DeviceExtension->MiniPortDeviceExtension, PathId)) if (!DeviceExtension->HwResetBus(DeviceExtension->MiniPortDeviceExtension, PathId))
{ {
@ -852,7 +853,7 @@ SpiScanAdapter(
Cdb = (PCDB)Srb->Cdb; Cdb = (PCDB)Srb->Cdb;
Cdb->CDB6INQUIRY.OperationCode = SCSIOP_INQUIRY; Cdb->CDB6INQUIRY.OperationCode = SCSIOP_INQUIRY;
Cdb->CDB6INQUIRY.LogicalUnitNumber = Srb->Lun; Cdb->CDB6INQUIRY.LogicalUnitNumber = Srb->Lun;
Cdb->CDB6INQUIRY.AllocationLength = Srb->DataTransferLength; Cdb->CDB6INQUIRY.AllocationLength = (UCHAR)Srb->DataTransferLength;
if (!SpiSendSynchronousSrb(DeviceExtension, Srb)) if (!SpiSendSynchronousSrb(DeviceExtension, Srb))
{ {
/* Don't check next LUNs */ /* Don't check next LUNs */
@ -862,13 +863,13 @@ SpiScanAdapter(
/* Device exists, create its ARC name */ /* Device exists, create its ARC name */
if (InquiryBuffer.RemovableMedia) if (InquiryBuffer.RemovableMedia)
{ {
sprintf(ArcName, "scsi(%ld)cdrom(%ld)fdisk(%ld)", sprintf(ArcName, "scsi(%ld)cdrom(%d)fdisk(%d)",
ScsiBus, TargetId, Lun); ScsiBus, TargetId, Lun);
FsRegisterDevice(ArcName, &DiskVtbl); FsRegisterDevice(ArcName, &DiskVtbl);
} }
else else
{ {
sprintf(ArcName, "scsi(%ld)disk(%ld)rdisk(%ld)", sprintf(ArcName, "scsi(%ld)disk(%d)rdisk(%d)",
ScsiBus, TargetId, Lun); ScsiBus, TargetId, Lun);
/* Now, check if it has partitions */ /* Now, check if it has partitions */
SpiScanDevice(DeviceExtension, ArcName, PathId, TargetId, Lun); SpiScanDevice(DeviceExtension, ArcName, PathId, TargetId, Lun);
@ -1074,6 +1075,7 @@ ScsiPortInitialize(
BOOLEAN Again; BOOLEAN Again;
BOOLEAN FirstConfigCall = TRUE; BOOLEAN FirstConfigCall = TRUE;
PCI_SLOT_NUMBER SlotNumber; PCI_SLOT_NUMBER SlotNumber;
UCHAR ScsiBus;
NTSTATUS Status; NTSTATUS Status;
if (HwInitializationData->HwInitializationDataSize != sizeof(HW_INITIALIZATION_DATA)) if (HwInitializationData->HwInitializationDataSize != sizeof(HW_INITIALIZATION_DATA))
@ -1196,14 +1198,11 @@ ScsiPortInitialize(
} }
/* Scan bus */ /* Scan bus */
{
ULONG ScsiBus;
for (ScsiBus = 0; ScsiBus < PortConfig.NumberOfBuses; ScsiBus++) for (ScsiBus = 0; ScsiBus < PortConfig.NumberOfBuses; ScsiBus++)
{ {
SpiScanAdapter(DeviceExtension, PortConfig.SystemIoBusNumber, ScsiBus); SpiScanAdapter(DeviceExtension, PortConfig.SystemIoBusNumber, ScsiBus);
PortConfig.SystemIoBusNumber++; PortConfig.SystemIoBusNumber++;
} }
}
FirstConfigCall = FALSE; FirstConfigCall = FALSE;
if (!Again) if (!Again)
@ -1633,7 +1632,7 @@ LoadBootDeviceDriver(VOID)
CHAR NtBootDdPath[MAX_PATH]; CHAR NtBootDdPath[MAX_PATH];
PVOID ImageBase; PVOID ImageBase;
ULONG (NTAPI *EntryPoint)(IN PVOID DriverObject, IN PVOID RegistryPath); ULONG (NTAPI *EntryPoint)(IN PVOID DriverObject, IN PVOID RegistryPath);
ULONG i; USHORT i;
BOOLEAN Status; BOOLEAN Status;
/* Some initialization of our temporary loader block */ /* Some initialization of our temporary loader block */
@ -1710,7 +1709,7 @@ LoadBootDeviceDriver(VOID)
NtHeaders = RtlImageNtHeader(VaToPa(BootDdDTE->DllBase)); NtHeaders = RtlImageNtHeader(VaToPa(BootDdDTE->DllBase));
if (!NtHeaders) if (!NtHeaders)
return EIO; return EIO;
Status = LdrRelocateImageWithBias( Status = (BOOLEAN)LdrRelocateImageWithBias(
VaToPa(BootDdDTE->DllBase), VaToPa(BootDdDTE->DllBase),
NtHeaders->OptionalHeader.ImageBase - (ULONG_PTR)BootDdDTE->DllBase, NtHeaders->OptionalHeader.ImageBase - (ULONG_PTR)BootDdDTE->DllBase,
"FreeLdr", "FreeLdr",

View file

@ -57,12 +57,12 @@ VOID BootMain(LPSTR CmdLine)
// We need to emulate these, because the original ones don't work in freeldr // We need to emulate these, because the original ones don't work in freeldr
int __cdecl wctomb(char *mbchar, wchar_t wchar) int __cdecl wctomb(char *mbchar, wchar_t wchar)
{ {
*mbchar = wchar; *mbchar = (char)wchar;
return 1; return 1;
} }
int __cdecl mbtowc (wchar_t *wchar, const char *mbchar, size_t count) int __cdecl mbtowc (wchar_t *wchar, const char *mbchar, size_t count)
{ {
*wchar = *mbchar; *wchar = (wchar_t)*mbchar;
return 1; return 1;
} }

View file

@ -25,7 +25,7 @@ BOOLEAN Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG
PEXT2_FILE_INFO Ext2OpenFile(PCSTR FileName); PEXT2_FILE_INFO Ext2OpenFile(PCSTR FileName);
BOOLEAN Ext2LookupFile(PCSTR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer); BOOLEAN Ext2LookupFile(PCSTR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer);
BOOLEAN Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry); BOOLEAN Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry);
BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONGLONG SectorCount, PVOID Buffer); BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULONGLONG* BytesRead, PVOID Buffer); BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULONGLONG* BytesRead, PVOID Buffer);
BOOLEAN Ext2ReadSuperBlock(VOID); BOOLEAN Ext2ReadSuperBlock(VOID);
@ -61,7 +61,7 @@ ULONG Ext2GroupCount = 0; // Number of groups in this file system
ULONG Ext2InodesPerBlock = 0; // Number of inodes in one block ULONG Ext2InodesPerBlock = 0; // Number of inodes in one block
ULONG Ext2GroupDescPerBlock = 0; // Number of group descriptors in one block ULONG Ext2GroupDescPerBlock = 0; // Number of group descriptors in one block
BOOLEAN DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType) BOOLEAN DiskGetBootVolume(PUCHAR DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType)
{ {
*DriveNumber = 0; *DriveNumber = 0;
*StartSector = 0; *StartSector = 0;
@ -425,7 +425,7 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO
DPRINTM(DPRINT_FILESYSTEM, "Reading fast symbolic link data\n"); DPRINTM(DPRINT_FILESYSTEM, "Reading fast symbolic link data\n");
// Copy the data from the link // Copy the data from the link
RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)Ext2FileInfo->FilePointer + Ext2FileInfo->Inode.symlink), BytesToRead); RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)Ext2FileInfo->FilePointer + Ext2FileInfo->Inode.symlink), (ULONG)BytesToRead);
if (BytesRead != NULL) if (BytesRead != NULL)
{ {
@ -472,10 +472,10 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO
// //
// Do the math for our first read // Do the math for our first read
// //
BlockNumberIndex = (Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes); BlockNumberIndex = (ULONG)(Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes);
BlockNumber = Ext2FileInfo->FileBlockList[BlockNumberIndex]; BlockNumber = Ext2FileInfo->FileBlockList[BlockNumberIndex];
OffsetInBlock = (Ext2FileInfo->FilePointer % Ext2BlockSizeInBytes); OffsetInBlock = (Ext2FileInfo->FilePointer % Ext2BlockSizeInBytes);
LengthInBlock = (BytesToRead > (Ext2BlockSizeInBytes - OffsetInBlock)) ? (Ext2BlockSizeInBytes - OffsetInBlock) : BytesToRead; LengthInBlock = (ULONG)((BytesToRead > (Ext2BlockSizeInBytes - OffsetInBlock)) ? (Ext2BlockSizeInBytes - OffsetInBlock) : BytesToRead);
// //
// Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer // Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer
@ -501,11 +501,11 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO
// //
// Determine how many full clusters we need to read // Determine how many full clusters we need to read
// //
NumberOfBlocks = (BytesToRead / Ext2BlockSizeInBytes); NumberOfBlocks = (ULONG)(BytesToRead / Ext2BlockSizeInBytes);
while (NumberOfBlocks > 0) while (NumberOfBlocks > 0)
{ {
BlockNumberIndex = (Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes); BlockNumberIndex = (ULONG)(Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes);
BlockNumber = Ext2FileInfo->FileBlockList[BlockNumberIndex]; BlockNumber = Ext2FileInfo->FileBlockList[BlockNumberIndex];
// //
@ -531,13 +531,13 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO
// //
if (BytesToRead > 0) if (BytesToRead > 0)
{ {
BlockNumberIndex = (Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes); BlockNumberIndex = (ULONG)(Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes);
BlockNumber = Ext2FileInfo->FileBlockList[BlockNumberIndex]; BlockNumber = Ext2FileInfo->FileBlockList[BlockNumberIndex];
// //
// Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer // Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer
// //
if (!Ext2ReadPartialBlock(BlockNumber, 0, BytesToRead, Buffer)) if (!Ext2ReadPartialBlock(BlockNumber, 0, (ULONG)BytesToRead, Buffer))
{ {
return FALSE; return FALSE;
} }
@ -553,7 +553,7 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO
return TRUE; return TRUE;
} }
BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONGLONG SectorCount, PVOID Buffer) BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
{ {
//GEOMETRY DiskGeometry; //GEOMETRY DiskGeometry;
//BOOLEAN ReturnValue; //BOOLEAN ReturnValue;
@ -796,7 +796,8 @@ BOOLEAN Ext2ReadDirectory(ULONG Inode, PVOID* DirectoryBuffer, PEXT2_INODE Inode
// //
// Now allocate the memory to hold the group descriptors // Now allocate the memory to hold the group descriptors
// //
*DirectoryBuffer = (PEXT2_DIR_ENTRY)MmHeapAlloc(DirectoryFileInfo.FileSize); ASSERT(DirectoryFileInfo.FileSize <= 0xFFFFFFFF);
*DirectoryBuffer = (PEXT2_DIR_ENTRY)MmHeapAlloc((ULONG)DirectoryFileInfo.FileSize);
// //
// Make sure we got the memory // Make sure we got the memory
@ -1009,7 +1010,7 @@ ULONG* Ext2ReadBlockPointerList(PEXT2_INODE Inode)
//BlockCount = Inode->i_blocks; //BlockCount = Inode->i_blocks;
FileSize = Ext2GetInodeFileSize(Inode); FileSize = Ext2GetInodeFileSize(Inode);
FileSize = ROUND_UP(FileSize, Ext2BlockSizeInBytes); FileSize = ROUND_UP(FileSize, Ext2BlockSizeInBytes);
BlockCount = (FileSize / Ext2BlockSizeInBytes); BlockCount = (ULONG)(FileSize / Ext2BlockSizeInBytes);
// Allocate the memory for the block list // Allocate the memory for the block list
BlockList = MmHeapAlloc(BlockCount * sizeof(ULONG)); BlockList = MmHeapAlloc(BlockCount * sizeof(ULONG));
@ -1181,8 +1182,8 @@ LONG Ext2GetFileInformation(ULONG FileId, FILEINFORMATION* Information)
PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
RtlZeroMemory(Information, sizeof(FILEINFORMATION)); RtlZeroMemory(Information, sizeof(FILEINFORMATION));
Information->EndingAddress.LowPart = FileHandle->FileSize; Information->EndingAddress.QuadPart = FileHandle->FileSize;
Information->CurrentAddress.LowPart = FileHandle->FilePointer; Information->CurrentAddress.QuadPart = FileHandle->FilePointer;
DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFileInformation() FileSize = %d\n", DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFileInformation() FileSize = %d\n",
Information->EndingAddress.LowPart); Information->EndingAddress.LowPart);
@ -1297,7 +1298,7 @@ const DEVVTBL* Ext2Mount(ULONG DeviceId)
// //
// Compatibility hack as long as FS is not using underlying device DeviceId // Compatibility hack as long as FS is not using underlying device DeviceId
// //
ULONG DriveNumber; UCHAR DriveNumber;
ULONGLONG StartSector; ULONGLONG StartSector;
ULONGLONG SectorCount; ULONGLONG SectorCount;
int Type; int Type;

View file

@ -23,7 +23,7 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCount); ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONGLONG PartitionSectorCount);
PVOID FatBufferDirectory(PFAT_VOLUME_INFO Volume, ULONG DirectoryStartCluster, ULONG* EntryCountPointer, BOOLEAN RootDirectory); PVOID FatBufferDirectory(PFAT_VOLUME_INFO Volume, ULONG DirectoryStartCluster, ULONG* EntryCountPointer, BOOLEAN RootDirectory);
BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID DirectoryBuffer, ULONG EntryCount, PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer); BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID DirectoryBuffer, ULONG EntryCount, PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer);
LONG FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, ULONG DeviceId, PFAT_FILE_INFO FatFileInfoPointer); LONG FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, ULONG DeviceId, PFAT_FILE_INFO FatFileInfoPointer);
@ -263,8 +263,8 @@ BOOLEAN FatOpenVolume(PFAT_VOLUME_INFO Volume, PFAT_BOOTSECTOR BootSector, ULONG
Volume->FatSectorStart = (4096 / Volume->BytesPerSector); Volume->FatSectorStart = (4096 / Volume->BytesPerSector);
Volume->ActiveFatSectorStart = Volume->FatSectorStart; Volume->ActiveFatSectorStart = Volume->FatSectorStart;
Volume->NumberOfFats = 1; Volume->NumberOfFats = 1;
FatSize = PartitionSectorCount / Volume->SectorsPerCluster * FatSize = (ULONG)(PartitionSectorCount / Volume->SectorsPerCluster *
(Volume->FatType == FATX16 ? 2 : 4); (Volume->FatType == FATX16 ? 2 : 4));
Volume->SectorsPerFat = (((FatSize + 4095) / 4096) * 4096) / Volume->BytesPerSector; Volume->SectorsPerFat = (((FatSize + 4095) / 4096) * 4096) / Volume->BytesPerSector;
Volume->RootDirSectorStart = Volume->FatSectorStart + Volume->NumberOfFats * Volume->SectorsPerFat; Volume->RootDirSectorStart = Volume->FatSectorStart + Volume->NumberOfFats * Volume->SectorsPerFat;
@ -313,7 +313,7 @@ BOOLEAN FatOpenVolume(PFAT_VOLUME_INFO Volume, PFAT_BOOTSECTOR BootSector, ULONG
return TRUE; return TRUE;
} }
ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCount) ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONGLONG PartitionSectorCount)
{ {
ULONG RootDirSectors; ULONG RootDirSectors;
ULONG DataSectorCount; ULONG DataSectorCount;
@ -325,7 +325,7 @@ ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCo
if (0 == strncmp(FatXBootSector->FileSystemType, "FATX", 4)) if (0 == strncmp(FatXBootSector->FileSystemType, "FATX", 4))
{ {
CountOfClusters = PartitionSectorCount / FatXBootSector->SectorsPerCluster; CountOfClusters = (ULONG)(PartitionSectorCount / FatXBootSector->SectorsPerCluster);
if (CountOfClusters < 65525) if (CountOfClusters < 65525)
{ {
/* Volume is FATX16 */ /* Volume is FATX16 */

View file

@ -134,7 +134,7 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON
{ {
LARGE_INTEGER Position; LARGE_INTEGER Position;
ULONG Count; ULONG Count;
USHORT ReadLength; ULONG ReadLength;
LONG ret; LONG ret;
DPRINTM(DPRINT_FILESYSTEM, "NtfsDiskRead - Offset: %I64d Length: %I64d\n", Offset, Length); DPRINTM(DPRINT_FILESYSTEM, "NtfsDiskRead - Offset: %I64d Length: %I64d\n", Offset, Length);
@ -144,15 +144,14 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON
// //
if (Offset % Volume->BootSector.BytesPerSector) if (Offset % Volume->BootSector.BytesPerSector)
{ {
Position.HighPart = 0; Position.QuadPart = Offset & ~(Volume->BootSector.BytesPerSector - 1);
Position.LowPart = Offset & ~(Volume->BootSector.BytesPerSector - 1);
ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute); ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS) if (ret != ESUCCESS)
return FALSE; return FALSE;
ret = ArcRead(Volume->DeviceId, Volume->TemporarySector, Volume->BootSector.BytesPerSector, &Count); ret = ArcRead(Volume->DeviceId, Volume->TemporarySector, Volume->BootSector.BytesPerSector, &Count);
if (ret != ESUCCESS || Count != Volume->BootSector.BytesPerSector) if (ret != ESUCCESS || Count != Volume->BootSector.BytesPerSector)
return FALSE; return FALSE;
ReadLength = min(Length, Volume->BootSector.BytesPerSector - (Offset % Volume->BootSector.BytesPerSector)); ReadLength = (USHORT)min(Length, Volume->BootSector.BytesPerSector - (Offset % Volume->BootSector.BytesPerSector));
// //
// Copy interesting data // Copy interesting data
@ -174,8 +173,7 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON
// //
if (Length >= Volume->BootSector.BytesPerSector) if (Length >= Volume->BootSector.BytesPerSector)
{ {
Position.HighPart = 0; Position.QuadPart = Offset;
Position.LowPart = Offset;
ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute); ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS) if (ret != ESUCCESS)
return FALSE; return FALSE;
@ -197,12 +195,11 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON
// //
if (Length) if (Length)
{ {
Position.HighPart = 0; Position.QuadPart = Offset;
Position.LowPart = Offset;
ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute); ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS) if (ret != ESUCCESS)
return FALSE; return FALSE;
ret = ArcRead(Volume->DeviceId, Buffer, Length, &Count); ret = ArcRead(Volume->DeviceId, Buffer, (ULONG)Length, &Count);
if (ret != ESUCCESS || Count != Length) if (ret != ESUCCESS || Count != Length)
return FALSE; return FALSE;
} }
@ -210,7 +207,7 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON
return TRUE; return TRUE;
} }
static ULONGLONG NtfsReadAttribute(PNTFS_VOLUME_INFO Volume, PNTFS_ATTR_CONTEXT Context, ULONGLONG Offset, PCHAR Buffer, ULONGLONG Length) static ULONG NtfsReadAttribute(PNTFS_VOLUME_INFO Volume, PNTFS_ATTR_CONTEXT Context, ULONGLONG Offset, PCHAR Buffer, ULONG Length)
{ {
ULONGLONG LastLCN; ULONGLONG LastLCN;
PUCHAR DataRun; PUCHAR DataRun;
@ -218,15 +215,15 @@ static ULONGLONG NtfsReadAttribute(PNTFS_VOLUME_INFO Volume, PNTFS_ATTR_CONTEXT
ULONGLONG DataRunLength; ULONGLONG DataRunLength;
LONGLONG DataRunStartLCN; LONGLONG DataRunStartLCN;
ULONGLONG CurrentOffset; ULONGLONG CurrentOffset;
ULONGLONG ReadLength; ULONG ReadLength;
ULONGLONG AlreadyRead; ULONG AlreadyRead;
if (!Context->Record.IsNonResident) if (!Context->Record.IsNonResident)
{ {
if (Offset > Context->Record.Resident.ValueLength) if (Offset > Context->Record.Resident.ValueLength)
return 0; return 0;
if (Offset + Length > Context->Record.Resident.ValueLength) if (Offset + Length > Context->Record.Resident.ValueLength)
Length = Context->Record.Resident.ValueLength - Offset; Length = (ULONG)(Context->Record.Resident.ValueLength - Offset);
RtlCopyMemory(Buffer, (PCHAR)&Context->Record + Context->Record.Resident.ValueOffset + Offset, Length); RtlCopyMemory(Buffer, (PCHAR)&Context->Record + Context->Record.Resident.ValueOffset + Offset, Length);
return Length; return Length;
} }
@ -291,7 +288,7 @@ static ULONGLONG NtfsReadAttribute(PNTFS_VOLUME_INFO Volume, PNTFS_ATTR_CONTEXT
* II. Go through the run list and read the data * II. Go through the run list and read the data
*/ */
ReadLength = min(DataRunLength * Volume->ClusterSize - (Offset - CurrentOffset), Length); ReadLength = (ULONG)min(DataRunLength * Volume->ClusterSize - (Offset - CurrentOffset), Length);
if (DataRunStartLCN == -1) if (DataRunStartLCN == -1)
RtlZeroMemory(Buffer, ReadLength); RtlZeroMemory(Buffer, ReadLength);
if (NtfsDiskRead(Volume, DataRunStartLCN * Volume->ClusterSize + Offset - CurrentOffset, ReadLength, Buffer)) if (NtfsDiskRead(Volume, DataRunStartLCN * Volume->ClusterSize + Offset - CurrentOffset, ReadLength, Buffer))
@ -318,7 +315,7 @@ static ULONGLONG NtfsReadAttribute(PNTFS_VOLUME_INFO Volume, PNTFS_ATTR_CONTEXT
while (Length > 0) while (Length > 0)
{ {
ReadLength = min(DataRunLength * Volume->ClusterSize, Length); ReadLength = (ULONG)min(DataRunLength * Volume->ClusterSize, Length);
if (DataRunStartLCN == -1) if (DataRunStartLCN == -1)
RtlZeroMemory(Buffer, ReadLength); RtlZeroMemory(Buffer, ReadLength);
else if (!NtfsDiskRead(Volume, DataRunStartLCN * Volume->ClusterSize, ReadLength, Buffer)) else if (!NtfsDiskRead(Volume, DataRunStartLCN * Volume->ClusterSize, ReadLength, Buffer))
@ -384,12 +381,21 @@ static PNTFS_ATTR_CONTEXT NtfsFindAttributeHelper(PNTFS_VOLUME_INFO Volume, PNTF
ListContext = NtfsPrepareAttributeContext(AttrRecord); ListContext = NtfsPrepareAttributeContext(AttrRecord);
ListSize = NtfsGetAttributeSize(&ListContext->Record); ListSize = NtfsGetAttributeSize(&ListContext->Record);
ListBuffer = MmHeapAlloc(ListSize); if(ListSize <= 0xFFFFFFFF)
ListBuffer = MmHeapAlloc((ULONG)ListSize);
else
ListBuffer = NULL;
if(!ListBuffer)
{
DPRINTM(DPRINT_FILESYSTEM, "Failed to allocate memory: %x\n", (ULONG)ListSize);
continue;
}
ListAttrRecord = (PNTFS_ATTR_RECORD)ListBuffer; ListAttrRecord = (PNTFS_ATTR_RECORD)ListBuffer;
ListAttrRecordEnd = (PNTFS_ATTR_RECORD)((PCHAR)ListBuffer + ListSize); ListAttrRecordEnd = (PNTFS_ATTR_RECORD)((PCHAR)ListBuffer + ListSize);
if (NtfsReadAttribute(Volume, ListContext, 0, ListBuffer, ListSize) == ListSize) if (NtfsReadAttribute(Volume, ListContext, 0, ListBuffer, (ULONG)ListSize) == ListSize)
{ {
Context = NtfsFindAttributeHelper(Volume, ListAttrRecord, ListAttrRecordEnd, Context = NtfsFindAttributeHelper(Volume, ListAttrRecord, ListAttrRecordEnd,
Type, Name, NameLength); Type, Name, NameLength);
@ -463,7 +469,7 @@ static BOOLEAN NtfsFixupRecord(PNTFS_VOLUME_INFO Volume, PNTFS_RECORD Record)
return TRUE; return TRUE;
} }
static BOOLEAN NtfsReadMftRecord(PNTFS_VOLUME_INFO Volume, ULONG MFTIndex, PNTFS_MFT_RECORD Buffer) static BOOLEAN NtfsReadMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, PNTFS_MFT_RECORD Buffer)
{ {
ULONGLONG BytesRead; ULONGLONG BytesRead;
@ -484,10 +490,10 @@ VOID NtfsPrintFile(PNTFS_INDEX_ENTRY IndexEntry)
UCHAR i; UCHAR i;
FileName = IndexEntry->FileName.FileName; FileName = IndexEntry->FileName.FileName;
FileNameLength = IndexEntry->FileName.FileNameLength; FileNameLength = min(IndexEntry->FileName.FileNameLength, 255);
for (i = 0; i < FileNameLength; i++) for (i = 0; i < FileNameLength; i++)
AnsiFileName[i] = FileName[i]; AnsiFileName[i] = (CHAR)FileName[i];
AnsiFileName[i] = 0; AnsiFileName[i] = 0;
DPRINTM(DPRINT_FILESYSTEM, "- %s (%x)\n", AnsiFileName, IndexEntry->Data.Directory.IndexedFile); DPRINTM(DPRINT_FILESYSTEM, "- %s (%x)\n", AnsiFileName, IndexEntry->Data.Directory.IndexedFile);
@ -527,7 +533,7 @@ static BOOLEAN NtfsCompareFileName(PCHAR FileName, PNTFS_INDEX_ENTRY IndexEntry)
return TRUE; return TRUE;
} }
static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONG MFTIndex, PCHAR FileName, ULONG *OutMFTIndex) static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, PCHAR FileName, ULONGLONG *OutMFTIndex)
{ {
PNTFS_MFT_RECORD MftRecord; PNTFS_MFT_RECORD MftRecord;
ULONG Magic; ULONG Magic;
@ -603,15 +609,19 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONG MFTIndex, PCHAR
return FALSE; return FALSE;
} }
BitmapDataSize = NtfsGetAttributeSize(&IndexBitmapCtx->Record); BitmapDataSize = NtfsGetAttributeSize(&IndexBitmapCtx->Record);
DPRINTM(DPRINT_FILESYSTEM, "BitmapDataSize: %x\n", BitmapDataSize); DPRINTM(DPRINT_FILESYSTEM, "BitmapDataSize: %x\n", (ULONG)BitmapDataSize);
BitmapData = MmHeapAlloc(BitmapDataSize); if(BitmapDataSize <= 0xFFFFFFFF)
BitmapData = MmHeapAlloc((ULONG)BitmapDataSize);
else
BitmapData = NULL;
if (BitmapData == NULL) if (BitmapData == NULL)
{ {
MmHeapFree(IndexRecord); MmHeapFree(IndexRecord);
MmHeapFree(MftRecord); MmHeapFree(MftRecord);
return FALSE; return FALSE;
} }
NtfsReadAttribute(Volume, IndexBitmapCtx, 0, BitmapData, BitmapDataSize); NtfsReadAttribute(Volume, IndexBitmapCtx, 0, BitmapData, (ULONG)BitmapDataSize);
NtfsReleaseAttributeContext(IndexBitmapCtx); NtfsReleaseAttributeContext(IndexBitmapCtx);
IndexAllocationCtx = NtfsFindAttribute(Volume, MftRecord, NTFS_ATTR_TYPE_INDEX_ALLOCATION, L"$I30"); IndexAllocationCtx = NtfsFindAttribute(Volume, MftRecord, NTFS_ATTR_TYPE_INDEX_ALLOCATION, L"$I30");
@ -693,7 +703,7 @@ static BOOLEAN NtfsLookupFile(PNTFS_VOLUME_INFO Volume, PCSTR FileName, PNTFS_MF
{ {
ULONG NumberOfPathParts; ULONG NumberOfPathParts;
CHAR PathPart[261]; CHAR PathPart[261];
ULONG CurrentMFTIndex; ULONGLONG CurrentMFTIndex;
UCHAR i; UCHAR i;
DPRINTM(DPRINT_FILESYSTEM, "NtfsLookupFile() FileName = %s\n", FileName); DPRINTM(DPRINT_FILESYSTEM, "NtfsLookupFile() FileName = %s\n", FileName);
@ -748,8 +758,8 @@ LONG NtfsGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
PNTFS_FILE_HANDLE FileHandle = FsGetDeviceSpecific(FileId); PNTFS_FILE_HANDLE FileHandle = FsGetDeviceSpecific(FileId);
RtlZeroMemory(Information, sizeof(FILEINFORMATION)); RtlZeroMemory(Information, sizeof(FILEINFORMATION));
Information->EndingAddress.LowPart = (ULONG)NtfsGetAttributeSize(&FileHandle->DataContext->Record); Information->EndingAddress.QuadPart = NtfsGetAttributeSize(&FileHandle->DataContext->Record);
Information->CurrentAddress.LowPart = FileHandle->Offset; Information->CurrentAddress.QuadPart = FileHandle->Offset;
DPRINTM(DPRINT_FILESYSTEM, "NtfsGetFileInformation() FileSize = %d\n", DPRINTM(DPRINT_FILESYSTEM, "NtfsGetFileInformation() FileSize = %d\n",
Information->EndingAddress.LowPart); Information->EndingAddress.LowPart);
@ -923,8 +933,7 @@ const DEVVTBL* NtfsMount(ULONG DeviceId)
MmHeapFree(Volume); MmHeapFree(Volume);
return NULL; return NULL;
} }
Position.HighPart = 0; Position.QuadPart = Volume->BootSector.MftLocation * Volume->ClusterSize;
Position.LowPart = Volume->BootSector.MftLocation * Volume->ClusterSize;
ret = ArcSeek(DeviceId, &Position, SeekAbsolute); ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS) if (ret != ESUCCESS)
{ {

View file

@ -29,7 +29,7 @@ typedef struct
VOID DriveMapMapDrivesInSection(PCSTR SectionName); VOID DriveMapMapDrivesInSection(PCSTR SectionName);
BOOLEAN DriveMapIsValidDriveString(PCSTR DriveString); // Checks the drive string ("hd0") for validity BOOLEAN DriveMapIsValidDriveString(PCSTR DriveString); // Checks the drive string ("hd0") for validity
ULONG DriveMapGetBiosDriveNumber(PCSTR DeviceName); // Returns a BIOS drive number for any given device name (e.g. 0x80 for 'hd0') UCHAR DriveMapGetBiosDriveNumber(PCSTR DeviceName); // Returns a BIOS drive number for any given device name (e.g. 0x80 for 'hd0')
VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap); // Installs the int 13h handler for the drive mapper VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap); // Installs the int 13h handler for the drive mapper
VOID DriveMapRemoveInt13Handler(VOID); // Removes a previously installed int 13h drive map handler VOID DriveMapRemoveInt13Handler(VOID); // Removes a previously installed int 13h drive map handler

View file

@ -36,7 +36,7 @@ VOID XboxVideoClearScreen(UCHAR Attr);
VIDEODISPLAYMODE XboxVideoSetDisplayMode(char *DisplayModem, BOOLEAN Init); VIDEODISPLAYMODE XboxVideoSetDisplayMode(char *DisplayModem, BOOLEAN Init);
VOID XboxVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth); VOID XboxVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth);
ULONG XboxVideoGetBufferSize(VOID); ULONG XboxVideoGetBufferSize(VOID);
VOID XboxVideoSetTextCursorPosition(ULONG X, ULONG Y); VOID XboxVideoSetTextCursorPosition(UCHAR X, UCHAR Y);
VOID XboxVideoHideShowTextCursor(BOOLEAN Show); VOID XboxVideoHideShowTextCursor(BOOLEAN Show);
VOID XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y); VOID XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y);
VOID XboxVideoCopyOffScreenBufferToVRAM(PVOID Buffer); VOID XboxVideoCopyOffScreenBufferToVRAM(PVOID Buffer);
@ -51,10 +51,10 @@ VOID XboxMemInit(VOID);
PVOID XboxMemReserveMemory(ULONG MbToReserve); PVOID XboxMemReserveMemory(ULONG MbToReserve);
ULONG XboxMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); ULONG XboxMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize);
BOOLEAN XboxDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); BOOLEAN XboxDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
BOOLEAN XboxDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); BOOLEAN XboxDiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
BOOLEAN XboxDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry); BOOLEAN XboxDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry);
ULONG XboxDiskGetCacheableBlockCount(ULONG DriveNumber); ULONG XboxDiskGetCacheableBlockCount(UCHAR DriveNumber);
TIMEINFO* XboxGetTime(VOID); TIMEINFO* XboxGetTime(VOID);

View file

@ -35,7 +35,7 @@ VOID PcVideoClearScreen(UCHAR Attr);
VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init); VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init);
VOID PcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth); VOID PcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth);
ULONG PcVideoGetBufferSize(VOID); ULONG PcVideoGetBufferSize(VOID);
VOID PcVideoSetTextCursorPosition(ULONG X, ULONG Y); VOID PcVideoSetTextCursorPosition(UCHAR X, UCHAR Y);
VOID PcVideoHideShowTextCursor(BOOLEAN Show); VOID PcVideoHideShowTextCursor(BOOLEAN Show);
VOID PcVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y); VOID PcVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y);
VOID PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer); VOID PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer);
@ -49,10 +49,10 @@ VOID PcPrepareForReactOS(IN BOOLEAN Setup);
ULONG PcMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); ULONG PcMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize);
BOOLEAN PcDiskGetBootPath(char *BootPath, unsigned Size); BOOLEAN PcDiskGetBootPath(char *BootPath, unsigned Size);
BOOLEAN PcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); BOOLEAN PcDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
BOOLEAN PcDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); BOOLEAN PcDiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
BOOLEAN PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry); BOOLEAN PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry);
ULONG PcDiskGetCacheableBlockCount(ULONG DriveNumber); ULONG PcDiskGetCacheableBlockCount(UCHAR DriveNumber);
TIMEINFO* PcGetTime(VOID); TIMEINFO* PcGetTime(VOID);

View file

@ -50,7 +50,7 @@ typedef struct
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
typedef struct typedef struct
{ {
ULONG DriveNumber; UCHAR DriveNumber;
ULONG BytesPerSector; ULONG BytesPerSector;
ULONG BlockSize; // Block size (in sectors) ULONG BlockSize; // Block size (in sectors)
@ -84,8 +84,8 @@ VOID CacheInternalDumpBlockList(PCACHE_DRIVE CacheDrive); // Dumps the
VOID CacheInternalOptimizeBlockList(PCACHE_DRIVE CacheDrive, PCACHE_BLOCK CacheBlock); // Moves the specified block to the head of the list VOID CacheInternalOptimizeBlockList(PCACHE_DRIVE CacheDrive, PCACHE_BLOCK CacheBlock); // Moves the specified block to the head of the list
BOOLEAN CacheInitializeDrive(ULONG DriveNumber); BOOLEAN CacheInitializeDrive(UCHAR DriveNumber);
VOID CacheInvalidateCacheData(VOID); VOID CacheInvalidateCacheData(VOID);
BOOLEAN CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount, PVOID Buffer); BOOLEAN CacheReadDiskSectors(UCHAR DiskNumber, ULONGLONG StartSector, ULONG SectorCount, PVOID Buffer);
BOOLEAN CacheForceDiskSectorsIntoCache(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount); BOOLEAN CacheForceDiskSectorsIntoCache(UCHAR DiskNumber, ULONGLONG StartSector, ULONG SectorCount);
BOOLEAN CacheReleaseMemory(ULONG MinimumAmountToRelease); BOOLEAN CacheReleaseMemory(ULONG MinimumAmountToRelease);

View file

@ -105,10 +105,10 @@ typedef struct _MASTER_BOOT_RECORD
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
#if defined(__i386__) || defined(_M_AMD64) #if defined(__i386__) || defined(_M_AMD64)
BOOLEAN DiskResetController(ULONG DriveNumber); BOOLEAN DiskResetController(UCHAR DriveNumber);
BOOLEAN DiskInt13ExtensionsSupported(ULONG DriveNumber); BOOLEAN DiskInt13ExtensionsSupported(UCHAR DriveNumber);
//VOID DiskStopFloppyMotor(VOID); //VOID DiskStopFloppyMotor(VOID);
BOOLEAN DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT BufferSize); BOOLEAN DiskGetExtendedDriveParameters(UCHAR DriveNumber, PVOID Buffer, USHORT BufferSize);
#endif // defined __i386__ || defined(_M_AMD64) #endif // defined __i386__ || defined(_M_AMD64)
@ -120,10 +120,10 @@ BOOLEAN DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT B
VOID DiskReportError (BOOLEAN bError); VOID DiskReportError (BOOLEAN bError);
VOID DiskError(PCSTR ErrorString, ULONG ErrorCode); VOID DiskError(PCSTR ErrorString, ULONG ErrorCode);
PCSTR DiskGetErrorCodeString(ULONG ErrorCode); PCSTR DiskGetErrorCodeString(ULONG ErrorCode);
BOOLEAN DiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); // Implemented in i386disk.c BOOLEAN DiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); // Implemented in i386disk.c
BOOLEAN DiskIsDriveRemovable(ULONG DriveNumber); BOOLEAN DiskIsDriveRemovable(UCHAR DriveNumber);
VOID DiskStopFloppyMotor(VOID); // Implemented in i386disk.c VOID DiskStopFloppyMotor(VOID); // Implemented in i386disk.c
extern ULONG FrldrBootDrive; extern UCHAR FrldrBootDrive;
extern ULONG FrldrBootPartition; extern ULONG FrldrBootPartition;
BOOLEAN DiskGetBootPath(char *BootPath, unsigned Size); BOOLEAN DiskGetBootPath(char *BootPath, unsigned Size);
@ -134,10 +134,10 @@ BOOLEAN DiskGetBootPath(char *BootPath, unsigned Size);
// Fixed Disk Partition Management Functions // Fixed Disk Partition Management Functions
// //
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
BOOLEAN DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry, ULONG *ActivePartition); BOOLEAN DiskGetActivePartitionEntry(UCHAR DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry, ULONG *ActivePartition);
BOOLEAN DiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); BOOLEAN DiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
BOOLEAN DiskGetFirstPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry); BOOLEAN DiskGetFirstPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry);
BOOLEAN DiskGetFirstExtendedPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry); BOOLEAN DiskGetFirstExtendedPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry);
BOOLEAN DiskReadBootRecord(ULONG DriveNumber, ULONGLONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord); BOOLEAN DiskReadBootRecord(UCHAR DriveNumber, ULONGLONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord);
ULONG LoadBootDeviceDriver(VOID); ULONG LoadBootDeviceDriver(VOID);

View file

@ -75,7 +75,7 @@ struct ext2_sblock
ULONG free_inodes; ULONG free_inodes;
ULONG first_data_block; ULONG first_data_block;
ULONG log2_block_size; ULONG log2_block_size;
ULONG log2_fragment_size; LONG log2_fragment_size;
ULONG blocks_per_group; ULONG blocks_per_group;
ULONG fragments_per_group; ULONG fragments_per_group;
ULONG inodes_per_group; ULONG inodes_per_group;

View file

@ -47,7 +47,7 @@ typedef struct tagMACHVTBL
VIDEODISPLAYMODE (*VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init); VIDEODISPLAYMODE (*VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init);
VOID (*VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth); VOID (*VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth);
ULONG (*VideoGetBufferSize)(VOID); ULONG (*VideoGetBufferSize)(VOID);
VOID (*VideoSetTextCursorPosition)(ULONG X, ULONG Y); VOID (*VideoSetTextCursorPosition)(UCHAR X, UCHAR Y);
VOID (*VideoHideShowTextCursor)(BOOLEAN Show); VOID (*VideoHideShowTextCursor)(BOOLEAN Show);
VOID (*VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y); VOID (*VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y);
VOID (*VideoCopyOffScreenBufferToVRAM)(PVOID Buffer); VOID (*VideoCopyOffScreenBufferToVRAM)(PVOID Buffer);
@ -62,9 +62,9 @@ typedef struct tagMACHVTBL
ULONG (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); ULONG (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize);
BOOLEAN (*DiskGetBootPath)(char *BootPath, unsigned Size); BOOLEAN (*DiskGetBootPath)(char *BootPath, unsigned Size);
BOOLEAN (*DiskReadLogicalSectors)(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); BOOLEAN (*DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
BOOLEAN (*DiskGetDriveGeometry)(ULONG DriveNumber, PGEOMETRY DriveGeometry); BOOLEAN (*DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry);
ULONG (*DiskGetCacheableBlockCount)(ULONG DriveNumber); ULONG (*DiskGetCacheableBlockCount)(UCHAR DriveNumber);
TIMEINFO* (*GetTime)(VOID); TIMEINFO* (*GetTime)(VOID);
ULONG (*GetRelativeTime)(VOID); ULONG (*GetRelativeTime)(VOID);
@ -83,7 +83,7 @@ VOID MachVideoClearScreen(UCHAR Attr);
VIDEODISPLAYMODE MachVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init); VIDEODISPLAYMODE MachVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init);
VOID MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth); VOID MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth);
ULONG MachVideoGetBufferSize(VOID); ULONG MachVideoGetBufferSize(VOID);
VOID MachVideoSetTextCursorPosition(ULONG X, ULONG Y); VOID MachVideoSetTextCursorPosition(UCHAR X, UCHAR Y);
VOID MachVideoHideShowTextCursor(BOOLEAN Show); VOID MachVideoHideShowTextCursor(BOOLEAN Show);
VOID MachVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y); VOID MachVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y);
VOID MachVideoCopyOffScreenBufferToVRAM(PVOID Buffer); VOID MachVideoCopyOffScreenBufferToVRAM(PVOID Buffer);
@ -94,9 +94,9 @@ VOID MachVideoSync(VOID);
VOID MachBeep(VOID); VOID MachBeep(VOID);
BOOLEAN MachDiskGetBootPath(char *BootPath, unsigned Size); BOOLEAN MachDiskGetBootPath(char *BootPath, unsigned Size);
BOOLEAN MachDiskNormalizeSystemPath(char *SystemPath, unsigned Size); BOOLEAN MachDiskNormalizeSystemPath(char *SystemPath, unsigned Size);
BOOLEAN MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); BOOLEAN MachDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
BOOLEAN MachDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry); BOOLEAN MachDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry);
ULONG MachDiskGetCacheableBlockCount(ULONG DriveNumber); ULONG MachDiskGetCacheableBlockCount(UCHAR DriveNumber);
VOID MachPrepareForReactOS(IN BOOLEAN Setup); VOID MachPrepareForReactOS(IN BOOLEAN Setup);
#define MachConsPutChar(Ch) MachVtbl.ConsPutChar(Ch) #define MachConsPutChar(Ch) MachVtbl.ConsPutChar(Ch)

View file

@ -54,6 +54,7 @@ typedef struct
#define MM_PAGE_SIZE 4096 #define MM_PAGE_SIZE 4096
#define MM_PAGE_MASK 0xFFF #define MM_PAGE_MASK 0xFFF
#define MM_PAGE_SHIFT 12 #define MM_PAGE_SHIFT 12
// FIXME: freeldr implementation uses ULONG for page numbers
#define MM_MAX_PAGE 0xFFFFFFFFFFFFF #define MM_MAX_PAGE 0xFFFFFFFFFFFFF
#define MM_SIZE_TO_PAGES(a) \ #define MM_SIZE_TO_PAGES(a) \

View file

@ -81,9 +81,9 @@ DissectArcPath2(
OUT ULONG* z, OUT ULONG* z,
OUT ULONG* Partition, OUT ULONG* Partition,
OUT ULONG *PathSyntax); OUT ULONG *PathSyntax);
BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, ULONG* BootDrive, ULONG* BootPartition); BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, UCHAR* BootDrive, ULONG* BootPartition);
VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, ULONG Disk, ULONG Partition); VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Partition);
ULONG ConvertArcNameToBiosDriveNumber(PCHAR ArcPath); UCHAR ConvertArcNameToBiosDriveNumber(PCHAR ArcPath);
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
// //

View file

@ -86,7 +86,7 @@ MachVideoGetBufferSize(VOID)
} }
VOID VOID
MachVideoSetTextCursorPosition(ULONG X, ULONG Y) MachVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
{ {
MachVtbl.VideoSetTextCursorPosition(X, Y); MachVtbl.VideoSetTextCursorPosition(X, Y);
} }
@ -152,19 +152,19 @@ MachDiskGetBootPath(char *BootPath, unsigned Size)
} }
BOOLEAN BOOLEAN
MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) MachDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
{ {
return MachVtbl.DiskReadLogicalSectors(DriveNumber, SectorNumber, SectorCount, Buffer); return MachVtbl.DiskReadLogicalSectors(DriveNumber, SectorNumber, SectorCount, Buffer);
} }
BOOLEAN BOOLEAN
MachDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry) MachDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry)
{ {
return MachVtbl.DiskGetDriveGeometry(DriveNumber, DriveGeometry); return MachVtbl.DiskGetDriveGeometry(DriveNumber, DriveGeometry);
} }
ULONG ULONG
MachDiskGetCacheableBlockCount(ULONG DriveNumber) MachDiskGetCacheableBlockCount(UCHAR DriveNumber)
{ {
return MachVtbl.DiskGetCacheableBlockCount(DriveNumber); return MachVtbl.DiskGetCacheableBlockCount(DriveNumber);
} }

View file

@ -21,7 +21,7 @@
#include <freeldr.h> #include <freeldr.h>
BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, ULONG* BootDrive, ULONG* BootPartition) BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, UCHAR* BootDrive, ULONG* BootPartition)
{ {
char *p; char *p;
@ -160,8 +160,9 @@ DissectArcPath2(
return FALSE; return FALSE;
} }
#if 0 #if 0
VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, ULONG Disk, ULONG Partition) VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Partition)
{ {
char tmp[50]; char tmp[50];
@ -197,10 +198,10 @@ VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, ULONG Disk, ULONG Parti
} }
} }
ULONG ConvertArcNameToBiosDriveNumber(PCHAR ArcPath) UCHAR ConvertArcNameToBiosDriveNumber(PCHAR ArcPath)
{ {
char * p; char * p;
ULONG DriveNumber = 0; UCHAR DriveNumber = 0;
if (_strnicmp(ArcPath, "multi(0)disk(0)", 15) != 0) if (_strnicmp(ArcPath, "multi(0)disk(0)", 15) != 0)
return 0; return 0;

View file

@ -24,7 +24,7 @@
VOID VideoSetAllColorsToBlack(ULONG ColorCount) VOID VideoSetAllColorsToBlack(ULONG ColorCount)
{ {
ULONG Color; UCHAR Color;
MachVideoSync(); MachVideoSync();
@ -37,7 +37,7 @@ VOID VideoSetAllColorsToBlack(ULONG ColorCount)
VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount) VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount)
{ {
ULONG Index; ULONG Index;
ULONG Color; UCHAR Color;
PPALETTE_ENTRY PaletteColors; PPALETTE_ENTRY PaletteColors;
PaletteColors = MmHeapAlloc(sizeof(PALETTE_ENTRY) * ColorCount); PaletteColors = MmHeapAlloc(sizeof(PALETTE_ENTRY) * ColorCount);
@ -97,7 +97,7 @@ VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount)
VOID VideoFadeOut(ULONG ColorCount) VOID VideoFadeOut(ULONG ColorCount)
{ {
ULONG Index; ULONG Index;
ULONG Color; UCHAR Color;
UCHAR Red; UCHAR Red;
UCHAR Green; UCHAR Green;
UCHAR Blue; UCHAR Blue;

View file

@ -24,7 +24,7 @@ VOID VideoSavePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount)
for (Color=0; Color<ColorCount; Color++) for (Color=0; Color<ColorCount; Color++)
{ {
MachVideoGetPaletteColor(Color, &Palette[Color].Red, &Palette[Color].Green, &Palette[Color].Blue); MachVideoGetPaletteColor((UCHAR)Color, &Palette[Color].Red, &Palette[Color].Green, &Palette[Color].Blue);
} }
} }
@ -36,7 +36,7 @@ VOID VideoRestorePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount)
for (Color=0; Color<ColorCount; Color++) for (Color=0; Color<ColorCount; Color++)
{ {
MachVideoSetPaletteColor(Color, Palette[Color].Red, Palette[Color].Green, Palette[Color].Blue); MachVideoSetPaletteColor((UCHAR)Color, Palette[Color].Red, Palette[Color].Green, Palette[Color].Blue);
} }
} }
#endif #endif

View file

@ -277,7 +277,7 @@ WinLdrSetProcessorContext(PVOID GdtIdt, IN ULONG Pcr, IN ULONG Tss)
GDTIDT GdtDesc, IdtDesc, OldIdt; GDTIDT GdtDesc, IdtDesc, OldIdt;
PKGDTENTRY pGdt; PKGDTENTRY pGdt;
PKIDTENTRY pIdt; PKIDTENTRY pIdt;
ULONG Ldt = 0; USHORT Ldt = 0;
//ULONG i; //ULONG i;
DPRINTM(DPRINT_WINDOWS, "GDtIdt %p, Pcr %p, Tss 0x%08X\n", DPRINTM(DPRINT_WINDOWS, "GDtIdt %p, Pcr %p, Tss 0x%08X\n",