mirror of
https://github.com/reactos/reactos.git
synced 2024-07-01 02:10:07 +00:00
[FREELDR]: Fix all (?, or almost?) LONG Status; into ARC_STATUS, and the awfully ugly BOOLEAN Status into BOOLEAN Success.
svn path=/trunk/; revision=65984
This commit is contained in:
parent
a1b3d1f7e8
commit
e36f91e0de
|
@ -249,7 +249,7 @@ IopReadBootRecord(
|
||||||
ULONG FileId = (ULONG)DeviceObject;
|
ULONG FileId = (ULONG)DeviceObject;
|
||||||
LARGE_INTEGER Position;
|
LARGE_INTEGER Position;
|
||||||
ULONG BytesRead;
|
ULONG BytesRead;
|
||||||
ULONG Status;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
Position.QuadPart = LogicalSectorNumber * SectorSize;
|
Position.QuadPart = LogicalSectorNumber * SectorSize;
|
||||||
Status = ArcSeek(FileId, &Position, SeekAbsolute);
|
Status = ArcSeek(FileId, &Position, SeekAbsolute);
|
||||||
|
|
|
@ -126,7 +126,7 @@ RamDiskLoadVirtualFile(IN PCHAR FileName)
|
||||||
ULONG PercentPerChunk, Percent;
|
ULONG PercentPerChunk, Percent;
|
||||||
FILEINFORMATION Information;
|
FILEINFORMATION Information;
|
||||||
LARGE_INTEGER Position;
|
LARGE_INTEGER Position;
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Display progress
|
// Display progress
|
||||||
|
@ -143,8 +143,8 @@ RamDiskLoadVirtualFile(IN PCHAR FileName)
|
||||||
//
|
//
|
||||||
// Get the file size
|
// Get the file size
|
||||||
//
|
//
|
||||||
ret = ArcGetFileInformation(RamFile, &Information);
|
Status = ArcGetFileInformation(RamFile, &Information);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
FsCloseFile(RamFile);
|
FsCloseFile(RamFile);
|
||||||
return;
|
return;
|
||||||
|
@ -204,10 +204,10 @@ RamDiskLoadVirtualFile(IN PCHAR FileName)
|
||||||
//
|
//
|
||||||
Position.HighPart = 0;
|
Position.HighPart = 0;
|
||||||
Position.LowPart = TotalRead;
|
Position.LowPart = TotalRead;
|
||||||
ret = ArcSeek(RamFile, &Position, SeekAbsolute);
|
Status = ArcSeek(RamFile, &Position, SeekAbsolute);
|
||||||
if (ret == ESUCCESS)
|
if (Status == ESUCCESS)
|
||||||
{
|
{
|
||||||
ret = ArcRead(RamFile,
|
Status = ArcRead(RamFile,
|
||||||
(PVOID)((ULONG_PTR)gRamDiskBase + TotalRead),
|
(PVOID)((ULONG_PTR)gRamDiskBase + TotalRead),
|
||||||
ChunkSize,
|
ChunkSize,
|
||||||
&Count);
|
&Count);
|
||||||
|
@ -216,7 +216,7 @@ RamDiskLoadVirtualFile(IN PCHAR FileName)
|
||||||
//
|
//
|
||||||
// Check for success
|
// Check for success
|
||||||
//
|
//
|
||||||
if (ret != ESUCCESS || Count != ChunkSize)
|
if (Status != ESUCCESS || Count != ChunkSize)
|
||||||
{
|
{
|
||||||
MmFreeMemory(gRamDiskBase);
|
MmFreeMemory(gRamDiskBase);
|
||||||
gRamDiskBase = NULL;
|
gRamDiskBase = NULL;
|
||||||
|
|
|
@ -776,7 +776,7 @@ SpiScanDevice(
|
||||||
IN ULONG Lun)
|
IN ULONG Lun)
|
||||||
{
|
{
|
||||||
ULONG FileId, i;
|
ULONG FileId, i;
|
||||||
ULONG Status;
|
ARC_STATUS Status;
|
||||||
NTSTATUS ret;
|
NTSTATUS ret;
|
||||||
struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer;
|
struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer;
|
||||||
CHAR PartitionName[64];
|
CHAR PartitionName[64];
|
||||||
|
@ -1574,7 +1574,7 @@ LoadBootDeviceDriver(VOID)
|
||||||
CHAR NtBootDdPath[MAX_PATH];
|
CHAR NtBootDdPath[MAX_PATH];
|
||||||
PVOID ImageBase = NULL;
|
PVOID ImageBase = NULL;
|
||||||
ULONG (NTAPI *EntryPoint)(IN PVOID DriverObject, IN PVOID RegistryPath);
|
ULONG (NTAPI *EntryPoint)(IN PVOID DriverObject, IN PVOID RegistryPath);
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
|
|
||||||
/* Initialize the loaded module list */
|
/* Initialize the loaded module list */
|
||||||
InitializeListHead(&ModuleListHead);
|
InitializeListHead(&ModuleListHead);
|
||||||
|
@ -1584,37 +1584,37 @@ LoadBootDeviceDriver(VOID)
|
||||||
strcat(NtBootDdPath, "\\NTBOOTDD.SYS");
|
strcat(NtBootDdPath, "\\NTBOOTDD.SYS");
|
||||||
|
|
||||||
/* Load file */
|
/* Load file */
|
||||||
Status = WinLdrLoadImage(NtBootDdPath, LoaderBootDriver, &ImageBase);
|
Success = WinLdrLoadImage(NtBootDdPath, LoaderBootDriver, &ImageBase);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
{
|
{
|
||||||
/* That's OK. File simply doesn't exist */
|
/* That's OK. File simply doesn't exist */
|
||||||
return ESUCCESS;
|
return ESUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a DTE for ntbootdd */
|
/* Allocate a DTE for ntbootdd */
|
||||||
Status = WinLdrAllocateDataTableEntry(&ModuleListHead, "ntbootdd.sys",
|
Success = WinLdrAllocateDataTableEntry(&ModuleListHead, "ntbootdd.sys",
|
||||||
"NTBOOTDD.SYS", ImageBase, &BootDdDTE);
|
"NTBOOTDD.SYS", ImageBase, &BootDdDTE);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
return EIO;
|
return EIO;
|
||||||
|
|
||||||
/* Add the PE part of freeldr.sys to the list of loaded executables, it
|
/* Add the PE part of freeldr.sys to the list of loaded executables, it
|
||||||
contains Scsiport* exports, imported by ntbootdd.sys */
|
contains Scsiport* exports, imported by ntbootdd.sys */
|
||||||
Status = WinLdrAllocateDataTableEntry(&ModuleListHead, "scsiport.sys",
|
Success = WinLdrAllocateDataTableEntry(&ModuleListHead, "scsiport.sys",
|
||||||
"FREELDR.SYS", &__ImageBase, &FreeldrDTE);
|
"FREELDR.SYS", &__ImageBase, &FreeldrDTE);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
{
|
{
|
||||||
RemoveEntryList(&BootDdDTE->InLoadOrderLinks);
|
RemoveEntryList(&BootDdDTE->InLoadOrderLinks);
|
||||||
return EIO;
|
return EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fix imports */
|
/* Fix imports */
|
||||||
Status = WinLdrScanImportDescriptorTable(&ModuleListHead, "", BootDdDTE);
|
Success = WinLdrScanImportDescriptorTable(&ModuleListHead, "", BootDdDTE);
|
||||||
|
|
||||||
/* Now unlinkt the DTEs, they won't be valid later */
|
/* Now unlinkt the DTEs, they won't be valid later */
|
||||||
RemoveEntryList(&BootDdDTE->InLoadOrderLinks);
|
RemoveEntryList(&BootDdDTE->InLoadOrderLinks);
|
||||||
RemoveEntryList(&FreeldrDTE->InLoadOrderLinks);
|
RemoveEntryList(&FreeldrDTE->InLoadOrderLinks);
|
||||||
|
|
||||||
if (!Status)
|
if (!Success)
|
||||||
return EIO;
|
return EIO;
|
||||||
|
|
||||||
/* Change imports to PA */
|
/* Change imports to PA */
|
||||||
|
@ -1635,14 +1635,13 @@ LoadBootDeviceDriver(VOID)
|
||||||
NtHeaders = RtlImageNtHeader(VaToPa(BootDdDTE->DllBase));
|
NtHeaders = RtlImageNtHeader(VaToPa(BootDdDTE->DllBase));
|
||||||
if (!NtHeaders)
|
if (!NtHeaders)
|
||||||
return EIO;
|
return EIO;
|
||||||
Status = (BOOLEAN)LdrRelocateImageWithBias(
|
Success = (BOOLEAN)LdrRelocateImageWithBias(VaToPa(BootDdDTE->DllBase),
|
||||||
VaToPa(BootDdDTE->DllBase),
|
|
||||||
NtHeaders->OptionalHeader.ImageBase - (ULONG_PTR)BootDdDTE->DllBase,
|
NtHeaders->OptionalHeader.ImageBase - (ULONG_PTR)BootDdDTE->DllBase,
|
||||||
"FreeLdr",
|
"FreeLdr",
|
||||||
TRUE,
|
TRUE,
|
||||||
TRUE, /* in case of conflict still return success */
|
TRUE, /* in case of conflict still return success */
|
||||||
FALSE);
|
FALSE);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
return EIO;
|
return EIO;
|
||||||
|
|
||||||
/* Call the entrypoint */
|
/* Call the entrypoint */
|
||||||
|
|
|
@ -918,7 +918,6 @@ BOOLEAN Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer)
|
||||||
ULONG InodeOffsetInBlock;
|
ULONG InodeOffsetInBlock;
|
||||||
CHAR ErrorString[80];
|
CHAR ErrorString[80];
|
||||||
EXT2_GROUP_DESC GroupDescriptor;
|
EXT2_GROUP_DESC GroupDescriptor;
|
||||||
BOOLEAN Status;
|
|
||||||
|
|
||||||
TRACE("Ext2ReadInode() Inode = %d\n", Inode);
|
TRACE("Ext2ReadInode() Inode = %d\n", Inode);
|
||||||
|
|
||||||
|
@ -949,11 +948,10 @@ BOOLEAN Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer)
|
||||||
TRACE("InodeBlockNumber (after group desc correction) = %d\n", InodeBlockNumber);
|
TRACE("InodeBlockNumber (after group desc correction) = %d\n", InodeBlockNumber);
|
||||||
|
|
||||||
// Read the block
|
// Read the block
|
||||||
Status = Ext2ReadPartialBlock(InodeBlockNumber,
|
if (!Ext2ReadPartialBlock(InodeBlockNumber,
|
||||||
(InodeOffsetInBlock * EXT2_INODE_SIZE(Ext2SuperBlock)),
|
(InodeOffsetInBlock * EXT2_INODE_SIZE(Ext2SuperBlock)),
|
||||||
sizeof(EXT2_INODE),
|
sizeof(EXT2_INODE),
|
||||||
InodeBuffer);
|
InodeBuffer))
|
||||||
if (!Status)
|
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1255,18 +1253,18 @@ ARC_STATUS Ext2Read(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
|
||||||
{
|
{
|
||||||
PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
|
PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
|
||||||
ULONGLONG BytesReadBig;
|
ULONGLONG BytesReadBig;
|
||||||
BOOLEAN ret;
|
BOOLEAN Success;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read data
|
// Read data
|
||||||
//
|
//
|
||||||
ret = Ext2ReadFileBig(FileHandle, N, &BytesReadBig, Buffer);
|
Success = Ext2ReadFileBig(FileHandle, N, &BytesReadBig, Buffer);
|
||||||
*Count = (ULONG)BytesReadBig;
|
*Count = (ULONG)BytesReadBig;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check for success
|
// Check for success
|
||||||
//
|
//
|
||||||
if (ret)
|
if (Success)
|
||||||
return ESUCCESS;
|
return ESUCCESS;
|
||||||
else
|
else
|
||||||
return EIO;
|
return EIO;
|
||||||
|
@ -1304,18 +1302,18 @@ const DEVVTBL* Ext2Mount(ULONG DeviceId)
|
||||||
EXT2_SUPER_BLOCK SuperBlock;
|
EXT2_SUPER_BLOCK SuperBlock;
|
||||||
LARGE_INTEGER Position;
|
LARGE_INTEGER Position;
|
||||||
ULONG Count;
|
ULONG Count;
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read the SuperBlock
|
// Read the SuperBlock
|
||||||
//
|
//
|
||||||
Position.HighPart = 0;
|
Position.HighPart = 0;
|
||||||
Position.LowPart = 2 * 512;
|
Position.LowPart = 2 * 512;
|
||||||
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
return NULL;
|
return NULL;
|
||||||
ret = ArcRead(DeviceId, &SuperBlock, sizeof(SuperBlock), &Count);
|
Status = ArcRead(DeviceId, &SuperBlock, sizeof(SuperBlock), &Count);
|
||||||
if (ret != ESUCCESS || Count != sizeof(SuperBlock))
|
if (Status != ESUCCESS || Count != sizeof(SuperBlock))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -28,7 +28,7 @@ DBG_DEFAULT_CHANNEL(FILESYSTEM);
|
||||||
ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONGLONG PartitionSectorCount);
|
ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONGLONG PartitionSectorCount);
|
||||||
PVOID FatBufferDirectory(PFAT_VOLUME_INFO Volume, ULONG DirectoryStartCluster, ULONG* EntryCountPointer, BOOLEAN RootDirectory);
|
PVOID FatBufferDirectory(PFAT_VOLUME_INFO Volume, ULONG DirectoryStartCluster, ULONG* EntryCountPointer, BOOLEAN RootDirectory);
|
||||||
BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID DirectoryBuffer, ULONG EntryCount, PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer);
|
BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID DirectoryBuffer, ULONG EntryCount, PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer);
|
||||||
LONG FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, ULONG DeviceId, PFAT_FILE_INFO FatFileInfoPointer);
|
ARC_STATUS FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, ULONG DeviceId, PFAT_FILE_INFO FatFileInfoPointer);
|
||||||
void FatParseShortFileName(PCHAR Buffer, PDIRENTRY DirEntry);
|
void FatParseShortFileName(PCHAR Buffer, PDIRENTRY DirEntry);
|
||||||
BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPointer);
|
BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPointer);
|
||||||
ULONG FatCountClustersInChain(PFAT_VOLUME_INFO Volume, ULONG StartCluster);
|
ULONG FatCountClustersInChain(PFAT_VOLUME_INFO Volume, ULONG StartCluster);
|
||||||
|
@ -762,7 +762,7 @@ static BOOLEAN FatXSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID D
|
||||||
* specified filename and fills in an FAT_FILE_INFO structure
|
* specified filename and fills in an FAT_FILE_INFO structure
|
||||||
* with info describing the file, etc. returns ARC error code
|
* with info describing the file, etc. returns ARC error code
|
||||||
*/
|
*/
|
||||||
LONG FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, ULONG DeviceId, PFAT_FILE_INFO FatFileInfoPointer)
|
ARC_STATUS FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, ULONG DeviceId, PFAT_FILE_INFO FatFileInfoPointer)
|
||||||
{
|
{
|
||||||
UINT32 i;
|
UINT32 i;
|
||||||
ULONG NumberOfPathParts;
|
ULONG NumberOfPathParts;
|
||||||
|
@ -912,7 +912,7 @@ BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPoi
|
||||||
UINT32 ThisFatEntOffset;
|
UINT32 ThisFatEntOffset;
|
||||||
ULONG SectorCount;
|
ULONG SectorCount;
|
||||||
PUCHAR ReadBuffer;
|
PUCHAR ReadBuffer;
|
||||||
BOOLEAN status = TRUE;
|
BOOLEAN Success = TRUE;
|
||||||
|
|
||||||
//TRACE("FatGetFatEntry() Retrieving FAT entry for cluster %d.\n", Cluster);
|
//TRACE("FatGetFatEntry() Retrieving FAT entry for cluster %d.\n", Cluster);
|
||||||
|
|
||||||
|
@ -946,7 +946,7 @@ BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPoi
|
||||||
|
|
||||||
if (!FatReadVolumeSectors(Volume, ThisFatSecNum, SectorCount, ReadBuffer))
|
if (!FatReadVolumeSectors(Volume, ThisFatSecNum, SectorCount, ReadBuffer))
|
||||||
{
|
{
|
||||||
status = FALSE;
|
Success = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -968,7 +968,7 @@ BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPoi
|
||||||
|
|
||||||
if (!FatReadVolumeSectors(Volume, ThisFatSecNum, 1, ReadBuffer))
|
if (!FatReadVolumeSectors(Volume, ThisFatSecNum, 1, ReadBuffer))
|
||||||
{
|
{
|
||||||
status = FALSE;
|
Success = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -997,7 +997,7 @@ BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPoi
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERR("Unknown FAT type %d\n", Volume->FatType);
|
ERR("Unknown FAT type %d\n", Volume->FatType);
|
||||||
status = FALSE;
|
Success = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1007,7 +1007,7 @@ BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPoi
|
||||||
|
|
||||||
*ClusterPointer = fat;
|
*ClusterPointer = fat;
|
||||||
|
|
||||||
return status;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG FatCountClustersInChain(PFAT_VOLUME_INFO Volume, ULONG StartCluster)
|
ULONG FatCountClustersInChain(PFAT_VOLUME_INFO Volume, ULONG StartCluster)
|
||||||
|
@ -1171,7 +1171,7 @@ BOOLEAN FatReadPartialCluster(PFAT_VOLUME_INFO Volume, ULONG ClusterNumber, ULON
|
||||||
ULONG ClusterStartSector;
|
ULONG ClusterStartSector;
|
||||||
ULONG SectorOffset, ReadSize, SectorCount;
|
ULONG SectorOffset, ReadSize, SectorCount;
|
||||||
PUCHAR ReadBuffer;
|
PUCHAR ReadBuffer;
|
||||||
BOOLEAN status = FALSE;
|
BOOLEAN Success = FALSE;
|
||||||
|
|
||||||
//TRACE("FatReadPartialCluster() ClusterNumber = %d StartingOffset = %d Length = %d Buffer = 0x%x\n", ClusterNumber, StartingOffset, Length, Buffer);
|
//TRACE("FatReadPartialCluster() ClusterNumber = %d StartingOffset = %d Length = %d Buffer = 0x%x\n", ClusterNumber, StartingOffset, Length, Buffer);
|
||||||
|
|
||||||
|
@ -1196,12 +1196,12 @@ BOOLEAN FatReadPartialCluster(PFAT_VOLUME_INFO Volume, ULONG ClusterNumber, ULON
|
||||||
if (FatReadVolumeSectors(Volume, ClusterStartSector + SectorOffset, SectorCount, ReadBuffer))
|
if (FatReadVolumeSectors(Volume, ClusterStartSector + SectorOffset, SectorCount, ReadBuffer))
|
||||||
{
|
{
|
||||||
memcpy(Buffer, ReadBuffer + StartingOffset, Length);
|
memcpy(Buffer, ReadBuffer + StartingOffset, Length);
|
||||||
status = TRUE;
|
Success = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
FrLdrTempFree(ReadBuffer, TAG_FAT_BUFFER);
|
FrLdrTempFree(ReadBuffer, TAG_FAT_BUFFER);
|
||||||
|
|
||||||
return status;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1367,7 +1367,7 @@ BOOLEAN FatReadVolumeSectors(PFAT_VOLUME_INFO Volume, ULONG SectorNumber, ULONG
|
||||||
{
|
{
|
||||||
LARGE_INTEGER Position;
|
LARGE_INTEGER Position;
|
||||||
ULONG Count;
|
ULONG Count;
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
//TRACE("FatReadVolumeSectors(): SectorNumber %d, SectorCount %d, Buffer %p\n",
|
//TRACE("FatReadVolumeSectors(): SectorNumber %d, SectorCount %d, Buffer %p\n",
|
||||||
// SectorNumber, SectorCount, Buffer);
|
// SectorNumber, SectorCount, Buffer);
|
||||||
|
@ -1376,8 +1376,8 @@ BOOLEAN FatReadVolumeSectors(PFAT_VOLUME_INFO Volume, ULONG SectorNumber, ULONG
|
||||||
// Seek to right position
|
// Seek to right position
|
||||||
//
|
//
|
||||||
Position.QuadPart = (ULONGLONG)SectorNumber * 512;
|
Position.QuadPart = (ULONGLONG)SectorNumber * 512;
|
||||||
ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
|
Status = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
TRACE("FatReadVolumeSectors() Failed to seek\n");
|
TRACE("FatReadVolumeSectors() Failed to seek\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1386,8 +1386,8 @@ BOOLEAN FatReadVolumeSectors(PFAT_VOLUME_INFO Volume, ULONG SectorNumber, ULONG
|
||||||
//
|
//
|
||||||
// Read data
|
// Read data
|
||||||
//
|
//
|
||||||
ret = ArcRead(Volume->DeviceId, Buffer, SectorCount * 512, &Count);
|
Status = ArcRead(Volume->DeviceId, Buffer, SectorCount * 512, &Count);
|
||||||
if (ret != ESUCCESS || Count != SectorCount * 512)
|
if (Status != ESUCCESS || Count != SectorCount * 512)
|
||||||
{
|
{
|
||||||
TRACE("FatReadVolumeSectors() Failed to read\n");
|
TRACE("FatReadVolumeSectors() Failed to read\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1430,7 +1430,7 @@ ARC_STATUS FatOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
||||||
PFAT_FILE_INFO FileHandle;
|
PFAT_FILE_INFO FileHandle;
|
||||||
ULONG DeviceId;
|
ULONG DeviceId;
|
||||||
BOOLEAN IsDirectory;
|
BOOLEAN IsDirectory;
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
if (OpenMode != OpenReadOnly && OpenMode != OpenDirectory)
|
if (OpenMode != OpenReadOnly && OpenMode != OpenDirectory)
|
||||||
return EACCES;
|
return EACCES;
|
||||||
|
@ -1441,8 +1441,8 @@ ARC_STATUS FatOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
||||||
TRACE("FatOpen() FileName = %s\n", Path);
|
TRACE("FatOpen() FileName = %s\n", Path);
|
||||||
|
|
||||||
RtlZeroMemory(&TempFileInfo, sizeof(TempFileInfo));
|
RtlZeroMemory(&TempFileInfo, sizeof(TempFileInfo));
|
||||||
ret = FatLookupFile(FatVolume, Path, DeviceId, &TempFileInfo);
|
Status = FatLookupFile(FatVolume, Path, DeviceId, &TempFileInfo);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1468,17 +1468,17 @@ ARC_STATUS FatOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
||||||
ARC_STATUS FatRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
|
ARC_STATUS FatRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
|
||||||
{
|
{
|
||||||
PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
|
PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
|
||||||
BOOLEAN ret;
|
BOOLEAN Success;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Call old read method
|
// Call old read method
|
||||||
//
|
//
|
||||||
ret = FatReadFile(FileHandle, N, Count, Buffer);
|
Success = FatReadFile(FileHandle, N, Count, Buffer);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check for success
|
// Check for success
|
||||||
//
|
//
|
||||||
if (ret)
|
if (Success)
|
||||||
return ESUCCESS;
|
return ESUCCESS;
|
||||||
else
|
else
|
||||||
return EIO;
|
return EIO;
|
||||||
|
@ -1522,7 +1522,7 @@ const DEVVTBL* FatMount(ULONG DeviceId)
|
||||||
LARGE_INTEGER Position;
|
LARGE_INTEGER Position;
|
||||||
ULONG Count;
|
ULONG Count;
|
||||||
ULARGE_INTEGER SectorCount;
|
ULARGE_INTEGER SectorCount;
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate data for volume information
|
// Allocate data for volume information
|
||||||
|
@ -1537,14 +1537,14 @@ const DEVVTBL* FatMount(ULONG DeviceId)
|
||||||
//
|
//
|
||||||
Position.HighPart = 0;
|
Position.HighPart = 0;
|
||||||
Position.LowPart = 0;
|
Position.LowPart = 0;
|
||||||
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
FrLdrTempFree(Volume, TAG_FAT_VOLUME);
|
FrLdrTempFree(Volume, TAG_FAT_VOLUME);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ret = ArcRead(DeviceId, Buffer, sizeof(Buffer), &Count);
|
Status = ArcRead(DeviceId, Buffer, sizeof(Buffer), &Count);
|
||||||
if (ret != ESUCCESS || Count != sizeof(Buffer))
|
if (Status != ESUCCESS || Count != sizeof(Buffer))
|
||||||
{
|
{
|
||||||
FrLdrTempFree(Volume, TAG_FAT_VOLUME);
|
FrLdrTempFree(Volume, TAG_FAT_VOLUME);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1565,8 +1565,8 @@ const DEVVTBL* FatMount(ULONG DeviceId)
|
||||||
//
|
//
|
||||||
// Determine sector count
|
// Determine sector count
|
||||||
//
|
//
|
||||||
ret = ArcGetFileInformation(DeviceId, &FileInformation);
|
Status = ArcGetFileInformation(DeviceId, &FileInformation);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
FrLdrTempFree(Volume, TAG_FAT_VOLUME);
|
FrLdrTempFree(Volume, TAG_FAT_VOLUME);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -57,7 +57,8 @@ static LIST_ENTRY DeviceListHead;
|
||||||
|
|
||||||
ARC_STATUS ArcOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
ARC_STATUS ArcOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
||||||
{
|
{
|
||||||
ULONG Count, i, ret;
|
ARC_STATUS Status;
|
||||||
|
ULONG Count, i;
|
||||||
PLIST_ENTRY pEntry;
|
PLIST_ENTRY pEntry;
|
||||||
DEVICE* pDevice;
|
DEVICE* pDevice;
|
||||||
CHAR* DeviceName;
|
CHAR* DeviceName;
|
||||||
|
@ -132,11 +133,11 @@ ARC_STATUS ArcOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
||||||
|
|
||||||
/* Try to open the device */
|
/* Try to open the device */
|
||||||
FileData[DeviceId].FuncTable = pDevice->FuncTable;
|
FileData[DeviceId].FuncTable = pDevice->FuncTable;
|
||||||
ret = pDevice->FuncTable->Open(pDevice->Prefix, DeviceOpenMode, &DeviceId);
|
Status = pDevice->FuncTable->Open(pDevice->Prefix, DeviceOpenMode, &DeviceId);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
FileData[DeviceId].FuncTable = NULL;
|
FileData[DeviceId].FuncTable = NULL;
|
||||||
return ret;
|
return Status;
|
||||||
}
|
}
|
||||||
else if (!*FileName)
|
else if (!*FileName)
|
||||||
{
|
{
|
||||||
|
@ -205,31 +206,31 @@ ARC_STATUS ArcOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
||||||
FileData[i].FuncTable = FileData[DeviceId].FileFuncTable;
|
FileData[i].FuncTable = FileData[DeviceId].FileFuncTable;
|
||||||
FileData[i].DeviceId = DeviceId;
|
FileData[i].DeviceId = DeviceId;
|
||||||
*FileId = i;
|
*FileId = i;
|
||||||
ret = FileData[i].FuncTable->Open(FileName, OpenMode, FileId);
|
Status = FileData[i].FuncTable->Open(FileName, OpenMode, FileId);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
FileData[i].FuncTable = NULL;
|
FileData[i].FuncTable = NULL;
|
||||||
*FileId = MAX_FDS;
|
*FileId = MAX_FDS;
|
||||||
}
|
}
|
||||||
return ret;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ARC_STATUS ArcClose(ULONG FileId)
|
ARC_STATUS ArcClose(ULONG FileId)
|
||||||
{
|
{
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
if (FileId >= MAX_FDS || !FileData[FileId].FuncTable)
|
if (FileId >= MAX_FDS || !FileData[FileId].FuncTable)
|
||||||
return EBADF;
|
return EBADF;
|
||||||
|
|
||||||
ret = FileData[FileId].FuncTable->Close(FileId);
|
Status = FileData[FileId].FuncTable->Close(FileId);
|
||||||
|
|
||||||
if (ret == ESUCCESS)
|
if (Status == ESUCCESS)
|
||||||
{
|
{
|
||||||
FileData[FileId].FuncTable = NULL;
|
FileData[FileId].FuncTable = NULL;
|
||||||
FileData[FileId].Specific = NULL;
|
FileData[FileId].Specific = NULL;
|
||||||
FileData[FileId].DeviceId = -1;
|
FileData[FileId].DeviceId = -1;
|
||||||
}
|
}
|
||||||
return ret;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ARC_STATUS ArcRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
|
ARC_STATUS ArcRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
|
||||||
|
@ -265,7 +266,7 @@ PFILE FsOpenFile(PCSTR FileName)
|
||||||
{
|
{
|
||||||
CHAR FullPath[MAX_PATH] = "";
|
CHAR FullPath[MAX_PATH] = "";
|
||||||
ULONG FileId;
|
ULONG FileId;
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Print status message
|
// Print status message
|
||||||
|
@ -293,12 +294,12 @@ PFILE FsOpenFile(PCSTR FileName)
|
||||||
//
|
//
|
||||||
// Open the file
|
// Open the file
|
||||||
//
|
//
|
||||||
ret = ArcOpen(FullPath, OpenReadOnly, &FileId);
|
Status = ArcOpen(FullPath, OpenReadOnly, &FileId);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check for success
|
// Check for success
|
||||||
//
|
//
|
||||||
if (ret == ESUCCESS)
|
if (Status == ESUCCESS)
|
||||||
return (PFILE)FileId;
|
return (PFILE)FileId;
|
||||||
else
|
else
|
||||||
return (PFILE)0;
|
return (PFILE)0;
|
||||||
|
@ -343,17 +344,17 @@ ULONG FsGetFileSize(PFILE FileHandle)
|
||||||
{
|
{
|
||||||
ULONG FileId = (ULONG)FileHandle;
|
ULONG FileId = (ULONG)FileHandle;
|
||||||
FILEINFORMATION Information;
|
FILEINFORMATION Information;
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Query file informations
|
// Query file informations
|
||||||
//
|
//
|
||||||
ret = ArcGetFileInformation(FileId, &Information);
|
Status = ArcGetFileInformation(FileId, &Information);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check for error
|
// Check for error
|
||||||
//
|
//
|
||||||
if (ret != ESUCCESS || Information.EndingAddress.HighPart != 0)
|
if (Status != ESUCCESS || Information.EndingAddress.HighPart != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -96,14 +96,14 @@ static BOOLEAN IsoSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG Dire
|
||||||
* function returns an ARC error code. The directory is specified
|
* function returns an ARC error code. The directory is specified
|
||||||
* by its starting sector and length.
|
* by its starting sector and length.
|
||||||
*/
|
*/
|
||||||
static LONG IsoBufferDirectory(ULONG DeviceId, ULONG DirectoryStartSector, ULONG DirectoryLength,
|
static ARC_STATUS IsoBufferDirectory(ULONG DeviceId, ULONG DirectoryStartSector, ULONG DirectoryLength,
|
||||||
PVOID* pDirectoryBuffer)
|
PVOID* pDirectoryBuffer)
|
||||||
{
|
{
|
||||||
PVOID DirectoryBuffer;
|
PVOID DirectoryBuffer;
|
||||||
ULONG SectorCount;
|
ULONG SectorCount;
|
||||||
LARGE_INTEGER Position;
|
LARGE_INTEGER Position;
|
||||||
ULONG Count;
|
ULONG Count;
|
||||||
ULONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
TRACE("IsoBufferDirectory() DirectoryStartSector = %d DirectoryLength = %d\n", DirectoryStartSector, DirectoryLength);
|
TRACE("IsoBufferDirectory() DirectoryStartSector = %d DirectoryLength = %d\n", DirectoryStartSector, DirectoryLength);
|
||||||
|
|
||||||
|
@ -123,14 +123,14 @@ static LONG IsoBufferDirectory(ULONG DeviceId, ULONG DirectoryStartSector, ULONG
|
||||||
//
|
//
|
||||||
Position.HighPart = 0;
|
Position.HighPart = 0;
|
||||||
Position.LowPart = DirectoryStartSector * SECTORSIZE;
|
Position.LowPart = DirectoryStartSector * SECTORSIZE;
|
||||||
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
FrLdrTempFree(DirectoryBuffer, TAG_ISO_BUFFER);
|
FrLdrTempFree(DirectoryBuffer, TAG_ISO_BUFFER);
|
||||||
return ret;
|
return Status;
|
||||||
}
|
}
|
||||||
ret = ArcRead(DeviceId, DirectoryBuffer, SectorCount * SECTORSIZE, &Count);
|
Status = ArcRead(DeviceId, DirectoryBuffer, SectorCount * SECTORSIZE, &Count);
|
||||||
if (ret != ESUCCESS || Count != SectorCount * SECTORSIZE)
|
if (Status != ESUCCESS || Count != SectorCount * SECTORSIZE)
|
||||||
{
|
{
|
||||||
FrLdrTempFree(DirectoryBuffer, TAG_ISO_BUFFER);
|
FrLdrTempFree(DirectoryBuffer, TAG_ISO_BUFFER);
|
||||||
return EIO;
|
return EIO;
|
||||||
|
@ -147,7 +147,7 @@ static LONG IsoBufferDirectory(ULONG DeviceId, ULONG DirectoryStartSector, ULONG
|
||||||
* specified filename and fills in an ISO_FILE_INFO structure
|
* specified filename and fills in an ISO_FILE_INFO structure
|
||||||
* with info describing the file, etc. returns ARC error code
|
* with info describing the file, etc. returns ARC error code
|
||||||
*/
|
*/
|
||||||
static LONG IsoLookupFile(PCSTR FileName, ULONG DeviceId, PISO_FILE_INFO IsoFileInfoPointer)
|
static ARC_STATUS IsoLookupFile(PCSTR FileName, ULONG DeviceId, PISO_FILE_INFO IsoFileInfoPointer)
|
||||||
{
|
{
|
||||||
UCHAR Buffer[SECTORSIZE];
|
UCHAR Buffer[SECTORSIZE];
|
||||||
PPVD Pvd = (PPVD)Buffer;
|
PPVD Pvd = (PPVD)Buffer;
|
||||||
|
@ -160,7 +160,7 @@ static LONG IsoLookupFile(PCSTR FileName, ULONG DeviceId, PISO_FILE_INFO IsoFile
|
||||||
ISO_FILE_INFO IsoFileInfo;
|
ISO_FILE_INFO IsoFileInfo;
|
||||||
LARGE_INTEGER Position;
|
LARGE_INTEGER Position;
|
||||||
ULONG Count;
|
ULONG Count;
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
TRACE("IsoLookupFile() FileName = %s\n", FileName);
|
TRACE("IsoLookupFile() FileName = %s\n", FileName);
|
||||||
|
|
||||||
|
@ -172,11 +172,11 @@ static LONG IsoLookupFile(PCSTR FileName, ULONG DeviceId, PISO_FILE_INFO IsoFile
|
||||||
//
|
//
|
||||||
Position.HighPart = 0;
|
Position.HighPart = 0;
|
||||||
Position.LowPart = 16 * SECTORSIZE;
|
Position.LowPart = 16 * SECTORSIZE;
|
||||||
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
return ret;
|
return Status;
|
||||||
ret = ArcRead(DeviceId, Pvd, SECTORSIZE, &Count);
|
Status = ArcRead(DeviceId, Pvd, SECTORSIZE, &Count);
|
||||||
if (ret != ESUCCESS || Count < sizeof(PVD))
|
if (Status != ESUCCESS || Count < sizeof(PVD))
|
||||||
return EIO;
|
return EIO;
|
||||||
|
|
||||||
DirectorySector = Pvd->RootDirRecord.ExtentLocationL;
|
DirectorySector = Pvd->RootDirRecord.ExtentLocationL;
|
||||||
|
@ -208,9 +208,9 @@ static LONG IsoLookupFile(PCSTR FileName, ULONG DeviceId, PISO_FILE_INFO IsoFile
|
||||||
//
|
//
|
||||||
// Buffer the directory contents
|
// Buffer the directory contents
|
||||||
//
|
//
|
||||||
ret = IsoBufferDirectory(DeviceId, DirectorySector, DirectoryLength, &DirectoryBuffer);
|
Status = IsoBufferDirectory(DeviceId, DirectorySector, DirectoryLength, &DirectoryBuffer);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
return ret;
|
return Status;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Search for file name in directory
|
// Search for file name in directory
|
||||||
|
@ -268,7 +268,7 @@ ARC_STATUS IsoOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
||||||
ISO_FILE_INFO TempFileInfo;
|
ISO_FILE_INFO TempFileInfo;
|
||||||
PISO_FILE_INFO FileHandle;
|
PISO_FILE_INFO FileHandle;
|
||||||
ULONG DeviceId;
|
ULONG DeviceId;
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
if (OpenMode != OpenReadOnly)
|
if (OpenMode != OpenReadOnly)
|
||||||
return EACCES;
|
return EACCES;
|
||||||
|
@ -278,8 +278,8 @@ ARC_STATUS IsoOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
||||||
TRACE("IsoOpen() FileName = %s\n", Path);
|
TRACE("IsoOpen() FileName = %s\n", Path);
|
||||||
|
|
||||||
RtlZeroMemory(&TempFileInfo, sizeof(TempFileInfo));
|
RtlZeroMemory(&TempFileInfo, sizeof(TempFileInfo));
|
||||||
ret = IsoLookupFile(Path, DeviceId, &TempFileInfo);
|
Status = IsoLookupFile(Path, DeviceId, &TempFileInfo);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
|
|
||||||
FileHandle = FrLdrTempAlloc(sizeof(ISO_FILE_INFO), TAG_ISO_FILE);
|
FileHandle = FrLdrTempAlloc(sizeof(ISO_FILE_INFO), TAG_ISO_FILE);
|
||||||
|
@ -304,7 +304,7 @@ ARC_STATUS IsoRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
|
||||||
ULONG LengthInSector;
|
ULONG LengthInSector;
|
||||||
ULONG NumberOfSectors;
|
ULONG NumberOfSectors;
|
||||||
ULONG BytesRead;
|
ULONG BytesRead;
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
TRACE("IsoRead() Buffer = %p, N = %lu\n", Buffer, N);
|
TRACE("IsoRead() Buffer = %p, N = %lu\n", Buffer, N);
|
||||||
|
|
||||||
|
@ -378,13 +378,13 @@ ARC_STATUS IsoRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
|
||||||
//
|
//
|
||||||
Position.HighPart = 0;
|
Position.HighPart = 0;
|
||||||
Position.LowPart = SectorNumber * SECTORSIZE;
|
Position.LowPart = SectorNumber * SECTORSIZE;
|
||||||
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
return ret;
|
return Status;
|
||||||
}
|
}
|
||||||
ret = ArcRead(DeviceId, SectorBuffer, SECTORSIZE, &BytesRead);
|
Status = ArcRead(DeviceId, SectorBuffer, SECTORSIZE, &BytesRead);
|
||||||
if (ret != ESUCCESS || BytesRead != SECTORSIZE)
|
if (Status != ESUCCESS || BytesRead != SECTORSIZE)
|
||||||
{
|
{
|
||||||
return EIO;
|
return EIO;
|
||||||
}
|
}
|
||||||
|
@ -412,13 +412,13 @@ ARC_STATUS IsoRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
|
||||||
//
|
//
|
||||||
Position.HighPart = 0;
|
Position.HighPart = 0;
|
||||||
Position.LowPart = SectorNumber * SECTORSIZE;
|
Position.LowPart = SectorNumber * SECTORSIZE;
|
||||||
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
return ret;
|
return Status;
|
||||||
}
|
}
|
||||||
ret = ArcRead(DeviceId, Buffer, NumberOfSectors * SECTORSIZE, &BytesRead);
|
Status = ArcRead(DeviceId, Buffer, NumberOfSectors * SECTORSIZE, &BytesRead);
|
||||||
if (ret != ESUCCESS || BytesRead != NumberOfSectors * SECTORSIZE)
|
if (Status != ESUCCESS || BytesRead != NumberOfSectors * SECTORSIZE)
|
||||||
{
|
{
|
||||||
return EIO;
|
return EIO;
|
||||||
}
|
}
|
||||||
|
@ -441,13 +441,13 @@ ARC_STATUS IsoRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
|
||||||
//
|
//
|
||||||
Position.HighPart = 0;
|
Position.HighPart = 0;
|
||||||
Position.LowPart = SectorNumber * SECTORSIZE;
|
Position.LowPart = SectorNumber * SECTORSIZE;
|
||||||
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
return ret;
|
return Status;
|
||||||
}
|
}
|
||||||
ret = ArcRead(DeviceId, SectorBuffer, SECTORSIZE, &BytesRead);
|
Status = ArcRead(DeviceId, SectorBuffer, SECTORSIZE, &BytesRead);
|
||||||
if (ret != ESUCCESS || BytesRead != SECTORSIZE)
|
if (Status != ESUCCESS || BytesRead != SECTORSIZE)
|
||||||
{
|
{
|
||||||
return EIO;
|
return EIO;
|
||||||
}
|
}
|
||||||
|
@ -494,18 +494,18 @@ const DEVVTBL* IsoMount(ULONG DeviceId)
|
||||||
PPVD Pvd = (PPVD)Buffer;
|
PPVD Pvd = (PPVD)Buffer;
|
||||||
LARGE_INTEGER Position;
|
LARGE_INTEGER Position;
|
||||||
ULONG Count;
|
ULONG Count;
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read The Primary Volume Descriptor
|
// Read The Primary Volume Descriptor
|
||||||
//
|
//
|
||||||
Position.HighPart = 0;
|
Position.HighPart = 0;
|
||||||
Position.LowPart = 16 * SECTORSIZE;
|
Position.LowPart = 16 * SECTORSIZE;
|
||||||
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
return NULL;
|
return NULL;
|
||||||
ret = ArcRead(DeviceId, Pvd, SECTORSIZE, &Count);
|
Status = ArcRead(DeviceId, Pvd, SECTORSIZE, &Count);
|
||||||
if (ret != ESUCCESS || Count < sizeof(PVD))
|
if (Status != ESUCCESS || Count < sizeof(PVD))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -147,7 +147,7 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON
|
||||||
LARGE_INTEGER Position;
|
LARGE_INTEGER Position;
|
||||||
ULONG Count;
|
ULONG Count;
|
||||||
ULONG ReadLength;
|
ULONG ReadLength;
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
TRACE("NtfsDiskRead - Offset: %I64d Length: %I64d\n", Offset, Length);
|
TRACE("NtfsDiskRead - Offset: %I64d Length: %I64d\n", Offset, Length);
|
||||||
|
|
||||||
|
@ -157,11 +157,11 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON
|
||||||
if (Offset % Volume->BootSector.BytesPerSector)
|
if (Offset % Volume->BootSector.BytesPerSector)
|
||||||
{
|
{
|
||||||
Position.QuadPart = Offset & ~(Volume->BootSector.BytesPerSector - 1);
|
Position.QuadPart = Offset & ~(Volume->BootSector.BytesPerSector - 1);
|
||||||
ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
|
Status = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
ret = ArcRead(Volume->DeviceId, Volume->TemporarySector, Volume->BootSector.BytesPerSector, &Count);
|
Status = ArcRead(Volume->DeviceId, Volume->TemporarySector, Volume->BootSector.BytesPerSector, &Count);
|
||||||
if (ret != ESUCCESS || Count != Volume->BootSector.BytesPerSector)
|
if (Status != ESUCCESS || Count != Volume->BootSector.BytesPerSector)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
ReadLength = (USHORT)min(Length, Volume->BootSector.BytesPerSector - (Offset % Volume->BootSector.BytesPerSector));
|
ReadLength = (USHORT)min(Length, Volume->BootSector.BytesPerSector - (Offset % Volume->BootSector.BytesPerSector));
|
||||||
|
|
||||||
|
@ -186,12 +186,12 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON
|
||||||
if (Length >= Volume->BootSector.BytesPerSector)
|
if (Length >= Volume->BootSector.BytesPerSector)
|
||||||
{
|
{
|
||||||
Position.QuadPart = Offset;
|
Position.QuadPart = Offset;
|
||||||
ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
|
Status = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
ReadLength = Length & ~(Volume->BootSector.BytesPerSector - 1);
|
ReadLength = Length & ~(Volume->BootSector.BytesPerSector - 1);
|
||||||
ret = ArcRead(Volume->DeviceId, Buffer, ReadLength, &Count);
|
Status = ArcRead(Volume->DeviceId, Buffer, ReadLength, &Count);
|
||||||
if (ret != ESUCCESS || Count != ReadLength)
|
if (Status != ESUCCESS || Count != ReadLength)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -208,11 +208,11 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON
|
||||||
if (Length)
|
if (Length)
|
||||||
{
|
{
|
||||||
Position.QuadPart = Offset;
|
Position.QuadPart = Offset;
|
||||||
ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
|
Status = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
ret = ArcRead(Volume->DeviceId, Buffer, (ULONG)Length, &Count);
|
Status = ArcRead(Volume->DeviceId, Buffer, (ULONG)Length, &Count);
|
||||||
if (ret != ESUCCESS || Count != Length)
|
if (Status != ESUCCESS || Count != Length)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -880,7 +880,7 @@ const DEVVTBL* NtfsMount(ULONG DeviceId)
|
||||||
PNTFS_VOLUME_INFO Volume;
|
PNTFS_VOLUME_INFO Volume;
|
||||||
LARGE_INTEGER Position;
|
LARGE_INTEGER Position;
|
||||||
ULONG Count;
|
ULONG Count;
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate data for volume information
|
// Allocate data for volume information
|
||||||
|
@ -895,14 +895,14 @@ const DEVVTBL* NtfsMount(ULONG DeviceId)
|
||||||
//
|
//
|
||||||
Position.HighPart = 0;
|
Position.HighPart = 0;
|
||||||
Position.LowPart = 0;
|
Position.LowPart = 0;
|
||||||
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
|
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ret = ArcRead(DeviceId, &Volume->BootSector, sizeof(Volume->BootSector), &Count);
|
Status = ArcRead(DeviceId, &Volume->BootSector, sizeof(Volume->BootSector), &Count);
|
||||||
if (ret != ESUCCESS || Count != sizeof(Volume->BootSector))
|
if (Status != ESUCCESS || Count != sizeof(Volume->BootSector))
|
||||||
{
|
{
|
||||||
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
|
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -947,16 +947,16 @@ const DEVVTBL* NtfsMount(ULONG DeviceId)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
Position.QuadPart = Volume->BootSector.MftLocation * Volume->ClusterSize;
|
Position.QuadPart = Volume->BootSector.MftLocation * Volume->ClusterSize;
|
||||||
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
FileSystemError("Failed to seek to Master File Table record.");
|
FileSystemError("Failed to seek to Master File Table record.");
|
||||||
FrLdrTempFree(Volume->MasterFileTable, TAG_NTFS_MFT);
|
FrLdrTempFree(Volume->MasterFileTable, TAG_NTFS_MFT);
|
||||||
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
|
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ret = ArcRead(DeviceId, Volume->MasterFileTable, Volume->MftRecordSize, &Count);
|
Status = ArcRead(DeviceId, Volume->MasterFileTable, Volume->MftRecordSize, &Count);
|
||||||
if (ret != ESUCCESS || Count != Volume->MftRecordSize)
|
if (Status != ESUCCESS || Count != Volume->MftRecordSize)
|
||||||
{
|
{
|
||||||
FileSystemError("Failed to read the Master File Table record.");
|
FileSystemError("Failed to read the Master File Table record.");
|
||||||
FrLdrTempFree(Volume->MasterFileTable, TAG_NTFS_MFT);
|
FrLdrTempFree(Volume->MasterFileTable, TAG_NTFS_MFT);
|
||||||
|
|
|
@ -350,20 +350,20 @@ static BOOLEAN GetCachedInfo(VOID)
|
||||||
BOOLEAN PxeInit(VOID)
|
BOOLEAN PxeInit(VOID)
|
||||||
{
|
{
|
||||||
static BOOLEAN Initialized = FALSE;
|
static BOOLEAN Initialized = FALSE;
|
||||||
static BOOLEAN Status = FALSE;
|
static BOOLEAN Success = FALSE;
|
||||||
|
|
||||||
// Do initialization only once
|
// Do initialization only once
|
||||||
if (Initialized)
|
if (Initialized)
|
||||||
return Status;
|
return Success;
|
||||||
Initialized = TRUE;
|
Initialized = TRUE;
|
||||||
|
|
||||||
// Check if PXE is available
|
// Check if PXE is available
|
||||||
if (GetPxeStructure() && GetCachedInfo())
|
if (GetPxeStructure() && GetCachedInfo())
|
||||||
{
|
{
|
||||||
FsRegisterDevice("net(0)", &PxeDiskVtbl);
|
FsRegisterDevice("net(0)", &PxeDiskVtbl);
|
||||||
Status = TRUE;
|
Success = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -944,7 +944,7 @@ InfOpenFile(
|
||||||
ULONG FileSize, Count;
|
ULONG FileSize, Count;
|
||||||
PINFCACHE Cache;
|
PINFCACHE Cache;
|
||||||
BOOLEAN Success;
|
BOOLEAN Success;
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
|
|
||||||
*InfHandle = NULL;
|
*InfHandle = NULL;
|
||||||
*ErrorLine = (ULONG) - 1;
|
*ErrorLine = (ULONG) - 1;
|
||||||
|
@ -952,8 +952,8 @@ InfOpenFile(
|
||||||
//
|
//
|
||||||
// Open the .inf file
|
// Open the .inf file
|
||||||
//
|
//
|
||||||
ret = ArcOpen((PCHAR)FileName, OpenReadOnly, &FileId);
|
Status = ArcOpen((PCHAR)FileName, OpenReadOnly, &FileId);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -961,8 +961,8 @@ InfOpenFile(
|
||||||
//
|
//
|
||||||
// Query file size
|
// Query file size
|
||||||
//
|
//
|
||||||
ret = ArcGetFileInformation(FileId, &Information);
|
Status = ArcGetFileInformation(FileId, &Information);
|
||||||
if ((ret != ESUCCESS) || (Information.EndingAddress.HighPart != 0))
|
if ((Status != ESUCCESS) || (Information.EndingAddress.HighPart != 0))
|
||||||
{
|
{
|
||||||
ArcClose(FileId);
|
ArcClose(FileId);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -982,8 +982,8 @@ InfOpenFile(
|
||||||
//
|
//
|
||||||
// Read file into memory
|
// Read file into memory
|
||||||
//
|
//
|
||||||
ret = ArcRead(FileId, FileBuffer, FileSize, &Count);
|
Status = ArcRead(FileId, FileBuffer, FileSize, &Count);
|
||||||
if ((ret != ESUCCESS) || (Count != FileSize))
|
if ((Status != ESUCCESS) || (Count != FileSize))
|
||||||
{
|
{
|
||||||
ArcClose(FileId);
|
ArcClose(FileId);
|
||||||
FrLdrTempFree(FileBuffer, TAG_INF_FILE);
|
FrLdrTempFree(FileBuffer, TAG_INF_FILE);
|
||||||
|
|
|
@ -21,10 +21,9 @@
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
DBG_DEFAULT_CHANNEL(INIFILE);
|
DBG_DEFAULT_CHANNEL(INIFILE);
|
||||||
|
|
||||||
static LONG IniOpenIniFile(ULONG* FileId)
|
static ARC_STATUS IniOpenIniFile(ULONG* FileId)
|
||||||
{
|
{
|
||||||
CHAR FreeldrPath[MAX_PATH];
|
CHAR FreeldrPath[MAX_PATH];
|
||||||
LONG ret;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create full freeldr.ini path
|
// Create full freeldr.ini path
|
||||||
|
@ -33,9 +32,7 @@ static LONG IniOpenIniFile(ULONG* FileId)
|
||||||
strcat(FreeldrPath, "\\freeldr.ini");
|
strcat(FreeldrPath, "\\freeldr.ini");
|
||||||
|
|
||||||
// Try to open freeldr.ini
|
// Try to open freeldr.ini
|
||||||
ret = ArcOpen(FreeldrPath, OpenReadOnly, FileId);
|
return ArcOpen(FreeldrPath, OpenReadOnly, FileId);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN IniFileInitialize(VOID)
|
BOOLEAN IniFileInitialize(VOID)
|
||||||
|
@ -44,15 +41,15 @@ BOOLEAN IniFileInitialize(VOID)
|
||||||
ULONG FileId; // File handle for freeldr.ini
|
ULONG FileId; // File handle for freeldr.ini
|
||||||
PCHAR FreeLoaderIniFileData;
|
PCHAR FreeLoaderIniFileData;
|
||||||
ULONG FreeLoaderIniFileSize, Count;
|
ULONG FreeLoaderIniFileSize, Count;
|
||||||
LONG ret;
|
ARC_STATUS Status;
|
||||||
BOOLEAN Success;
|
BOOLEAN Success;
|
||||||
TRACE("IniFileInitialize()\n");
|
TRACE("IniFileInitialize()\n");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Open freeldr.ini
|
// Open freeldr.ini
|
||||||
//
|
//
|
||||||
ret = IniOpenIniFile(&FileId);
|
Status = IniOpenIniFile(&FileId);
|
||||||
if (ret != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
UiMessageBoxCritical("Error opening freeldr.ini or file not found.\nYou need to re-install FreeLoader.");
|
UiMessageBoxCritical("Error opening freeldr.ini or file not found.\nYou need to re-install FreeLoader.");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -61,8 +58,8 @@ BOOLEAN IniFileInitialize(VOID)
|
||||||
//
|
//
|
||||||
// Get the file size
|
// Get the file size
|
||||||
//
|
//
|
||||||
ret = ArcGetFileInformation(FileId, &FileInformation);
|
Status = ArcGetFileInformation(FileId, &FileInformation);
|
||||||
if (ret != ESUCCESS || FileInformation.EndingAddress.HighPart != 0)
|
if (Status != ESUCCESS || FileInformation.EndingAddress.HighPart != 0)
|
||||||
{
|
{
|
||||||
UiMessageBoxCritical("Error while getting informations about freeldr.ini.\nYou need to re-install FreeLoader.");
|
UiMessageBoxCritical("Error while getting informations about freeldr.ini.\nYou need to re-install FreeLoader.");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -83,8 +80,8 @@ BOOLEAN IniFileInitialize(VOID)
|
||||||
//
|
//
|
||||||
// Read freeldr.ini off the disk
|
// Read freeldr.ini off the disk
|
||||||
//
|
//
|
||||||
ret = ArcRead(FileId, FreeLoaderIniFileData, FreeLoaderIniFileSize, &Count);
|
Status = ArcRead(FileId, FreeLoaderIniFileData, FreeLoaderIniFileSize, &Count);
|
||||||
if (ret != ESUCCESS || Count != FreeLoaderIniFileSize)
|
if (Status != ESUCCESS || Count != FreeLoaderIniFileSize)
|
||||||
{
|
{
|
||||||
UiMessageBoxCritical("Error while reading freeldr.ini.");
|
UiMessageBoxCritical("Error while reading freeldr.ini.");
|
||||||
ArcClose(FileId);
|
ArcClose(FileId);
|
||||||
|
|
|
@ -103,7 +103,7 @@ WinLdrScanImportDescriptorTable(IN OUT PLIST_ENTRY ModuleListHead,
|
||||||
PIMAGE_IMPORT_DESCRIPTOR ImportTable;
|
PIMAGE_IMPORT_DESCRIPTOR ImportTable;
|
||||||
ULONG ImportTableSize;
|
ULONG ImportTableSize;
|
||||||
PCH ImportName;
|
PCH ImportName;
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
|
|
||||||
/* Get a pointer to the import table of this image */
|
/* Get a pointer to the import table of this image */
|
||||||
ImportTable = (PIMAGE_IMPORT_DESCRIPTOR)RtlImageDirectoryEntryToData(VaToPa(ScanDTE->DllBase),
|
ImportTable = (PIMAGE_IMPORT_DESCRIPTOR)RtlImageDirectoryEntryToData(VaToPa(ScanDTE->DllBase),
|
||||||
|
@ -136,31 +136,29 @@ WinLdrScanImportDescriptorTable(IN OUT PLIST_ENTRY ModuleListHead,
|
||||||
/* Load the DLL if it is not already loaded */
|
/* Load the DLL if it is not already loaded */
|
||||||
if (!WinLdrCheckForLoadedDll(ModuleListHead, ImportName, &DataTableEntry))
|
if (!WinLdrCheckForLoadedDll(ModuleListHead, ImportName, &DataTableEntry))
|
||||||
{
|
{
|
||||||
Status = WinLdrpLoadAndScanReferencedDll(ModuleListHead,
|
Success = WinLdrpLoadAndScanReferencedDll(ModuleListHead,
|
||||||
DirectoryPath,
|
DirectoryPath,
|
||||||
ImportName,
|
ImportName,
|
||||||
&DataTableEntry);
|
&DataTableEntry);
|
||||||
|
if (!Success)
|
||||||
if (!Status)
|
|
||||||
{
|
{
|
||||||
ERR("WinLdrpLoadAndScanReferencedDll() failed\n");
|
ERR("WinLdrpLoadAndScanReferencedDll() failed\n");
|
||||||
return Status;
|
return Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Scan its import address table */
|
/* Scan its import address table */
|
||||||
Status = WinLdrpScanImportAddressTable(
|
Success = WinLdrpScanImportAddressTable(ModuleListHead,
|
||||||
ModuleListHead,
|
|
||||||
DataTableEntry->DllBase,
|
DataTableEntry->DllBase,
|
||||||
ScanDTE->DllBase,
|
ScanDTE->DllBase,
|
||||||
(PIMAGE_THUNK_DATA)RVA(ScanDTE->DllBase, ImportTable->FirstThunk),
|
(PIMAGE_THUNK_DATA)RVA(ScanDTE->DllBase, ImportTable->FirstThunk),
|
||||||
DirectoryPath);
|
DirectoryPath);
|
||||||
|
|
||||||
if (!Status)
|
if (!Success)
|
||||||
{
|
{
|
||||||
ERR("WinLdrpScanImportAddressTable() failed: ImportName = '%s', DirectoryPath = '%s'\n",
|
ERR("WinLdrpScanImportAddressTable() failed: ImportName = '%s', DirectoryPath = '%s'\n",
|
||||||
ImportName, DirectoryPath);
|
ImportName, DirectoryPath);
|
||||||
return Status;
|
return Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +273,7 @@ WinLdrLoadImage(IN PCHAR FileName,
|
||||||
PIMAGE_NT_HEADERS NtHeaders;
|
PIMAGE_NT_HEADERS NtHeaders;
|
||||||
PIMAGE_SECTION_HEADER SectionHeader;
|
PIMAGE_SECTION_HEADER SectionHeader;
|
||||||
ULONG VirtualSize, SizeOfRawData, NumberOfSections;
|
ULONG VirtualSize, SizeOfRawData, NumberOfSections;
|
||||||
LONG Status;
|
ARC_STATUS Status;
|
||||||
LARGE_INTEGER Position;
|
LARGE_INTEGER Position;
|
||||||
ULONG i, BytesRead;
|
ULONG i, BytesRead;
|
||||||
TRACE("WinLdrLoadImage(%s, %ld, *)\n", FileName, MemoryType);
|
TRACE("WinLdrLoadImage(%s, %ld, *)\n", FileName, MemoryType);
|
||||||
|
@ -355,7 +353,6 @@ WinLdrLoadImage(IN PCHAR FileName,
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ArcRead(FileId, PhysicalBase, NtHeaders->OptionalHeader.SizeOfHeaders, &BytesRead);
|
Status = ArcRead(FileId, PhysicalBase, NtHeaders->OptionalHeader.SizeOfHeaders, &BytesRead);
|
||||||
|
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
//Print(L"Error reading headers %s\n", FileName);
|
//Print(L"Error reading headers %s\n", FileName);
|
||||||
|
@ -407,7 +404,6 @@ WinLdrLoadImage(IN PCHAR FileName,
|
||||||
|
|
||||||
/* Read this section from the file, size = SizeOfRawData */
|
/* Read this section from the file, size = SizeOfRawData */
|
||||||
Status = ArcRead(FileId, (PUCHAR)PhysicalBase + SectionHeader->VirtualAddress, SizeOfRawData, &BytesRead);
|
Status = ArcRead(FileId, (PUCHAR)PhysicalBase + SectionHeader->VirtualAddress, SizeOfRawData, &BytesRead);
|
||||||
|
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
ERR("WinLdrLoadImage(): Error reading section from file!\n");
|
ERR("WinLdrLoadImage(): Error reading section from file!\n");
|
||||||
|
@ -515,7 +511,7 @@ WinLdrpBindImportName(IN OUT PLIST_ENTRY ModuleListHead,
|
||||||
ULONG Hint;
|
ULONG Hint;
|
||||||
PIMAGE_IMPORT_BY_NAME ImportData;
|
PIMAGE_IMPORT_BY_NAME ImportData;
|
||||||
PCHAR ExportName, ForwarderName;
|
PCHAR ExportName, ForwarderName;
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
|
|
||||||
//TRACE("WinLdrpBindImportName(): DllBase 0x%X, ImageBase 0x%X, ThunkData 0x%X, ExportDirectory 0x%X, ExportSize %d, ProcessForwards 0x%X\n",
|
//TRACE("WinLdrpBindImportName(): DllBase 0x%X, ImageBase 0x%X, ThunkData 0x%X, ExportDirectory 0x%X, ExportSize %d, ProcessForwards 0x%X\n",
|
||||||
// DllBase, ImageBase, ThunkData, ExportDirectory, ExportSize, ProcessForwards);
|
// DllBase, ImageBase, ThunkData, ExportDirectory, ExportSize, ProcessForwards);
|
||||||
|
@ -680,14 +676,14 @@ WinLdrpBindImportName(IN OUT PLIST_ENTRY ModuleListHead,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now let's try to load it! */
|
/* Now let's try to load it! */
|
||||||
Status = WinLdrpLoadAndScanReferencedDll(ModuleListHead,
|
Success = WinLdrpLoadAndScanReferencedDll(ModuleListHead,
|
||||||
DirectoryPath,
|
DirectoryPath,
|
||||||
ForwardDllName,
|
ForwardDllName,
|
||||||
&DataTableEntry);
|
&DataTableEntry);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
{
|
{
|
||||||
ERR("WinLdrpLoadAndScanReferencedDll() failed to load forwarder dll.\n");
|
ERR("WinLdrpLoadAndScanReferencedDll() failed to load forwarder dll.\n");
|
||||||
return Status;
|
return Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -722,8 +718,7 @@ WinLdrpBindImportName(IN OUT PLIST_ENTRY ModuleListHead,
|
||||||
RefThunkData.u1.AddressOfData = (ULONG_PTR)ImportByName;
|
RefThunkData.u1.AddressOfData = (ULONG_PTR)ImportByName;
|
||||||
|
|
||||||
/* And recursively call ourselves */
|
/* And recursively call ourselves */
|
||||||
Status = WinLdrpBindImportName(
|
Success = WinLdrpBindImportName(ModuleListHead,
|
||||||
ModuleListHead,
|
|
||||||
DataTableEntry->DllBase,
|
DataTableEntry->DllBase,
|
||||||
ImageBase,
|
ImageBase,
|
||||||
&RefThunkData,
|
&RefThunkData,
|
||||||
|
@ -736,7 +731,7 @@ WinLdrpBindImportName(IN OUT PLIST_ENTRY ModuleListHead,
|
||||||
ThunkData->u1 = RefThunkData.u1;
|
ThunkData->u1 = RefThunkData.u1;
|
||||||
|
|
||||||
/* Return what we got from the recursive call */
|
/* Return what we got from the recursive call */
|
||||||
return Status;
|
return Success;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -756,7 +751,7 @@ WinLdrpLoadAndScanReferencedDll(PLIST_ENTRY ModuleListHead,
|
||||||
PLDR_DATA_TABLE_ENTRY *DataTableEntry)
|
PLDR_DATA_TABLE_ENTRY *DataTableEntry)
|
||||||
{
|
{
|
||||||
CHAR FullDllName[256];
|
CHAR FullDllName[256];
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
PVOID BasePA = NULL;
|
PVOID BasePA = NULL;
|
||||||
|
|
||||||
/* Prepare the full path to the file to be loaded */
|
/* Prepare the full path to the file to be loaded */
|
||||||
|
@ -767,33 +762,33 @@ WinLdrpLoadAndScanReferencedDll(PLIST_ENTRY ModuleListHead,
|
||||||
//Print(L"Loading referenced DLL: %s\n", FullDllName);
|
//Print(L"Loading referenced DLL: %s\n", FullDllName);
|
||||||
|
|
||||||
/* Load the image */
|
/* Load the image */
|
||||||
Status = WinLdrLoadImage(FullDllName, LoaderBootDriver, &BasePA);
|
Success = WinLdrLoadImage(FullDllName, LoaderBootDriver, &BasePA);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
{
|
{
|
||||||
ERR("WinLdrLoadImage() failed\n");
|
ERR("WinLdrLoadImage() failed\n");
|
||||||
return Status;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate DTE for newly loaded DLL */
|
/* Allocate DTE for newly loaded DLL */
|
||||||
Status = WinLdrAllocateDataTableEntry(ModuleListHead,
|
Success = WinLdrAllocateDataTableEntry(ModuleListHead,
|
||||||
ImportName,
|
ImportName,
|
||||||
FullDllName,
|
FullDllName,
|
||||||
BasePA,
|
BasePA,
|
||||||
DataTableEntry);
|
DataTableEntry);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
{
|
{
|
||||||
ERR("WinLdrAllocateDataTableEntry() failed\n");
|
ERR("WinLdrAllocateDataTableEntry() failed\n");
|
||||||
return Status;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Scan its dependencies too */
|
/* Scan its dependencies too */
|
||||||
TRACE("WinLdrScanImportDescriptorTable() calling ourselves for %S\n",
|
TRACE("WinLdrScanImportDescriptorTable() calling ourselves for %S\n",
|
||||||
VaToPa((*DataTableEntry)->BaseDllName.Buffer));
|
VaToPa((*DataTableEntry)->BaseDllName.Buffer));
|
||||||
Status = WinLdrScanImportDescriptorTable(ModuleListHead, DirectoryPath, *DataTableEntry);
|
Success = WinLdrScanImportDescriptorTable(ModuleListHead, DirectoryPath, *DataTableEntry);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
{
|
{
|
||||||
ERR("WinLdrScanImportDescriptorTable() failed\n");
|
ERR("WinLdrScanImportDescriptorTable() failed\n");
|
||||||
return Status;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -807,7 +802,7 @@ WinLdrpScanImportAddressTable(IN OUT PLIST_ENTRY ModuleListHead,
|
||||||
IN PCSTR DirectoryPath)
|
IN PCSTR DirectoryPath)
|
||||||
{
|
{
|
||||||
PIMAGE_EXPORT_DIRECTORY ExportDirectory = NULL;
|
PIMAGE_EXPORT_DIRECTORY ExportDirectory = NULL;
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
ULONG ExportSize;
|
ULONG ExportSize;
|
||||||
|
|
||||||
TRACE("WinLdrpScanImportAddressTable(): DllBase 0x%X, "
|
TRACE("WinLdrpScanImportAddressTable(): DllBase 0x%X, "
|
||||||
|
@ -841,8 +836,7 @@ WinLdrpScanImportAddressTable(IN OUT PLIST_ENTRY ModuleListHead,
|
||||||
while (((PIMAGE_THUNK_DATA)VaToPa(ThunkData))->u1.AddressOfData != 0)
|
while (((PIMAGE_THUNK_DATA)VaToPa(ThunkData))->u1.AddressOfData != 0)
|
||||||
{
|
{
|
||||||
/* Bind it */
|
/* Bind it */
|
||||||
Status = WinLdrpBindImportName(
|
Success = WinLdrpBindImportName(ModuleListHead,
|
||||||
ModuleListHead,
|
|
||||||
DllBase,
|
DllBase,
|
||||||
ImageBase,
|
ImageBase,
|
||||||
ThunkData,
|
ThunkData,
|
||||||
|
@ -855,8 +849,8 @@ WinLdrpScanImportAddressTable(IN OUT PLIST_ENTRY ModuleListHead,
|
||||||
ThunkData++;
|
ThunkData++;
|
||||||
|
|
||||||
/* Return error if binding was unsuccessful */
|
/* Return error if binding was unsuccessful */
|
||||||
if (!Status)
|
if (!Success)
|
||||||
return Status;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
|
|
|
@ -41,7 +41,7 @@ static VOID
|
||||||
SetupLdrLoadNlsData(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPCSTR SearchPath)
|
SetupLdrLoadNlsData(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPCSTR SearchPath)
|
||||||
{
|
{
|
||||||
INFCONTEXT InfContext;
|
INFCONTEXT InfContext;
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
LPCSTR AnsiName, OemName, LangName;
|
LPCSTR AnsiName, OemName, LangName;
|
||||||
|
|
||||||
/* Get ANSI codepage file */
|
/* Get ANSI codepage file */
|
||||||
|
@ -79,15 +79,15 @@ SetupLdrLoadNlsData(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPCSTR
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName);
|
Success = WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName);
|
||||||
TRACE("NLS data loaded with status %d\n", Status);
|
TRACE("NLS data loading %s\n", Success ? "successful" : "failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
SetupLdrScanBootDrivers(PLIST_ENTRY BootDriverListHead, HINF InfHandle, LPCSTR SearchPath)
|
SetupLdrScanBootDrivers(PLIST_ENTRY BootDriverListHead, HINF InfHandle, LPCSTR SearchPath)
|
||||||
{
|
{
|
||||||
INFCONTEXT InfContext, dirContext;
|
INFCONTEXT InfContext, dirContext;
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
LPCSTR Media, DriverName, dirIndex, ImagePath;
|
LPCSTR Media, DriverName, dirIndex, ImagePath;
|
||||||
WCHAR ServiceName[256];
|
WCHAR ServiceName[256];
|
||||||
WCHAR ImagePathW[256];
|
WCHAR ImagePathW[256];
|
||||||
|
@ -119,12 +119,11 @@ SetupLdrScanBootDrivers(PLIST_ENTRY BootDriverListHead, HINF InfHandle, LPCSTR S
|
||||||
ServiceName[wcslen(ServiceName) - 4] = 0;
|
ServiceName[wcslen(ServiceName) - 4] = 0;
|
||||||
|
|
||||||
/* Add it to the list */
|
/* Add it to the list */
|
||||||
Status = WinLdrAddDriverToList(BootDriverListHead,
|
Success = WinLdrAddDriverToList(BootDriverListHead,
|
||||||
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
|
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
|
||||||
ImagePathW,
|
ImagePathW,
|
||||||
ServiceName);
|
ServiceName);
|
||||||
|
if (!Success)
|
||||||
if (!Status)
|
|
||||||
{
|
{
|
||||||
ERR("could not add boot driver %s, %s\n", SearchPath, DriverName);
|
ERR("could not add boot driver %s, %s\n", SearchPath, DriverName);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -234,7 +234,7 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
|
||||||
CHAR DriverPath[1024];
|
CHAR DriverPath[1024];
|
||||||
CHAR DllName[1024];
|
CHAR DllName[1024];
|
||||||
PCHAR DriverNamePos;
|
PCHAR DriverNamePos;
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
PVOID DriverBase = NULL;
|
PVOID DriverBase = NULL;
|
||||||
|
|
||||||
// Separate the path to file name and directory path
|
// Separate the path to file name and directory path
|
||||||
|
@ -258,8 +258,8 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
|
||||||
TRACE("DriverPath: %s, DllName: %s, LPB\n", DriverPath, DllName);
|
TRACE("DriverPath: %s, DllName: %s, LPB\n", DriverPath, DllName);
|
||||||
|
|
||||||
// Check if driver is already loaded
|
// Check if driver is already loaded
|
||||||
Status = WinLdrCheckForLoadedDll(LoadOrderListHead, DllName, DriverDTE);
|
Success = WinLdrCheckForLoadedDll(LoadOrderListHead, DllName, DriverDTE);
|
||||||
if (Status)
|
if (Success)
|
||||||
{
|
{
|
||||||
// We've got the pointer to its DTE, just return success
|
// We've got the pointer to its DTE, just return success
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -267,13 +267,13 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
|
||||||
|
|
||||||
// It's not loaded, we have to load it
|
// It's not loaded, we have to load it
|
||||||
_snprintf(FullPath, sizeof(FullPath), "%s%wZ", BootPath, FilePath);
|
_snprintf(FullPath, sizeof(FullPath), "%s%wZ", BootPath, FilePath);
|
||||||
Status = WinLdrLoadImage(FullPath, LoaderBootDriver, &DriverBase);
|
Success = WinLdrLoadImage(FullPath, LoaderBootDriver, &DriverBase);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Allocate a DTE for it
|
// Allocate a DTE for it
|
||||||
Status = WinLdrAllocateDataTableEntry(LoadOrderListHead, DllName, DllName, DriverBase, DriverDTE);
|
Success = WinLdrAllocateDataTableEntry(LoadOrderListHead, DllName, DllName, DriverBase, DriverDTE);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
{
|
{
|
||||||
ERR("WinLdrAllocateDataTableEntry() failed\n");
|
ERR("WinLdrAllocateDataTableEntry() failed\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -284,8 +284,8 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
|
||||||
|
|
||||||
// Look for any dependencies it may have, and load them too
|
// Look for any dependencies it may have, and load them too
|
||||||
sprintf(FullPath,"%s%s", BootPath, DriverPath);
|
sprintf(FullPath,"%s%s", BootPath, DriverPath);
|
||||||
Status = WinLdrScanImportDescriptorTable(LoadOrderListHead, FullPath, *DriverDTE);
|
Success = WinLdrScanImportDescriptorTable(LoadOrderListHead, FullPath, *DriverDTE);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
{
|
{
|
||||||
ERR("WinLdrScanImportDescriptorTable() failed for %s\n", FullPath);
|
ERR("WinLdrScanImportDescriptorTable() failed for %s\n", FullPath);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -300,7 +300,7 @@ WinLdrLoadBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
{
|
{
|
||||||
PLIST_ENTRY NextBd;
|
PLIST_ENTRY NextBd;
|
||||||
PBOOT_DRIVER_LIST_ENTRY BootDriver;
|
PBOOT_DRIVER_LIST_ENTRY BootDriver;
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
|
|
||||||
// Walk through the boot drivers list
|
// Walk through the boot drivers list
|
||||||
NextBd = LoaderBlock->BootDriverListHead.Flink;
|
NextBd = LoaderBlock->BootDriverListHead.Flink;
|
||||||
|
@ -315,7 +315,7 @@ WinLdrLoadBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
// Paths are relative (FIXME: Are they always relative?)
|
// Paths are relative (FIXME: Are they always relative?)
|
||||||
|
|
||||||
// Load it
|
// Load it
|
||||||
Status = WinLdrLoadDeviceDriver(&LoaderBlock->LoadOrderListHead,
|
Success = WinLdrLoadDeviceDriver(&LoaderBlock->LoadOrderListHead,
|
||||||
BootPath,
|
BootPath,
|
||||||
&BootDriver->FilePath,
|
&BootDriver->FilePath,
|
||||||
0,
|
0,
|
||||||
|
@ -323,7 +323,7 @@ WinLdrLoadBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
|
|
||||||
// If loading failed - cry loudly
|
// If loading failed - cry loudly
|
||||||
//FIXME: Maybe remove it from the list and try to continue?
|
//FIXME: Maybe remove it from the list and try to continue?
|
||||||
if (!Status)
|
if (!Success)
|
||||||
{
|
{
|
||||||
ERR("Can't load boot driver '%wZ'!", &BootDriver->FilePath);
|
ERR("Can't load boot driver '%wZ'!", &BootDriver->FilePath);
|
||||||
UiMessageBox("Can't load boot driver '%wZ'!", &BootDriver->FilePath);
|
UiMessageBox("Can't load boot driver '%wZ'!", &BootDriver->FilePath);
|
||||||
|
@ -350,7 +350,7 @@ WinLdrLoadModule(PCSTR ModuleName,
|
||||||
PVOID PhysicalBase;
|
PVOID PhysicalBase;
|
||||||
FILEINFORMATION FileInfo;
|
FILEINFORMATION FileInfo;
|
||||||
ULONG FileSize;
|
ULONG FileSize;
|
||||||
ULONG Status;
|
ARC_STATUS Status;
|
||||||
ULONG BytesRead;
|
ULONG BytesRead;
|
||||||
|
|
||||||
//CHAR ProgressString[256];
|
//CHAR ProgressString[256];
|
||||||
|
@ -432,7 +432,7 @@ LoadModule(
|
||||||
BOOLEAN IsKdTransportDll,
|
BOOLEAN IsKdTransportDll,
|
||||||
ULONG Percentage)
|
ULONG Percentage)
|
||||||
{
|
{
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
CHAR FullFileName[MAX_PATH];
|
CHAR FullFileName[MAX_PATH];
|
||||||
CHAR ProgressString[256];
|
CHAR ProgressString[256];
|
||||||
PVOID BaseAdress = NULL;
|
PVOID BaseAdress = NULL;
|
||||||
|
@ -445,8 +445,8 @@ LoadModule(
|
||||||
strcat(FullFileName, "SYSTEM32\\");
|
strcat(FullFileName, "SYSTEM32\\");
|
||||||
strcat(FullFileName, File);
|
strcat(FullFileName, File);
|
||||||
|
|
||||||
Status = WinLdrLoadImage(FullFileName, MemoryType, &BaseAdress);
|
Success = WinLdrLoadImage(FullFileName, MemoryType, &BaseAdress);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
{
|
{
|
||||||
TRACE("Loading %s failed\n", File);
|
TRACE("Loading %s failed\n", File);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -460,13 +460,13 @@ LoadModule(
|
||||||
* the Kernel Debugger Transport DLL, to make the
|
* the Kernel Debugger Transport DLL, to make the
|
||||||
* PE loader happy.
|
* PE loader happy.
|
||||||
*/
|
*/
|
||||||
Status = WinLdrAllocateDataTableEntry(&LoaderBlock->LoadOrderListHead,
|
Success = WinLdrAllocateDataTableEntry(&LoaderBlock->LoadOrderListHead,
|
||||||
(IsKdTransportDll ? "KDCOM.DLL" : File),
|
(IsKdTransportDll ? "KDCOM.DLL" : File),
|
||||||
FullFileName,
|
FullFileName,
|
||||||
BaseAdress,
|
BaseAdress,
|
||||||
Dte);
|
Dte);
|
||||||
|
|
||||||
return Status;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -477,7 +477,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
|
||||||
IN LPCSTR BootPath,
|
IN LPCSTR BootPath,
|
||||||
IN OUT PLDR_DATA_TABLE_ENTRY* KernelDTE)
|
IN OUT PLDR_DATA_TABLE_ENTRY* KernelDTE)
|
||||||
{
|
{
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
CHAR DirPath[MAX_PATH];
|
CHAR DirPath[MAX_PATH];
|
||||||
CHAR KdTransportDllName[MAX_PATH];
|
CHAR KdTransportDllName[MAX_PATH];
|
||||||
PLDR_DATA_TABLE_ENTRY HalDTE, KdComDTE = NULL;
|
PLDR_DATA_TABLE_ENTRY HalDTE, KdComDTE = NULL;
|
||||||
|
@ -578,14 +578,14 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
|
||||||
/* Load all referenced DLLs for Kernel, HAL and Kernel Debugger Transport DLL */
|
/* Load all referenced DLLs for Kernel, HAL and Kernel Debugger Transport DLL */
|
||||||
strcpy(DirPath, BootPath);
|
strcpy(DirPath, BootPath);
|
||||||
strcat(DirPath, "system32\\");
|
strcat(DirPath, "system32\\");
|
||||||
Status = WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, *KernelDTE);
|
Success = WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, *KernelDTE);
|
||||||
Status &= WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, HalDTE);
|
Success &= WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, HalDTE);
|
||||||
if (KdComDTE)
|
if (KdComDTE)
|
||||||
{
|
{
|
||||||
Status &= WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, KdComDTE);
|
Success &= WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, KdComDTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -600,7 +600,7 @@ LoadAndBootWindows(IN OperatingSystemItem* OperatingSystem,
|
||||||
CHAR FileName[MAX_PATH];
|
CHAR FileName[MAX_PATH];
|
||||||
CHAR BootOptions[256];
|
CHAR BootOptions[256];
|
||||||
PCHAR File;
|
PCHAR File;
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
PLOADER_PARAMETER_BLOCK LoaderBlock;
|
PLOADER_PARAMETER_BLOCK LoaderBlock;
|
||||||
|
|
||||||
/* Get OS setting value */
|
/* Get OS setting value */
|
||||||
|
@ -688,12 +688,12 @@ LoadAndBootWindows(IN OperatingSystemItem* OperatingSystem,
|
||||||
/* Load Hive */
|
/* Load Hive */
|
||||||
UiDrawBackdrop();
|
UiDrawBackdrop();
|
||||||
UiDrawProgressBarCenter(15, 100, "Loading system hive...");
|
UiDrawProgressBarCenter(15, 100, "Loading system hive...");
|
||||||
Status = WinLdrInitSystemHive(LoaderBlock, BootPath);
|
Success = WinLdrInitSystemHive(LoaderBlock, BootPath);
|
||||||
TRACE("SYSTEM hive %s\n", (Status ? "loaded" : "not loaded"));
|
TRACE("SYSTEM hive %s\n", (Success ? "loaded" : "not loaded"));
|
||||||
|
|
||||||
/* Load NLS data, OEM font, and prepare boot drivers list */
|
/* Load NLS data, OEM font, and prepare boot drivers list */
|
||||||
Status = WinLdrScanSystemHive(LoaderBlock, BootPath);
|
Success = WinLdrScanSystemHive(LoaderBlock, BootPath);
|
||||||
TRACE("SYSTEM hive %s\n", (Status ? "scanned" : "not scanned"));
|
TRACE("SYSTEM hive %s\n", (Success ? "scanned" : "not scanned"));
|
||||||
|
|
||||||
/* Finish loading */
|
/* Finish loading */
|
||||||
LoadAndBootWindowsCommon(OperatingSystemVersion,
|
LoadAndBootWindowsCommon(OperatingSystemVersion,
|
||||||
|
@ -712,7 +712,7 @@ LoadAndBootWindowsCommon(
|
||||||
BOOLEAN Setup)
|
BOOLEAN Setup)
|
||||||
{
|
{
|
||||||
PLOADER_PARAMETER_BLOCK LoaderBlockVA;
|
PLOADER_PARAMETER_BLOCK LoaderBlockVA;
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
PLDR_DATA_TABLE_ENTRY KernelDTE;
|
PLDR_DATA_TABLE_ENTRY KernelDTE;
|
||||||
KERNEL_ENTRY_POINT KiSystemStartup;
|
KERNEL_ENTRY_POINT KiSystemStartup;
|
||||||
LPCSTR SystemRoot;
|
LPCSTR SystemRoot;
|
||||||
|
@ -733,12 +733,12 @@ LoadAndBootWindowsCommon(
|
||||||
OperatingSystemVersion = WinLdrDetectVersion();
|
OperatingSystemVersion = WinLdrDetectVersion();
|
||||||
|
|
||||||
/* Load the operating system core: the Kernel, the HAL and the Kernel Debugger Transport DLL */
|
/* Load the operating system core: the Kernel, the HAL and the Kernel Debugger Transport DLL */
|
||||||
Status = LoadWindowsCore(OperatingSystemVersion,
|
Success = LoadWindowsCore(OperatingSystemVersion,
|
||||||
LoaderBlock,
|
LoaderBlock,
|
||||||
BootOptions,
|
BootOptions,
|
||||||
BootPath,
|
BootPath,
|
||||||
&KernelDTE);
|
&KernelDTE);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
{
|
{
|
||||||
UiMessageBox("Error loading NTOS core.");
|
UiMessageBox("Error loading NTOS core.");
|
||||||
return;
|
return;
|
||||||
|
@ -747,8 +747,8 @@ LoadAndBootWindowsCommon(
|
||||||
/* Load boot drivers */
|
/* Load boot drivers */
|
||||||
UiDrawBackdrop();
|
UiDrawBackdrop();
|
||||||
UiDrawProgressBarCenter(100, 100, "Loading boot drivers...");
|
UiDrawProgressBarCenter(100, 100, "Loading boot drivers...");
|
||||||
Status = WinLdrLoadBootDrivers(LoaderBlock, BootPath);
|
Success = WinLdrLoadBootDrivers(LoaderBlock, BootPath);
|
||||||
TRACE("Boot drivers loaded with status %d\n", Status);
|
TRACE("Boot drivers loading %s\n", Success ? "successful" : "failed");
|
||||||
|
|
||||||
/* Initialize Phase 1 - no drivers loading anymore */
|
/* Initialize Phase 1 - no drivers loading anymore */
|
||||||
WinLdrInitializePhase1(LoaderBlock,
|
WinLdrInitializePhase1(LoaderBlock,
|
||||||
|
|
|
@ -35,7 +35,7 @@ WinLdrLoadSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
{
|
{
|
||||||
ULONG FileId;
|
ULONG FileId;
|
||||||
CHAR FullHiveName[256];
|
CHAR FullHiveName[256];
|
||||||
LONG Status;
|
ARC_STATUS Status;
|
||||||
FILEINFORMATION FileInfo;
|
FILEINFORMATION FileInfo;
|
||||||
ULONG HiveFileSize;
|
ULONG HiveFileSize;
|
||||||
ULONG_PTR HiveDataPhysical;
|
ULONG_PTR HiveDataPhysical;
|
||||||
|
@ -48,7 +48,6 @@ WinLdrLoadSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
strcat(FullHiveName, HiveName);
|
strcat(FullHiveName, HiveName);
|
||||||
//Print(L"Loading %s...\n", FullHiveName);
|
//Print(L"Loading %s...\n", FullHiveName);
|
||||||
Status = ArcOpen(FullHiveName, OpenReadOnly, &FileId);
|
Status = ArcOpen(FullHiveName, OpenReadOnly, &FileId);
|
||||||
|
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
UiMessageBox("Opening hive file failed!");
|
UiMessageBox("Opening hive file failed!");
|
||||||
|
@ -57,7 +56,6 @@ WinLdrLoadSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
|
|
||||||
/* Get the file length */
|
/* Get the file length */
|
||||||
Status = ArcGetFileInformation(FileId, &FileInfo);
|
Status = ArcGetFileInformation(FileId, &FileInfo);
|
||||||
|
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
{
|
{
|
||||||
ArcClose(FileId);
|
ArcClose(FileId);
|
||||||
|
@ -98,12 +96,13 @@ WinLdrLoadSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
FsService = FsGetServiceName(FileId);
|
FsService = FsGetServiceName(FileId);
|
||||||
if (FsService)
|
if (FsService)
|
||||||
{
|
{
|
||||||
|
BOOLEAN Success;
|
||||||
TRACE(" Adding filesystem service %S\n", FsService);
|
TRACE(" Adding filesystem service %S\n", FsService);
|
||||||
Status = WinLdrAddDriverToList(&LoaderBlock->BootDriverListHead,
|
Success = WinLdrAddDriverToList(&LoaderBlock->BootDriverListHead,
|
||||||
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
|
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
|
||||||
NULL,
|
NULL,
|
||||||
(LPWSTR)FsService);
|
(LPWSTR)FsService);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
TRACE(" Failed to add filesystem service\n");
|
TRACE(" Failed to add filesystem service\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -119,7 +118,7 @@ BOOLEAN WinLdrInitSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
IN LPCSTR DirectoryPath)
|
IN LPCSTR DirectoryPath)
|
||||||
{
|
{
|
||||||
CHAR SearchPath[1024];
|
CHAR SearchPath[1024];
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
|
|
||||||
// There is a simple logic here: try to load usual hive (system), if it
|
// There is a simple logic here: try to load usual hive (system), if it
|
||||||
// fails, then give system.alt a try, and finally try a system.sav
|
// fails, then give system.alt a try, and finally try a system.sav
|
||||||
|
@ -127,18 +126,18 @@ BOOLEAN WinLdrInitSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
// FIXME: For now we only try system
|
// FIXME: For now we only try system
|
||||||
strcpy(SearchPath, DirectoryPath);
|
strcpy(SearchPath, DirectoryPath);
|
||||||
strcat(SearchPath, "SYSTEM32\\CONFIG\\");
|
strcat(SearchPath, "SYSTEM32\\CONFIG\\");
|
||||||
Status = WinLdrLoadSystemHive(LoaderBlock, SearchPath, "SYSTEM");
|
Success = WinLdrLoadSystemHive(LoaderBlock, SearchPath, "SYSTEM");
|
||||||
|
|
||||||
// Fail if failed...
|
// Fail if failed...
|
||||||
if (!Status)
|
if (!Success)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Initialize in-memory registry
|
// Initialize in-memory registry
|
||||||
RegInitializeRegistry();
|
RegInitializeRegistry();
|
||||||
|
|
||||||
// Import what was loaded
|
// Import what was loaded
|
||||||
Status = RegImportBinaryHive((PCHAR)VaToPa(LoaderBlock->RegistryBase), LoaderBlock->RegistryLength);
|
Success = RegImportBinaryHive((PCHAR)VaToPa(LoaderBlock->RegistryBase), LoaderBlock->RegistryLength);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
{
|
{
|
||||||
UiMessageBox("Importing binary hive failed!");
|
UiMessageBox("Importing binary hive failed!");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -159,14 +158,14 @@ BOOLEAN WinLdrScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
{
|
{
|
||||||
CHAR SearchPath[1024];
|
CHAR SearchPath[1024];
|
||||||
CHAR AnsiName[256], OemName[256], LangName[256];
|
CHAR AnsiName[256], OemName[256], LangName[256];
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
|
|
||||||
// Scan registry and prepare boot drivers list
|
// Scan registry and prepare boot drivers list
|
||||||
WinLdrScanRegistry(&LoaderBlock->BootDriverListHead, DirectoryPath);
|
WinLdrScanRegistry(&LoaderBlock->BootDriverListHead, DirectoryPath);
|
||||||
|
|
||||||
// Get names of NLS files
|
// Get names of NLS files
|
||||||
Status = WinLdrGetNLSNames(AnsiName, OemName, LangName);
|
Success = WinLdrGetNLSNames(AnsiName, OemName, LangName);
|
||||||
if (!Status)
|
if (!Success)
|
||||||
{
|
{
|
||||||
UiMessageBox("Getting NLS names from registry failed!");
|
UiMessageBox("Getting NLS names from registry failed!");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -177,8 +176,8 @@ BOOLEAN WinLdrScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
// Load NLS data
|
// Load NLS data
|
||||||
strcpy(SearchPath, DirectoryPath);
|
strcpy(SearchPath, DirectoryPath);
|
||||||
strcat(SearchPath, "SYSTEM32\\");
|
strcat(SearchPath, "SYSTEM32\\");
|
||||||
Status = WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName);
|
Success = WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName);
|
||||||
TRACE("NLS data loaded with status %d\n", Status);
|
TRACE("NLS data loading %s\n", Success ? "successful" : "failed");
|
||||||
|
|
||||||
/* TODO: Load OEM HAL font */
|
/* TODO: Load OEM HAL font */
|
||||||
|
|
||||||
|
@ -298,7 +297,8 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
PVOID NlsVirtual;
|
PVOID NlsVirtual;
|
||||||
BOOLEAN AnsiEqualsOem = FALSE;
|
BOOLEAN AnsiEqualsOem = FALSE;
|
||||||
FILEINFORMATION FileInfo;
|
FILEINFORMATION FileInfo;
|
||||||
ULONG BytesRead, Status;
|
ULONG BytesRead;
|
||||||
|
ARC_STATUS Status;
|
||||||
|
|
||||||
/* There may be a case, when OEM and ANSI page coincide */
|
/* There may be a case, when OEM and ANSI page coincide */
|
||||||
if (!strcmp(AnsiFileName, OemFileName))
|
if (!strcmp(AnsiFileName, OemFileName))
|
||||||
|
@ -309,7 +309,6 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
strcpy(FileName, DirectoryPath);
|
strcpy(FileName, DirectoryPath);
|
||||||
strcat(FileName, AnsiFileName);
|
strcat(FileName, AnsiFileName);
|
||||||
Status = ArcOpen(FileName, OpenReadOnly, &AnsiFileId);
|
Status = ArcOpen(FileName, OpenReadOnly, &AnsiFileId);
|
||||||
|
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
goto Failure;
|
goto Failure;
|
||||||
|
|
||||||
|
@ -331,7 +330,6 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
strcpy(FileName, DirectoryPath);
|
strcpy(FileName, DirectoryPath);
|
||||||
strcat(FileName, OemFileName);
|
strcat(FileName, OemFileName);
|
||||||
Status = ArcOpen(FileName, OpenReadOnly, &OemFileId);
|
Status = ArcOpen(FileName, OpenReadOnly, &OemFileId);
|
||||||
|
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
goto Failure;
|
goto Failure;
|
||||||
|
|
||||||
|
@ -348,7 +346,6 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
strcpy(FileName, DirectoryPath);
|
strcpy(FileName, DirectoryPath);
|
||||||
strcat(FileName, LanguageFileName);
|
strcat(FileName, LanguageFileName);
|
||||||
Status = ArcOpen(FileName, OpenReadOnly, &LanguageFileId);
|
Status = ArcOpen(FileName, OpenReadOnly, &LanguageFileId);
|
||||||
|
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
goto Failure;
|
goto Failure;
|
||||||
|
|
||||||
|
@ -390,12 +387,10 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
strcpy(FileName, DirectoryPath);
|
strcpy(FileName, DirectoryPath);
|
||||||
strcat(FileName, AnsiFileName);
|
strcat(FileName, AnsiFileName);
|
||||||
Status = ArcOpen(FileName, OpenReadOnly, &AnsiFileId);
|
Status = ArcOpen(FileName, OpenReadOnly, &AnsiFileId);
|
||||||
|
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
goto Failure;
|
goto Failure;
|
||||||
|
|
||||||
Status = ArcRead(AnsiFileId, VaToPa(LoaderBlock->NlsData->AnsiCodePageData), AnsiFileSize, &BytesRead);
|
Status = ArcRead(AnsiFileId, VaToPa(LoaderBlock->NlsData->AnsiCodePageData), AnsiFileSize, &BytesRead);
|
||||||
|
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
goto Failure;
|
goto Failure;
|
||||||
|
|
||||||
|
@ -407,12 +402,10 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
strcpy(FileName, DirectoryPath);
|
strcpy(FileName, DirectoryPath);
|
||||||
strcat(FileName, OemFileName);
|
strcat(FileName, OemFileName);
|
||||||
Status = ArcOpen(FileName, OpenReadOnly, &OemFileId);
|
Status = ArcOpen(FileName, OpenReadOnly, &OemFileId);
|
||||||
|
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
goto Failure;
|
goto Failure;
|
||||||
|
|
||||||
Status = ArcRead(OemFileId, VaToPa(LoaderBlock->NlsData->OemCodePageData), OemFileSize, &BytesRead);
|
Status = ArcRead(OemFileId, VaToPa(LoaderBlock->NlsData->OemCodePageData), OemFileSize, &BytesRead);
|
||||||
|
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
goto Failure;
|
goto Failure;
|
||||||
|
|
||||||
|
@ -423,12 +416,10 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
strcpy(FileName, DirectoryPath);
|
strcpy(FileName, DirectoryPath);
|
||||||
strcat(FileName, LanguageFileName);
|
strcat(FileName, LanguageFileName);
|
||||||
Status = ArcOpen(FileName, OpenReadOnly, &LanguageFileId);
|
Status = ArcOpen(FileName, OpenReadOnly, &LanguageFileId);
|
||||||
|
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
goto Failure;
|
goto Failure;
|
||||||
|
|
||||||
Status = ArcRead(LanguageFileId, VaToPa(LoaderBlock->NlsData->UnicodeCodePageData), LanguageFileSize, &BytesRead);
|
Status = ArcRead(LanguageFileId, VaToPa(LoaderBlock->NlsData->UnicodeCodePageData), LanguageFileSize, &BytesRead);
|
||||||
|
|
||||||
if (Status != ESUCCESS)
|
if (Status != ESUCCESS)
|
||||||
goto Failure;
|
goto Failure;
|
||||||
|
|
||||||
|
@ -475,7 +466,7 @@ WinLdrScanRegistry(IN OUT PLIST_ENTRY BootDriverListHead,
|
||||||
CHAR ImagePath[256];
|
CHAR ImagePath[256];
|
||||||
WCHAR TempImagePath[256];
|
WCHAR TempImagePath[256];
|
||||||
|
|
||||||
BOOLEAN Status;
|
BOOLEAN Success;
|
||||||
|
|
||||||
/* get 'service group order' key */
|
/* get 'service group order' key */
|
||||||
rc = RegOpenKey(NULL,
|
rc = RegOpenKey(NULL,
|
||||||
|
@ -570,32 +561,36 @@ WinLdrScanRegistry(IN OUT PLIST_ENTRY BootDriverListHead,
|
||||||
/* Make sure it should be started */
|
/* Make sure it should be started */
|
||||||
if ((StartValue == 0) &&
|
if ((StartValue == 0) &&
|
||||||
(TagValue == OrderList[TagIndex]) &&
|
(TagValue == OrderList[TagIndex]) &&
|
||||||
(_wcsicmp(DriverGroup, GroupName) == 0)) {
|
(_wcsicmp(DriverGroup, GroupName) == 0))
|
||||||
|
{
|
||||||
/* Get the Driver's Location */
|
/* Get the Driver's Location */
|
||||||
ValueSize = sizeof(TempImagePath);
|
ValueSize = sizeof(TempImagePath);
|
||||||
rc = RegQueryValue(hDriverKey, L"ImagePath", NULL, (PUCHAR)TempImagePath, &ValueSize);
|
rc = RegQueryValue(hDriverKey, L"ImagePath", NULL, (PUCHAR)TempImagePath, &ValueSize);
|
||||||
|
|
||||||
/* Write the whole path if it suceeded, else prepare to fail */
|
/* Write the whole path if it suceeded, else prepare to fail */
|
||||||
if (rc != ERROR_SUCCESS) {
|
if (rc != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
TRACE_CH(REACTOS, "ImagePath: not found\n");
|
TRACE_CH(REACTOS, "ImagePath: not found\n");
|
||||||
TempImagePath[0] = 0;
|
TempImagePath[0] = 0;
|
||||||
sprintf(ImagePath, "%s\\system32\\drivers\\%S.sys", DirectoryPath, ServiceName);
|
sprintf(ImagePath, "%s\\system32\\drivers\\%S.sys", DirectoryPath, ServiceName);
|
||||||
} else if (TempImagePath[0] != L'\\') {
|
}
|
||||||
|
else if (TempImagePath[0] != L'\\')
|
||||||
|
{
|
||||||
sprintf(ImagePath, "%s%S", DirectoryPath, TempImagePath);
|
sprintf(ImagePath, "%s%S", DirectoryPath, TempImagePath);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
sprintf(ImagePath, "%S", TempImagePath);
|
sprintf(ImagePath, "%S", TempImagePath);
|
||||||
TRACE_CH(REACTOS, "ImagePath: '%s'\n", ImagePath);
|
TRACE_CH(REACTOS, "ImagePath: '%s'\n", ImagePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("Adding boot driver: '%s'\n", ImagePath);
|
TRACE("Adding boot driver: '%s'\n", ImagePath);
|
||||||
|
|
||||||
Status = WinLdrAddDriverToList(BootDriverListHead,
|
Success = WinLdrAddDriverToList(BootDriverListHead,
|
||||||
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
|
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
|
||||||
TempImagePath,
|
TempImagePath,
|
||||||
ServiceName);
|
ServiceName);
|
||||||
|
if (!Success)
|
||||||
if (!Status)
|
|
||||||
ERR("Failed to add boot driver\n");
|
ERR("Failed to add boot driver\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -642,34 +637,39 @@ WinLdrScanRegistry(IN OUT PLIST_ENTRY BootDriverListHead,
|
||||||
rc = RegQueryValue(hDriverKey, L"Group", NULL, (PUCHAR)DriverGroup, &DriverGroupSize);
|
rc = RegQueryValue(hDriverKey, L"Group", NULL, (PUCHAR)DriverGroup, &DriverGroupSize);
|
||||||
//TRACE_CH(REACTOS, " Group: '%S' \n", DriverGroup);
|
//TRACE_CH(REACTOS, " Group: '%S' \n", DriverGroup);
|
||||||
|
|
||||||
for (TagIndex = 1; TagIndex <= OrderList[0]; TagIndex++) {
|
for (TagIndex = 1; TagIndex <= OrderList[0]; TagIndex++)
|
||||||
|
{
|
||||||
if (TagValue == OrderList[TagIndex]) break;
|
if (TagValue == OrderList[TagIndex]) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((StartValue == 0) &&
|
if ((StartValue == 0) &&
|
||||||
(TagIndex > OrderList[0]) &&
|
(TagIndex > OrderList[0]) &&
|
||||||
(_wcsicmp(DriverGroup, GroupName) == 0)) {
|
(_wcsicmp(DriverGroup, GroupName) == 0))
|
||||||
|
{
|
||||||
ValueSize = sizeof(TempImagePath);
|
ValueSize = sizeof(TempImagePath);
|
||||||
rc = RegQueryValue(hDriverKey, L"ImagePath", NULL, (PUCHAR)TempImagePath, &ValueSize);
|
rc = RegQueryValue(hDriverKey, L"ImagePath", NULL, (PUCHAR)TempImagePath, &ValueSize);
|
||||||
if (rc != ERROR_SUCCESS) {
|
if (rc != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
TRACE_CH(REACTOS, "ImagePath: not found\n");
|
TRACE_CH(REACTOS, "ImagePath: not found\n");
|
||||||
TempImagePath[0] = 0;
|
TempImagePath[0] = 0;
|
||||||
sprintf(ImagePath, "%ssystem32\\drivers\\%S.sys", DirectoryPath, ServiceName);
|
sprintf(ImagePath, "%ssystem32\\drivers\\%S.sys", DirectoryPath, ServiceName);
|
||||||
} else if (TempImagePath[0] != L'\\') {
|
}
|
||||||
|
else if (TempImagePath[0] != L'\\')
|
||||||
|
{
|
||||||
sprintf(ImagePath, "%s%S", DirectoryPath, TempImagePath);
|
sprintf(ImagePath, "%s%S", DirectoryPath, TempImagePath);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
sprintf(ImagePath, "%S", TempImagePath);
|
sprintf(ImagePath, "%S", TempImagePath);
|
||||||
TRACE_CH(REACTOS, "ImagePath: '%s'\n", ImagePath);
|
TRACE_CH(REACTOS, "ImagePath: '%s'\n", ImagePath);
|
||||||
}
|
}
|
||||||
TRACE(" Adding boot driver: '%s'\n", ImagePath);
|
TRACE(" Adding boot driver: '%s'\n", ImagePath);
|
||||||
|
|
||||||
Status = WinLdrAddDriverToList(BootDriverListHead,
|
Success = WinLdrAddDriverToList(BootDriverListHead,
|
||||||
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
|
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
|
||||||
TempImagePath,
|
TempImagePath,
|
||||||
ServiceName);
|
ServiceName);
|
||||||
|
if (!Success)
|
||||||
if (!Status)
|
|
||||||
ERR(" Failed to add boot driver\n");
|
ERR(" Failed to add boot driver\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue