ReactOS 0.4.16-dev-753-g705a985
|
Go to the source code of this file.
Macros | |
#define | NDEBUG |
Typedefs | |
typedef enum _RESULT | RESULT |
Enumerations | |
enum | _RESULT { NotHive , Fail , NoMemory , HiveSuccess , RecoverHeader , RecoverData , SelfHeal } |
Functions | |
BOOLEAN CMAPI | HvpVerifyHiveHeader (_In_ PHBASE_BLOCK BaseBlock, _In_ ULONG FileType) |
Validates the base block header of a registry file (hive or log). | |
VOID CMAPI | HvpFreeHiveBins (_In_ PHHIVE Hive) |
Frees all the bins within storage space associated with a hive descriptor. | |
static __inline PHBASE_BLOCK | HvpAllocBaseBlockAligned (_In_ PHHIVE Hive, _In_ BOOLEAN Paged, _In_ ULONG Tag) |
Allocates a cluster-aligned hive base header block. | |
static VOID | HvpInitFileName (_Inout_ PHBASE_BLOCK BaseBlock, _In_opt_ PCUNICODE_STRING FileName) |
Initializes a NULL-terminated Unicode hive file name of a hive header by copying the last 31 characters of the hive file name. Mainly used for debugging purposes. | |
NTSTATUS CMAPI | HvpCreateHive (_Inout_ PHHIVE RegistryHive, _In_opt_ PCUNICODE_STRING FileName) |
Initializes a hive descriptor structure for a newly created hive in memory. | |
NTSTATUS CMAPI | HvpInitializeMemoryHive (_In_ PHHIVE Hive, _In_ PHBASE_BLOCK ChunkBase, _In_opt_ PCUNICODE_STRING FileName) |
Initializes a hive descriptor from an already loaded registry hive stored in memory. The data of the hive is copied and it is prepared for read/write access. | |
NTSTATUS CMAPI | HvpInitializeFlatHive (_In_ PHHIVE Hive, _In_ PHBASE_BLOCK ChunkBase) |
Initializes a hive descriptor for an already loaded hive that is stored in memory. This descriptor serves to denote such hive as being "flat", that is, the data and properties can be only read and not written into. | |
RESULT CMAPI | HvpGetHiveHeader (_In_ PHHIVE Hive, _Inout_ PHBASE_BLOCK *HiveBaseBlock, _Inout_ PLARGE_INTEGER TimeStamp) |
Retrieves the base block hive header from the primary hive file stored in physical backing storage. This function may invoke a self-healing warning if hive header couldn't be obtained. See Return and Remarks sections for further information. | |
ULONG CMAPI | HvpQueryHiveSize (_In_ PHHIVE Hive) |
Computes the hive space size by querying the file size of the associated hive file. | |
RESULT CMAPI | HvpRecoverHeaderFromLog (_In_ PHHIVE Hive, _In_ PLARGE_INTEGER TimeStamp, _Inout_ PHBASE_BLOCK *BaseBlock) |
Recovers the base block header by obtaining it from a log file associated with the hive. | |
RESULT CMAPI | HvpRecoverDataFromLog (_In_ PHHIVE Hive, _In_ PHBASE_BLOCK BaseBlock) |
Recovers the registry data by obtaining it from a log that is associated with the hive. | |
NTSTATUS CMAPI | HvLoadHive (_In_ PHHIVE Hive, _In_opt_ PCUNICODE_STRING FileName) |
Loads a registry hive from a physical hive file within the physical backing storage. Base block and registry data are read from the said physical hive file. This function can perform registry recovery if hive loading could not be done normally. | |
NTSTATUS CMAPI | HvInitialize (_Inout_ PHHIVE RegistryHive, _In_ ULONG OperationType, _In_ ULONG HiveFlags, _In_ ULONG FileType, _In_opt_ PVOID HiveData, _In_opt_ PALLOCATE_ROUTINE Allocate, _In_opt_ PFREE_ROUTINE Free, _In_opt_ PFILE_SET_SIZE_ROUTINE FileSetSize, _In_opt_ PFILE_WRITE_ROUTINE FileWrite, _In_opt_ PFILE_READ_ROUTINE FileRead, _In_opt_ PFILE_FLUSH_ROUTINE FileFlush, _In_ ULONG Cluster, _In_opt_ PCUNICODE_STRING FileName) |
Initializes a registry hive. It allocates a hive descriptor and sets up the hive type depending on the type chosen by the caller. | |
VOID CMAPI | HvFree (_In_ PHHIVE RegistryHive) |
Frees all the bins within the storage, the dirty vector and the base block associated with the given registry hive descriptor. | |
#define NDEBUG |
Definition at line 12 of file hiveinit.c.
Enumerator | |
---|---|
NotHive | |
Fail | |
NoMemory | |
HiveSuccess | |
RecoverHeader | |
RecoverData | |
SelfHeal |
Definition at line 17 of file hiveinit.c.
Frees all the bins within the storage, the dirty vector and the base block associated with the given registry hive descriptor.
[in] | RegistryHive | A pointer to a hive descriptor where all of its data is to be freed. |
Definition at line 1512 of file hiveinit.c.
NTSTATUS CMAPI HvInitialize | ( | _Inout_ PHHIVE | RegistryHive, |
_In_ ULONG | OperationType, | ||
_In_ ULONG | HiveFlags, | ||
_In_ ULONG | FileType, | ||
_In_opt_ PVOID | HiveData, | ||
_In_opt_ PALLOCATE_ROUTINE | Allocate, | ||
_In_opt_ PFREE_ROUTINE | Free, | ||
_In_opt_ PFILE_SET_SIZE_ROUTINE | FileSetSize, | ||
_In_opt_ PFILE_WRITE_ROUTINE | FileWrite, | ||
_In_opt_ PFILE_READ_ROUTINE | FileRead, | ||
_In_opt_ PFILE_FLUSH_ROUTINE | FileFlush, | ||
_In_ ULONG | Cluster, | ||
_In_opt_ PCUNICODE_STRING | FileName | ||
) |
Initializes a registry hive. It allocates a hive descriptor and sets up the hive type depending on the type chosen by the caller.
[in,out] | RegistryHive | A pointer to a hive descriptor to be initialized. |
[in] | OperationType | The operation type to choose for hive initialization. For further information about this, see Remarks. |
[in] | HiveFlags | A hive flag. Such flag is used to determine what kind of action must be taken into the hive or what aspects must be taken into account for such hive. For further information, see Remarks. |
[in] | FileType | Hive file type. For the newly initialized hive, you can choose from three different types for the hive: |
HFILE_TYPE_PRIMARY - Initializes a hive as primary hive of the system.
HFILE_TYPE_LOG - The newly created hive is a hive log. Logs don't exist per se but they're accompanied with their associated primary hives. The Log field member of the hive descriptor is set to TRUE.
HFILE_TYPE_EXTERNAL - The newly created hive is a portable hive, that can be used and copied for different machines, unlike primary hives.
HFILE_TYPE_ALTERNATE - The newly created hive is an alternate hive. Technically speaking it is the same as a primary hive (the representation of on-disk image of the registry header is HFILE_TYPE_PRIMARY), with the purpose is to serve as a backup hive. The Alternate field of the hive descriptor is set to TRUE. Only the SYSTEM hive has a backup alternate hive.
[in] | HiveData | An arbitrary pointer that points to the hive data. Usually this data is in form of a hive base block given by the caller of this function. |
[in] | Allocate | A pointer to a ALLOCATE_ROUTINE function that describes the main allocation routine for this hive. This parameter can be NULL. |
[in] | Free | A pointer to a FREE_ROUTINE function that describes the the main memory freeing routine for this hive. This parameter can be NULL. |
[in] | FileSetSize | A pointer to a FILE_SET_SIZE_ROUTINE function that describes the file set size routine for this hive. This parameter can be NULL. |
[in] | FileWrite | A pointer to a FILE_WRITE_ROUTINE function that describes the file writing routine for this hive. This parameter can be NULL. |
[in] | FileRead | A pointer to a FILE_READ_ROUTINE function that describes the file reading routine for this hive. This parameter can be NULL. |
[in] | FileFlush | A pointer to a FILE_FLUSH_ROUTINE function that describes the file flushing routine for this hive. This parameter can be NULL. |
[in] | Cluster | The registry hive cluster to be set. Usually this value is set to 1. |
[in] | FileName | A to a NULL-terminated Unicode string structure containing the hive file name. This parameter can be NULL. |
HINIT_CREATE – Creates a new fresh hive.
HINIT_MEMORY – Initializes a registry hive that already exists from memory. The hive data is copied from the loaded hive in memory and used for read/write access.
HINIT_FLAT – Initializes a flat registry hive, with data that can only be read and not written into. Cells are always allocated on a flat hive.
HINIT_FILE – Initializes a hive from a hive file from the physical backing storage of the system. In this situation the function will perform self-healing and resuscitation procedures if data read from the physical hive file is corrupt.
HINIT_MEMORY_INPLACE – This operation type is similar to HINIT_FLAT, with the difference is that the hive is initialized with hive data from memory. The hive can only be read and not written into.
HINIT_MAPFILE – Initializes a hive from a hive file from the physical backing storage of the system. Unlike HINIT_FILE, the initialized hive is not backed to paged pool in memory but rather through mapping views.
Alongside the operation type, the hive flags also influence the aspect of the newly initialized hive. These are the following supported hive flags:
HIVE_VOLATILE – Tells the function that this hive will be volatile, that is, the data stored inside the hive space resides only in volatile memory of the system, aka the RAM, and the data will be erased upon shutdown of the system.
HIVE_NOLAZYFLUSH – Tells the function that no lazy flushing must be done to this hive.
Definition at line 1352 of file hiveinit.c.
Loads a registry hive from a physical hive file within the physical backing storage. Base block and registry data are read from the said physical hive file. This function can perform registry recovery if hive loading could not be done normally.
[in] | Hive | A pointer to a hive descriptor where the said hive is to be loaded from the physical hive file. |
[in] | FileName | A pointer to a NULL-terminated Unicode string structure containing the hive file name to be copied from. |
Definition at line 1030 of file hiveinit.c.
Referenced by HvInitialize().
|
static |
Allocates a cluster-aligned hive base header block.
[in] | Hive | A pointer to a hive descriptor where the header block allocator function is to be gathered from. |
[in] | Paged | If set to TRUE, the allocated base block will reside in paged pool, otherwise it will reside in non paged pool. |
[in] | Tag | A tag name to supply for the allocated memory block for identification. This is for debugging purposes. |
Definition at line 143 of file hiveinit.c.
Referenced by HvpCreateHive(), HvpGetHiveHeader(), HvpInitializeMemoryHive(), and HvpRecoverHeaderFromLog().
Initializes a hive descriptor structure for a newly created hive in memory.
[in,out] | RegistryHive | A pointer to a registry hive descriptor where the internal structures field are to be initialized for the said hive. |
[in] | FileName | A pointer to a Unicode string structure containing the hive file name to be copied from. If this argument is NULL, the base block will not have any hive file name. |
Definition at line 238 of file hiveinit.c.
Referenced by HvInitialize().
Frees all the bins within storage space associated with a hive descriptor.
[in] | Hive | A pointer to a hive descriptor where all the bins are to be freed. |
Definition at line 90 of file hiveinit.c.
Referenced by HvFree(), and HvpInitializeMemoryHive().
RESULT CMAPI HvpGetHiveHeader | ( | _In_ PHHIVE | Hive, |
_Inout_ PHBASE_BLOCK * | HiveBaseBlock, | ||
_Inout_ PLARGE_INTEGER | TimeStamp | ||
) |
Retrieves the base block hive header from the primary hive file stored in physical backing storage. This function may invoke a self-healing warning if hive header couldn't be obtained. See Return and Remarks sections for further information.
[in] | Hive | A pointer to a registry hive descriptor that points to the primary hive being loaded. This descriptor is needed to obtain the hive header block from said hive. |
[in,out] | HiveBaseBlock | A pointer returned by the function that contains the hive header base block buffer obtained from the primary hive file pointed by the Hive argument. This parameter must not be NULL! |
[in,out] | TimeStamp | A pointer returned by the function that contains the time-stamp of the registry hive file at the moment of creation or modification. This parameter must not be NULL! |
Definition at line 552 of file hiveinit.c.
Referenced by HvLoadHive().
|
static |
Initializes a NULL-terminated Unicode hive file name of a hive header by copying the last 31 characters of the hive file name. Mainly used for debugging purposes.
[in,out] | BaseBlock | A pointer to a base block header where the hive file name is to be copied to. |
[in] | FileName | A pointer to a Unicode string structure containing the hive file name to be copied from. If this argument is NULL, the base block will not have any hive file name. |
Definition at line 189 of file hiveinit.c.
Referenced by HvpCreateHive(), and HvpInitializeMemoryHive().
Initializes a hive descriptor for an already loaded hive that is stored in memory. This descriptor serves to denote such hive as being "flat", that is, the data and properties can be only read and not written into.
[in] | Hive | A pointer to a registry hive descriptor where the internal structures fields are to be initialized from hive data that is already loaded in memory. Such hive descriptor will become read-only and flat. |
[in] | ChunkBase | A pointer to a valid base block header containing registry header data for initialization. |
Definition at line 485 of file hiveinit.c.
Referenced by HvInitialize().
NTSTATUS CMAPI HvpInitializeMemoryHive | ( | _In_ PHHIVE | Hive, |
_In_ PHBASE_BLOCK | ChunkBase, | ||
_In_opt_ PCUNICODE_STRING | FileName | ||
) |
Initializes a hive descriptor from an already loaded registry hive stored in memory. The data of the hive is copied and it is prepared for read/write access.
[in] | Hive | A pointer to a registry hive descriptor where the internal structures field are to be initialized from hive data that is already loaded in memory. |
[in] | ChunkBase | A pointer to a valid base block header containing registry header data for initialization. |
[in] | FileName | A pointer to a Unicode string structure containing the hive file name to be copied from. If this argument is NULL, the base block will not have any hive file name. |
Definition at line 318 of file hiveinit.c.
Referenced by HvInitialize(), and HvLoadHive().
Computes the hive space size by querying the file size of the associated hive file.
[in] | Hive | A pointer to a hive descriptor where the hive length size is to be calculated. |
Definition at line 671 of file hiveinit.c.
Referenced by HvpRecoverHeaderFromLog().
Recovers the registry data by obtaining it from a log that is associated with the hive.
[in] | Hive | A pointer to a hive descriptor associated with the log file where the hive data is to be read from. |
[in] | BaseBlock | A pointer to a base block header. |
Definition at line 899 of file hiveinit.c.
Referenced by HvLoadHive().
RESULT CMAPI HvpRecoverHeaderFromLog | ( | _In_ PHHIVE | Hive, |
_In_ PLARGE_INTEGER | TimeStamp, | ||
_Inout_ PHBASE_BLOCK * | BaseBlock | ||
) |
Recovers the base block header by obtaining it from a log file associated with the hive.
[in] | Hive | A pointer to a hive descriptor associated with the log file where the hive header is to be read from. |
[in] | TimeStamp | A pointer to a time-stamp used to check if the provided time matches with that of the hive. |
[in,out] | BaseBlock | A pointer returned by the caller that contains the base block header that was read from the log. This base block could be also made manually by hand. See Remarks for further information. |
Definition at line 743 of file hiveinit.c.
Referenced by HvLoadHive().
Validates the base block header of a registry file (hive or log).
[in] | BaseBlock | A pointer to a base block header to be validated. |
[in] | FileType | The file type of a registry file to check against the file type of the base block. |
Definition at line 49 of file hiveinit.c.
Referenced by HvpGetHiveHeader(), HvpInitializeFlatHive(), HvpInitializeMemoryHive(), HvpRecoverHeaderFromLog(), and RegRecoverHeaderHive().