[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:
Hermès Bélusca-Maïto 2015-01-05 01:34:29 +00:00
parent a1b3d1f7e8
commit e36f91e0de
15 changed files with 360 additions and 372 deletions

View file

@ -249,7 +249,7 @@ IopReadBootRecord(
ULONG FileId = (ULONG)DeviceObject;
LARGE_INTEGER Position;
ULONG BytesRead;
ULONG Status;
ARC_STATUS Status;
Position.QuadPart = LogicalSectorNumber * SectorSize;
Status = ArcSeek(FileId, &Position, SeekAbsolute);

View file

@ -126,7 +126,7 @@ RamDiskLoadVirtualFile(IN PCHAR FileName)
ULONG PercentPerChunk, Percent;
FILEINFORMATION Information;
LARGE_INTEGER Position;
LONG ret;
ARC_STATUS Status;
//
// Display progress
@ -143,8 +143,8 @@ RamDiskLoadVirtualFile(IN PCHAR FileName)
//
// Get the file size
//
ret = ArcGetFileInformation(RamFile, &Information);
if (ret != ESUCCESS)
Status = ArcGetFileInformation(RamFile, &Information);
if (Status != ESUCCESS)
{
FsCloseFile(RamFile);
return;
@ -204,19 +204,19 @@ RamDiskLoadVirtualFile(IN PCHAR FileName)
//
Position.HighPart = 0;
Position.LowPart = TotalRead;
ret = ArcSeek(RamFile, &Position, SeekAbsolute);
if (ret == ESUCCESS)
Status = ArcSeek(RamFile, &Position, SeekAbsolute);
if (Status == ESUCCESS)
{
ret = ArcRead(RamFile,
(PVOID)((ULONG_PTR)gRamDiskBase + TotalRead),
ChunkSize,
&Count);
Status = ArcRead(RamFile,
(PVOID)((ULONG_PTR)gRamDiskBase + TotalRead),
ChunkSize,
&Count);
}
//
// Check for success
//
if (ret != ESUCCESS || Count != ChunkSize)
if (Status != ESUCCESS || Count != ChunkSize)
{
MmFreeMemory(gRamDiskBase);
gRamDiskBase = NULL;

View file

@ -776,7 +776,7 @@ SpiScanDevice(
IN ULONG Lun)
{
ULONG FileId, i;
ULONG Status;
ARC_STATUS Status;
NTSTATUS ret;
struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer;
CHAR PartitionName[64];
@ -1574,7 +1574,7 @@ LoadBootDeviceDriver(VOID)
CHAR NtBootDdPath[MAX_PATH];
PVOID ImageBase = NULL;
ULONG (NTAPI *EntryPoint)(IN PVOID DriverObject, IN PVOID RegistryPath);
BOOLEAN Status;
BOOLEAN Success;
/* Initialize the loaded module list */
InitializeListHead(&ModuleListHead);
@ -1584,37 +1584,37 @@ LoadBootDeviceDriver(VOID)
strcat(NtBootDdPath, "\\NTBOOTDD.SYS");
/* Load file */
Status = WinLdrLoadImage(NtBootDdPath, LoaderBootDriver, &ImageBase);
if (!Status)
Success = WinLdrLoadImage(NtBootDdPath, LoaderBootDriver, &ImageBase);
if (!Success)
{
/* That's OK. File simply doesn't exist */
return ESUCCESS;
}
/* Allocate a DTE for ntbootdd */
Status = WinLdrAllocateDataTableEntry(&ModuleListHead, "ntbootdd.sys",
Success = WinLdrAllocateDataTableEntry(&ModuleListHead, "ntbootdd.sys",
"NTBOOTDD.SYS", ImageBase, &BootDdDTE);
if (!Status)
if (!Success)
return EIO;
/* Add the PE part of freeldr.sys to the list of loaded executables, it
contains Scsiport* exports, imported by ntbootdd.sys */
Status = WinLdrAllocateDataTableEntry(&ModuleListHead, "scsiport.sys",
Success = WinLdrAllocateDataTableEntry(&ModuleListHead, "scsiport.sys",
"FREELDR.SYS", &__ImageBase, &FreeldrDTE);
if (!Status)
if (!Success)
{
RemoveEntryList(&BootDdDTE->InLoadOrderLinks);
return EIO;
}
/* Fix imports */
Status = WinLdrScanImportDescriptorTable(&ModuleListHead, "", BootDdDTE);
Success = WinLdrScanImportDescriptorTable(&ModuleListHead, "", BootDdDTE);
/* Now unlinkt the DTEs, they won't be valid later */
RemoveEntryList(&BootDdDTE->InLoadOrderLinks);
RemoveEntryList(&FreeldrDTE->InLoadOrderLinks);
if (!Status)
if (!Success)
return EIO;
/* Change imports to PA */
@ -1635,14 +1635,13 @@ LoadBootDeviceDriver(VOID)
NtHeaders = RtlImageNtHeader(VaToPa(BootDdDTE->DllBase));
if (!NtHeaders)
return EIO;
Status = (BOOLEAN)LdrRelocateImageWithBias(
VaToPa(BootDdDTE->DllBase),
NtHeaders->OptionalHeader.ImageBase - (ULONG_PTR)BootDdDTE->DllBase,
"FreeLdr",
TRUE,
TRUE, /* in case of conflict still return success */
FALSE);
if (!Status)
Success = (BOOLEAN)LdrRelocateImageWithBias(VaToPa(BootDdDTE->DllBase),
NtHeaders->OptionalHeader.ImageBase - (ULONG_PTR)BootDdDTE->DllBase,
"FreeLdr",
TRUE,
TRUE, /* in case of conflict still return success */
FALSE);
if (!Success)
return EIO;
/* Call the entrypoint */

View file

@ -918,7 +918,6 @@ BOOLEAN Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer)
ULONG InodeOffsetInBlock;
CHAR ErrorString[80];
EXT2_GROUP_DESC GroupDescriptor;
BOOLEAN Status;
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);
// Read the block
Status = Ext2ReadPartialBlock(InodeBlockNumber,
(InodeOffsetInBlock * EXT2_INODE_SIZE(Ext2SuperBlock)),
sizeof(EXT2_INODE),
InodeBuffer);
if (!Status)
if (!Ext2ReadPartialBlock(InodeBlockNumber,
(InodeOffsetInBlock * EXT2_INODE_SIZE(Ext2SuperBlock)),
sizeof(EXT2_INODE),
InodeBuffer))
{
return FALSE;
}
@ -1255,18 +1253,18 @@ ARC_STATUS Ext2Read(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
{
PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
ULONGLONG BytesReadBig;
BOOLEAN ret;
BOOLEAN Success;
//
// Read data
//
ret = Ext2ReadFileBig(FileHandle, N, &BytesReadBig, Buffer);
Success = Ext2ReadFileBig(FileHandle, N, &BytesReadBig, Buffer);
*Count = (ULONG)BytesReadBig;
//
// Check for success
//
if (ret)
if (Success)
return ESUCCESS;
else
return EIO;
@ -1304,18 +1302,18 @@ const DEVVTBL* Ext2Mount(ULONG DeviceId)
EXT2_SUPER_BLOCK SuperBlock;
LARGE_INTEGER Position;
ULONG Count;
LONG ret;
ARC_STATUS Status;
//
// Read the SuperBlock
//
Position.HighPart = 0;
Position.LowPart = 2 * 512;
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS)
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
return NULL;
ret = ArcRead(DeviceId, &SuperBlock, sizeof(SuperBlock), &Count);
if (ret != ESUCCESS || Count != sizeof(SuperBlock))
Status = ArcRead(DeviceId, &SuperBlock, sizeof(SuperBlock), &Count);
if (Status != ESUCCESS || Count != sizeof(SuperBlock))
return NULL;
//

View file

@ -28,7 +28,7 @@ DBG_DEFAULT_CHANNEL(FILESYSTEM);
ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONGLONG PartitionSectorCount);
PVOID FatBufferDirectory(PFAT_VOLUME_INFO Volume, ULONG DirectoryStartCluster, ULONG* EntryCountPointer, BOOLEAN RootDirectory);
BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID DirectoryBuffer, ULONG EntryCount, PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer);
LONG FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, ULONG DeviceId, PFAT_FILE_INFO FatFileInfoPointer);
ARC_STATUS FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, ULONG DeviceId, 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);
@ -762,7 +762,7 @@ static BOOLEAN FatXSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID D
* specified filename and fills in an FAT_FILE_INFO structure
* 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;
ULONG NumberOfPathParts;
@ -912,7 +912,7 @@ BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPoi
UINT32 ThisFatEntOffset;
ULONG SectorCount;
PUCHAR ReadBuffer;
BOOLEAN status = TRUE;
BOOLEAN Success = TRUE;
//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))
{
status = FALSE;
Success = FALSE;
break;
}
@ -968,7 +968,7 @@ BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPoi
if (!FatReadVolumeSectors(Volume, ThisFatSecNum, 1, ReadBuffer))
{
status = FALSE;
Success = FALSE;
break;
}
@ -997,7 +997,7 @@ BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPoi
default:
ERR("Unknown FAT type %d\n", Volume->FatType);
status = FALSE;
Success = FALSE;
break;
}
@ -1007,7 +1007,7 @@ BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPoi
*ClusterPointer = fat;
return status;
return Success;
}
ULONG FatCountClustersInChain(PFAT_VOLUME_INFO Volume, ULONG StartCluster)
@ -1171,7 +1171,7 @@ BOOLEAN FatReadPartialCluster(PFAT_VOLUME_INFO Volume, ULONG ClusterNumber, ULON
ULONG ClusterStartSector;
ULONG SectorOffset, ReadSize, SectorCount;
PUCHAR ReadBuffer;
BOOLEAN status = FALSE;
BOOLEAN Success = FALSE;
//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))
{
memcpy(Buffer, ReadBuffer + StartingOffset, Length);
status = TRUE;
Success = TRUE;
}
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;
ULONG Count;
LONG ret;
ARC_STATUS Status;
//TRACE("FatReadVolumeSectors(): SectorNumber %d, SectorCount %d, Buffer %p\n",
// SectorNumber, SectorCount, Buffer);
@ -1376,8 +1376,8 @@ BOOLEAN FatReadVolumeSectors(PFAT_VOLUME_INFO Volume, ULONG SectorNumber, ULONG
// Seek to right position
//
Position.QuadPart = (ULONGLONG)SectorNumber * 512;
ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS)
Status = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
{
TRACE("FatReadVolumeSectors() Failed to seek\n");
return FALSE;
@ -1386,8 +1386,8 @@ BOOLEAN FatReadVolumeSectors(PFAT_VOLUME_INFO Volume, ULONG SectorNumber, ULONG
//
// Read data
//
ret = ArcRead(Volume->DeviceId, Buffer, SectorCount * 512, &Count);
if (ret != ESUCCESS || Count != SectorCount * 512)
Status = ArcRead(Volume->DeviceId, Buffer, SectorCount * 512, &Count);
if (Status != ESUCCESS || Count != SectorCount * 512)
{
TRACE("FatReadVolumeSectors() Failed to read\n");
return FALSE;
@ -1430,7 +1430,7 @@ ARC_STATUS FatOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
PFAT_FILE_INFO FileHandle;
ULONG DeviceId;
BOOLEAN IsDirectory;
LONG ret;
ARC_STATUS Status;
if (OpenMode != OpenReadOnly && OpenMode != OpenDirectory)
return EACCES;
@ -1441,8 +1441,8 @@ ARC_STATUS FatOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
TRACE("FatOpen() FileName = %s\n", Path);
RtlZeroMemory(&TempFileInfo, sizeof(TempFileInfo));
ret = FatLookupFile(FatVolume, Path, DeviceId, &TempFileInfo);
if (ret != ESUCCESS)
Status = FatLookupFile(FatVolume, Path, DeviceId, &TempFileInfo);
if (Status != ESUCCESS)
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)
{
PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
BOOLEAN ret;
BOOLEAN Success;
//
// Call old read method
//
ret = FatReadFile(FileHandle, N, Count, Buffer);
Success = FatReadFile(FileHandle, N, Count, Buffer);
//
// Check for success
//
if (ret)
if (Success)
return ESUCCESS;
else
return EIO;
@ -1522,7 +1522,7 @@ const DEVVTBL* FatMount(ULONG DeviceId)
LARGE_INTEGER Position;
ULONG Count;
ULARGE_INTEGER SectorCount;
LONG ret;
ARC_STATUS Status;
//
// Allocate data for volume information
@ -1537,14 +1537,14 @@ const DEVVTBL* FatMount(ULONG DeviceId)
//
Position.HighPart = 0;
Position.LowPart = 0;
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS)
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
{
FrLdrTempFree(Volume, TAG_FAT_VOLUME);
return NULL;
}
ret = ArcRead(DeviceId, Buffer, sizeof(Buffer), &Count);
if (ret != ESUCCESS || Count != sizeof(Buffer))
Status = ArcRead(DeviceId, Buffer, sizeof(Buffer), &Count);
if (Status != ESUCCESS || Count != sizeof(Buffer))
{
FrLdrTempFree(Volume, TAG_FAT_VOLUME);
return NULL;
@ -1565,8 +1565,8 @@ const DEVVTBL* FatMount(ULONG DeviceId)
//
// Determine sector count
//
ret = ArcGetFileInformation(DeviceId, &FileInformation);
if (ret != ESUCCESS)
Status = ArcGetFileInformation(DeviceId, &FileInformation);
if (Status != ESUCCESS)
{
FrLdrTempFree(Volume, TAG_FAT_VOLUME);
return NULL;

View file

@ -57,7 +57,8 @@ static LIST_ENTRY DeviceListHead;
ARC_STATUS ArcOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
{
ULONG Count, i, ret;
ARC_STATUS Status;
ULONG Count, i;
PLIST_ENTRY pEntry;
DEVICE* pDevice;
CHAR* DeviceName;
@ -132,11 +133,11 @@ ARC_STATUS ArcOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
/* Try to open the device */
FileData[DeviceId].FuncTable = pDevice->FuncTable;
ret = pDevice->FuncTable->Open(pDevice->Prefix, DeviceOpenMode, &DeviceId);
if (ret != ESUCCESS)
Status = pDevice->FuncTable->Open(pDevice->Prefix, DeviceOpenMode, &DeviceId);
if (Status != ESUCCESS)
{
FileData[DeviceId].FuncTable = NULL;
return ret;
return Status;
}
else if (!*FileName)
{
@ -205,31 +206,31 @@ ARC_STATUS ArcOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
FileData[i].FuncTable = FileData[DeviceId].FileFuncTable;
FileData[i].DeviceId = DeviceId;
*FileId = i;
ret = FileData[i].FuncTable->Open(FileName, OpenMode, FileId);
if (ret != ESUCCESS)
Status = FileData[i].FuncTable->Open(FileName, OpenMode, FileId);
if (Status != ESUCCESS)
{
FileData[i].FuncTable = NULL;
*FileId = MAX_FDS;
}
return ret;
return Status;
}
ARC_STATUS ArcClose(ULONG FileId)
{
LONG ret;
ARC_STATUS Status;
if (FileId >= MAX_FDS || !FileData[FileId].FuncTable)
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].Specific = NULL;
FileData[FileId].DeviceId = -1;
}
return ret;
return Status;
}
ARC_STATUS ArcRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
@ -265,7 +266,7 @@ PFILE FsOpenFile(PCSTR FileName)
{
CHAR FullPath[MAX_PATH] = "";
ULONG FileId;
LONG ret;
ARC_STATUS Status;
//
// Print status message
@ -293,12 +294,12 @@ PFILE FsOpenFile(PCSTR FileName)
//
// Open the file
//
ret = ArcOpen(FullPath, OpenReadOnly, &FileId);
Status = ArcOpen(FullPath, OpenReadOnly, &FileId);
//
// Check for success
//
if (ret == ESUCCESS)
if (Status == ESUCCESS)
return (PFILE)FileId;
else
return (PFILE)0;
@ -343,17 +344,17 @@ ULONG FsGetFileSize(PFILE FileHandle)
{
ULONG FileId = (ULONG)FileHandle;
FILEINFORMATION Information;
LONG ret;
ARC_STATUS Status;
//
// Query file informations
//
ret = ArcGetFileInformation(FileId, &Information);
Status = ArcGetFileInformation(FileId, &Information);
//
// Check for error
//
if (ret != ESUCCESS || Information.EndingAddress.HighPart != 0)
if (Status != ESUCCESS || Information.EndingAddress.HighPart != 0)
return 0;
//

View file

@ -96,14 +96,14 @@ static BOOLEAN IsoSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG Dire
* function returns an ARC error code. The directory is specified
* 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 DirectoryBuffer;
ULONG SectorCount;
LARGE_INTEGER Position;
ULONG Count;
ULONG ret;
ARC_STATUS Status;
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.LowPart = DirectoryStartSector * SECTORSIZE;
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS)
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
{
FrLdrTempFree(DirectoryBuffer, TAG_ISO_BUFFER);
return ret;
return Status;
}
ret = ArcRead(DeviceId, DirectoryBuffer, SectorCount * SECTORSIZE, &Count);
if (ret != ESUCCESS || Count != SectorCount * SECTORSIZE)
Status = ArcRead(DeviceId, DirectoryBuffer, SectorCount * SECTORSIZE, &Count);
if (Status != ESUCCESS || Count != SectorCount * SECTORSIZE)
{
FrLdrTempFree(DirectoryBuffer, TAG_ISO_BUFFER);
return EIO;
@ -147,7 +147,7 @@ static LONG IsoBufferDirectory(ULONG DeviceId, ULONG DirectoryStartSector, ULONG
* specified filename and fills in an ISO_FILE_INFO structure
* 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];
PPVD Pvd = (PPVD)Buffer;
@ -160,7 +160,7 @@ static LONG IsoLookupFile(PCSTR FileName, ULONG DeviceId, PISO_FILE_INFO IsoFile
ISO_FILE_INFO IsoFileInfo;
LARGE_INTEGER Position;
ULONG Count;
LONG ret;
ARC_STATUS Status;
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.LowPart = 16 * SECTORSIZE;
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS)
return ret;
ret = ArcRead(DeviceId, Pvd, SECTORSIZE, &Count);
if (ret != ESUCCESS || Count < sizeof(PVD))
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
return Status;
Status = ArcRead(DeviceId, Pvd, SECTORSIZE, &Count);
if (Status != ESUCCESS || Count < sizeof(PVD))
return EIO;
DirectorySector = Pvd->RootDirRecord.ExtentLocationL;
@ -208,9 +208,9 @@ static LONG IsoLookupFile(PCSTR FileName, ULONG DeviceId, PISO_FILE_INFO IsoFile
//
// Buffer the directory contents
//
ret = IsoBufferDirectory(DeviceId, DirectorySector, DirectoryLength, &DirectoryBuffer);
if (ret != ESUCCESS)
return ret;
Status = IsoBufferDirectory(DeviceId, DirectorySector, DirectoryLength, &DirectoryBuffer);
if (Status != ESUCCESS)
return Status;
//
// Search for file name in directory
@ -268,7 +268,7 @@ ARC_STATUS IsoOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
ISO_FILE_INFO TempFileInfo;
PISO_FILE_INFO FileHandle;
ULONG DeviceId;
LONG ret;
ARC_STATUS Status;
if (OpenMode != OpenReadOnly)
return EACCES;
@ -278,8 +278,8 @@ ARC_STATUS IsoOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
TRACE("IsoOpen() FileName = %s\n", Path);
RtlZeroMemory(&TempFileInfo, sizeof(TempFileInfo));
ret = IsoLookupFile(Path, DeviceId, &TempFileInfo);
if (ret != ESUCCESS)
Status = IsoLookupFile(Path, DeviceId, &TempFileInfo);
if (Status != ESUCCESS)
return ENOENT;
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 NumberOfSectors;
ULONG BytesRead;
LONG ret;
ARC_STATUS Status;
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.LowPart = SectorNumber * SECTORSIZE;
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS)
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
{
return ret;
return Status;
}
ret = ArcRead(DeviceId, SectorBuffer, SECTORSIZE, &BytesRead);
if (ret != ESUCCESS || BytesRead != SECTORSIZE)
Status = ArcRead(DeviceId, SectorBuffer, SECTORSIZE, &BytesRead);
if (Status != ESUCCESS || BytesRead != SECTORSIZE)
{
return EIO;
}
@ -412,13 +412,13 @@ ARC_STATUS IsoRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
//
Position.HighPart = 0;
Position.LowPart = SectorNumber * SECTORSIZE;
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS)
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
{
return ret;
return Status;
}
ret = ArcRead(DeviceId, Buffer, NumberOfSectors * SECTORSIZE, &BytesRead);
if (ret != ESUCCESS || BytesRead != NumberOfSectors * SECTORSIZE)
Status = ArcRead(DeviceId, Buffer, NumberOfSectors * SECTORSIZE, &BytesRead);
if (Status != ESUCCESS || BytesRead != NumberOfSectors * SECTORSIZE)
{
return EIO;
}
@ -441,13 +441,13 @@ ARC_STATUS IsoRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
//
Position.HighPart = 0;
Position.LowPart = SectorNumber * SECTORSIZE;
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS)
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
{
return ret;
return Status;
}
ret = ArcRead(DeviceId, SectorBuffer, SECTORSIZE, &BytesRead);
if (ret != ESUCCESS || BytesRead != SECTORSIZE)
Status = ArcRead(DeviceId, SectorBuffer, SECTORSIZE, &BytesRead);
if (Status != ESUCCESS || BytesRead != SECTORSIZE)
{
return EIO;
}
@ -494,18 +494,18 @@ const DEVVTBL* IsoMount(ULONG DeviceId)
PPVD Pvd = (PPVD)Buffer;
LARGE_INTEGER Position;
ULONG Count;
LONG ret;
ARC_STATUS Status;
//
// Read The Primary Volume Descriptor
//
Position.HighPart = 0;
Position.LowPart = 16 * SECTORSIZE;
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS)
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
return NULL;
ret = ArcRead(DeviceId, Pvd, SECTORSIZE, &Count);
if (ret != ESUCCESS || Count < sizeof(PVD))
Status = ArcRead(DeviceId, Pvd, SECTORSIZE, &Count);
if (Status != ESUCCESS || Count < sizeof(PVD))
return NULL;
//

View file

@ -147,7 +147,7 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON
LARGE_INTEGER Position;
ULONG Count;
ULONG ReadLength;
LONG ret;
ARC_STATUS Status;
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)
{
Position.QuadPart = Offset & ~(Volume->BootSector.BytesPerSector - 1);
ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS)
Status = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
return FALSE;
ret = ArcRead(Volume->DeviceId, Volume->TemporarySector, Volume->BootSector.BytesPerSector, &Count);
if (ret != ESUCCESS || Count != Volume->BootSector.BytesPerSector)
Status = ArcRead(Volume->DeviceId, Volume->TemporarySector, Volume->BootSector.BytesPerSector, &Count);
if (Status != ESUCCESS || Count != Volume->BootSector.BytesPerSector)
return FALSE;
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)
{
Position.QuadPart = Offset;
ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS)
Status = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
return FALSE;
ReadLength = Length & ~(Volume->BootSector.BytesPerSector - 1);
ret = ArcRead(Volume->DeviceId, Buffer, ReadLength, &Count);
if (ret != ESUCCESS || Count != ReadLength)
Status = ArcRead(Volume->DeviceId, Buffer, ReadLength, &Count);
if (Status != ESUCCESS || Count != ReadLength)
return FALSE;
//
@ -208,11 +208,11 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON
if (Length)
{
Position.QuadPart = Offset;
ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS)
Status = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
return FALSE;
ret = ArcRead(Volume->DeviceId, Buffer, (ULONG)Length, &Count);
if (ret != ESUCCESS || Count != Length)
Status = ArcRead(Volume->DeviceId, Buffer, (ULONG)Length, &Count);
if (Status != ESUCCESS || Count != Length)
return FALSE;
}
@ -880,7 +880,7 @@ const DEVVTBL* NtfsMount(ULONG DeviceId)
PNTFS_VOLUME_INFO Volume;
LARGE_INTEGER Position;
ULONG Count;
LONG ret;
ARC_STATUS Status;
//
// Allocate data for volume information
@ -895,14 +895,14 @@ const DEVVTBL* NtfsMount(ULONG DeviceId)
//
Position.HighPart = 0;
Position.LowPart = 0;
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS)
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
{
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
return NULL;
}
ret = ArcRead(DeviceId, &Volume->BootSector, sizeof(Volume->BootSector), &Count);
if (ret != ESUCCESS || Count != sizeof(Volume->BootSector))
Status = ArcRead(DeviceId, &Volume->BootSector, sizeof(Volume->BootSector), &Count);
if (Status != ESUCCESS || Count != sizeof(Volume->BootSector))
{
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
return NULL;
@ -947,16 +947,16 @@ const DEVVTBL* NtfsMount(ULONG DeviceId)
return NULL;
}
Position.QuadPart = Volume->BootSector.MftLocation * Volume->ClusterSize;
ret = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS)
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
if (Status != ESUCCESS)
{
FileSystemError("Failed to seek to Master File Table record.");
FrLdrTempFree(Volume->MasterFileTable, TAG_NTFS_MFT);
FrLdrTempFree(Volume, TAG_NTFS_VOLUME);
return NULL;
}
ret = ArcRead(DeviceId, Volume->MasterFileTable, Volume->MftRecordSize, &Count);
if (ret != ESUCCESS || Count != Volume->MftRecordSize)
Status = ArcRead(DeviceId, Volume->MasterFileTable, Volume->MftRecordSize, &Count);
if (Status != ESUCCESS || Count != Volume->MftRecordSize)
{
FileSystemError("Failed to read the Master File Table record.");
FrLdrTempFree(Volume->MasterFileTable, TAG_NTFS_MFT);

View file

@ -350,20 +350,20 @@ static BOOLEAN GetCachedInfo(VOID)
BOOLEAN PxeInit(VOID)
{
static BOOLEAN Initialized = FALSE;
static BOOLEAN Status = FALSE;
static BOOLEAN Success = FALSE;
// Do initialization only once
if (Initialized)
return Status;
return Success;
Initialized = TRUE;
// Check if PXE is available
if (GetPxeStructure() && GetCachedInfo())
{
FsRegisterDevice("net(0)", &PxeDiskVtbl);
Status = TRUE;
Success = TRUE;
}
return Status;
return Success;
}

View file

@ -944,7 +944,7 @@ InfOpenFile(
ULONG FileSize, Count;
PINFCACHE Cache;
BOOLEAN Success;
LONG ret;
ARC_STATUS Status;
*InfHandle = NULL;
*ErrorLine = (ULONG) - 1;
@ -952,8 +952,8 @@ InfOpenFile(
//
// Open the .inf file
//
ret = ArcOpen((PCHAR)FileName, OpenReadOnly, &FileId);
if (ret != ESUCCESS)
Status = ArcOpen((PCHAR)FileName, OpenReadOnly, &FileId);
if (Status != ESUCCESS)
{
return FALSE;
}
@ -961,8 +961,8 @@ InfOpenFile(
//
// Query file size
//
ret = ArcGetFileInformation(FileId, &Information);
if ((ret != ESUCCESS) || (Information.EndingAddress.HighPart != 0))
Status = ArcGetFileInformation(FileId, &Information);
if ((Status != ESUCCESS) || (Information.EndingAddress.HighPart != 0))
{
ArcClose(FileId);
return FALSE;
@ -982,8 +982,8 @@ InfOpenFile(
//
// Read file into memory
//
ret = ArcRead(FileId, FileBuffer, FileSize, &Count);
if ((ret != ESUCCESS) || (Count != FileSize))
Status = ArcRead(FileId, FileBuffer, FileSize, &Count);
if ((Status != ESUCCESS) || (Count != FileSize))
{
ArcClose(FileId);
FrLdrTempFree(FileBuffer, TAG_INF_FILE);

View file

@ -21,10 +21,9 @@
#include <debug.h>
DBG_DEFAULT_CHANNEL(INIFILE);
static LONG IniOpenIniFile(ULONG* FileId)
static ARC_STATUS IniOpenIniFile(ULONG* FileId)
{
CHAR FreeldrPath[MAX_PATH];
LONG ret;
//
// Create full freeldr.ini path
@ -33,9 +32,7 @@ static LONG IniOpenIniFile(ULONG* FileId)
strcat(FreeldrPath, "\\freeldr.ini");
// Try to open freeldr.ini
ret = ArcOpen(FreeldrPath, OpenReadOnly, FileId);
return ret;
return ArcOpen(FreeldrPath, OpenReadOnly, FileId);
}
BOOLEAN IniFileInitialize(VOID)
@ -44,15 +41,15 @@ BOOLEAN IniFileInitialize(VOID)
ULONG FileId; // File handle for freeldr.ini
PCHAR FreeLoaderIniFileData;
ULONG FreeLoaderIniFileSize, Count;
LONG ret;
ARC_STATUS Status;
BOOLEAN Success;
TRACE("IniFileInitialize()\n");
//
// Open freeldr.ini
//
ret = IniOpenIniFile(&FileId);
if (ret != ESUCCESS)
Status = IniOpenIniFile(&FileId);
if (Status != ESUCCESS)
{
UiMessageBoxCritical("Error opening freeldr.ini or file not found.\nYou need to re-install FreeLoader.");
return FALSE;
@ -61,8 +58,8 @@ BOOLEAN IniFileInitialize(VOID)
//
// Get the file size
//
ret = ArcGetFileInformation(FileId, &FileInformation);
if (ret != ESUCCESS || FileInformation.EndingAddress.HighPart != 0)
Status = ArcGetFileInformation(FileId, &FileInformation);
if (Status != ESUCCESS || FileInformation.EndingAddress.HighPart != 0)
{
UiMessageBoxCritical("Error while getting informations about freeldr.ini.\nYou need to re-install FreeLoader.");
return FALSE;
@ -83,8 +80,8 @@ BOOLEAN IniFileInitialize(VOID)
//
// Read freeldr.ini off the disk
//
ret = ArcRead(FileId, FreeLoaderIniFileData, FreeLoaderIniFileSize, &Count);
if (ret != ESUCCESS || Count != FreeLoaderIniFileSize)
Status = ArcRead(FileId, FreeLoaderIniFileData, FreeLoaderIniFileSize, &Count);
if (Status != ESUCCESS || Count != FreeLoaderIniFileSize)
{
UiMessageBoxCritical("Error while reading freeldr.ini.");
ArcClose(FileId);

View file

@ -103,7 +103,7 @@ WinLdrScanImportDescriptorTable(IN OUT PLIST_ENTRY ModuleListHead,
PIMAGE_IMPORT_DESCRIPTOR ImportTable;
ULONG ImportTableSize;
PCH ImportName;
BOOLEAN Status;
BOOLEAN Success;
/* Get a pointer to the import table of this image */
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 */
if (!WinLdrCheckForLoadedDll(ModuleListHead, ImportName, &DataTableEntry))
{
Status = WinLdrpLoadAndScanReferencedDll(ModuleListHead,
DirectoryPath,
ImportName,
&DataTableEntry);
if (!Status)
Success = WinLdrpLoadAndScanReferencedDll(ModuleListHead,
DirectoryPath,
ImportName,
&DataTableEntry);
if (!Success)
{
ERR("WinLdrpLoadAndScanReferencedDll() failed\n");
return Status;
return Success;
}
}
/* Scan its import address table */
Status = WinLdrpScanImportAddressTable(
ModuleListHead,
DataTableEntry->DllBase,
ScanDTE->DllBase,
(PIMAGE_THUNK_DATA)RVA(ScanDTE->DllBase, ImportTable->FirstThunk),
DirectoryPath);
Success = WinLdrpScanImportAddressTable(ModuleListHead,
DataTableEntry->DllBase,
ScanDTE->DllBase,
(PIMAGE_THUNK_DATA)RVA(ScanDTE->DllBase, ImportTable->FirstThunk),
DirectoryPath);
if (!Status)
if (!Success)
{
ERR("WinLdrpScanImportAddressTable() failed: ImportName = '%s', DirectoryPath = '%s'\n",
ImportName, DirectoryPath);
return Status;
return Success;
}
}
@ -275,7 +273,7 @@ WinLdrLoadImage(IN PCHAR FileName,
PIMAGE_NT_HEADERS NtHeaders;
PIMAGE_SECTION_HEADER SectionHeader;
ULONG VirtualSize, SizeOfRawData, NumberOfSections;
LONG Status;
ARC_STATUS Status;
LARGE_INTEGER Position;
ULONG i, BytesRead;
TRACE("WinLdrLoadImage(%s, %ld, *)\n", FileName, MemoryType);
@ -355,7 +353,6 @@ WinLdrLoadImage(IN PCHAR FileName,
}
Status = ArcRead(FileId, PhysicalBase, NtHeaders->OptionalHeader.SizeOfHeaders, &BytesRead);
if (Status != ESUCCESS)
{
//Print(L"Error reading headers %s\n", FileName);
@ -407,7 +404,6 @@ WinLdrLoadImage(IN PCHAR FileName,
/* Read this section from the file, size = SizeOfRawData */
Status = ArcRead(FileId, (PUCHAR)PhysicalBase + SectionHeader->VirtualAddress, SizeOfRawData, &BytesRead);
if (Status != ESUCCESS)
{
ERR("WinLdrLoadImage(): Error reading section from file!\n");
@ -438,11 +434,11 @@ WinLdrLoadImage(IN PCHAR FileName,
WARN("Relocating %p -> %p\n", NtHeaders->OptionalHeader.ImageBase,
VirtualBase);
return (BOOLEAN)LdrRelocateImageWithBias(PhysicalBase,
(ULONG_PTR)VirtualBase - (ULONG_PTR)PhysicalBase,
"FreeLdr",
TRUE,
TRUE, /* in case of conflict still return success */
FALSE);
(ULONG_PTR)VirtualBase - (ULONG_PTR)PhysicalBase,
"FreeLdr",
TRUE,
TRUE, /* in case of conflict still return success */
FALSE);
}
TRACE("WinLdrLoadImage() done, PA = %p\n", *ImageBasePA);
@ -515,7 +511,7 @@ WinLdrpBindImportName(IN OUT PLIST_ENTRY ModuleListHead,
ULONG Hint;
PIMAGE_IMPORT_BY_NAME ImportData;
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",
// DllBase, ImageBase, ThunkData, ExportDirectory, ExportSize, ProcessForwards);
@ -680,14 +676,14 @@ WinLdrpBindImportName(IN OUT PLIST_ENTRY ModuleListHead,
}
/* Now let's try to load it! */
Status = WinLdrpLoadAndScanReferencedDll(ModuleListHead,
DirectoryPath,
ForwardDllName,
&DataTableEntry);
if (!Status)
Success = WinLdrpLoadAndScanReferencedDll(ModuleListHead,
DirectoryPath,
ForwardDllName,
&DataTableEntry);
if (!Success)
{
ERR("WinLdrpLoadAndScanReferencedDll() failed to load forwarder dll.\n");
return Status;
return Success;
}
}
@ -722,21 +718,20 @@ WinLdrpBindImportName(IN OUT PLIST_ENTRY ModuleListHead,
RefThunkData.u1.AddressOfData = (ULONG_PTR)ImportByName;
/* And recursively call ourselves */
Status = WinLdrpBindImportName(
ModuleListHead,
DataTableEntry->DllBase,
ImageBase,
&RefThunkData,
RefExportDirectory,
RefExportSize,
TRUE,
DirectoryPath);
Success = WinLdrpBindImportName(ModuleListHead,
DataTableEntry->DllBase,
ImageBase,
&RefThunkData,
RefExportDirectory,
RefExportSize,
TRUE,
DirectoryPath);
/* Fill out the ThunkData with data from RefThunkData */
ThunkData->u1 = RefThunkData.u1;
/* Return what we got from the recursive call */
return Status;
return Success;
}
else
{
@ -756,7 +751,7 @@ WinLdrpLoadAndScanReferencedDll(PLIST_ENTRY ModuleListHead,
PLDR_DATA_TABLE_ENTRY *DataTableEntry)
{
CHAR FullDllName[256];
BOOLEAN Status;
BOOLEAN Success;
PVOID BasePA = NULL;
/* 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);
/* Load the image */
Status = WinLdrLoadImage(FullDllName, LoaderBootDriver, &BasePA);
if (!Status)
Success = WinLdrLoadImage(FullDllName, LoaderBootDriver, &BasePA);
if (!Success)
{
ERR("WinLdrLoadImage() failed\n");
return Status;
return Success;
}
/* Allocate DTE for newly loaded DLL */
Status = WinLdrAllocateDataTableEntry(ModuleListHead,
ImportName,
FullDllName,
BasePA,
DataTableEntry);
if (!Status)
Success = WinLdrAllocateDataTableEntry(ModuleListHead,
ImportName,
FullDllName,
BasePA,
DataTableEntry);
if (!Success)
{
ERR("WinLdrAllocateDataTableEntry() failed\n");
return Status;
return Success;
}
/* Scan its dependencies too */
TRACE("WinLdrScanImportDescriptorTable() calling ourselves for %S\n",
VaToPa((*DataTableEntry)->BaseDllName.Buffer));
Status = WinLdrScanImportDescriptorTable(ModuleListHead, DirectoryPath, *DataTableEntry);
if (!Status)
Success = WinLdrScanImportDescriptorTable(ModuleListHead, DirectoryPath, *DataTableEntry);
if (!Success)
{
ERR("WinLdrScanImportDescriptorTable() failed\n");
return Status;
return Success;
}
return TRUE;
@ -807,7 +802,7 @@ WinLdrpScanImportAddressTable(IN OUT PLIST_ENTRY ModuleListHead,
IN PCSTR DirectoryPath)
{
PIMAGE_EXPORT_DIRECTORY ExportDirectory = NULL;
BOOLEAN Status;
BOOLEAN Success;
ULONG ExportSize;
TRACE("WinLdrpScanImportAddressTable(): DllBase 0x%X, "
@ -841,22 +836,21 @@ WinLdrpScanImportAddressTable(IN OUT PLIST_ENTRY ModuleListHead,
while (((PIMAGE_THUNK_DATA)VaToPa(ThunkData))->u1.AddressOfData != 0)
{
/* Bind it */
Status = WinLdrpBindImportName(
ModuleListHead,
DllBase,
ImageBase,
ThunkData,
ExportDirectory,
ExportSize,
FALSE,
DirectoryPath);
Success = WinLdrpBindImportName(ModuleListHead,
DllBase,
ImageBase,
ThunkData,
ExportDirectory,
ExportSize,
FALSE,
DirectoryPath);
/* Move to the next entry */
ThunkData++;
/* Return error if binding was unsuccessful */
if (!Status)
return Status;
if (!Success)
return Success;
}
/* Return success */

View file

@ -41,7 +41,7 @@ static VOID
SetupLdrLoadNlsData(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPCSTR SearchPath)
{
INFCONTEXT InfContext;
BOOLEAN Status;
BOOLEAN Success;
LPCSTR AnsiName, OemName, LangName;
/* Get ANSI codepage file */
@ -79,15 +79,15 @@ SetupLdrLoadNlsData(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPCSTR
return;
}
Status = WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName);
TRACE("NLS data loaded with status %d\n", Status);
Success = WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName);
TRACE("NLS data loading %s\n", Success ? "successful" : "failed");
}
static VOID
SetupLdrScanBootDrivers(PLIST_ENTRY BootDriverListHead, HINF InfHandle, LPCSTR SearchPath)
{
INFCONTEXT InfContext, dirContext;
BOOLEAN Status;
BOOLEAN Success;
LPCSTR Media, DriverName, dirIndex, ImagePath;
WCHAR ServiceName[256];
WCHAR ImagePathW[256];
@ -119,12 +119,11 @@ SetupLdrScanBootDrivers(PLIST_ENTRY BootDriverListHead, HINF InfHandle, LPCSTR S
ServiceName[wcslen(ServiceName) - 4] = 0;
/* Add it to the list */
Status = WinLdrAddDriverToList(BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
ImagePathW,
ServiceName);
if (!Status)
Success = WinLdrAddDriverToList(BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
ImagePathW,
ServiceName);
if (!Success)
{
ERR("could not add boot driver %s, %s\n", SearchPath, DriverName);
return;

View file

@ -234,7 +234,7 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
CHAR DriverPath[1024];
CHAR DllName[1024];
PCHAR DriverNamePos;
BOOLEAN Status;
BOOLEAN Success;
PVOID DriverBase = NULL;
// 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);
// Check if driver is already loaded
Status = WinLdrCheckForLoadedDll(LoadOrderListHead, DllName, DriverDTE);
if (Status)
Success = WinLdrCheckForLoadedDll(LoadOrderListHead, DllName, DriverDTE);
if (Success)
{
// We've got the pointer to its DTE, just return success
return TRUE;
@ -267,13 +267,13 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
// It's not loaded, we have to load it
_snprintf(FullPath, sizeof(FullPath), "%s%wZ", BootPath, FilePath);
Status = WinLdrLoadImage(FullPath, LoaderBootDriver, &DriverBase);
if (!Status)
Success = WinLdrLoadImage(FullPath, LoaderBootDriver, &DriverBase);
if (!Success)
return FALSE;
// Allocate a DTE for it
Status = WinLdrAllocateDataTableEntry(LoadOrderListHead, DllName, DllName, DriverBase, DriverDTE);
if (!Status)
Success = WinLdrAllocateDataTableEntry(LoadOrderListHead, DllName, DllName, DriverBase, DriverDTE);
if (!Success)
{
ERR("WinLdrAllocateDataTableEntry() failed\n");
return FALSE;
@ -284,8 +284,8 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
// Look for any dependencies it may have, and load them too
sprintf(FullPath,"%s%s", BootPath, DriverPath);
Status = WinLdrScanImportDescriptorTable(LoadOrderListHead, FullPath, *DriverDTE);
if (!Status)
Success = WinLdrScanImportDescriptorTable(LoadOrderListHead, FullPath, *DriverDTE);
if (!Success)
{
ERR("WinLdrScanImportDescriptorTable() failed for %s\n", FullPath);
return FALSE;
@ -300,7 +300,7 @@ WinLdrLoadBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock,
{
PLIST_ENTRY NextBd;
PBOOT_DRIVER_LIST_ENTRY BootDriver;
BOOLEAN Status;
BOOLEAN Success;
// Walk through the boot drivers list
NextBd = LoaderBlock->BootDriverListHead.Flink;
@ -315,15 +315,15 @@ WinLdrLoadBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock,
// Paths are relative (FIXME: Are they always relative?)
// Load it
Status = WinLdrLoadDeviceDriver(&LoaderBlock->LoadOrderListHead,
BootPath,
&BootDriver->FilePath,
0,
&BootDriver->LdrEntry);
Success = WinLdrLoadDeviceDriver(&LoaderBlock->LoadOrderListHead,
BootPath,
&BootDriver->FilePath,
0,
&BootDriver->LdrEntry);
// If loading failed - cry loudly
//FIXME: Maybe remove it from the list and try to continue?
if (!Status)
if (!Success)
{
ERR("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;
FILEINFORMATION FileInfo;
ULONG FileSize;
ULONG Status;
ARC_STATUS Status;
ULONG BytesRead;
//CHAR ProgressString[256];
@ -432,7 +432,7 @@ LoadModule(
BOOLEAN IsKdTransportDll,
ULONG Percentage)
{
BOOLEAN Status;
BOOLEAN Success;
CHAR FullFileName[MAX_PATH];
CHAR ProgressString[256];
PVOID BaseAdress = NULL;
@ -445,8 +445,8 @@ LoadModule(
strcat(FullFileName, "SYSTEM32\\");
strcat(FullFileName, File);
Status = WinLdrLoadImage(FullFileName, MemoryType, &BaseAdress);
if (!Status)
Success = WinLdrLoadImage(FullFileName, MemoryType, &BaseAdress);
if (!Success)
{
TRACE("Loading %s failed\n", File);
return FALSE;
@ -460,13 +460,13 @@ LoadModule(
* the Kernel Debugger Transport DLL, to make the
* PE loader happy.
*/
Status = WinLdrAllocateDataTableEntry(&LoaderBlock->LoadOrderListHead,
(IsKdTransportDll ? "KDCOM.DLL" : File),
FullFileName,
BaseAdress,
Dte);
Success = WinLdrAllocateDataTableEntry(&LoaderBlock->LoadOrderListHead,
(IsKdTransportDll ? "KDCOM.DLL" : File),
FullFileName,
BaseAdress,
Dte);
return Status;
return Success;
}
static
@ -477,7 +477,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
IN LPCSTR BootPath,
IN OUT PLDR_DATA_TABLE_ENTRY* KernelDTE)
{
BOOLEAN Status;
BOOLEAN Success;
CHAR DirPath[MAX_PATH];
CHAR KdTransportDllName[MAX_PATH];
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 */
strcpy(DirPath, BootPath);
strcat(DirPath, "system32\\");
Status = WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, *KernelDTE);
Status &= WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, HalDTE);
Success = WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, *KernelDTE);
Success &= WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, HalDTE);
if (KdComDTE)
{
Status &= WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, KdComDTE);
Success &= WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, KdComDTE);
}
return Status;
return Success;
}
VOID
@ -600,7 +600,7 @@ LoadAndBootWindows(IN OperatingSystemItem* OperatingSystem,
CHAR FileName[MAX_PATH];
CHAR BootOptions[256];
PCHAR File;
BOOLEAN Status;
BOOLEAN Success;
PLOADER_PARAMETER_BLOCK LoaderBlock;
/* Get OS setting value */
@ -688,12 +688,12 @@ LoadAndBootWindows(IN OperatingSystemItem* OperatingSystem,
/* Load Hive */
UiDrawBackdrop();
UiDrawProgressBarCenter(15, 100, "Loading system hive...");
Status = WinLdrInitSystemHive(LoaderBlock, BootPath);
TRACE("SYSTEM hive %s\n", (Status ? "loaded" : "not loaded"));
Success = WinLdrInitSystemHive(LoaderBlock, BootPath);
TRACE("SYSTEM hive %s\n", (Success ? "loaded" : "not loaded"));
/* Load NLS data, OEM font, and prepare boot drivers list */
Status = WinLdrScanSystemHive(LoaderBlock, BootPath);
TRACE("SYSTEM hive %s\n", (Status ? "scanned" : "not scanned"));
Success = WinLdrScanSystemHive(LoaderBlock, BootPath);
TRACE("SYSTEM hive %s\n", (Success ? "scanned" : "not scanned"));
/* Finish loading */
LoadAndBootWindowsCommon(OperatingSystemVersion,
@ -712,7 +712,7 @@ LoadAndBootWindowsCommon(
BOOLEAN Setup)
{
PLOADER_PARAMETER_BLOCK LoaderBlockVA;
BOOLEAN Status;
BOOLEAN Success;
PLDR_DATA_TABLE_ENTRY KernelDTE;
KERNEL_ENTRY_POINT KiSystemStartup;
LPCSTR SystemRoot;
@ -733,12 +733,12 @@ LoadAndBootWindowsCommon(
OperatingSystemVersion = WinLdrDetectVersion();
/* Load the operating system core: the Kernel, the HAL and the Kernel Debugger Transport DLL */
Status = LoadWindowsCore(OperatingSystemVersion,
LoaderBlock,
BootOptions,
BootPath,
&KernelDTE);
if (!Status)
Success = LoadWindowsCore(OperatingSystemVersion,
LoaderBlock,
BootOptions,
BootPath,
&KernelDTE);
if (!Success)
{
UiMessageBox("Error loading NTOS core.");
return;
@ -747,8 +747,8 @@ LoadAndBootWindowsCommon(
/* Load boot drivers */
UiDrawBackdrop();
UiDrawProgressBarCenter(100, 100, "Loading boot drivers...");
Status = WinLdrLoadBootDrivers(LoaderBlock, BootPath);
TRACE("Boot drivers loaded with status %d\n", Status);
Success = WinLdrLoadBootDrivers(LoaderBlock, BootPath);
TRACE("Boot drivers loading %s\n", Success ? "successful" : "failed");
/* Initialize Phase 1 - no drivers loading anymore */
WinLdrInitializePhase1(LoaderBlock,

View file

@ -35,7 +35,7 @@ WinLdrLoadSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
{
ULONG FileId;
CHAR FullHiveName[256];
LONG Status;
ARC_STATUS Status;
FILEINFORMATION FileInfo;
ULONG HiveFileSize;
ULONG_PTR HiveDataPhysical;
@ -48,7 +48,6 @@ WinLdrLoadSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
strcat(FullHiveName, HiveName);
//Print(L"Loading %s...\n", FullHiveName);
Status = ArcOpen(FullHiveName, OpenReadOnly, &FileId);
if (Status != ESUCCESS)
{
UiMessageBox("Opening hive file failed!");
@ -57,7 +56,6 @@ WinLdrLoadSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
/* Get the file length */
Status = ArcGetFileInformation(FileId, &FileInfo);
if (Status != ESUCCESS)
{
ArcClose(FileId);
@ -98,12 +96,13 @@ WinLdrLoadSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
FsService = FsGetServiceName(FileId);
if (FsService)
{
BOOLEAN Success;
TRACE(" Adding filesystem service %S\n", FsService);
Status = WinLdrAddDriverToList(&LoaderBlock->BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
NULL,
(LPWSTR)FsService);
if (!Status)
Success = WinLdrAddDriverToList(&LoaderBlock->BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
NULL,
(LPWSTR)FsService);
if (!Success)
TRACE(" Failed to add filesystem service\n");
}
else
@ -119,7 +118,7 @@ BOOLEAN WinLdrInitSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
IN LPCSTR DirectoryPath)
{
CHAR SearchPath[1024];
BOOLEAN Status;
BOOLEAN Success;
// 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
@ -127,18 +126,18 @@ BOOLEAN WinLdrInitSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
// FIXME: For now we only try system
strcpy(SearchPath, DirectoryPath);
strcat(SearchPath, "SYSTEM32\\CONFIG\\");
Status = WinLdrLoadSystemHive(LoaderBlock, SearchPath, "SYSTEM");
Success = WinLdrLoadSystemHive(LoaderBlock, SearchPath, "SYSTEM");
// Fail if failed...
if (!Status)
if (!Success)
return FALSE;
// Initialize in-memory registry
RegInitializeRegistry();
// Import what was loaded
Status = RegImportBinaryHive((PCHAR)VaToPa(LoaderBlock->RegistryBase), LoaderBlock->RegistryLength);
if (!Status)
Success = RegImportBinaryHive((PCHAR)VaToPa(LoaderBlock->RegistryBase), LoaderBlock->RegistryLength);
if (!Success)
{
UiMessageBox("Importing binary hive failed!");
return FALSE;
@ -159,14 +158,14 @@ BOOLEAN WinLdrScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
{
CHAR SearchPath[1024];
CHAR AnsiName[256], OemName[256], LangName[256];
BOOLEAN Status;
BOOLEAN Success;
// Scan registry and prepare boot drivers list
WinLdrScanRegistry(&LoaderBlock->BootDriverListHead, DirectoryPath);
// Get names of NLS files
Status = WinLdrGetNLSNames(AnsiName, OemName, LangName);
if (!Status)
Success = WinLdrGetNLSNames(AnsiName, OemName, LangName);
if (!Success)
{
UiMessageBox("Getting NLS names from registry failed!");
return FALSE;
@ -177,8 +176,8 @@ BOOLEAN WinLdrScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
// Load NLS data
strcpy(SearchPath, DirectoryPath);
strcat(SearchPath, "SYSTEM32\\");
Status = WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName);
TRACE("NLS data loaded with status %d\n", Status);
Success = WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName);
TRACE("NLS data loading %s\n", Success ? "successful" : "failed");
/* TODO: Load OEM HAL font */
@ -298,7 +297,8 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
PVOID NlsVirtual;
BOOLEAN AnsiEqualsOem = FALSE;
FILEINFORMATION FileInfo;
ULONG BytesRead, Status;
ULONG BytesRead;
ARC_STATUS Status;
/* There may be a case, when OEM and ANSI page coincide */
if (!strcmp(AnsiFileName, OemFileName))
@ -309,7 +309,6 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
strcpy(FileName, DirectoryPath);
strcat(FileName, AnsiFileName);
Status = ArcOpen(FileName, OpenReadOnly, &AnsiFileId);
if (Status != ESUCCESS)
goto Failure;
@ -331,7 +330,6 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
strcpy(FileName, DirectoryPath);
strcat(FileName, OemFileName);
Status = ArcOpen(FileName, OpenReadOnly, &OemFileId);
if (Status != ESUCCESS)
goto Failure;
@ -348,7 +346,6 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
strcpy(FileName, DirectoryPath);
strcat(FileName, LanguageFileName);
Status = ArcOpen(FileName, OpenReadOnly, &LanguageFileId);
if (Status != ESUCCESS)
goto Failure;
@ -390,12 +387,10 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
strcpy(FileName, DirectoryPath);
strcat(FileName, AnsiFileName);
Status = ArcOpen(FileName, OpenReadOnly, &AnsiFileId);
if (Status != ESUCCESS)
goto Failure;
Status = ArcRead(AnsiFileId, VaToPa(LoaderBlock->NlsData->AnsiCodePageData), AnsiFileSize, &BytesRead);
if (Status != ESUCCESS)
goto Failure;
@ -407,12 +402,10 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
strcpy(FileName, DirectoryPath);
strcat(FileName, OemFileName);
Status = ArcOpen(FileName, OpenReadOnly, &OemFileId);
if (Status != ESUCCESS)
goto Failure;
Status = ArcRead(OemFileId, VaToPa(LoaderBlock->NlsData->OemCodePageData), OemFileSize, &BytesRead);
if (Status != ESUCCESS)
goto Failure;
@ -423,12 +416,10 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
strcpy(FileName, DirectoryPath);
strcat(FileName, LanguageFileName);
Status = ArcOpen(FileName, OpenReadOnly, &LanguageFileId);
if (Status != ESUCCESS)
goto Failure;
Status = ArcRead(LanguageFileId, VaToPa(LoaderBlock->NlsData->UnicodeCodePageData), LanguageFileSize, &BytesRead);
if (Status != ESUCCESS)
goto Failure;
@ -475,7 +466,7 @@ WinLdrScanRegistry(IN OUT PLIST_ENTRY BootDriverListHead,
CHAR ImagePath[256];
WCHAR TempImagePath[256];
BOOLEAN Status;
BOOLEAN Success;
/* get 'service group order' key */
rc = RegOpenKey(NULL,
@ -570,33 +561,37 @@ WinLdrScanRegistry(IN OUT PLIST_ENTRY BootDriverListHead,
/* Make sure it should be started */
if ((StartValue == 0) &&
(TagValue == OrderList[TagIndex]) &&
(_wcsicmp(DriverGroup, GroupName) == 0)) {
(_wcsicmp(DriverGroup, GroupName) == 0))
{
/* Get the Driver's Location */
ValueSize = sizeof(TempImagePath);
rc = RegQueryValue(hDriverKey, L"ImagePath", NULL, (PUCHAR)TempImagePath, &ValueSize);
/* Get the Driver's Location */
ValueSize = sizeof(TempImagePath);
rc = RegQueryValue(hDriverKey, L"ImagePath", NULL, (PUCHAR)TempImagePath, &ValueSize);
/* Write the whole path if it suceeded, else prepare to fail */
if (rc != ERROR_SUCCESS)
{
TRACE_CH(REACTOS, "ImagePath: not found\n");
TempImagePath[0] = 0;
sprintf(ImagePath, "%s\\system32\\drivers\\%S.sys", DirectoryPath, ServiceName);
}
else if (TempImagePath[0] != L'\\')
{
sprintf(ImagePath, "%s%S", DirectoryPath, TempImagePath);
}
else
{
sprintf(ImagePath, "%S", TempImagePath);
TRACE_CH(REACTOS, "ImagePath: '%s'\n", ImagePath);
}
/* Write the whole path if it suceeded, else prepare to fail */
if (rc != ERROR_SUCCESS) {
TRACE_CH(REACTOS, "ImagePath: not found\n");
TempImagePath[0] = 0;
sprintf(ImagePath, "%s\\system32\\drivers\\%S.sys", DirectoryPath, ServiceName);
} else if (TempImagePath[0] != L'\\') {
sprintf(ImagePath, "%s%S", DirectoryPath, TempImagePath);
} else {
sprintf(ImagePath, "%S", TempImagePath);
TRACE_CH(REACTOS, "ImagePath: '%s'\n", ImagePath);
}
TRACE("Adding boot driver: '%s'\n", ImagePath);
TRACE("Adding boot driver: '%s'\n", ImagePath);
Status = WinLdrAddDriverToList(BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
TempImagePath,
ServiceName);
if (!Status)
ERR("Failed to add boot driver\n");
Success = WinLdrAddDriverToList(BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
TempImagePath,
ServiceName);
if (!Success)
ERR("Failed to add boot driver\n");
}
else
{
@ -642,35 +637,40 @@ WinLdrScanRegistry(IN OUT PLIST_ENTRY BootDriverListHead,
rc = RegQueryValue(hDriverKey, L"Group", NULL, (PUCHAR)DriverGroup, &DriverGroupSize);
//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 ((StartValue == 0) &&
(TagIndex > OrderList[0]) &&
(_wcsicmp(DriverGroup, GroupName) == 0)) {
(_wcsicmp(DriverGroup, GroupName) == 0))
{
ValueSize = sizeof(TempImagePath);
rc = RegQueryValue(hDriverKey, L"ImagePath", NULL, (PUCHAR)TempImagePath, &ValueSize);
if (rc != ERROR_SUCCESS)
{
TRACE_CH(REACTOS, "ImagePath: not found\n");
TempImagePath[0] = 0;
sprintf(ImagePath, "%ssystem32\\drivers\\%S.sys", DirectoryPath, ServiceName);
}
else if (TempImagePath[0] != L'\\')
{
sprintf(ImagePath, "%s%S", DirectoryPath, TempImagePath);
}
else
{
sprintf(ImagePath, "%S", TempImagePath);
TRACE_CH(REACTOS, "ImagePath: '%s'\n", ImagePath);
}
TRACE(" Adding boot driver: '%s'\n", ImagePath);
ValueSize = sizeof(TempImagePath);
rc = RegQueryValue(hDriverKey, L"ImagePath", NULL, (PUCHAR)TempImagePath, &ValueSize);
if (rc != ERROR_SUCCESS) {
TRACE_CH(REACTOS, "ImagePath: not found\n");
TempImagePath[0] = 0;
sprintf(ImagePath, "%ssystem32\\drivers\\%S.sys", DirectoryPath, ServiceName);
} else if (TempImagePath[0] != L'\\') {
sprintf(ImagePath, "%s%S", DirectoryPath, TempImagePath);
} else {
sprintf(ImagePath, "%S", TempImagePath);
TRACE_CH(REACTOS, "ImagePath: '%s'\n", ImagePath);
}
TRACE(" Adding boot driver: '%s'\n", ImagePath);
Status = WinLdrAddDriverToList(BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
TempImagePath,
ServiceName);
if (!Status)
ERR(" Failed to add boot driver\n");
Success = WinLdrAddDriverToList(BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
TempImagePath,
ServiceName);
if (!Success)
ERR(" Failed to add boot driver\n");
}
else
{