PCHAR sptr;
Elf32_Ehdr ehdr;
Elf32_Shdr *shdr;
+ LARGE_INTEGER Position;
LPSTR TempName;
TempName = strrchr(ImageName, '\\');
//printf("Loading file (elf at %x)\n", KernelAddr);
/* Load the first 1024 bytes of the kernel image so we can read the PE header */
- if (!FsReadFile(KernelImage, sizeof(ehdr), NULL, &ehdr)) {
+ if (ArcRead(KernelImage, &ehdr, sizeof(ehdr), NULL) != ESUCCESS) {
/* Fail if we couldn't read */
printf("Couldn't read the elf header\n");
sptr = (PCHAR)FrLdrTempAlloc(shnum * shsize, TAG_MBOOT);
/* Read section headers */
- FsSetFilePointer(KernelImage, ehdr.e_shoff);
- FsReadFile(KernelImage, shsize * shnum, NULL, sptr);
+ Position.QuadPart = ehdr.e_shoff;
+ ArcSeek(KernelImage, &Position, SeekAbsolute);
+ ArcRead(KernelImage, sptr, shsize * shnum, NULL);
/* Now we'll get the PE Header */
for( i = 0; i < shnum; i++ )
/* Find the PE Header */
if (shdr->sh_type == TYPE_PEHEADER)
{
- FsSetFilePointer(KernelImage, shdr->sh_offset);
- FsReadFile(KernelImage, shdr->sh_size, NULL, MemLoadAddr);
+ Position.QuadPart = shdr->sh_offset;
+ ArcSeek(KernelImage, &Position, SeekAbsolute);
+ ArcRead(KernelImage, MemLoadAddr, shdr->sh_size, NULL);
ImageHeader = (PIMAGE_DOS_HEADER)MemLoadAddr;
NtHeader = (PIMAGE_NT_HEADERS)((PCHAR)MemLoadAddr + SWAPD(ImageHeader->e_lfanew));
#if 0
{
/* Content area */
printf("Loading section %d at %x (real: %x:%d)\n", i, KernelAddr + SectionAddr, MemLoadAddr+SectionAddr, shdr->sh_size);
- FsSetFilePointer(KernelImage, shdr->sh_offset);
- FsReadFile(KernelImage, shdr->sh_size, NULL, MemLoadAddr + SectionAddr);
+ Position.QuadPart = shdr->sh_offset;
+ ArcSeek(KernelImage, &Position, SeekAbsolute);
+ ArcRead(KernelImage, MemLoadAddr + SectionAddr, shdr->sh_size, NULL);
}
else
{
if (!ELF_SECTION(targetSection)->sh_addr) continue;
RelocSection = FrLdrTempAlloc(shdr->sh_size, TAG_MBOOT);
- FsSetFilePointer(KernelImage, relstart);
- FsReadFile(KernelImage, shdr->sh_size, NULL, RelocSection);
+ Position.QuadPart = relstart;
+ ArcSeek(KernelImage, &Position, SeekAbsolute);
+ ArcRead(KernelImage, RelocSection, shdr->sh_size, NULL);
/* Get the symbol section */
shdr = ELF_SECTION(shdr->sh_link);
SymbolSection = FrLdrTempAlloc(shdr->sh_size, TAG_MBOOT);
- FsSetFilePointer(KernelImage, shdr->sh_offset);
- FsReadFile(KernelImage, shdr->sh_size, NULL, SymbolSection);
+ Position.QuadPart = shdr->sh_offset;
+ ArcSeek(KernelImage, &Position, SeekAbsolute);
+ ArcRead(KernelImage, SymbolSection, shdr->sh_size, NULL);
for(j = 0; j < numreloc; j++)
{
LPCSTR ModuleName,
PULONG ModuleSize)
{
+ ARC_STATUS Status;
+ FILEINFORMATION FileInfo;
ULONG LocalModuleSize;
ULONG_PTR ThisModuleBase = NextModuleBase;
PLOADER_MODULE ModuleData;
} while(TempName);
NameBuffer = reactos_module_strings[LoaderBlock.ModsCount];
-
/* Get Module Size */
- LocalModuleSize = FsGetFileSize(ModuleImage);
+ Status = ArcGetFileInformation(ModuleImage, &FileInfo);
+ if (Status != ESUCCESS || FileInfo.EndingAddress.HighPart != 0)
+ LocalModuleSize = 0;
+ else
+ LocalModuleSize = FileInfo.EndingAddress.LowPart;
/* Fill out Module Data Structure */
ModuleData->ModStart = NextModuleBase;
ModuleData->String = (ULONG_PTR)NameBuffer;
/* Load the file image */
- FsReadFile(ModuleImage, LocalModuleSize, NULL, (PVOID)NextModuleBase);
+ ArcRead(ModuleImage, (PVOID)NextModuleBase, LocalModuleSize, NULL);
/* Move to next memory block and increase Module Count */
NextModuleBase = ROUND_UP(ModuleData->ModEnd, PAGE_SIZE);
NTAPI
RamDiskLoadVirtualFile(IN PCHAR FileName)
{
- PFILE RamFile;
+ ULONG RamFileId;
ULONG TotalRead, ChunkSize, Count;
PCHAR MsgBuffer = "Loading RamDisk...";
ULONG PercentPerChunk, Percent;
//
// Try opening the ramdisk file
//
- RamFile = FsOpenFile(FileName);
- if (!RamFile)
+ RamFileId = FsOpenFile(FileName);
+ if (!RamFileId)
return FALSE;
//
// Get the file size
//
- Status = ArcGetFileInformation(RamFile, &Information);
+ Status = ArcGetFileInformation(RamFileId, &Information);
if (Status != ESUCCESS)
{
- FsCloseFile(RamFile);
+ ArcClose(RamFileId);
return FALSE;
}
if (Information.EndingAddress.HighPart != 0)
{
UiMessageBox("RAM disk too big.");
- FsCloseFile(RamFile);
+ ArcClose(RamFileId);
return FALSE;
}
gRamDiskSize = Information.EndingAddress.LowPart;
if (!gRamDiskBase)
{
UiMessageBox("Failed to allocate memory for RAM disk.");
- FsCloseFile(RamFile);
+ ArcClose(RamFileId);
return FALSE;
}
//
Position.HighPart = 0;
Position.LowPart = TotalRead;
- Status = ArcSeek(RamFile, &Position, SeekAbsolute);
+ Status = ArcSeek(RamFileId, &Position, SeekAbsolute);
if (Status == ESUCCESS)
{
- Status = ArcRead(RamFile,
+ Status = ArcRead(RamFileId,
(PVOID)((ULONG_PTR)gRamDiskBase + TotalRead),
ChunkSize,
&Count);
MmFreeMemory(gRamDiskBase);
gRamDiskBase = NULL;
gRamDiskSize = 0;
- FsCloseFile(RamFile);
+ ArcClose(RamFileId);
UiMessageBox("Failed to read RAM disk.");
return FALSE;
}
}
- FsCloseFile(RamFile);
+ ArcClose(RamFileId);
/* Setup the RAMDISK device */
RamDiskInitialize();
LPCWSTR ServiceName;
} DEVVTBL;
-#define FS_FAT 1
-#define FS_NTFS 2
-#define FS_EXT2 3
-#define FS_ISO9660 5
-
-#define PFILE ULONG
+#define MAX_FDS 60
ARC_STATUS ArcOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId);
ARC_STATUS ArcClose(ULONG FileId);
ARC_STATUS ArcGetFileInformation(ULONG FileId, FILEINFORMATION* Information);
VOID FileSystemError(PCSTR ErrorString);
-PFILE FsOpenFile(PCSTR FileName);
-VOID FsCloseFile(PFILE FileHandle);
-BOOLEAN FsReadFile(PFILE FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer);
-BOOLEAN FsGetFileInformation(PFILE FileHandle, FILEINFORMATION* Information);
-ULONG FsGetFileSize(PFILE FileHandle);
-VOID FsSetFilePointer(PFILE FileHandle, ULONG NewFilePointer);
+ULONG FsOpenFile(PCSTR FileName);
ULONG FsGetNumPathParts(PCSTR Path);
VOID FsGetFirstNameFromPath(PCHAR Buffer, PCSTR Path);
VOID* FsGetDeviceSpecific(ULONG FileId);
ULONG FsGetDeviceId(ULONG FileId);
VOID FsInit(VOID);
-
-#define MAX_FDS 60
ULONG FileSize; /* File size */
ULONG FilePointer; /* File pointer */
ULONG* FileFatChain; /* File fat chain array */
- ULONG DriveNumber;
PFAT_VOLUME_INFO Volume;
} FAT_FILE_INFO, * PFAT_FILE_INFO;
IN ULONG Argc,
IN PCHAR Argv[]);
-BOOLEAN LinuxReadBootSector(PFILE LinuxKernelFile);
-BOOLEAN LinuxReadSetupSector(PFILE LinuxKernelFile);
-BOOLEAN LinuxReadKernel(PFILE LinuxKernelFile);
-BOOLEAN LinuxCheckKernelVersion(VOID);
-BOOLEAN LinuxReadInitrd(PFILE LinuxInitrdFile);
+BOOLEAN LinuxReadBootSector(ULONG LinuxKernelFile);
+BOOLEAN LinuxReadSetupSector(ULONG LinuxKernelFile);
+BOOLEAN LinuxReadKernel(ULONG LinuxKernelFile);
+BOOLEAN LinuxCheckKernelVersion(VOID);
+BOOLEAN LinuxReadInitrd(ULONG LinuxInitrdFile);
#endif // _M_IX86
struct btrfs_path path;
struct btrfs_root_item fs_root_item;
- TRACE("Enter BtrFsMount(), sizeof %d %d\n", sizeof(struct BTRFS_INFO), sizeof(struct btrfs_super_block));
+ TRACE("Enter BtrFsMount(%lu)\n", DeviceId);
BtrFsInfo = FrLdrTempAlloc(sizeof(struct BTRFS_INFO), TAG_BTRFS_INFO);
if (!BtrFsInfo)
}
/* Check if SuperBlock is valid. If yes, return BTRFS function table */
- if (BtrFsInfo->SuperBlock.magic == BTRFS_MAGIC_N)
+ if (BtrFsInfo->SuperBlock.magic != BTRFS_MAGIC_N)
{
- BtrFsInfo->DeviceId = DeviceId;
- TRACE("BtrFsMount() superblock magic ok\n");
-
- btrfs_init_crc32c();
-
- btrfs_read_sys_chunk_array();
- btrfs_read_chunk_tree();
-
- /* setup roots */
- fs_root_item.bytenr = BtrFsInfo->SuperBlock.root;
- fs_root_item.level = BtrFsInfo->SuperBlock.root_level;
+ FrLdrTempFree(BtrFsInfo, TAG_BTRFS_INFO);
+ return NULL;
+ }
- init_path(&path);
- if (!BtrFsSearchTreeType(&fs_root_item, BTRFS_FS_TREE_OBJECTID, BTRFS_ROOT_ITEM_KEY, &path))
- {
- FrLdrTempFree(BtrFsInfo, TAG_BTRFS_INFO);
- free_path(&path);
- return NULL;
- }
+ BtrFsInfo->DeviceId = DeviceId;
+ TRACE("BtrFsMount(%lu) superblock magic ok\n", DeviceId);
- BtrFsInfo->FsRoot = *(struct btrfs_root_item *) path_current_data(&path);
+ btrfs_init_crc32c();
- free_path(&path);
+ btrfs_read_sys_chunk_array();
+ btrfs_read_chunk_tree();
- TRACE("BtrFsMount success\n");
+ /* setup roots */
+ fs_root_item.bytenr = BtrFsInfo->SuperBlock.root;
+ fs_root_item.level = BtrFsInfo->SuperBlock.root_level;
- return &BtrFsFuncTable;
- }
- else
+ init_path(&path);
+ if (!BtrFsSearchTreeType(&fs_root_item, BTRFS_FS_TREE_OBJECTID, BTRFS_ROOT_ITEM_KEY, &path))
{
+ FrLdrTempFree(BtrFsInfo, TAG_BTRFS_INFO);
+ free_path(&path);
return NULL;
}
+
+ BtrFsInfo->FsRoot = *(struct btrfs_root_item *) path_current_data(&path);
+
+ free_path(&path);
+
+ TRACE("BtrFsMount(%lu) success\n", DeviceId);
+ return &BtrFsFuncTable;
}
ULONG Count;
ARC_STATUS Status;
+ TRACE("Enter Ext2Mount(%lu)\n", DeviceId);
+
//
// Read the SuperBlock
//
if (!DiskGetBootVolume(&DriveNumber, &StartSector, &SectorCount, &Type))
return NULL;
Ext2OpenVolume(DriveNumber, StartSector, SectorCount);
+
+ /* Return success */
+ TRACE("Ext2Mount(%lu) success\n", DeviceId);
return &Ext2FuncTable;
}
else
}
#endif
-
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);
-ARC_STATUS FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, ULONG DeviceId, PFAT_FILE_INFO FatFileInfoPointer);
+ARC_STATUS FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, PFAT_FILE_INFO FatFileInfoPointer);
void FatParseShortFileName(PCHAR Buffer, PDIRENTRY DirEntry);
BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPointer);
ULONG FatCountClustersInChain(PFAT_VOLUME_INFO Volume, ULONG StartCluster);
* specified filename and fills in an FAT_FILE_INFO structure
* with info describing the file, etc. returns ARC error code
*/
-ARC_STATUS FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, ULONG DeviceId, PFAT_FILE_INFO FatFileInfoPointer)
+ARC_STATUS FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, PFAT_FILE_INFO FatFileInfoPointer)
{
UINT32 i;
ULONG NumberOfPathParts;
if (!FatReadVolumeSectors(Volume, ThisFatSecNum, 1, ReadBuffer))
{
- return FALSE;
+ Success = FALSE;
+ break;
}
// Get the fat entry
TRACE("FatOpen() FileName = %s\n", Path);
RtlZeroMemory(&TempFileInfo, sizeof(TempFileInfo));
- Status = FatLookupFile(FatVolume, Path, DeviceId, &TempFileInfo);
+ Status = FatLookupFile(FatVolume, Path, &TempFileInfo);
if (Status != ESUCCESS)
return ENOENT;
ULARGE_INTEGER SectorCount;
ARC_STATUS Status;
+ TRACE("Enter FatMount(%lu)\n", DeviceId);
+
//
// Allocate data for volume information
//
//
// Read the BootSector
//
- Position.HighPart = 0;
- Position.LowPart = 0;
+ Position.QuadPart = 0;
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
{
FrLdrTempFree(Volume, TAG_FAT_VOLUME);
return NULL;
}
- SectorCount.HighPart = FileInformation.EndingAddress.HighPart;
- SectorCount.LowPart = FileInformation.EndingAddress.LowPart;
+ SectorCount.QuadPart = FileInformation.EndingAddress.QuadPart;
SectorCount.QuadPart /= SECTOR_SIZE;
//
//
// Return success
//
+ TRACE("FatMount(%lu) success\n", DeviceId);
return &FatFuncTable;
}
UiMessageBox(ErrorString);
}
-PFILE FsOpenFile(PCSTR FileName)
+ULONG FsOpenFile(PCSTR FileName)
{
CHAR FullPath[MAX_PATH] = "";
ULONG FileId;
// Check for success
//
if (Status == ESUCCESS)
- return (PFILE)FileId;
+ return FileId;
else
- return (PFILE)0;
-}
-
-VOID FsCloseFile(PFILE FileHandle)
-{
- ULONG FileId = (ULONG)FileHandle;
-
- //
- // Close the handle. Do not check for error,
- // this function is supposed to always succeed.
- //
- ArcClose(FileId);
-}
-
-/*
- * ReadFile()
- * returns number of bytes read or EOF
- */
-BOOLEAN FsReadFile(PFILE FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer)
-{
- ULONG FileId = (ULONG)FileHandle;
-
- //
- // Read the file
- //
- return (ArcRead(FileId, Buffer, BytesToRead, BytesRead) == ESUCCESS);
-}
-
-BOOLEAN FsGetFileInformation(PFILE FileHandle, FILEINFORMATION* Information)
-{
- ULONG FileId = (ULONG)FileHandle;
-
- //
- // Get file information
- //
- return (ArcGetFileInformation(FileId, Information) == ESUCCESS);
-}
-
-ULONG FsGetFileSize(PFILE FileHandle)
-{
- ULONG FileId = (ULONG)FileHandle;
- FILEINFORMATION Information;
- ARC_STATUS Status;
-
- //
- // Query file informations
- //
- Status = ArcGetFileInformation(FileId, &Information);
-
- //
- // Check for error
- //
- if (Status != ESUCCESS || Information.EndingAddress.HighPart != 0)
return 0;
-
- //
- // Return file size
- //
- return Information.EndingAddress.LowPart;
-}
-
-VOID FsSetFilePointer(PFILE FileHandle, ULONG NewFilePointer)
-{
- ULONG FileId = (ULONG)FileHandle;
- LARGE_INTEGER Position;
-
- //
- // Set file position. Do not check for error,
- // this function is supposed to always succeed.
- //
- Position.HighPart = 0;
- Position.LowPart = NewFilePointer;
- ArcSeek(FileId, &Position, SeekAbsolute);
}
/*
ULONG Count;
ARC_STATUS Status;
+ TRACE("Enter IsoMount(%lu)\n", DeviceId);
+
//
// Read The Primary Volume Descriptor
//
// Check if PVD is valid. If yes, return ISO9660 function table
//
if (Pvd->VdType == 1 && RtlEqualMemory(Pvd->StandardId, "CD001", 5))
+ {
+ TRACE("IsoMount(%lu) success\n", DeviceId);
return &Iso9660FuncTable;
- else
- return NULL;
+ }
+
+ return NULL;
}
#endif
-
ULONG Count;
ARC_STATUS Status;
+ TRACE("Enter NtfsMount(%lu)\n", DeviceId);
+
//
// Allocate data for volume information
//
//
// Read the BootSector
//
- Position.HighPart = 0;
- Position.LowPart = 0;
+ Position.QuadPart = 0;
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
{
//
// Return success
//
+ TRACE("NtfsMount(%lu) success\n", DeviceId);
return &NtfsFuncTable;
}
DbgPrint("*");
break;
case LoaderBad:
- DbgPrint( "-");
+ DbgPrint("-");
break;
case LoaderLoadedProgram:
DbgPrint("O");
DbgPrint("T");
break;
case LoaderFirmwarePermanent:
- DbgPrint( "P");
+ DbgPrint("P");
break;
case LoaderOsloaderHeap:
DbgPrint("H");
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+/*
+ * The x86 Linux Boot Protocol is explained at:
+ * https://www.kernel.org/doc/Documentation/x86/boot.txt
+ */
+
#ifndef _M_ARM
#ifdef _M_IX86
IN PCHAR Envp[])
{
PCSTR Description;
- PFILE LinuxKernel = 0;
- PFILE LinuxInitrdFile = 0;
+ ULONG LinuxKernel = 0;
+ ULONG LinuxInitrdFile = 0;
+ ARC_STATUS Status;
+ FILEINFORMATION FileInfo;
Description = GetArgumentValue(Argc, Argv, "LoadIdentifier");
if (Description)
goto LinuxBootFailed;
/* Calc kernel size */
- LinuxKernelSize = FsGetFileSize(LinuxKernel) - (512 + SetupSectorSize);
+ Status = ArcGetFileInformation(LinuxKernel, &FileInfo);
+ if (Status != ESUCCESS || FileInfo.EndingAddress.HighPart != 0)
+ LinuxKernelSize = 0;
+ else
+ LinuxKernelSize = FileInfo.EndingAddress.LowPart - (512 + SetupSectorSize);
- /* Get the file size */
- LinuxInitrdSize = FsGetFileSize(LinuxInitrdFile);
+ /* Get the initrd file image (if necessary) */
+ LinuxInitrdSize = 0;
+ if (LinuxInitrdName)
+ {
+ Status = ArcGetFileInformation(LinuxInitrdFile, &FileInfo);
+ if (Status != ESUCCESS || FileInfo.EndingAddress.HighPart != 0)
+ LinuxInitrdSize = 0;
+ else
+ LinuxInitrdSize = FileInfo.EndingAddress.LowPart;
+ }
/* Read the kernel */
if (!LinuxReadKernel(LinuxKernel))
LinuxBootFailed:
if (LinuxKernel)
- FsCloseFile(LinuxKernel);
+ ArcClose(LinuxKernel);
if (LinuxInitrdFile)
- FsCloseFile(LinuxInitrdFile);
+ ArcClose(LinuxInitrdFile);
if (LinuxBootSector != NULL)
MmFreeMemory(LinuxBootSector);
IN ULONG Argc,
IN PCHAR Argv[])
{
+#if 0
LinuxBootPath = GetArgumentValue(Argc, Argv, "BootPath");
if (!LinuxBootPath)
{
UiMessageBox("Boot path not specified for selected OS!");
return FALSE;
}
+#endif
/* Get the kernel name */
LinuxKernelName = GetArgumentValue(Argc, Argv, "Kernel");
return TRUE;
}
-BOOLEAN LinuxReadBootSector(PFILE LinuxKernelFile)
+BOOLEAN LinuxReadBootSector(ULONG LinuxKernelFile)
{
+ LARGE_INTEGER Position;
+
/* Allocate memory for boot sector */
LinuxBootSector = MmAllocateMemoryWithType(512, LoaderSystemCode);
if (LinuxBootSector == NULL)
return FALSE;
/* Read linux boot sector */
- FsSetFilePointer(LinuxKernelFile, 0);
- if (!FsReadFile(LinuxKernelFile, 512, NULL, LinuxBootSector))
+ Position.QuadPart = 0;
+ if (ArcSeek(LinuxKernelFile, &Position, SeekAbsolute) != ESUCCESS)
+ return FALSE;
+ if (ArcRead(LinuxKernelFile, LinuxBootSector, 512, NULL) != ESUCCESS)
return FALSE;
/* Check for validity */
return TRUE;
}
-BOOLEAN LinuxReadSetupSector(PFILE LinuxKernelFile)
+BOOLEAN LinuxReadSetupSector(ULONG LinuxKernelFile)
{
+ LARGE_INTEGER Position;
UCHAR TempLinuxSetupSector[512];
/* Read first linux setup sector */
- FsSetFilePointer(LinuxKernelFile, 512);
- if (!FsReadFile(LinuxKernelFile, 512, NULL, TempLinuxSetupSector))
+ Position.QuadPart = 512;
+ if (ArcSeek(LinuxKernelFile, &Position, SeekAbsolute) != ESUCCESS)
+ return FALSE;
+ if (ArcRead(LinuxKernelFile, TempLinuxSetupSector, 512, NULL) != ESUCCESS)
return FALSE;
/* Check the kernel version */
RtlCopyMemory(LinuxSetupSector, TempLinuxSetupSector, 512);
/* Read in the rest of the linux setup sectors */
- FsSetFilePointer(LinuxKernelFile, 1024);
- if (!FsReadFile(LinuxKernelFile, SetupSectorSize - 512, NULL, (PVOID)((ULONG_PTR)LinuxSetupSector + 512)))
+ Position.QuadPart = 1024;
+ if (ArcSeek(LinuxKernelFile, &Position, SeekAbsolute) != ESUCCESS)
+ return FALSE;
+ if (ArcRead(LinuxKernelFile, (PVOID)((ULONG_PTR)LinuxSetupSector + 512), SetupSectorSize - 512, NULL) != ESUCCESS)
return FALSE;
// DbgDumpBuffer(DPRINT_LINUX, LinuxSetupSector, SetupSectorSize);
return TRUE;
}
-BOOLEAN LinuxReadKernel(PFILE LinuxKernelFile)
+BOOLEAN LinuxReadKernel(ULONG LinuxKernelFile)
{
+ PVOID LoadAddress;
+ LARGE_INTEGER Position;
ULONG BytesLoaded;
CHAR StatusText[260];
- PVOID LoadAddress;
RtlStringCbPrintfA(StatusText, sizeof(StatusText), "Loading %s", LinuxKernelName);
UiDrawStatusText(StatusText);
LoadAddress = LinuxKernelLoadAddress;
/* Read linux kernel to 0x100000 (1mb) */
- FsSetFilePointer(LinuxKernelFile, 512 + SetupSectorSize);
+ Position.QuadPart = 512 + SetupSectorSize;
+ if (ArcSeek(LinuxKernelFile, &Position, SeekAbsolute) != ESUCCESS)
+ return FALSE;
for (BytesLoaded=0; BytesLoaded<LinuxKernelSize; )
{
- if (!FsReadFile(LinuxKernelFile, LINUX_READ_CHUNK_SIZE, NULL, LoadAddress))
+ if (ArcRead(LinuxKernelFile, LoadAddress, LINUX_READ_CHUNK_SIZE, NULL) != ESUCCESS)
return FALSE;
BytesLoaded += LINUX_READ_CHUNK_SIZE;
return TRUE;
}
-BOOLEAN LinuxReadInitrd(PFILE LinuxInitrdFile)
+BOOLEAN LinuxReadInitrd(ULONG LinuxInitrdFile)
{
ULONG BytesLoaded;
CHAR StatusText[260];
/* Read in the ramdisk */
for (BytesLoaded=0; BytesLoaded<LinuxInitrdSize; )
{
- if (!FsReadFile(LinuxInitrdFile, LINUX_READ_CHUNK_SIZE, NULL, (PVOID)LinuxInitrdLoadAddress))
+ if (ArcRead(LinuxInitrdFile, (PVOID)LinuxInitrdLoadAddress, LINUX_READ_CHUNK_SIZE, NULL) != ESUCCESS)
return FALSE;
BytesLoaded += LINUX_READ_CHUNK_SIZE;
IN PCHAR Envp[])
{
PCSTR FileName;
- PFILE FilePointer;
+ ULONG FileId;
ULONG BytesRead;
/* Find all the message box settings and run them */
return EINVAL;
}
- FilePointer = FsOpenFile(FileName);
- if (!FilePointer)
+ FileId = FsOpenFile(FileName);
+ if (!FileId)
{
UiMessageBox("%s not found.", FileName);
return ENOENT;
}
/* Read boot sector */
- if (!FsReadFile(FilePointer, 512, &BytesRead, (void*)0x7c00) || (BytesRead != 512))
+ if (ArcRead(FileId, (void*)0x7c00, 512, &BytesRead) != ESUCCESS ||
+ (BytesRead != 512))
{
UiMessageBox("Unable to read boot sector.");
return EIO;