ReactOS 0.4.16-dev-197-g92996da
|
#include <freeldr.h>
#include <cmlib.h>
#include "registry.h"
#include <internal/cmboot.h>
#include <debug.h>
Go to the source code of this file.
Macros | |
#define | HCI_TO_HKEY(CellIndex) ((HKEY)(ULONG_PTR)(CellIndex)) |
#define | GET_HHIVE(CmHive) (&((CmHive)->Hive)) |
#define | GET_HHIVE_FROM_HKEY(hKey) GET_HHIVE(CmSystemHive) |
#define | GET_CM_KEY_NODE(hHive, hKey) ((PCM_KEY_NODE)HvGetCell(hHive, HKEY_TO_HCI(hKey))) |
#define | GET_HBASE_BLOCK(ChunkBase) ((PHBASE_BLOCK)ChunkBase) |
Functions | |
DBG_DEFAULT_CHANNEL (REGISTRY) | |
PVOID NTAPI | CmpAllocate (IN SIZE_T Size, IN BOOLEAN Paged, IN ULONG Tag) |
VOID NTAPI | CmpFree (IN PVOID Ptr, IN ULONG Quota) |
static BOOLEAN | RegInitializeHive (_In_ PCMHIVE CmHive, _In_ PVOID ChunkBase, _In_ BOOLEAN LoadAlternate) |
Initializes a flat hive descriptor for the hive and validates the registry hive. Volatile data is purged during this procedure for initialization. | |
static BOOLEAN | RegLoadHiveLog (_In_ PCSTR DirectoryPath, _In_ ULONG LogFileOffset, _In_ PCSTR LogName, _Out_ PVOID *LogData) |
Loads and reads a hive log at specified file offset. | |
static BOOLEAN | RegRecoverHeaderHive (_Inout_ PVOID ChunkBase, _In_ PCSTR DirectoryPath, _In_ PCSTR LogName) |
Recovers the header base block of a flat registry hive. | |
static BOOLEAN | RegRecoverDataHive (_Inout_ PVOID ChunkBase, _In_ PCSTR DirectoryPath, _In_ PCSTR LogName) |
Recovers the corrupt data of a primary flat registry hive. | |
BOOLEAN | RegImportBinaryHive (_In_ PVOID ChunkBase, _In_ ULONG ChunkSize, _In_ PCSTR SearchPath, _In_ BOOLEAN LoadAlternate) |
Imports the SYSTEM binary hive from the registry base chunk that's been provided by the loader block. | |
BOOLEAN | RegInitCurrentControlSet (_In_ BOOLEAN LastKnownGood) |
static BOOLEAN | GetNextPathElement (_Out_ PUNICODE_STRING NextElement, _Inout_ PUNICODE_STRING RemainingPath) |
LONG | RegOpenKey (_In_ HKEY ParentKey, _In_z_ PCWSTR KeyName, _Out_ PHKEY Key) |
static VOID | RepGetValueData (_In_ PHHIVE Hive, _In_ PCM_KEY_VALUE ValueCell, _Out_opt_ PULONG Type, _Out_opt_ PUCHAR Data, _Inout_opt_ PULONG DataSize) |
LONG | RegQueryValue (_In_ HKEY Key, _In_z_ PCWSTR ValueName, _Out_opt_ PULONG Type, _Out_opt_ PUCHAR Data, _Inout_opt_ PULONG DataSize) |
Variables | |
static PCMHIVE | CmSystemHive |
static HCELL_INDEX | SystemRootCell |
PHHIVE | SystemHive = NULL |
HKEY | CurrentControlSetKey = NULL |
#define GET_CM_KEY_NODE | ( | hHive, | |
hKey | |||
) | ((PCM_KEY_NODE)HvGetCell(hHive, HKEY_TO_HCI(hKey))) |
Definition at line 43 of file registry.c.
#define GET_HBASE_BLOCK | ( | ChunkBase | ) | ((PHBASE_BLOCK)ChunkBase) |
Definition at line 45 of file registry.c.
#define GET_HHIVE | ( | CmHive | ) | (&((CmHive)->Hive)) |
Definition at line 41 of file registry.c.
#define GET_HHIVE_FROM_HKEY | ( | hKey | ) | GET_HHIVE(CmSystemHive) |
Definition at line 42 of file registry.c.
Definition at line 36 of file registry.c.
Definition at line 49 of file registry.c.
Referenced by RegInitializeHive().
Definition at line 60 of file registry.c.
Referenced by RegInitializeHive().
DBG_DEFAULT_CHANNEL | ( | REGISTRY | ) |
|
static |
Definition at line 563 of file registry.c.
Referenced by RegOpenKey().
BOOLEAN RegImportBinaryHive | ( | _In_ PVOID | ChunkBase, |
_In_ ULONG | ChunkSize, | ||
_In_ PCSTR | SearchPath, | ||
_In_ BOOLEAN | LoadAlternate | ||
) |
Imports the SYSTEM binary hive from the registry base chunk that's been provided by the loader block.
[in] | ChunkBase | A pointer to the registry base chunk that serves for SYSTEM hive initialization. |
[in] | ChunkSize | The size of the registry base chunk. This parameter refers to the actual size of the SYSTEM hive. This parameter is currently unused. |
[in] | LoadAlternate | If set to TRUE, the function will initialize the hive as an alternate hive, otherwise FALSE to initialize it as primary. |
Definition at line 449 of file registry.c.
Referenced by WinLdrInitSystemHive().
Definition at line 525 of file registry.c.
Referenced by WinLdrInitSystemHive().
|
static |
Initializes a flat hive descriptor for the hive and validates the registry hive. Volatile data is purged during this procedure for initialization.
[in] | CmHive | A pointer to a CM (in-memory) hive descriptor containing the hive descriptor to be initialized. |
[in] | ChunkBase | An arbitrary pointer that points to the registry chunk base. This pointer serves as the base block containing the hive file header data. |
[in] | LoadAlternate | If set to TRUE, the function will initialize the hive as an alternate hive, otherwise FALSE to initialize it as primary. |
Definition at line 96 of file registry.c.
Referenced by RegImportBinaryHive().
|
static |
Loads and reads a hive log at specified file offset.
[in] | DirectoryPath | A pointer to a string that denotes the directory path of the hives and logs location. |
[in] | LogFileOffset | The file offset of which this function uses to seek at specific position during read. |
[in] | LogName | A pointer to a string that denotes the name of the desired hive log (e.g. "SYSTEM"). |
[out] | LogData | A pointer to the returned hive log data that was read. The following data varies depending on the specified offset set up by the caller, that is used to where to start reading from the hive log. |
Definition at line 182 of file registry.c.
Referenced by RegRecoverDataHive(), and RegRecoverHeaderHive().
Definition at line 676 of file registry.c.
LONG RegQueryValue | ( | _In_ HKEY | Key, |
_In_z_ PCWSTR | ValueName, | ||
_Out_opt_ PULONG | Type, | ||
_Out_opt_ PUCHAR | Data, | ||
_Inout_opt_ PULONG | DataSize | ||
) |
Definition at line 831 of file registry.c.
|
static |
Recovers the corrupt data of a primary flat registry hive.
[in] | ChunkBase | A pointer to the registry hive chunk base of which the damaged hive data is to be replaced with healthy data from the corresponding hive log. |
[in] | DirectoryPath | A pointer to a string that denotes the directory path of the hives and logs location. |
[in] | LogName | A pointer to a string that denotes the name of the desired hive log (e.g. "SYSTEM"). |
Definition at line 362 of file registry.c.
Referenced by RegImportBinaryHive().
|
static |
Recovers the header base block of a flat registry hive.
[in] | ChunkBase | A pointer to the registry hive chunk base of which the damaged header block is to be recovered. |
[in] | DirectoryPath | A pointer to a string that denotes the directory path of the hives and logs location. |
[in] | LogName | A pointer to a string that denotes the name of the desired hive log (e.g. "SYSTEM"). |
Definition at line 289 of file registry.c.
Referenced by RegImportBinaryHive().
|
static |
Definition at line 794 of file registry.c.
Referenced by RegQueryValue(), and RegQueryValueExW().
|
static |
Definition at line 30 of file registry.c.
Referenced by RegImportBinaryHive(), and RegOpenKey().
Definition at line 34 of file registry.c.
Referenced by RegInitCurrentControlSet(), RegOpenKey(), WinLdrDetectVersion(), WinLdrInitErrataInf(), WinLdrScanRegistry(), and WinLdrScanSystemHive().
Definition at line 33 of file registry.c.
Referenced by CmGetSystemControlValues(), CmpFindControlSet(), CmpInitializeSystemHive(), CmpWalkPath(), RegImportBinaryHive(), RegInitCurrentControlSet(), and WinLdrScanRegistry().
|
static |
Definition at line 31 of file registry.c.
Referenced by RegImportBinaryHive(), RegInitCurrentControlSet(), and RegOpenKey().