From 8d25697873869ca86c4ad200bd157fc21846874e Mon Sep 17 00:00:00 2001 From: Rafal Harabien Date: Sun, 3 Jul 2011 23:01:39 +0000 Subject: [PATCH] [FREELDR] - Fix all MSVC warnings svn path=/trunk/; revision=52526 --- reactos/boot/freeldr/freeldr/arcemul/mm.c | 4 +- .../boot/freeldr/freeldr/arch/amd64/arch.S | 5 +- reactos/boot/freeldr/freeldr/arch/i386/arch.S | 5 +- .../boot/freeldr/freeldr/arch/i386/drivemap.c | 4 +- .../boot/freeldr/freeldr/arch/i386/entry.S | 7 +- .../boot/freeldr/freeldr/arch/i386/halstub.c | 2 +- .../boot/freeldr/freeldr/arch/i386/hardware.c | 47 ++++++------- .../boot/freeldr/freeldr/arch/i386/i386disk.c | 8 +-- .../boot/freeldr/freeldr/arch/i386/miscboot.c | 4 +- .../boot/freeldr/freeldr/arch/i386/pcdisk.c | 42 ++++++------ .../boot/freeldr/freeldr/arch/i386/pcvideo.c | 28 ++++---- .../boot/freeldr/freeldr/arch/i386/xboxdisk.c | 12 ++-- .../boot/freeldr/freeldr/arch/i386/xboxhw.c | 22 +++--- .../freeldr/freeldr/arch/i386/xboxvideo.c | 2 +- reactos/boot/freeldr/freeldr/cache/cache.c | 18 ++--- reactos/boot/freeldr/freeldr/disk/disk.c | 4 +- reactos/boot/freeldr/freeldr/disk/partition.c | 6 +- reactos/boot/freeldr/freeldr/disk/scsiport.c | 49 +++++++------- reactos/boot/freeldr/freeldr/freeldr.c | 4 +- reactos/boot/freeldr/freeldr/fs/ext2.c | 31 ++++----- reactos/boot/freeldr/freeldr/fs/fat.c | 10 +-- reactos/boot/freeldr/freeldr/fs/ntfs.c | 67 +++++++++++-------- .../freeldr/include/arch/i386/drivemap.h | 2 +- .../freeldr/include/arch/i386/machxbox.h | 10 +-- .../freeldr/freeldr/include/arch/pc/machpc.h | 10 +-- reactos/boot/freeldr/freeldr/include/cache.h | 8 +-- reactos/boot/freeldr/freeldr/include/disk.h | 18 ++--- .../boot/freeldr/freeldr/include/fs/ext2.h | 2 +- .../boot/freeldr/freeldr/include/machine.h | 16 ++--- reactos/boot/freeldr/freeldr/include/mm.h | 1 + .../boot/freeldr/freeldr/include/reactos.h | 6 +- reactos/boot/freeldr/freeldr/machine.c | 8 +-- .../boot/freeldr/freeldr/reactos/arcname.c | 9 +-- reactos/boot/freeldr/freeldr/video/fade.c | 6 +- reactos/boot/freeldr/freeldr/video/palette.c | 4 +- .../freeldr/freeldr/windows/i386/wlmemory.c | 2 +- 36 files changed, 248 insertions(+), 235 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/arcemul/mm.c b/reactos/boot/freeldr/freeldr/arcemul/mm.c index 0a0472f9f74..3e6dd5599a3 100644 --- a/reactos/boot/freeldr/freeldr/arcemul/mm.c +++ b/reactos/boot/freeldr/freeldr/arcemul/mm.c @@ -77,8 +77,8 @@ ArcGetMemoryDescriptor(const MEMORY_DESCRIPTOR* Current) // Copy this memory descriptor // BiosMemoryDescriptors[j].m.MemoryType = MemoryFree; - BiosMemoryDescriptors[j].m.BasePage = BiosMemoryMap[i].BaseAddress / MM_PAGE_SIZE; - BiosMemoryDescriptors[j].m.PageCount = BiosMemoryMap[i].Length / MM_PAGE_SIZE; + BiosMemoryDescriptors[j].m.BasePage = (ULONG)(BiosMemoryMap[i].BaseAddress / MM_PAGE_SIZE); + BiosMemoryDescriptors[j].m.PageCount = (ULONG)(BiosMemoryMap[i].Length / MM_PAGE_SIZE); BiosMemoryDescriptors[j].Index = j; BiosMemoryDescriptors[j].GeneratedDescriptor = TRUE; j++; diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/arch.S b/reactos/boot/freeldr/freeldr/arch/amd64/arch.S index 4edfb5c9934..4be61c377b8 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/arch.S +++ b/reactos/boot/freeldr/freeldr/arch/amd64/arch.S @@ -28,9 +28,8 @@ RealEntryPoint: /* Setup a real mode stack */ mov sp, stack16 - /* Zero BootDrive and BootPartition */ + /* Zero BootPartition */ xor eax, eax - mov FrldrBootDrive, eax mov FrldrBootPartition, eax /* Store the boot drive */ @@ -408,7 +407,7 @@ gdtptr: .global FrldrBootDrive FrldrBootDrive: - .long 0 + .byte 0 .global FrldrBootPartition FrldrBootPartition: diff --git a/reactos/boot/freeldr/freeldr/arch/i386/arch.S b/reactos/boot/freeldr/freeldr/arch/i386/arch.S index dee3b0fbee1..3251fdd1c52 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/arch.S +++ b/reactos/boot/freeldr/freeldr/arch/i386/arch.S @@ -47,9 +47,8 @@ EXTERN(_RealEntryPoint) .code32 - /* Zero BootDrive and BootPartition */ + /* Zero BootPartition */ xor eax, eax - mov dword ptr [_FrldrBootDrive], eax mov dword ptr [_FrldrBootPartition], eax /* Store the boot drive */ @@ -498,7 +497,7 @@ cmdline: .fill CMDLINE_SIZE, 1, 0 EXTERN(_FrldrBootDrive) - .long 0 + .byte 0 EXTERN(_FrldrBootPartition) .long 0 diff --git a/reactos/boot/freeldr/freeldr/arch/i386/drivemap.c b/reactos/boot/freeldr/freeldr/arch/i386/drivemap.c index 92778275815..174595b63b7 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/drivemap.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/drivemap.c @@ -144,9 +144,9 @@ BOOLEAN DriveMapIsValidDriveString(PCSTR DriveString) } #endif -ULONG DriveMapGetBiosDriveNumber(PCSTR DeviceName) +UCHAR DriveMapGetBiosDriveNumber(PCSTR DeviceName) { - ULONG BiosDriveNumber = 0; + UCHAR BiosDriveNumber = 0; // If they passed in a number string then just // convert it to decimal and return it diff --git a/reactos/boot/freeldr/freeldr/arch/i386/entry.S b/reactos/boot/freeldr/freeldr/arch/i386/entry.S index 30908783c02..c117aa07c0e 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/entry.S +++ b/reactos/boot/freeldr/freeldr/arch/i386/entry.S @@ -58,9 +58,8 @@ ContinueAddress: _FrldrStartup: /* Store BootDrive and BootPartition */ - xor eax, eax - mov al, dl - mov dword ptr ds:[_FrldrBootDrive], eax + mov byte ptr ds:[_FrldrBootDrive], dl + xor eax, eax mov al, dh mov dword ptr ds:[_FrldrBootPartition], eax @@ -294,7 +293,7 @@ i386idtptr: PUBLIC _FrldrBootDrive _FrldrBootDrive: - .long 0 + .byte 0 PUBLIC _FrldrBootPartition _FrldrBootPartition: diff --git a/reactos/boot/freeldr/freeldr/arch/i386/halstub.c b/reactos/boot/freeldr/freeldr/arch/i386/halstub.c index 02aca2b67de..32a4ae6bb3b 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/halstub.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/halstub.c @@ -33,7 +33,7 @@ NTAPI xHalVectorToIDTEntry(IN ULONG Vector) { /* Return the vector */ - return Vector; + return (UCHAR)Vector; } VOID diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hardware.c b/reactos/boot/freeldr/freeldr/arch/i386/hardware.c index f89204fc8a3..47ec99e6639 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hardware.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hardware.c @@ -323,7 +323,7 @@ DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber) static PCM_PARTIAL_RESOURCE_LIST -GetHarddiskConfigurationData(ULONG DriveNumber, ULONG* pSize) +GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize) { PCM_PARTIAL_RESOURCE_LIST PartialResourceList; PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry; @@ -400,7 +400,7 @@ GetHarddiskConfigurationData(ULONG DriveNumber, ULONG* pSize) typedef struct tagDISKCONTEXT { - ULONG DriveNumber; + UCHAR DriveNumber; ULONG SectorSize; ULONGLONG SectorOffset; ULONGLONG SectorCount; @@ -421,7 +421,7 @@ static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information) RtlZeroMemory(Information, sizeof(FILEINFORMATION)); 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; } @@ -429,7 +429,8 @@ static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information) static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) { DISKCONTEXT* Context; - ULONG DriveNumber, DrivePartition, SectorSize; + UCHAR DriveNumber; + ULONG DrivePartition, SectorSize; ULONGLONG SectorOffset = 0; ULONGLONG SectorCount = 0; PARTITION_TABLE_ENTRY PartitionTableEntry; @@ -527,7 +528,7 @@ static const DEVVTBL DiskVtbl = { static VOID GetHarddiskIdentifier(PCHAR Identifier, - ULONG DriveNumber) + UCHAR DriveNumber) { PMASTER_BOOT_RECORD Mbr; ULONG *Buffer; @@ -568,7 +569,7 @@ GetHarddiskIdentifier(PCHAR Identifier, reactos_arc_strings[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); /* Add partitions */ @@ -578,7 +579,7 @@ GetHarddiskIdentifier(PCHAR Identifier, { 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); } i++; @@ -609,7 +610,7 @@ GetHarddiskIdentifier(PCHAR Identifier, DPRINTM(DPRINT_HWDETECT, "Identifier: %s\n", Identifier); } -static ULONG +static UCHAR GetFloppyCount(VOID) { UCHAR Data; @@ -657,7 +658,7 @@ DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey) CHAR Identifier[20]; PCONFIGURATION_COMPONENT_DATA PeripheralKey; ULONG Size; - ULONG FloppyNumber; + UCHAR FloppyNumber; UCHAR FloppyType; ULONG MaxDensity[6] = {0, 360, 1200, 720, 1440, 2880}; PUCHAR Ptr; @@ -674,7 +675,7 @@ DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey) Ptr = GetInt1eTable(); /* Set 'Identifier' value */ - sprintf(Identifier, "FLOPPY%ld", FloppyNumber + 1); + sprintf(Identifier, "FLOPPY%d", FloppyNumber + 1); Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + sizeof(CM_FLOPPY_DEVICE_DATA); @@ -804,9 +805,8 @@ DetectSystem(VOID) PCM_PARTIAL_RESOURCE_LIST PartialResourceList; PCM_INT13_DRIVE_PARAMETER Int13Drives; GEOMETRY Geometry; - ULONG DiskCount; + UCHAR DiskCount, i; ULONG Size; - ULONG i; BOOLEAN Changed; /* Count the number of visible drives */ @@ -869,8 +869,8 @@ DetectSystem(VOID) { Int13Drives[i].DriveSelect = 0x80 + i; Int13Drives[i].MaxCylinders = Geometry.Cylinders - 1; - Int13Drives[i].SectorsPerTrack = Geometry.Sectors; - Int13Drives[i].MaxHeads = Geometry.Heads - 1; + Int13Drives[i].SectorsPerTrack = (USHORT)Geometry.Sectors; + Int13Drives[i].MaxHeads = (USHORT)Geometry.Heads - 1; Int13Drives[i].NumberDrives = DiskCount; DPRINTM(DPRINT_HWDETECT, @@ -899,12 +899,12 @@ DetectSystem(VOID) return SystemKey; } -static ULONG +static UCHAR GetDiskCount(PCONFIGURATION_COMPONENT_DATA BusKey) { PCONFIGURATION_COMPONENT_DATA System; ULONG ConfigurationDataLength; - ULONG DiskCount = 0; + UCHAR DiskCount = 0; // // Get root component @@ -924,8 +924,8 @@ GetDiskCount(PCONFIGURATION_COMPONENT_DATA BusKey) // by n entries of CM_INT13_DRIVE_PARAMETER // if (ConfigurationDataLength > 0) - DiskCount = (ConfigurationDataLength - sizeof(CM_PARTIAL_RESOURCE_LIST)) - / sizeof(CM_INT13_DRIVE_PARAMETER); + DiskCount = (UCHAR)((ConfigurationDataLength - sizeof(CM_PARTIAL_RESOURCE_LIST)) + / sizeof(CM_INT13_DRIVE_PARAMETER)); // // Return number of disks @@ -940,7 +940,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA BusKey) PCONFIGURATION_COMPONENT_DATA DiskKey, ControllerKey; BOOLEAN BootDriveReported = FALSE; ULONG i; - ULONG DiskCount = GetDiskCount(BusKey); + UCHAR DiskCount = GetDiskCount(BusKey); CHAR BootPath[512]; FldrCreateComponentKey(BusKey, @@ -961,13 +961,14 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA BusKey) PCM_PARTIAL_RESOURCE_LIST PartialResourceList; ULONG Size; CHAR Identifier[20]; + UCHAR DriveNumber = 0x80 + (UCHAR)i; - if (FrldrBootDrive == 0x80 + i) + if (FrldrBootDrive == DriveNumber) BootDriveReported = TRUE; /* Get disk values */ - PartialResourceList = GetHarddiskConfigurationData(0x80 + i, &Size); - GetHarddiskIdentifier(Identifier, 0x80 + i); + PartialResourceList = GetHarddiskConfigurationData(DriveNumber, &Size); + GetHarddiskIdentifier(Identifier, DriveNumber); /* Create disk key */ FldrCreateComponentKey(ControllerKey, @@ -1020,7 +1021,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA BusKey) static VOID InitializeSerialPort(PUCHAR Port, - ULONG LineControl) + UCHAR LineControl) { WRITE_PORT_UCHAR(Port + 3, 0x80); /* set DLAB on */ WRITE_PORT_UCHAR(Port, 0x60); /* speed LO byte */ diff --git a/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c b/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c index bcee4538a07..5656ffa88d5 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c @@ -26,7 +26,7 @@ // FUNCTIONS ///////////////////////////////////////////////////////////////////////////////////////////// -BOOLEAN DiskResetController(ULONG DriveNumber) +BOOLEAN DiskResetController(UCHAR DriveNumber) { REGS RegsIn; REGS RegsOut; @@ -49,9 +49,9 @@ BOOLEAN DiskResetController(ULONG DriveNumber) return INT386_SUCCESS(RegsOut); } -BOOLEAN DiskInt13ExtensionsSupported(ULONG DriveNumber) +BOOLEAN DiskInt13ExtensionsSupported(UCHAR DriveNumber) { - static ULONG LastDriveNumber = 0xffffffff; + static UCHAR LastDriveNumber = 0xff; static BOOLEAN LastSupported; REGS RegsIn; REGS RegsOut; @@ -141,7 +141,7 @@ VOID DiskStopFloppyMotor(VOID) 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 RegsOut; diff --git a/reactos/boot/freeldr/freeldr/arch/i386/miscboot.c b/reactos/boot/freeldr/freeldr/arch/i386/miscboot.c index 1f30141ce7f..691c297f366 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/miscboot.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/miscboot.c @@ -85,7 +85,7 @@ VOID LoadAndBootPartition(PCSTR OperatingSystemName) CHAR SettingValue[80]; ULONG SectionId; PARTITION_TABLE_ENTRY PartitionTableEntry; - ULONG DriveNumber; + UCHAR DriveNumber; ULONG PartitionNumber; // Find all the message box settings and run them @@ -156,7 +156,7 @@ VOID LoadAndBootDrive(PCSTR OperatingSystemName) CHAR SettingName[80]; CHAR SettingValue[80]; ULONG SectionId; - ULONG DriveNumber; + UCHAR DriveNumber; // Find all the message box settings and run them UiShowMessageBoxesInSection(OperatingSystemName); diff --git a/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c b/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c index 4bde50c5839..c9d070bc5e1 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c @@ -42,7 +42,7 @@ typedef struct // FUNCTIONS ///////////////////////////////////////////////////////////////////////////////////////////// -static BOOLEAN PcDiskResetController(ULONG DriveNumber) +static BOOLEAN PcDiskResetController(UCHAR DriveNumber) { REGS RegsIn; REGS RegsOut; @@ -65,7 +65,7 @@ static BOOLEAN PcDiskResetController(ULONG DriveNumber) 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 RegsOut; @@ -73,6 +73,7 @@ static BOOLEAN PcDiskReadLogicalSectorsLBA(ULONG DriveNumber, ULONGLONG SectorNu 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); + ASSERT(((ULONG_PTR)Buffer) <= 0xFFFFF); // BIOS int 0x13, function 42h - IBM/MS INT 13 Extensions - EXTENDED READ RegsIn.b.ah = 0x42; // Subfunction 42h @@ -84,9 +85,11 @@ static BOOLEAN PcDiskReadLogicalSectorsLBA(ULONG DriveNumber, ULONGLONG SectorNu RtlZeroMemory(Packet, sizeof(I386_DISK_ADDRESS_PACKET)); Packet->PacketSize = sizeof(I386_DISK_ADDRESS_PACKET); Packet->Reserved = 0; - Packet->LBABlockCount = SectorCount; + Packet->LBABlockCount = (USHORT)SectorCount; + ASSERT(Packet->LBABlockCount == SectorCount); + DbgPrint("here\n"); Packet->TransferBufferOffset = ((ULONG_PTR)Buffer) & 0x0F; - Packet->TransferBufferSegment = ((ULONG_PTR)Buffer) >> 4; + Packet->TransferBufferSegment = (USHORT)(((ULONG_PTR)Buffer) >> 4); Packet->LBAStartBlock = SectorNumber; // 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 for (RetryCount=0; RetryCount<3; RetryCount++) - { + {DPRINTM(DPRINT_DISK, "retry\n"); Int386(0x13, &RegsIn, &RegsOut); // If it worked return TRUE if (INT386_SUCCESS(RegsOut)) - { + {DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectorsLBA() success\n"); return TRUE; } // If it was a corrected ECC error then the data is still good else if (RegsOut.b.ah == 0x11) - { + {DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectorsLBA() success\n"); return TRUE; } // If it failed the do the next retry @@ -128,10 +131,10 @@ static BOOLEAN PcDiskReadLogicalSectorsLBA(ULONG DriveNumber, ULONGLONG SectorNu 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; - ULONG PhysicalHead; + UCHAR PhysicalSector; + UCHAR PhysicalHead; ULONG PhysicalTrack; GEOMETRY DriveGeometry; ULONG NumberOfSectorsToRead; @@ -156,10 +159,11 @@ static BOOLEAN PcDiskReadLogicalSectorsCHS(ULONG DriveNumber, ULONGLONG SectorNu // // Calculate the physical disk offsets + // Note: DriveGeometry.Sectors < 64 // - PhysicalSector = 1 + (SectorNumber % DriveGeometry.Sectors); - PhysicalHead = (SectorNumber / DriveGeometry.Sectors) % DriveGeometry.Heads; - PhysicalTrack = (SectorNumber / DriveGeometry.Sectors) / DriveGeometry.Heads; + PhysicalSector = 1 + (UCHAR)(SectorNumber % DriveGeometry.Sectors); + PhysicalHead = (UCHAR)((SectorNumber / DriveGeometry.Sectors) % DriveGeometry.Heads); + PhysicalTrack = (ULONG)((SectorNumber / DriveGeometry.Sectors) / DriveGeometry.Heads); // // 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 // (only valid if CF set for some BIOSes) RegsIn.b.ah = 0x02; - RegsIn.b.al = NumberOfSectorsToRead; + RegsIn.b.al = (UCHAR)NumberOfSectorsToRead; 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.dl = DriveNumber; - RegsIn.w.es = ((ULONG_PTR)Buffer) >> 4; + RegsIn.w.es = (USHORT)(((ULONG_PTR)Buffer) >> 4); RegsIn.w.bx = ((ULONG_PTR)Buffer) & 0x0F; // @@ -264,7 +268,7 @@ static BOOLEAN PcDiskReadLogicalSectorsCHS(ULONG DriveNumber, ULONGLONG SectorNu 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); @@ -294,7 +298,7 @@ BOOLEAN PcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULON } BOOLEAN -PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry) +PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry) { REGS RegsIn; REGS RegsOut; @@ -345,7 +349,7 @@ PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry) } ULONG -PcDiskGetCacheableBlockCount(ULONG DriveNumber) +PcDiskGetCacheableBlockCount(UCHAR DriveNumber) { GEOMETRY Geometry; diff --git a/reactos/boot/freeldr/freeldr/arch/i386/pcvideo.c b/reactos/boot/freeldr/freeldr/arch/i386/pcvideo.c index 8464b10328c..c15b67e9a40 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/pcvideo.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/pcvideo.c @@ -108,7 +108,7 @@ typedef struct } SVGA_MODE_INFORMATION, *PSVGA_MODE_INFORMATION; #include -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 ScreenHeight = 25; /* Screen Height in characters */ 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; @@ -298,7 +298,7 @@ PcVideoDisableCursorEmulation(VOID) } static VOID -PcVideoDefineCursor(ULONG StartScanLine, ULONG EndScanLine) +PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine) { REGS Regs; @@ -334,7 +334,7 @@ PcVideoDefineCursor(ULONG StartScanLine, ULONG EndScanLine) } static VOID -PcVideoSetVerticalResolution(ULONG ScanLines) +PcVideoSetVerticalResolution(UCHAR VerticalResolutionMode) { REGS Regs; @@ -356,7 +356,7 @@ PcVideoSetVerticalResolution(ULONG ScanLines) */ Regs.b.ah = 0x12; Regs.b.bl = 0x30; - Regs.b.al = ScanLines; + Regs.b.al = VerticalResolutionMode; Int386(0x10, &Regs, &Regs); } @@ -698,7 +698,7 @@ PcVideoSetMode80x60(VOID) } static BOOLEAN -PcVideoSetMode(ULONG NewMode) +PcVideoSetMode(USHORT NewMode) { CurrentMemoryBank = 0; @@ -735,7 +735,7 @@ PcVideoSetMode(ULONG NewMode) if (0x12 == NewMode) { /* 640x480x16 */ - PcVideoSetBiosMode(NewMode); + PcVideoSetBiosMode((UCHAR)NewMode); WRITE_PORT_USHORT((USHORT*)0x03CE, 0x0F01); /* For some reason this is necessary? */ ScreenWidth = 640; ScreenHeight = 480; @@ -748,7 +748,7 @@ PcVideoSetMode(ULONG NewMode) else if (0x13 == NewMode) { /* 320x200x256 */ - PcVideoSetBiosMode(NewMode); + PcVideoSetBiosMode((UCHAR)NewMode); ScreenWidth = 320; ScreenHeight = 200; BytesPerScanLine = 320; @@ -871,7 +871,7 @@ PcVideoSetMemoryBank(USHORT BankNumber) VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayModeName, BOOLEAN Init) { - ULONG VideoMode = VIDEOMODE_NORMAL_TEXT; + USHORT VideoMode = VIDEOMODE_NORMAL_TEXT; if (NULL == DisplayModeName || '\0' == *DisplayModeName) { @@ -923,7 +923,7 @@ PcVideoSetDisplayMode(char *DisplayModeName, BOOLEAN Init) PcVideoSetBlinkBit(! Init); - +DbgBreakPoint(); return DisplayMode; } @@ -958,7 +958,7 @@ PcVideoGetBufferSize(VOID) } VOID -PcVideoSetTextCursorPosition(ULONG X, ULONG Y) +PcVideoSetTextCursorPosition(UCHAR X, UCHAR Y) { REGS Regs; @@ -998,9 +998,9 @@ PcVideoHideShowTextCursor(BOOLEAN Show) VOID PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer) { - ULONG BanksToCopy; + USHORT BanksToCopy; ULONG BytesInLastBank; - ULONG CurrentBank; + USHORT CurrentBank; ULONG BankSize; /* PcVideoWaitForVerticalRetrace(); */ @@ -1014,7 +1014,7 @@ PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer) else if (VideoGraphicsMode == DisplayMode && VesaVideoMode) { BankSize = VesaVideoModeInformation.WindowGranularity << 10; - BanksToCopy = (VesaVideoModeInformation.HeightInPixels * VesaVideoModeInformation.BytesPerScanLine) / BankSize; + BanksToCopy = (USHORT)((VesaVideoModeInformation.HeightInPixels * VesaVideoModeInformation.BytesPerScanLine) / BankSize); BytesInLastBank = (VesaVideoModeInformation.HeightInPixels * VesaVideoModeInformation.BytesPerScanLine) % BankSize; /* Copy all the banks but the last one because diff --git a/reactos/boot/freeldr/freeldr/arch/i386/xboxdisk.c b/reactos/boot/freeldr/freeldr/arch/i386/xboxdisk.c index 57b57e7873f..3b33e0306d7 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/xboxdisk.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/xboxdisk.c @@ -152,7 +152,7 @@ static struct * Data block read and write commands */ #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) \ (WRITE_PORT_BUFFER_USHORT((PUSHORT)((Address) + IDE_REG_DATA_PORT), (PUSHORT)(Buffer), (Count) / 2)) @@ -435,7 +435,7 @@ XboxDiskPolledRead(ULONG CommandPort, } BOOLEAN -XboxDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) +XboxDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) { ULONG StartSector; UCHAR Count; @@ -456,7 +456,7 @@ XboxDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG Sect StartSector = (ULONG) SectorNumber; while (0 < SectorCount) { - Count = (SectorCount <= 255 ? SectorCount : 255); + Count = (SectorCount <= 255 ? (UCHAR)SectorCount : 255); if (! XboxDiskPolledRead(XBOX_IDE_COMMAND_PORT, XBOX_IDE_CONTROL_PORT, 0, Count, @@ -478,7 +478,7 @@ XboxDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG Sect } 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]; @@ -503,7 +503,7 @@ XboxDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_T } BOOLEAN -XboxDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry) +XboxDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry) { IDE_DRIVE_IDENTIFY DrvParms; ULONG i; @@ -563,7 +563,7 @@ XboxDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry) } ULONG -XboxDiskGetCacheableBlockCount(ULONG DriveNumber) +XboxDiskGetCacheableBlockCount(UCHAR DriveNumber) { /* 64 seems a nice number, it is used by the machpc code for LBA devices */ return 64; diff --git a/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c b/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c index ff325b3dd49..1984955b008 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c @@ -30,7 +30,7 @@ extern ARC_DISK_SIGNATURE reactos_arc_disk_info[]; extern char reactos_arc_strings[32][256]; static PCM_PARTIAL_RESOURCE_LIST -GetHarddiskConfigurationData(ULONG DriveNumber, ULONG* pSize) +GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize) { PCM_PARTIAL_RESOURCE_LIST PartialResourceList; PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry; @@ -101,7 +101,7 @@ GetHarddiskConfigurationData(ULONG DriveNumber, ULONG* pSize) typedef struct tagDISKCONTEXT { - ULONG DriveNumber; + UCHAR DriveNumber; ULONG SectorSize; ULONGLONG SectorOffset; ULONGLONG SectorCount; @@ -122,7 +122,7 @@ static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information) RtlZeroMemory(Information, sizeof(FILEINFORMATION)); 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; } @@ -130,7 +130,8 @@ static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information) static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) { DISKCONTEXT* Context; - ULONG DriveNumber, DrivePartition, SectorSize; + ULONG DrivePartition, SectorSize; + UCHAR DriveNumber; ULONGLONG SectorOffset = 0; ULONGLONG SectorCount = 0; PARTITION_TABLE_ENTRY PartitionTableEntry; @@ -233,7 +234,7 @@ static const DEVVTBL DiskVtbl = { static VOID GetHarddiskIdentifier(PCHAR Identifier, - ULONG DriveNumber) + UCHAR DriveNumber) { PMASTER_BOOT_RECORD Mbr; ULONG *Buffer; @@ -274,7 +275,7 @@ GetHarddiskIdentifier(PCHAR Identifier, reactos_arc_strings[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); /* Add partitions */ @@ -284,7 +285,7 @@ GetHarddiskIdentifier(PCHAR Identifier, { 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); } i++; @@ -323,9 +324,8 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, PCM_INT13_DRIVE_PARAMETER Int13Drives; GEOMETRY Geometry; PCONFIGURATION_COMPONENT_DATA DiskKey, ControllerKey; - ULONG DiskCount; + UCHAR DiskCount, i; ULONG Size; - ULONG i; BOOLEAN Changed; /* Count the number of visible drives */ @@ -390,8 +390,8 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, { Int13Drives[i].DriveSelect = 0x80 + i; Int13Drives[i].MaxCylinders = Geometry.Cylinders - 1; - Int13Drives[i].SectorsPerTrack = Geometry.Sectors; - Int13Drives[i].MaxHeads = Geometry.Heads - 1; + Int13Drives[i].SectorsPerTrack = (USHORT)Geometry.Sectors; + Int13Drives[i].MaxHeads = (USHORT)Geometry.Heads - 1; Int13Drives[i].NumberDrives = DiskCount; DPRINTM(DPRINT_HWDETECT, diff --git a/reactos/boot/freeldr/freeldr/arch/i386/xboxvideo.c b/reactos/boot/freeldr/freeldr/arch/i386/xboxvideo.c index d164b540b01..d1d3f86ebf6 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/xboxvideo.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/xboxvideo.c @@ -182,7 +182,7 @@ XboxVideoGetBufferSize(VOID) } VOID -XboxVideoSetTextCursorPosition(ULONG X, ULONG Y) +XboxVideoSetTextCursorPosition(UCHAR X, UCHAR Y) { /* We don't have a cursor yet */ } diff --git a/reactos/boot/freeldr/freeldr/cache/cache.c b/reactos/boot/freeldr/freeldr/cache/cache.c index 884ac698cf4..4b21350bbf4 100644 --- a/reactos/boot/freeldr/freeldr/cache/cache.c +++ b/reactos/boot/freeldr/freeldr/cache/cache.c @@ -32,7 +32,7 @@ ULONG CacheBlockCount = 0; ULONG CacheSizeLimit = 0; ULONG CacheSizeCurrent = 0; -BOOLEAN CacheInitializeDrive(ULONG DriveNumber) +BOOLEAN CacheInitializeDrive(UCHAR DriveNumber) { PCACHE_BLOCK NextCacheBlock; GEOMETRY DriveGeometry; @@ -111,7 +111,7 @@ VOID CacheInvalidateCacheData(VOID) 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; ULONG StartBlock; @@ -122,7 +122,7 @@ BOOLEAN CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCo ULONG BlockCount; 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 (CacheManagerInitialized == FALSE) @@ -133,11 +133,11 @@ BOOLEAN CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCo // // Caculate which blocks we must cache // - StartBlock = StartSector / CacheManagerDrive.BlockSize; - SectorOffsetInStartBlock = StartSector % CacheManagerDrive.BlockSize; - CopyLengthInStartBlock = (SectorCount > (CacheManagerDrive.BlockSize - SectorOffsetInStartBlock)) ? (CacheManagerDrive.BlockSize - SectorOffsetInStartBlock) : SectorCount; - EndBlock = (StartSector + (SectorCount - 1)) / CacheManagerDrive.BlockSize; - SectorOffsetInEndBlock = 1 + (StartSector + (SectorCount - 1)) % CacheManagerDrive.BlockSize; + StartBlock = (ULONG)(StartSector / CacheManagerDrive.BlockSize); + SectorOffsetInStartBlock = (ULONG)(StartSector % CacheManagerDrive.BlockSize); + CopyLengthInStartBlock = (ULONG)((SectorCount > (CacheManagerDrive.BlockSize - SectorOffsetInStartBlock)) ? (CacheManagerDrive.BlockSize - SectorOffsetInStartBlock) : SectorCount); + EndBlock = (ULONG)((StartSector + (SectorCount - 1)) / CacheManagerDrive.BlockSize); + SectorOffsetInEndBlock = (ULONG)(1 + (StartSector + (SectorCount - 1)) % CacheManagerDrive.BlockSize); 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); @@ -244,7 +244,7 @@ BOOLEAN CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCo } #if 0 -BOOLEAN CacheForceDiskSectorsIntoCache(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount) +BOOLEAN CacheForceDiskSectorsIntoCache(UCHAR DiskNumber, ULONGLONG StartSector, ULONG SectorCount) { PCACHE_BLOCK CacheBlock; ULONG StartBlock; diff --git a/reactos/boot/freeldr/freeldr/disk/disk.c b/reactos/boot/freeldr/freeldr/disk/disk.c index e932247bd40..4d1ea90dfcd 100644 --- a/reactos/boot/freeldr/freeldr/disk/disk.c +++ b/reactos/boot/freeldr/freeldr/disk/disk.c @@ -87,7 +87,7 @@ PCSTR DiskGetErrorCodeString(ULONG ErrorCode) // This function is in arch/i386/i386disk.c //BOOLEAN DiskReadLogicalSectors(ULONG DriveNumber, U64 SectorNumber, ULONG SectorCount, PVOID Buffer) -BOOLEAN DiskIsDriveRemovable(ULONG DriveNumber) +BOOLEAN DiskIsDriveRemovable(UCHAR DriveNumber) { // Hard disks use drive numbers >= 0x80 // So if the drive number indicates a hard disk @@ -188,6 +188,6 @@ DiskGetBootPath(char *BootPath, unsigned Size) //VOID DiskStopFloppyMotor(VOID) // This function is in arch/i386/i386disk.c -//ULONG DiskGetCacheableBlockCount(ULONG DriveNumber) +//ULONG DiskGetCacheableBlockCount(UCHAR DriveNumber) #endif diff --git a/reactos/boot/freeldr/freeldr/disk/partition.c b/reactos/boot/freeldr/freeldr/disk/partition.c index b93b2e17b2a..1941da3361a 100644 --- a/reactos/boot/freeldr/freeldr/disk/partition.c +++ b/reactos/boot/freeldr/freeldr/disk/partition.c @@ -21,7 +21,7 @@ #include #include -BOOLEAN DiskGetActivePartitionEntry(ULONG DriveNumber, +BOOLEAN DiskGetActivePartitionEntry(UCHAR DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry, ULONG *ActivePartition) { @@ -77,7 +77,7 @@ BOOLEAN DiskGetActivePartitionEntry(ULONG DriveNumber, 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; PARTITION_TABLE_ENTRY ExtendedPartitionTableEntry; @@ -195,7 +195,7 @@ BOOLEAN DiskGetFirstExtendedPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, return FALSE; } -BOOLEAN DiskReadBootRecord(ULONG DriveNumber, ULONGLONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord) +BOOLEAN DiskReadBootRecord(UCHAR DriveNumber, ULONGLONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord) { ULONG Index; diff --git a/reactos/boot/freeldr/freeldr/disk/scsiport.c b/reactos/boot/freeldr/freeldr/disk/scsiport.c index f23a41c2281..0db46a2ad29 100644 --- a/reactos/boot/freeldr/freeldr/disk/scsiport.c +++ b/reactos/boot/freeldr/freeldr/disk/scsiport.c @@ -137,9 +137,9 @@ typedef struct tagDISKCONTEXT { /* Device ID */ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension; - ULONG PathId; - ULONG TargetId; - ULONG Lun; + UCHAR PathId; + UCHAR TargetId; + UCHAR Lun; /* Device characteristics */ ULONG SectorSize; @@ -162,7 +162,7 @@ static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information) RtlZeroMemory(Information, sizeof(FILEINFORMATION)); Information->EndingAddress.QuadPart = Context->SectorCount * Context->SectorSize; - Information->CurrentAddress.LowPart = Context->SectorNumber * Context->SectorSize; + Information->CurrentAddress.QuadPart = Context->SectorNumber * Context->SectorSize; return ESUCCESS; } @@ -195,9 +195,9 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) RtlZeroMemory(Srb, sizeof(SCSI_REQUEST_BLOCK)); Srb->Length = sizeof(SCSI_REQUEST_BLOCK); Srb->Function = SRB_FUNCTION_EXECUTE_SCSI; - Srb->PathId = PathId; - Srb->TargetId = TargetId; - Srb->Lun = Lun; + Srb->PathId = (UCHAR)PathId; + Srb->TargetId = (UCHAR)TargetId; + Srb->Lun = (UCHAR)Lun; Srb->CdbLength = 10; Srb->SrbFlags = SRB_FLAGS_DATA_IN; Srb->DataTransferLength = sizeof(READ_CAPACITY_DATA); @@ -225,9 +225,9 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) if (!Context) return ENOMEM; Context->DeviceExtension = DeviceExtension; - Context->PathId = PathId; - Context->TargetId = TargetId; - Context->Lun = Lun; + Context->PathId = (UCHAR)PathId; + Context->TargetId = (UCHAR)TargetId; + Context->Lun = (UCHAR)Lun; Context->SectorSize = SectorSize; Context->SectorOffset = SectorOffset; Context->SectorCount = SectorCount; @@ -258,7 +258,8 @@ static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count) return EINVAL; /* Read full sectors */ - Lba = Context->SectorNumber; + ASSERT(Context->SectorNumber < 0xFFFFFFFF); + Lba = (ULONG)Context->SectorNumber; if (FullSectors > 0) { Srb = ExAllocatePool(PagedPool, sizeof(SCSI_REQUEST_BLOCK)); @@ -810,14 +811,14 @@ VOID SpiScanAdapter( IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, IN ULONG ScsiBus, - IN ULONG PathId) + IN UCHAR PathId) { CHAR ArcName[64]; PSCSI_REQUEST_BLOCK Srb; PCDB Cdb; INQUIRYDATA InquiryBuffer; - ULONG TargetId; - ULONG Lun; + UCHAR TargetId; + UCHAR Lun; if (!DeviceExtension->HwResetBus(DeviceExtension->MiniPortDeviceExtension, PathId)) { @@ -852,7 +853,7 @@ SpiScanAdapter( Cdb = (PCDB)Srb->Cdb; Cdb->CDB6INQUIRY.OperationCode = SCSIOP_INQUIRY; Cdb->CDB6INQUIRY.LogicalUnitNumber = Srb->Lun; - Cdb->CDB6INQUIRY.AllocationLength = Srb->DataTransferLength; + Cdb->CDB6INQUIRY.AllocationLength = (UCHAR)Srb->DataTransferLength; if (!SpiSendSynchronousSrb(DeviceExtension, Srb)) { /* Don't check next LUNs */ @@ -862,13 +863,13 @@ SpiScanAdapter( /* Device exists, create its ARC name */ if (InquiryBuffer.RemovableMedia) { - sprintf(ArcName, "scsi(%ld)cdrom(%ld)fdisk(%ld)", + sprintf(ArcName, "scsi(%ld)cdrom(%d)fdisk(%d)", ScsiBus, TargetId, Lun); FsRegisterDevice(ArcName, &DiskVtbl); } else { - sprintf(ArcName, "scsi(%ld)disk(%ld)rdisk(%ld)", + sprintf(ArcName, "scsi(%ld)disk(%d)rdisk(%d)", ScsiBus, TargetId, Lun); /* Now, check if it has partitions */ SpiScanDevice(DeviceExtension, ArcName, PathId, TargetId, Lun); @@ -1074,6 +1075,7 @@ ScsiPortInitialize( BOOLEAN Again; BOOLEAN FirstConfigCall = TRUE; PCI_SLOT_NUMBER SlotNumber; + UCHAR ScsiBus; NTSTATUS Status; if (HwInitializationData->HwInitializationDataSize != sizeof(HW_INITIALIZATION_DATA)) @@ -1196,13 +1198,10 @@ ScsiPortInitialize( } /* Scan bus */ + for (ScsiBus = 0; ScsiBus < PortConfig.NumberOfBuses; ScsiBus++) { - ULONG ScsiBus; - for (ScsiBus = 0; ScsiBus < PortConfig.NumberOfBuses; ScsiBus++) - { - SpiScanAdapter(DeviceExtension, PortConfig.SystemIoBusNumber, ScsiBus); - PortConfig.SystemIoBusNumber++; - } + SpiScanAdapter(DeviceExtension, PortConfig.SystemIoBusNumber, ScsiBus); + PortConfig.SystemIoBusNumber++; } FirstConfigCall = FALSE; @@ -1633,7 +1632,7 @@ LoadBootDeviceDriver(VOID) CHAR NtBootDdPath[MAX_PATH]; PVOID ImageBase; ULONG (NTAPI *EntryPoint)(IN PVOID DriverObject, IN PVOID RegistryPath); - ULONG i; + USHORT i; BOOLEAN Status; /* Some initialization of our temporary loader block */ @@ -1710,7 +1709,7 @@ LoadBootDeviceDriver(VOID) NtHeaders = RtlImageNtHeader(VaToPa(BootDdDTE->DllBase)); if (!NtHeaders) return EIO; - Status = LdrRelocateImageWithBias( + Status = (BOOLEAN)LdrRelocateImageWithBias( VaToPa(BootDdDTE->DllBase), NtHeaders->OptionalHeader.ImageBase - (ULONG_PTR)BootDdDTE->DllBase, "FreeLdr", diff --git a/reactos/boot/freeldr/freeldr/freeldr.c b/reactos/boot/freeldr/freeldr/freeldr.c index 57899168b2a..9ad6bd1c34a 100644 --- a/reactos/boot/freeldr/freeldr/freeldr.c +++ b/reactos/boot/freeldr/freeldr/freeldr.c @@ -57,12 +57,12 @@ VOID BootMain(LPSTR CmdLine) // We need to emulate these, because the original ones don't work in freeldr int __cdecl wctomb(char *mbchar, wchar_t wchar) { - *mbchar = wchar; + *mbchar = (char)wchar; return 1; } int __cdecl mbtowc (wchar_t *wchar, const char *mbchar, size_t count) { - *wchar = *mbchar; + *wchar = (wchar_t)*mbchar; return 1; } diff --git a/reactos/boot/freeldr/freeldr/fs/ext2.c b/reactos/boot/freeldr/freeldr/fs/ext2.c index 46f12fbe6d4..11434494f11 100644 --- a/reactos/boot/freeldr/freeldr/fs/ext2.c +++ b/reactos/boot/freeldr/freeldr/fs/ext2.c @@ -25,7 +25,7 @@ BOOLEAN Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG PEXT2_FILE_INFO Ext2OpenFile(PCSTR FileName); BOOLEAN Ext2LookupFile(PCSTR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer); 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 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 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; *StartSector = 0; @@ -425,7 +425,7 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO DPRINTM(DPRINT_FILESYSTEM, "Reading fast symbolic link data\n"); // 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) { @@ -472,10 +472,10 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO // // Do the math for our first read // - BlockNumberIndex = (Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes); + BlockNumberIndex = (ULONG)(Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes); BlockNumber = Ext2FileInfo->FileBlockList[BlockNumberIndex]; 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 @@ -501,11 +501,11 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO // // Determine how many full clusters we need to read // - NumberOfBlocks = (BytesToRead / Ext2BlockSizeInBytes); + NumberOfBlocks = (ULONG)(BytesToRead / Ext2BlockSizeInBytes); while (NumberOfBlocks > 0) { - BlockNumberIndex = (Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes); + BlockNumberIndex = (ULONG)(Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes); BlockNumber = Ext2FileInfo->FileBlockList[BlockNumberIndex]; // @@ -531,13 +531,13 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO // if (BytesToRead > 0) { - BlockNumberIndex = (Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes); + BlockNumberIndex = (ULONG)(Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes); BlockNumber = Ext2FileInfo->FileBlockList[BlockNumberIndex]; // // 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; } @@ -553,7 +553,7 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO return TRUE; } -BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONGLONG SectorCount, PVOID Buffer) +BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) { //GEOMETRY DiskGeometry; //BOOLEAN ReturnValue; @@ -796,7 +796,8 @@ BOOLEAN Ext2ReadDirectory(ULONG Inode, PVOID* DirectoryBuffer, PEXT2_INODE Inode // // 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 @@ -1009,7 +1010,7 @@ ULONG* Ext2ReadBlockPointerList(PEXT2_INODE Inode) //BlockCount = Inode->i_blocks; FileSize = Ext2GetInodeFileSize(Inode); FileSize = ROUND_UP(FileSize, Ext2BlockSizeInBytes); - BlockCount = (FileSize / Ext2BlockSizeInBytes); + BlockCount = (ULONG)(FileSize / Ext2BlockSizeInBytes); // Allocate the memory for the block list BlockList = MmHeapAlloc(BlockCount * sizeof(ULONG)); @@ -1181,8 +1182,8 @@ LONG Ext2GetFileInformation(ULONG FileId, FILEINFORMATION* Information) PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); RtlZeroMemory(Information, sizeof(FILEINFORMATION)); - Information->EndingAddress.LowPart = FileHandle->FileSize; - Information->CurrentAddress.LowPart = FileHandle->FilePointer; + Information->EndingAddress.QuadPart = FileHandle->FileSize; + Information->CurrentAddress.QuadPart = FileHandle->FilePointer; DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFileInformation() FileSize = %d\n", Information->EndingAddress.LowPart); @@ -1297,7 +1298,7 @@ const DEVVTBL* Ext2Mount(ULONG DeviceId) // // Compatibility hack as long as FS is not using underlying device DeviceId // - ULONG DriveNumber; + UCHAR DriveNumber; ULONGLONG StartSector; ULONGLONG SectorCount; int Type; diff --git a/reactos/boot/freeldr/freeldr/fs/fat.c b/reactos/boot/freeldr/freeldr/fs/fat.c index a97cdcb7318..53e3beb8568 100644 --- a/reactos/boot/freeldr/freeldr/fs/fat.c +++ b/reactos/boot/freeldr/freeldr/fs/fat.c @@ -23,7 +23,7 @@ #define NDEBUG #include -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); 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); @@ -263,8 +263,8 @@ BOOLEAN FatOpenVolume(PFAT_VOLUME_INFO Volume, PFAT_BOOTSECTOR BootSector, ULONG Volume->FatSectorStart = (4096 / Volume->BytesPerSector); Volume->ActiveFatSectorStart = Volume->FatSectorStart; Volume->NumberOfFats = 1; - FatSize = PartitionSectorCount / Volume->SectorsPerCluster * - (Volume->FatType == FATX16 ? 2 : 4); + FatSize = (ULONG)(PartitionSectorCount / Volume->SectorsPerCluster * + (Volume->FatType == FATX16 ? 2 : 4)); Volume->SectorsPerFat = (((FatSize + 4095) / 4096) * 4096) / Volume->BytesPerSector; Volume->RootDirSectorStart = Volume->FatSectorStart + Volume->NumberOfFats * Volume->SectorsPerFat; @@ -313,7 +313,7 @@ BOOLEAN FatOpenVolume(PFAT_VOLUME_INFO Volume, PFAT_BOOTSECTOR BootSector, ULONG return TRUE; } -ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCount) +ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONGLONG PartitionSectorCount) { ULONG RootDirSectors; ULONG DataSectorCount; @@ -325,7 +325,7 @@ ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCo if (0 == strncmp(FatXBootSector->FileSystemType, "FATX", 4)) { - CountOfClusters = PartitionSectorCount / FatXBootSector->SectorsPerCluster; + CountOfClusters = (ULONG)(PartitionSectorCount / FatXBootSector->SectorsPerCluster); if (CountOfClusters < 65525) { /* Volume is FATX16 */ diff --git a/reactos/boot/freeldr/freeldr/fs/ntfs.c b/reactos/boot/freeldr/freeldr/fs/ntfs.c index aff3bfaa339..55d95506275 100644 --- a/reactos/boot/freeldr/freeldr/fs/ntfs.c +++ b/reactos/boot/freeldr/freeldr/fs/ntfs.c @@ -134,7 +134,7 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON { LARGE_INTEGER Position; ULONG Count; - USHORT ReadLength; + ULONG ReadLength; LONG ret; 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) { - Position.HighPart = 0; - Position.LowPart = Offset & ~(Volume->BootSector.BytesPerSector - 1); + Position.QuadPart = Offset & ~(Volume->BootSector.BytesPerSector - 1); ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute); if (ret != ESUCCESS) return FALSE; ret = ArcRead(Volume->DeviceId, Volume->TemporarySector, Volume->BootSector.BytesPerSector, &Count); if (ret != ESUCCESS || Count != Volume->BootSector.BytesPerSector) 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 @@ -174,8 +173,7 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON // if (Length >= Volume->BootSector.BytesPerSector) { - Position.HighPart = 0; - Position.LowPart = Offset; + Position.QuadPart = Offset; ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute); if (ret != ESUCCESS) return FALSE; @@ -197,12 +195,11 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON // if (Length) { - Position.HighPart = 0; - Position.LowPart = Offset; + Position.QuadPart = Offset; ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute); if (ret != ESUCCESS) return FALSE; - ret = ArcRead(Volume->DeviceId, Buffer, Length, &Count); + ret = ArcRead(Volume->DeviceId, Buffer, (ULONG)Length, &Count); if (ret != ESUCCESS || Count != Length) return FALSE; } @@ -210,7 +207,7 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON 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; PUCHAR DataRun; @@ -218,15 +215,15 @@ static ULONGLONG NtfsReadAttribute(PNTFS_VOLUME_INFO Volume, PNTFS_ATTR_CONTEXT ULONGLONG DataRunLength; LONGLONG DataRunStartLCN; ULONGLONG CurrentOffset; - ULONGLONG ReadLength; - ULONGLONG AlreadyRead; + ULONG ReadLength; + ULONG AlreadyRead; if (!Context->Record.IsNonResident) { if (Offset > Context->Record.Resident.ValueLength) return 0; 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); 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 */ - ReadLength = min(DataRunLength * Volume->ClusterSize - (Offset - CurrentOffset), Length); + ReadLength = (ULONG)min(DataRunLength * Volume->ClusterSize - (Offset - CurrentOffset), Length); if (DataRunStartLCN == -1) RtlZeroMemory(Buffer, ReadLength); 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) { - ReadLength = min(DataRunLength * Volume->ClusterSize, Length); + ReadLength = (ULONG)min(DataRunLength * Volume->ClusterSize, Length); if (DataRunStartLCN == -1) RtlZeroMemory(Buffer, ReadLength); 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); 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; 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, Type, Name, NameLength); @@ -463,7 +469,7 @@ static BOOLEAN NtfsFixupRecord(PNTFS_VOLUME_INFO Volume, PNTFS_RECORD Record) 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; @@ -484,10 +490,10 @@ VOID NtfsPrintFile(PNTFS_INDEX_ENTRY IndexEntry) UCHAR i; FileName = IndexEntry->FileName.FileName; - FileNameLength = IndexEntry->FileName.FileNameLength; + FileNameLength = min(IndexEntry->FileName.FileNameLength, 255); for (i = 0; i < FileNameLength; i++) - AnsiFileName[i] = FileName[i]; + AnsiFileName[i] = (CHAR)FileName[i]; AnsiFileName[i] = 0; 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; } -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; ULONG Magic; @@ -603,15 +609,19 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONG MFTIndex, PCHAR return FALSE; } BitmapDataSize = NtfsGetAttributeSize(&IndexBitmapCtx->Record); - DPRINTM(DPRINT_FILESYSTEM, "BitmapDataSize: %x\n", BitmapDataSize); - BitmapData = MmHeapAlloc(BitmapDataSize); + DPRINTM(DPRINT_FILESYSTEM, "BitmapDataSize: %x\n", (ULONG)BitmapDataSize); + if(BitmapDataSize <= 0xFFFFFFFF) + BitmapData = MmHeapAlloc((ULONG)BitmapDataSize); + else + BitmapData = NULL; + if (BitmapData == NULL) { MmHeapFree(IndexRecord); MmHeapFree(MftRecord); return FALSE; } - NtfsReadAttribute(Volume, IndexBitmapCtx, 0, BitmapData, BitmapDataSize); + NtfsReadAttribute(Volume, IndexBitmapCtx, 0, BitmapData, (ULONG)BitmapDataSize); NtfsReleaseAttributeContext(IndexBitmapCtx); 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; CHAR PathPart[261]; - ULONG CurrentMFTIndex; + ULONGLONG CurrentMFTIndex; UCHAR i; DPRINTM(DPRINT_FILESYSTEM, "NtfsLookupFile() FileName = %s\n", FileName); @@ -748,8 +758,8 @@ LONG NtfsGetFileInformation(ULONG FileId, FILEINFORMATION* Information) PNTFS_FILE_HANDLE FileHandle = FsGetDeviceSpecific(FileId); RtlZeroMemory(Information, sizeof(FILEINFORMATION)); - Information->EndingAddress.LowPart = (ULONG)NtfsGetAttributeSize(&FileHandle->DataContext->Record); - Information->CurrentAddress.LowPart = FileHandle->Offset; + Information->EndingAddress.QuadPart = NtfsGetAttributeSize(&FileHandle->DataContext->Record); + Information->CurrentAddress.QuadPart = FileHandle->Offset; DPRINTM(DPRINT_FILESYSTEM, "NtfsGetFileInformation() FileSize = %d\n", Information->EndingAddress.LowPart); @@ -923,8 +933,7 @@ const DEVVTBL* NtfsMount(ULONG DeviceId) MmHeapFree(Volume); return NULL; } - Position.HighPart = 0; - Position.LowPart = Volume->BootSector.MftLocation * Volume->ClusterSize; + Position.QuadPart = Volume->BootSector.MftLocation * Volume->ClusterSize; ret = ArcSeek(DeviceId, &Position, SeekAbsolute); if (ret != ESUCCESS) { diff --git a/reactos/boot/freeldr/freeldr/include/arch/i386/drivemap.h b/reactos/boot/freeldr/freeldr/include/arch/i386/drivemap.h index aebd893a53b..90ee931d1a2 100644 --- a/reactos/boot/freeldr/freeldr/include/arch/i386/drivemap.h +++ b/reactos/boot/freeldr/freeldr/include/arch/i386/drivemap.h @@ -29,7 +29,7 @@ typedef struct VOID DriveMapMapDrivesInSection(PCSTR SectionName); 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 DriveMapRemoveInt13Handler(VOID); // Removes a previously installed int 13h drive map handler diff --git a/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h b/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h index febba0b8636..241320ac189 100644 --- a/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h +++ b/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h @@ -36,7 +36,7 @@ VOID XboxVideoClearScreen(UCHAR Attr); VIDEODISPLAYMODE XboxVideoSetDisplayMode(char *DisplayModem, BOOLEAN Init); VOID XboxVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth); ULONG XboxVideoGetBufferSize(VOID); -VOID XboxVideoSetTextCursorPosition(ULONG X, ULONG Y); +VOID XboxVideoSetTextCursorPosition(UCHAR X, UCHAR Y); VOID XboxVideoHideShowTextCursor(BOOLEAN Show); VOID XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y); VOID XboxVideoCopyOffScreenBufferToVRAM(PVOID Buffer); @@ -51,10 +51,10 @@ VOID XboxMemInit(VOID); PVOID XboxMemReserveMemory(ULONG MbToReserve); ULONG XboxMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); -BOOLEAN XboxDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); -BOOLEAN XboxDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); -BOOLEAN XboxDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry); -ULONG XboxDiskGetCacheableBlockCount(ULONG DriveNumber); +BOOLEAN XboxDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); +BOOLEAN XboxDiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); +BOOLEAN XboxDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry); +ULONG XboxDiskGetCacheableBlockCount(UCHAR DriveNumber); TIMEINFO* XboxGetTime(VOID); diff --git a/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h b/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h index e2af2118b8b..43ca48a2b12 100644 --- a/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h +++ b/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h @@ -35,7 +35,7 @@ VOID PcVideoClearScreen(UCHAR Attr); VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init); VOID PcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth); ULONG PcVideoGetBufferSize(VOID); -VOID PcVideoSetTextCursorPosition(ULONG X, ULONG Y); +VOID PcVideoSetTextCursorPosition(UCHAR X, UCHAR Y); VOID PcVideoHideShowTextCursor(BOOLEAN Show); VOID PcVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y); VOID PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer); @@ -49,10 +49,10 @@ VOID PcPrepareForReactOS(IN BOOLEAN Setup); ULONG PcMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); BOOLEAN PcDiskGetBootPath(char *BootPath, unsigned Size); -BOOLEAN PcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); -BOOLEAN PcDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); -BOOLEAN PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry); -ULONG PcDiskGetCacheableBlockCount(ULONG DriveNumber); +BOOLEAN PcDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); +BOOLEAN PcDiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); +BOOLEAN PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry); +ULONG PcDiskGetCacheableBlockCount(UCHAR DriveNumber); TIMEINFO* PcGetTime(VOID); diff --git a/reactos/boot/freeldr/freeldr/include/cache.h b/reactos/boot/freeldr/freeldr/include/cache.h index abadfd32c93..ecc02acac5f 100644 --- a/reactos/boot/freeldr/freeldr/include/cache.h +++ b/reactos/boot/freeldr/freeldr/include/cache.h @@ -50,7 +50,7 @@ typedef struct /////////////////////////////////////////////////////////////////////////////////////// typedef struct { - ULONG DriveNumber; + UCHAR DriveNumber; ULONG BytesPerSector; 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 -BOOLEAN CacheInitializeDrive(ULONG DriveNumber); +BOOLEAN CacheInitializeDrive(UCHAR DriveNumber); VOID CacheInvalidateCacheData(VOID); -BOOLEAN CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount, PVOID Buffer); -BOOLEAN CacheForceDiskSectorsIntoCache(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount); +BOOLEAN CacheReadDiskSectors(UCHAR DiskNumber, ULONGLONG StartSector, ULONG SectorCount, PVOID Buffer); +BOOLEAN CacheForceDiskSectorsIntoCache(UCHAR DiskNumber, ULONGLONG StartSector, ULONG SectorCount); BOOLEAN CacheReleaseMemory(ULONG MinimumAmountToRelease); diff --git a/reactos/boot/freeldr/freeldr/include/disk.h b/reactos/boot/freeldr/freeldr/include/disk.h index 2261930cf4f..9a862d1925f 100644 --- a/reactos/boot/freeldr/freeldr/include/disk.h +++ b/reactos/boot/freeldr/freeldr/include/disk.h @@ -105,10 +105,10 @@ typedef struct _MASTER_BOOT_RECORD /////////////////////////////////////////////////////////////////////////////////////// #if defined(__i386__) || defined(_M_AMD64) -BOOLEAN DiskResetController(ULONG DriveNumber); -BOOLEAN DiskInt13ExtensionsSupported(ULONG DriveNumber); +BOOLEAN DiskResetController(UCHAR DriveNumber); +BOOLEAN DiskInt13ExtensionsSupported(UCHAR DriveNumber); //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) @@ -120,10 +120,10 @@ BOOLEAN DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT B VOID DiskReportError (BOOLEAN bError); VOID DiskError(PCSTR ErrorString, ULONG ErrorCode); PCSTR DiskGetErrorCodeString(ULONG ErrorCode); -BOOLEAN DiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); // Implemented in i386disk.c -BOOLEAN DiskIsDriveRemovable(ULONG DriveNumber); +BOOLEAN DiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); // Implemented in i386disk.c +BOOLEAN DiskIsDriveRemovable(UCHAR DriveNumber); VOID DiskStopFloppyMotor(VOID); // Implemented in i386disk.c -extern ULONG FrldrBootDrive; +extern UCHAR FrldrBootDrive; extern ULONG FrldrBootPartition; BOOLEAN DiskGetBootPath(char *BootPath, unsigned Size); @@ -134,10 +134,10 @@ BOOLEAN DiskGetBootPath(char *BootPath, unsigned Size); // Fixed Disk Partition Management Functions // /////////////////////////////////////////////////////////////////////////////////////// -BOOLEAN DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry, ULONG *ActivePartition); -BOOLEAN DiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); +BOOLEAN DiskGetActivePartitionEntry(UCHAR DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry, ULONG *ActivePartition); +BOOLEAN DiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, 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 DiskReadBootRecord(ULONG DriveNumber, ULONGLONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord); +BOOLEAN DiskReadBootRecord(UCHAR DriveNumber, ULONGLONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord); ULONG LoadBootDeviceDriver(VOID); diff --git a/reactos/boot/freeldr/freeldr/include/fs/ext2.h b/reactos/boot/freeldr/freeldr/include/fs/ext2.h index 8a2b518a4be..3458e7dc94a 100644 --- a/reactos/boot/freeldr/freeldr/include/fs/ext2.h +++ b/reactos/boot/freeldr/freeldr/include/fs/ext2.h @@ -75,7 +75,7 @@ struct ext2_sblock ULONG free_inodes; ULONG first_data_block; ULONG log2_block_size; - ULONG log2_fragment_size; + LONG log2_fragment_size; ULONG blocks_per_group; ULONG fragments_per_group; ULONG inodes_per_group; diff --git a/reactos/boot/freeldr/freeldr/include/machine.h b/reactos/boot/freeldr/freeldr/include/machine.h index 2ff379368ec..1e77b786e97 100644 --- a/reactos/boot/freeldr/freeldr/include/machine.h +++ b/reactos/boot/freeldr/freeldr/include/machine.h @@ -47,7 +47,7 @@ typedef struct tagMACHVTBL VIDEODISPLAYMODE (*VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init); VOID (*VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth); ULONG (*VideoGetBufferSize)(VOID); - VOID (*VideoSetTextCursorPosition)(ULONG X, ULONG Y); + VOID (*VideoSetTextCursorPosition)(UCHAR X, UCHAR Y); VOID (*VideoHideShowTextCursor)(BOOLEAN Show); VOID (*VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y); VOID (*VideoCopyOffScreenBufferToVRAM)(PVOID Buffer); @@ -62,9 +62,9 @@ typedef struct tagMACHVTBL ULONG (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); BOOLEAN (*DiskGetBootPath)(char *BootPath, unsigned Size); - BOOLEAN (*DiskReadLogicalSectors)(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); - BOOLEAN (*DiskGetDriveGeometry)(ULONG DriveNumber, PGEOMETRY DriveGeometry); - ULONG (*DiskGetCacheableBlockCount)(ULONG DriveNumber); + BOOLEAN (*DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); + BOOLEAN (*DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry); + ULONG (*DiskGetCacheableBlockCount)(UCHAR DriveNumber); TIMEINFO* (*GetTime)(VOID); ULONG (*GetRelativeTime)(VOID); @@ -83,7 +83,7 @@ VOID MachVideoClearScreen(UCHAR Attr); VIDEODISPLAYMODE MachVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init); VOID MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth); ULONG MachVideoGetBufferSize(VOID); -VOID MachVideoSetTextCursorPosition(ULONG X, ULONG Y); +VOID MachVideoSetTextCursorPosition(UCHAR X, UCHAR Y); VOID MachVideoHideShowTextCursor(BOOLEAN Show); VOID MachVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y); VOID MachVideoCopyOffScreenBufferToVRAM(PVOID Buffer); @@ -94,9 +94,9 @@ VOID MachVideoSync(VOID); VOID MachBeep(VOID); BOOLEAN MachDiskGetBootPath(char *BootPath, unsigned Size); BOOLEAN MachDiskNormalizeSystemPath(char *SystemPath, unsigned Size); -BOOLEAN MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); -BOOLEAN MachDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry); -ULONG MachDiskGetCacheableBlockCount(ULONG DriveNumber); +BOOLEAN MachDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); +BOOLEAN MachDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry); +ULONG MachDiskGetCacheableBlockCount(UCHAR DriveNumber); VOID MachPrepareForReactOS(IN BOOLEAN Setup); #define MachConsPutChar(Ch) MachVtbl.ConsPutChar(Ch) diff --git a/reactos/boot/freeldr/freeldr/include/mm.h b/reactos/boot/freeldr/freeldr/include/mm.h index 7640498344e..8d325191bcd 100644 --- a/reactos/boot/freeldr/freeldr/include/mm.h +++ b/reactos/boot/freeldr/freeldr/include/mm.h @@ -54,6 +54,7 @@ typedef struct #define MM_PAGE_SIZE 4096 #define MM_PAGE_MASK 0xFFF #define MM_PAGE_SHIFT 12 +// FIXME: freeldr implementation uses ULONG for page numbers #define MM_MAX_PAGE 0xFFFFFFFFFFFFF #define MM_SIZE_TO_PAGES(a) \ diff --git a/reactos/boot/freeldr/freeldr/include/reactos.h b/reactos/boot/freeldr/freeldr/include/reactos.h index 82e23abb946..c31c0ca3f70 100644 --- a/reactos/boot/freeldr/freeldr/include/reactos.h +++ b/reactos/boot/freeldr/freeldr/include/reactos.h @@ -81,9 +81,9 @@ DissectArcPath2( OUT ULONG* z, OUT ULONG* Partition, OUT ULONG *PathSyntax); -BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, ULONG* BootDrive, ULONG* BootPartition); -VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, ULONG Disk, ULONG Partition); -ULONG ConvertArcNameToBiosDriveNumber(PCHAR ArcPath); +BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, UCHAR* BootDrive, ULONG* BootPartition); +VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Partition); +UCHAR ConvertArcNameToBiosDriveNumber(PCHAR ArcPath); /////////////////////////////////////////////////////////////////////////////////////// // diff --git a/reactos/boot/freeldr/freeldr/machine.c b/reactos/boot/freeldr/freeldr/machine.c index c898bf49430..5dae495d960 100644 --- a/reactos/boot/freeldr/freeldr/machine.c +++ b/reactos/boot/freeldr/freeldr/machine.c @@ -86,7 +86,7 @@ MachVideoGetBufferSize(VOID) } VOID -MachVideoSetTextCursorPosition(ULONG X, ULONG Y) +MachVideoSetTextCursorPosition(UCHAR X, UCHAR Y) { MachVtbl.VideoSetTextCursorPosition(X, Y); } @@ -152,19 +152,19 @@ MachDiskGetBootPath(char *BootPath, unsigned Size) } 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); } BOOLEAN -MachDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry) +MachDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry) { return MachVtbl.DiskGetDriveGeometry(DriveNumber, DriveGeometry); } ULONG -MachDiskGetCacheableBlockCount(ULONG DriveNumber) +MachDiskGetCacheableBlockCount(UCHAR DriveNumber) { return MachVtbl.DiskGetCacheableBlockCount(DriveNumber); } diff --git a/reactos/boot/freeldr/freeldr/reactos/arcname.c b/reactos/boot/freeldr/freeldr/reactos/arcname.c index ee2bd22491a..a51218f0e63 100644 --- a/reactos/boot/freeldr/freeldr/reactos/arcname.c +++ b/reactos/boot/freeldr/freeldr/reactos/arcname.c @@ -21,7 +21,7 @@ #include -BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, ULONG* BootDrive, ULONG* BootPartition) +BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, UCHAR* BootDrive, ULONG* BootPartition) { char *p; @@ -160,8 +160,9 @@ DissectArcPath2( return FALSE; } + #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]; @@ -197,10 +198,10 @@ VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, ULONG Disk, ULONG Parti } } -ULONG ConvertArcNameToBiosDriveNumber(PCHAR ArcPath) +UCHAR ConvertArcNameToBiosDriveNumber(PCHAR ArcPath) { char * p; - ULONG DriveNumber = 0; + UCHAR DriveNumber = 0; if (_strnicmp(ArcPath, "multi(0)disk(0)", 15) != 0) return 0; diff --git a/reactos/boot/freeldr/freeldr/video/fade.c b/reactos/boot/freeldr/freeldr/video/fade.c index 4cfd4352d46..49ad2afe2bb 100644 --- a/reactos/boot/freeldr/freeldr/video/fade.c +++ b/reactos/boot/freeldr/freeldr/video/fade.c @@ -24,7 +24,7 @@ VOID VideoSetAllColorsToBlack(ULONG ColorCount) { - ULONG Color; + UCHAR Color; MachVideoSync(); @@ -37,7 +37,7 @@ VOID VideoSetAllColorsToBlack(ULONG ColorCount) VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount) { ULONG Index; - ULONG Color; + UCHAR Color; PPALETTE_ENTRY PaletteColors; PaletteColors = MmHeapAlloc(sizeof(PALETTE_ENTRY) * ColorCount); @@ -97,7 +97,7 @@ VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount) VOID VideoFadeOut(ULONG ColorCount) { ULONG Index; - ULONG Color; + UCHAR Color; UCHAR Red; UCHAR Green; UCHAR Blue; diff --git a/reactos/boot/freeldr/freeldr/video/palette.c b/reactos/boot/freeldr/freeldr/video/palette.c index c631648381a..805b73672fc 100644 --- a/reactos/boot/freeldr/freeldr/video/palette.c +++ b/reactos/boot/freeldr/freeldr/video/palette.c @@ -24,7 +24,7 @@ VOID VideoSavePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount) for (Color=0; Color