mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
[FREELDR]
- Pass the module list head to a number of pe loader functions instead of the loader block. - use static for some functions - remove unneeded prototypes svn path=/trunk/; revision=53947
This commit is contained in:
parent
05b34b61ef
commit
a198408aeb
5 changed files with 71 additions and 76 deletions
|
@ -1563,7 +1563,7 @@ ULONG
|
|||
LoadBootDeviceDriver(VOID)
|
||||
{
|
||||
PIMAGE_NT_HEADERS NtHeaders;
|
||||
LOADER_PARAMETER_BLOCK LoaderBlock;
|
||||
LIST_ENTRY ModuleListHead;
|
||||
PIMAGE_IMPORT_DESCRIPTOR ImportTable;
|
||||
ULONG ImportTableSize;
|
||||
PLDR_DATA_TABLE_ENTRY BootDdDTE, FreeldrDTE;
|
||||
|
@ -1572,9 +1572,8 @@ LoadBootDeviceDriver(VOID)
|
|||
ULONG (NTAPI *EntryPoint)(IN PVOID DriverObject, IN PVOID RegistryPath);
|
||||
BOOLEAN Status;
|
||||
|
||||
/* Some initialization of our temporary loader block */
|
||||
RtlZeroMemory(&LoaderBlock, sizeof(LOADER_PARAMETER_BLOCK));
|
||||
InitializeListHead(&LoaderBlock.LoadOrderListHead);
|
||||
/* Initialize the loaded module list */
|
||||
InitializeListHead(&ModuleListHead);
|
||||
|
||||
/* Create full ntbootdd.sys path */
|
||||
MachDiskGetBootPath(NtBootDdPath, sizeof(NtBootDdPath));
|
||||
|
@ -1589,14 +1588,14 @@ LoadBootDeviceDriver(VOID)
|
|||
}
|
||||
|
||||
/* Allocate a DTE for ntbootdd */
|
||||
Status = WinLdrAllocateDataTableEntry(&LoaderBlock, "ntbootdd.sys",
|
||||
Status = WinLdrAllocateDataTableEntry(&ModuleListHead, "ntbootdd.sys",
|
||||
"NTBOOTDD.SYS", ImageBase, &BootDdDTE);
|
||||
if (!Status)
|
||||
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(&LoaderBlock, "scsiport.sys",
|
||||
Status = WinLdrAllocateDataTableEntry(&ModuleListHead, "scsiport.sys",
|
||||
"FREELDR.SYS", &__ImageBase, &FreeldrDTE);
|
||||
if (!Status)
|
||||
{
|
||||
|
@ -1605,7 +1604,7 @@ LoadBootDeviceDriver(VOID)
|
|||
}
|
||||
|
||||
/* Fix imports */
|
||||
Status = WinLdrScanImportDescriptorTable(&LoaderBlock, "", BootDdDTE);
|
||||
Status = WinLdrScanImportDescriptorTable(&ModuleListHead, "", BootDdDTE);
|
||||
|
||||
/* Now unlinkt the DTEs, they won't be valid later */
|
||||
RemoveEntryList(&BootDdDTE->InLoadOrderLinks);
|
||||
|
|
|
@ -107,14 +107,14 @@ WinLdrLoadImage(IN PCHAR FileName,
|
|||
|
||||
|
||||
BOOLEAN
|
||||
WinLdrAllocateDataTableEntry(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||
WinLdrAllocateDataTableEntry(IN OUT PLIST_ENTRY ModuleListHead,
|
||||
IN PCCH BaseDllName,
|
||||
IN PCCH FullDllName,
|
||||
IN PVOID BasePA,
|
||||
OUT PLDR_DATA_TABLE_ENTRY *NewEntry);
|
||||
|
||||
BOOLEAN
|
||||
WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||
WinLdrScanImportDescriptorTable(IN OUT PLIST_ENTRY ModuleListHead,
|
||||
IN PCCH DirectoryPath,
|
||||
IN PLDR_DATA_TABLE_ENTRY ScanDTE);
|
||||
|
||||
|
@ -135,13 +135,10 @@ BOOLEAN WinLdrScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
|
||||
|
||||
BOOLEAN
|
||||
WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||
WinLdrCheckForLoadedDll(IN OUT PLIST_ENTRY ModuleListHead,
|
||||
IN PCH DllName,
|
||||
OUT PLDR_DATA_TABLE_ENTRY *LoadedEntry);
|
||||
|
||||
BOOLEAN
|
||||
WinLdrLoadBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock, LPSTR BootPath);
|
||||
|
||||
VOID
|
||||
WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||
LPCSTR Options,
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
|
||||
DBG_DEFAULT_CHANNEL(PELOADER);
|
||||
|
||||
BOOLEAN
|
||||
static BOOLEAN
|
||||
WinLdrpCompareDllName(IN PCH DllName,
|
||||
IN PUNICODE_STRING UnicodeName);
|
||||
|
||||
BOOLEAN
|
||||
WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||
static BOOLEAN
|
||||
WinLdrpBindImportName(IN OUT PLIST_ENTRY ModuleListHead,
|
||||
IN PVOID DllBase,
|
||||
IN PVOID ImageBase,
|
||||
IN PIMAGE_THUNK_DATA ThunkData,
|
||||
|
@ -32,14 +32,14 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
IN ULONG ExportSize,
|
||||
IN BOOLEAN ProcessForwards);
|
||||
|
||||
BOOLEAN
|
||||
WinLdrpLoadAndScanReferencedDll(PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||
static BOOLEAN
|
||||
WinLdrpLoadAndScanReferencedDll(PLIST_ENTRY ModuleListHead,
|
||||
PCCH DirectoryPath,
|
||||
PCH ImportName,
|
||||
PLDR_DATA_TABLE_ENTRY *DataTableEntry);
|
||||
|
||||
BOOLEAN
|
||||
WinLdrpScanImportAddressTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||
static BOOLEAN
|
||||
WinLdrpScanImportAddressTable(IN OUT PLIST_ENTRY ModuleListHead,
|
||||
IN PVOID DllBase,
|
||||
IN PVOID ImageBase,
|
||||
IN PIMAGE_THUNK_DATA ThunkData);
|
||||
|
@ -50,7 +50,7 @@ WinLdrpScanImportAddressTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
|
||||
/* Returns TRUE if DLL has already been loaded - looks in LoadOrderList in LPB */
|
||||
BOOLEAN
|
||||
WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||
WinLdrCheckForLoadedDll(IN OUT PLIST_ENTRY ModuleListHead,
|
||||
IN PCH DllName,
|
||||
OUT PLDR_DATA_TABLE_ENTRY *LoadedEntry)
|
||||
{
|
||||
|
@ -62,16 +62,17 @@ WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
|
||||
/* Just go through each entry in the LoadOrderList and compare loaded module's
|
||||
name with a given name */
|
||||
ModuleEntry = WinLdrBlock->LoadOrderListHead.Flink;
|
||||
while (ModuleEntry != &WinLdrBlock->LoadOrderListHead)
|
||||
ModuleEntry = ModuleListHead->Flink;
|
||||
while (ModuleEntry != ModuleListHead)
|
||||
{
|
||||
/* Get pointer to the current DTE */
|
||||
DataTableEntry = CONTAINING_RECORD(ModuleEntry,
|
||||
LDR_DATA_TABLE_ENTRY,
|
||||
InLoadOrderLinks);
|
||||
|
||||
TRACE("WinLdrCheckForLoadedDll: DTE %p, EP %p\n",
|
||||
DataTableEntry, DataTableEntry->EntryPoint);
|
||||
TRACE("WinLdrCheckForLoadedDll: DTE %p, EP %p, base %p name '%ws'\n",
|
||||
DataTableEntry, DataTableEntry->EntryPoint, DataTableEntry->DllBase,
|
||||
VaToPa(DataTableEntry->BaseDllName.Buffer));
|
||||
|
||||
/* Compare names */
|
||||
if (WinLdrpCompareDllName(DllName, &DataTableEntry->BaseDllName))
|
||||
|
@ -93,7 +94,7 @@ WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
}
|
||||
|
||||
BOOLEAN
|
||||
WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||
WinLdrScanImportDescriptorTable(IN OUT PLIST_ENTRY ModuleListHead,
|
||||
IN PCCH DirectoryPath,
|
||||
IN PLDR_DATA_TABLE_ENTRY ScanDTE)
|
||||
{
|
||||
|
@ -132,9 +133,9 @@ WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
continue;
|
||||
|
||||
/* Load the DLL if it is not already loaded */
|
||||
if (!WinLdrCheckForLoadedDll(WinLdrBlock, ImportName, &DataTableEntry))
|
||||
if (!WinLdrCheckForLoadedDll(ModuleListHead, ImportName, &DataTableEntry))
|
||||
{
|
||||
Status = WinLdrpLoadAndScanReferencedDll(WinLdrBlock,
|
||||
Status = WinLdrpLoadAndScanReferencedDll(ModuleListHead,
|
||||
DirectoryPath,
|
||||
ImportName,
|
||||
&DataTableEntry);
|
||||
|
@ -148,7 +149,7 @@ WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
|
||||
/* Scan its import address table */
|
||||
Status = WinLdrpScanImportAddressTable(
|
||||
WinLdrBlock,
|
||||
ModuleListHead,
|
||||
DataTableEntry->DllBase,
|
||||
ScanDTE->DllBase,
|
||||
(PIMAGE_THUNK_DATA)RVA(ScanDTE->DllBase, ImportTable->FirstThunk));
|
||||
|
@ -164,7 +165,7 @@ WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
}
|
||||
|
||||
BOOLEAN
|
||||
WinLdrAllocateDataTableEntry(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||
WinLdrAllocateDataTableEntry(IN OUT PLIST_ENTRY ModuleListHead,
|
||||
IN PCCH BaseDllName,
|
||||
IN PCCH FullDllName,
|
||||
IN PVOID BasePA,
|
||||
|
@ -175,6 +176,8 @@ WinLdrAllocateDataTableEntry(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
PLDR_DATA_TABLE_ENTRY DataTableEntry;
|
||||
PIMAGE_NT_HEADERS NtHeaders;
|
||||
USHORT Length;
|
||||
TRACE("WinLdrAllocateDataTableEntry(, '%s', '%s', %p)\n",
|
||||
BaseDllName, FullDllName, BasePA);
|
||||
|
||||
/* Allocate memory for a data table entry, zero-initialize it */
|
||||
DataTableEntry = (PLDR_DATA_TABLE_ENTRY)MmHeapAlloc(sizeof(LDR_DATA_TABLE_ENTRY));
|
||||
|
@ -236,7 +239,9 @@ WinLdrAllocateDataTableEntry(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
DataTableEntry->LoadCount = 1;
|
||||
|
||||
/* Insert this DTE to a list in the LPB */
|
||||
InsertTailList(&WinLdrBlock->LoadOrderListHead, &DataTableEntry->InLoadOrderLinks);
|
||||
InsertTailList(ModuleListHead, &DataTableEntry->InLoadOrderLinks);
|
||||
TRACE("Inserting DTE %p, name='%S' DllBase=%p \n", DataTableEntry,
|
||||
DataTableEntry->BaseDllName.Buffer, DataTableEntry->DllBase);
|
||||
|
||||
/* Save pointer to a newly allocated and initialized entry */
|
||||
*NewEntry = DataTableEntry;
|
||||
|
@ -442,7 +447,7 @@ WinLdrLoadImage(IN PCHAR FileName,
|
|||
/* PRIVATE FUNCTIONS *******************************************************/
|
||||
|
||||
/* DllName - physical, UnicodeString->Buffer - virtual */
|
||||
BOOLEAN
|
||||
static BOOLEAN
|
||||
WinLdrpCompareDllName(IN PCH DllName,
|
||||
IN PUNICODE_STRING UnicodeName)
|
||||
{
|
||||
|
@ -488,8 +493,8 @@ WinLdrpCompareDllName(IN PCH DllName,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||
static BOOLEAN
|
||||
WinLdrpBindImportName(IN OUT PLIST_ENTRY ModuleListHead,
|
||||
IN PVOID DllBase,
|
||||
IN PVOID ImageBase,
|
||||
IN PIMAGE_THUNK_DATA ThunkData,
|
||||
|
@ -651,7 +656,7 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
*strchr(ForwardDllName,'.') = '\0';
|
||||
|
||||
TRACE("WinLdrpBindImportName(): ForwardDllName %s\n", ForwardDllName);
|
||||
if (!WinLdrCheckForLoadedDll(WinLdrBlock, ForwardDllName, &DataTableEntry))
|
||||
if (!WinLdrCheckForLoadedDll(ModuleListHead, ForwardDllName, &DataTableEntry))
|
||||
{
|
||||
/* We can't continue if DLL couldn't be loaded, so bomb out with an error */
|
||||
//Print(L"Error loading DLL!\n");
|
||||
|
@ -692,7 +697,7 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
|
||||
/* And recursively call ourselves */
|
||||
Status = WinLdrpBindImportName(
|
||||
WinLdrBlock,
|
||||
ModuleListHead,
|
||||
DataTableEntry->DllBase,
|
||||
ImageBase,
|
||||
&RefThunkData,
|
||||
|
@ -717,8 +722,8 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
WinLdrpLoadAndScanReferencedDll(PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||
static BOOLEAN
|
||||
WinLdrpLoadAndScanReferencedDll(PLIST_ENTRY ModuleListHead,
|
||||
PCCH DirectoryPath,
|
||||
PCH ImportName,
|
||||
PLDR_DATA_TABLE_ENTRY *DataTableEntry)
|
||||
|
@ -744,7 +749,7 @@ WinLdrpLoadAndScanReferencedDll(PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
}
|
||||
|
||||
/* Allocate DTE for newly loaded DLL */
|
||||
Status = WinLdrAllocateDataTableEntry(WinLdrBlock,
|
||||
Status = WinLdrAllocateDataTableEntry(ModuleListHead,
|
||||
ImportName,
|
||||
FullDllName,
|
||||
BasePA,
|
||||
|
@ -759,7 +764,7 @@ WinLdrpLoadAndScanReferencedDll(PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
/* Scan its dependencies too */
|
||||
TRACE("WinLdrScanImportDescriptorTable() calling ourselves for %S\n",
|
||||
VaToPa((*DataTableEntry)->BaseDllName.Buffer));
|
||||
Status = WinLdrScanImportDescriptorTable(WinLdrBlock, DirectoryPath, *DataTableEntry);
|
||||
Status = WinLdrScanImportDescriptorTable(ModuleListHead, DirectoryPath, *DataTableEntry);
|
||||
|
||||
if (!Status)
|
||||
{
|
||||
|
@ -770,8 +775,8 @@ WinLdrpLoadAndScanReferencedDll(PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
WinLdrpScanImportAddressTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||
static BOOLEAN
|
||||
WinLdrpScanImportAddressTable(IN OUT PLIST_ENTRY ModuleListHead,
|
||||
IN PVOID DllBase,
|
||||
IN PVOID ImageBase,
|
||||
IN PIMAGE_THUNK_DATA ThunkData)
|
||||
|
@ -786,7 +791,7 @@ WinLdrpScanImportAddressTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
/* Obtain the export table from the DLL's base */
|
||||
if (DllBase == NULL)
|
||||
{
|
||||
//Print(L"Error, DllBase == NULL!\n");
|
||||
ERR("Error, DllBase == NULL!\n");
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
|
@ -802,14 +807,17 @@ WinLdrpScanImportAddressTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
|||
|
||||
/* If pointer to Export Directory is */
|
||||
if (ExportDirectory == NULL)
|
||||
{
|
||||
ERR("DllBase=%p(%p)\n", DllBase, VaToPa(DllBase));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Go through each entry in the thunk table and bind it */
|
||||
while (((PIMAGE_THUNK_DATA)VaToPa(ThunkData))->u1.AddressOfData != 0)
|
||||
{
|
||||
/* Bind it */
|
||||
Status = WinLdrpBindImportName(
|
||||
WinLdrBlock,
|
||||
ModuleListHead,
|
||||
DllBase,
|
||||
ImageBase,
|
||||
ThunkData,
|
||||
|
|
|
@ -214,6 +214,7 @@ WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
if (LoaderBlock->SetupLdrBlock)
|
||||
LoaderBlock->SetupLdrBlock = PaToVa(LoaderBlock->SetupLdrBlock);
|
||||
|
||||
TRACE("WinLdrInitializePhase1() completed\n");
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
|
@ -252,7 +253,7 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
|
||||
|
||||
// Check if driver is already loaded
|
||||
Status = WinLdrCheckForLoadedDll(LoaderBlock, DllName, DriverDTE);
|
||||
Status = WinLdrCheckForLoadedDll(&LoaderBlock->LoadOrderListHead, DllName, DriverDTE);
|
||||
if (Status)
|
||||
{
|
||||
// We've got the pointer to its DTE, just return success
|
||||
|
@ -266,7 +267,7 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
return FALSE;
|
||||
|
||||
// Allocate a DTE for it
|
||||
Status = WinLdrAllocateDataTableEntry(LoaderBlock, DllName, DllName, DriverBase, DriverDTE);
|
||||
Status = WinLdrAllocateDataTableEntry(&LoaderBlock->LoadOrderListHead, DllName, DllName, DriverBase, DriverDTE);
|
||||
if (!Status)
|
||||
{
|
||||
ERR("WinLdrAllocateDataTableEntry() failed\n");
|
||||
|
@ -278,7 +279,7 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
|
||||
// Look for any dependencies it may have, and load them too
|
||||
sprintf(FullPath,"%s%s", BootPath, DriverPath);
|
||||
Status = WinLdrScanImportDescriptorTable(LoaderBlock, FullPath, *DriverDTE);
|
||||
Status = WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, FullPath, *DriverDTE);
|
||||
if (!Status)
|
||||
{
|
||||
ERR("WinLdrScanImportDescriptorTable() failed for %s\n", FullPath);
|
||||
|
@ -439,7 +440,7 @@ LoadModule(
|
|||
|
||||
strcpy(FullFileName, "WINDOWS\\SYSTEM32\\");
|
||||
strcat(FullFileName, File);
|
||||
WinLdrAllocateDataTableEntry(LoaderBlock, File,
|
||||
WinLdrAllocateDataTableEntry(&LoaderBlock->LoadOrderListHead, File,
|
||||
FullFileName, BaseAdress, Dte);
|
||||
|
||||
return BaseAdress;
|
||||
|
@ -587,10 +588,10 @@ LoadAndBootWindowsCommon(
|
|||
/* Load all referenced DLLs for kernel, HAL and kdcom.dll */
|
||||
strcpy(FileName, BootPath);
|
||||
strcat(FileName, "system32\\");
|
||||
Status = WinLdrScanImportDescriptorTable(LoaderBlock, FileName, KernelDTE);
|
||||
Status &= WinLdrScanImportDescriptorTable(LoaderBlock, FileName, HalDTE);
|
||||
Status = WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, FileName, KernelDTE);
|
||||
Status &= WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, FileName, HalDTE);
|
||||
if (KdComDTE)
|
||||
Status &= WinLdrScanImportDescriptorTable(LoaderBlock, FileName, KdComDTE);
|
||||
Status &= WinLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, FileName, KdComDTE);
|
||||
|
||||
if (!Status)
|
||||
{
|
||||
|
|
|
@ -16,26 +16,15 @@ DBG_DEFAULT_CHANNEL(WINDOWS);
|
|||
// The only global var here, used to mark mem pages as NLS in WinLdrSetupMemoryLayout()
|
||||
ULONG TotalNLSSize = 0;
|
||||
|
||||
BOOLEAN WinLdrGetNLSNames(LPSTR AnsiName,
|
||||
LPSTR OemName,
|
||||
LPSTR LangName);
|
||||
static BOOLEAN
|
||||
WinLdrGetNLSNames(LPSTR AnsiName,
|
||||
LPSTR OemName,
|
||||
LPSTR LangName);
|
||||
|
||||
BOOLEAN
|
||||
WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||
IN LPCSTR DirectoryPath,
|
||||
IN LPCSTR AnsiFileName,
|
||||
IN LPCSTR OemFileName,
|
||||
IN LPCSTR LanguageFileName);
|
||||
|
||||
VOID
|
||||
WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||
static VOID
|
||||
WinLdrScanRegistry(IN OUT PLIST_ENTRY BootDriverListHead,
|
||||
IN LPCSTR DirectoryPath);
|
||||
|
||||
BOOLEAN
|
||||
WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
|
||||
LPWSTR RegistryPath,
|
||||
LPWSTR ImagePath,
|
||||
LPWSTR ServiceName);
|
||||
|
||||
/* FUNCTIONS **************************************************************/
|
||||
|
||||
|
@ -173,7 +162,7 @@ BOOLEAN WinLdrScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
BOOLEAN Status;
|
||||
|
||||
// Scan registry and prepare boot drivers list
|
||||
WinLdrScanRegistry(LoaderBlock, DirectoryPath);
|
||||
WinLdrScanRegistry(&LoaderBlock->BootDriverListHead, DirectoryPath);
|
||||
|
||||
// Get names of NLS files
|
||||
Status = WinLdrGetNLSNames(AnsiName, OemName, LangName);
|
||||
|
@ -201,9 +190,10 @@ BOOLEAN WinLdrScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
/* PRIVATE FUNCTIONS ******************************************************/
|
||||
|
||||
// Queries registry for those three file names
|
||||
BOOLEAN WinLdrGetNLSNames(LPSTR AnsiName,
|
||||
LPSTR OemName,
|
||||
LPSTR LangName)
|
||||
static BOOLEAN
|
||||
WinLdrGetNLSNames(LPSTR AnsiName,
|
||||
LPSTR OemName,
|
||||
LPSTR LangName)
|
||||
{
|
||||
LONG rc = ERROR_SUCCESS;
|
||||
FRLDRHKEY hKey;
|
||||
|
@ -459,8 +449,8 @@ Failure:
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
VOID
|
||||
WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||
static VOID
|
||||
WinLdrScanRegistry(IN OUT PLIST_ENTRY BootDriverListHead,
|
||||
IN LPCSTR DirectoryPath)
|
||||
{
|
||||
LONG rc = 0;
|
||||
|
@ -602,7 +592,7 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
|
||||
TRACE("Adding boot driver: '%s'\n", ImagePath);
|
||||
|
||||
Status = WinLdrAddDriverToList(&LoaderBlock->BootDriverListHead,
|
||||
Status = WinLdrAddDriverToList(BootDriverListHead,
|
||||
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
|
||||
TempImagePath,
|
||||
ServiceName);
|
||||
|
@ -680,7 +670,7 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
}
|
||||
TRACE(" Adding boot driver: '%s'\n", ImagePath);
|
||||
|
||||
Status = WinLdrAddDriverToList(&LoaderBlock->BootDriverListHead,
|
||||
Status = WinLdrAddDriverToList(BootDriverListHead,
|
||||
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
|
||||
TempImagePath,
|
||||
ServiceName);
|
||||
|
|
Loading…
Reference in a new issue