16#define BI_FLUSH_HIVE 0x01
17#define BI_HIVE_WRITEABLE 0x02
52 ULONG HiveLength, HeaderSum;
59 if ((BaseBlock->Signature ==
'fger') &&
60 (BaseBlock->Type == 0) &&
61 (BaseBlock->Major <= 1) &&
62 (BaseBlock->Minor <= 5) &&
63 (BaseBlock->Minor >= 3) &&
64 (BaseBlock->Format == 1))
67 HiveLength = BaseBlock->Length;
71 if (!(HiveLength & 0xFFF) && HiveLength <= 0x7FFFE000)
75 if (HeaderSum == BaseBlock->CheckSum)
195 SIZE_T NameLength, SubNameLength, NameBytes;
196 PWCHAR NameStart, NameBuffer;
224 SubNameLength = NameStart -
KeyName;
230 SubNameLength = NameLength;
240 NameBytes = SubNameLength *
sizeof(
WCHAR);
274 NameLength += -1 - SubNameLength;
331 HiveSize = Hive->BaseBlock->Length +
sizeof(
HBASE_BLOCK);
332 if ((HiveSize <
sizeof(
HBASE_BLOCK)) || (HiveSize > Hive->HiveSize))
407 DeviceLength = BcdDevice->
Size;
417 HaveWriteAccess =
TRUE;
425 HaveWriteAccess =
FALSE;
460 BcdHive->BaseBlock = BaseBlock;
468 if (HiveSize <
sizeof(*BaseBlock))
475 HiveLength = BaseBlock->
Length;
476 if (BaseBlock->
Length <
sizeof(*BaseBlock))
493 EfiPrintf(
L"Log fix not implemented: %lx %lx\r\n");
502 if (HiveSize < (HiveLength +
sizeof(*BaseBlock)))
504 EfiPrintf(
L"Need bigger hive buffer path\r\n");
507 NewHiveSize = HiveLength +
sizeof(*BaseBlock);
527 BaseBlock = NewBaseBlock;
528 HiveSize = NewHiveSize;
529 BcdHive->BaseBlock = BaseBlock;
536 EfiPrintf(
L"Log fix not implemented: %lx %lx\r\n");
599 *HiveHandle = KeyObject;
732 ULONG NameLength, NewTotalNameLength, FinalLength, TotalNameLength;
777 NameLength =
Node->NameLength;
781 NewTotalNameLength = TotalNameLength + NameLength +
sizeof(
UNICODE_NULL);
782 if (NewTotalNameLength < TotalNameLength)
789 TotalNameLength = NewTotalNameLength;
802 Status = RtlULongLongToULong(
sizeof(
PWCHAR) * KeyCount, &FinalLength);
809 Status = RtlULongAdd(TotalNameLength, FinalLength, &FinalLength);
824 NameEnd = (
PWCHAR)&SubKeys[KeyCount];
825 for (
i = 0;
i < KeyCount;
i++)
853 NameLength =
Node->NameLength;
858 SubKeys[
i] = NameEnd;
859 NameEnd += (NameLength /
sizeof(
WCHAR));
875 *SubKeyList = SubKeys;
918 for (
i = 0;
i < SubKeyCount;
i++)
#define OBJ_NAME_PATH_SEPARATOR
#define BL_DEVICE_READ_ACCESS
struct _BL_DEVICE_DESCRIPTOR * PBL_DEVICE_DESCRIPTOR
VOID EfiPrintf(_In_ PWCHAR Format,...)
#define BL_DEVICE_WRITE_ACCESS
#define BL_MM_INCLUDE_MAPPED_ALLOCATED
NTSTATUS MmPapAllocatePagesInRange(_Inout_ PVOID *PhysicalAddress, _In_ BL_MEMORY_TYPE MemoryType, _In_ ULONGLONG Pages, _In_ ULONG Attributes, _In_ ULONG Alignment, _In_opt_ PBL_ADDRESS_RANGE Range, _In_ ULONG Type)
PVOID BlMmAllocateHeap(_In_ SIZE_T Size)
NTSTATUS BlpDeviceOpen(_In_ PBL_DEVICE_DESCRIPTOR Device, _In_ ULONG Flags, _In_ ULONG Unknown, _Out_ PULONG DeviceId)
NTSTATUS BlDeviceClose(_In_ ULONG DeviceId)
NTSTATUS BlImgLoadImageWithProgress2(_In_ ULONG DeviceId, _In_ BL_MEMORY_TYPE MemoryType, _In_ PWCHAR FileName, _Inout_ PVOID *MappedBase, _Inout_ PULONG MappedSize, _In_ ULONG ImageFlags, _In_ BOOLEAN ShowProgress, _Out_opt_ PUCHAR *HashBuffer, _Out_opt_ PULONG HashSize)
NTSTATUS MmPapFreePages(_In_ PVOID Address, _In_ ULONG WhichList)
NTSTATUS BlMmFreeHeap(_In_ PVOID Buffer)
NTSTATUS BiInitializeAndValidateHive(_In_ PBI_KEY_HIVE Hive)
NTSTATUS BiGetRegistryValue(_In_ HANDLE KeyHandle, _In_ PWCHAR ValueName, _In_ ULONG Type, _Out_ PVOID *Buffer, _Out_ PULONG ValueLength)
struct _BI_KEY_HIVE * PBI_KEY_HIVE
NTSTATUS BiOpenKey(_In_ HANDLE ParentHandle, _In_ PWCHAR KeyName, _Out_ PHANDLE Handle)
BOOLEAN BiHiveHashLibraryInitialized
VOID BiDereferenceHive(_In_ HANDLE KeyHandle)
PVOID NTAPI CmpAllocate(_In_ SIZE_T Size, _In_ BOOLEAN Paged, _In_ ULONG Tag)
#define BI_HIVE_WRITEABLE
BOOLEAN HvIsInPlaceBaseBlockValid(_In_ PHBASE_BLOCK BaseBlock)
VOID BiCloseKey(_In_ HANDLE KeyHandle)
VOID BiFlushHive(_In_ HANDLE KeyHandle)
struct _BI_KEY_OBJECT BI_KEY_OBJECT
struct _BI_KEY_HIVE BI_KEY_HIVE
struct _BI_KEY_OBJECT * PBI_KEY_OBJECT
VOID NTAPI CmpFree(_In_ PVOID Ptr, _In_ ULONG Quota)
NTSTATUS BiDeleteKey(_In_ HANDLE KeyHandle)
NTSTATUS BiEnumerateSubKeys(_In_ HANDLE KeyHandle, _Out_ PWCHAR **SubKeyList, _Out_ PULONG SubKeyCount)
NTSTATUS BiLoadHive(_In_ PBL_FILE_PATH_DESCRIPTOR FilePath, _Out_ PHANDLE HiveHandle)
CM_CHECK_REGISTRY_STATUS NTAPI CmCheckRegistry(_In_ PCMHIVE RegistryHive, _In_ ULONG Flags)
Checks the registry that is consistent and its contents valid and not corrupted. More specifically th...
struct _CM_KEY_NODE * PCM_KEY_NODE
struct _CM_KEY_VALUE * PCM_KEY_VALUE
HCELL_INDEX NTAPI CmpFindSubKeyByNumber(IN PHHIVE Hive, IN PCM_KEY_NODE Node, IN ULONG Number)
HCELL_INDEX NTAPI CmpFindSubKeyByName(IN PHHIVE Hive, IN PCM_KEY_NODE Parent, IN PCUNICODE_STRING SearchName)
NTSTATUS NTAPI CmpFreeKeyByCell(IN PHHIVE Hive, IN HCELL_INDEX Cell, IN BOOLEAN Unlink)
ULONG CMAPI HvpHiveHeaderChecksum(PHBASE_BLOCK HiveHeader)
VOID NTAPI CmpCopyCompressedName(OUT PWCHAR Destination, IN ULONG DestinationLength, IN PWCHAR Source, IN ULONG SourceLength)
NTSTATUS CMAPI HvInitialize(PHHIVE RegistryHive, ULONG OperationType, ULONG HiveFlags, ULONG FileType, PVOID HiveData OPTIONAL, PALLOCATE_ROUTINE Allocate, PFREE_ROUTINE Free, PFILE_SET_SIZE_ROUTINE FileSetSize, PFILE_WRITE_ROUTINE FileWrite, PFILE_READ_ROUTINE FileRead, PFILE_FLUSH_ROUTINE FileFlush, ULONG Cluster OPTIONAL, PCUNICODE_STRING FileName OPTIONAL)
#define CM_CHECK_REGISTRY_VALIDATE_HIVE
PCELL_DATA NTAPI CmpValueToData(IN PHHIVE Hive, IN PCM_KEY_VALUE Value, OUT PULONG Length)
#define CM_CHECK_REGISTRY_SUCCESS(StatusCode)
ULONG CM_CHECK_REGISTRY_STATUS
USHORT NTAPI CmpCompressedNameSize(IN PWCHAR Name, IN ULONG Length)
#define CM_CHECK_REGISTRY_BOOTLOADER_PURGE_VOLATILES
#define HvGetCell(Hive, Cell)
BOOLEAN NTAPI CmpFindNameInList(IN PHHIVE Hive, IN PCHILD_LIST ChildList, IN PCUNICODE_STRING Name, OUT PULONG ChildIndex OPTIONAL, OUT PHCELL_INDEX CellIndex)
#define STATUS_OBJECT_TYPE_MISMATCH
#define NT_SUCCESS(StatCode)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
struct _HBASE_BLOCK HBASE_BLOCK
_In_ GUID _In_ PVOID ValueData
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PCONFIGURATION_COMPONENT_DATA RootNode
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING _Out_ PNDIS_HANDLE SubKeyHandle
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define UNREFERENCED_PARAMETER(P)
#define STATUS_REGISTRY_CORRUPT
#define STATUS_NAME_TOO_LONG
PBL_FILE_PATH_DESCRIPTOR FilePath
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_MEDIA_WRITE_PROTECTED
#define STATUS_INVALID_PARAMETER
#define STATUS_OBJECT_NAME_NOT_FOUND
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
_Must_inspect_result_ _In_opt_ WDFKEY ParentKey
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG ValueLength