27 EfiPrintf(
L"Error in BiNotify: %lx for element %s\r\n",
Status, ElementName);
66 PWCHAR BcdString, ElementString;
75 switch (ElementType.Format)
131 ElementString = (
PWCHAR)Element;
137 NullTerminate =
FALSE;
141 NullTerminate =
TRUE;
166 ElementGuid = (
PGUID)Element;
191 ElementGuid = (
PGUID)Element;
269 ElementWord = (
PUSHORT)Element;
288 *ElementWord = *BcdBoolean != 0;
358 ULONG ElementSize, AlignedElementSize, AlignedDataSize;
375 Status = RtlULongAdd(ElementSize,
377 &AlignedElementSize);
394 Status = RtlULongMult(*ElementCount,
403 Status = RtlULongAdd(ElementSize,
404 AlignedElementSize +
sizeof(
ULONG) - 1,
405 &AlignedElementSize);
422 for (
i = 0;
i < *ElementCount;
i++)
425 Status = RtlULongAdd(Elements->Size,
435 Status = RtlULongAdd(AlignedElementSize,
437 &AlignedElementSize);
454 while (
Buffer[
j].
Header->Type == Elements->RootType.PackedValue)
474 Header->Size = Elements->Size;
475 Header->Type = Elements->Type;
476 Header->Version = Elements->Version;
496 Elements = Elements->NextEntry;
501 *ElementCount =
Count;
518 *ObjectHandle =
NULL;
524 RootObjectHandle =
NULL;
532 LocalGuid = *ObjectId;
550 if (RootObjectHandle)
566 HANDLE ElementsHandle, ElementHandle;
567 WCHAR TypeString[22];
590 ElementHandle =
NULL;
682 *ElementCount = ParsedElements;
708 PreviousElement =
NULL;
711 CurrentSize = *ElementSize;
714 for (
i = 0;
i < SubObjectCount;
i++)
737 *ElementCount += SubElementCount;
740 if (*ElementSize >= TotalSize)
746 CurrentSize = *ElementSize - TotalSize;
749 PreviousElement = Elements;
770 BlStatusPrint(
L"Ignoring missing BCD inherit object: {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
771 (&SubObjectList[
i])->Data1,
772 (&SubObjectList[
i])->Data2,
773 (&SubObjectList[
i])->Data3,
774 (&SubObjectList[
i])->Data4[0],
775 (&SubObjectList[
i])->Data4[1],
776 (&SubObjectList[
i])->Data4[2],
777 (&SubObjectList[
i])->Data4[3],
778 (&SubObjectList[
i])->Data4[4],
779 (&SubObjectList[
i])->Data4[5],
780 (&SubObjectList[
i])->Data4[6],
781 (&SubObjectList[
i])->Data4[7]);
793 if (*ElementSize < TotalSize)
799 *ElementSize = TotalSize;
814 HANDLE ElementsHandle, ElementHandle;
818 PVOID ElementData, SubObjectList, RegistryElementData;
821 ULONG SubElementCount, SubKeyCount, SubObjectCount, ElementDataLength;
830 ElementsHandle =
NULL;
831 ElementHandle =
NULL;
833 RegistryElementData =
NULL;
834 PreviousElement =
NULL;
836 SubObjectList =
NULL;
838 ElementDataLength = 0;
841 ElementsStart = Elements;
858 for (
i = 0;
i < SubKeyCount;
i++)
861 ElementName = SubKeys[
i];
876 ElementHandle =
NULL;
885 &RegistryElementData,
886 &RegistryElementDataLength);
894 ElementDataLength = 0;
897 RegistryElementDataLength,
917 RegistryElementDataLength,
946 RemainingLength = *ElementSize;
953 Elements->RootType.PackedValue = RootElementType;
954 Elements->Version = 1;
956 Elements->Size = ElementDataLength;
959 RtlCopyMemory(Elements->Data, ElementData, ElementDataLength);
963 PreviousElement = Elements;
996 *ElementCount += SubElementCount;
1002 if (SubElementCount)
1008 PreviousElement = Elements;
1018 ElementDataLength = 0;
1040 RtlCopyMemory(SubObjectList, ElementData, ElementDataLength);
1041 SubObjectCount = ElementDataLength /
sizeof(
GUID);
1048 RegistryElementData =
NULL;
1052 ElementHandle =
NULL;
1057 if ((
i != 0) && (
i == SubKeyCount) && (SubObjectList))
1074 *ElementCount += SubElementCount;
1077 PreviousElement =
NULL;
1096 if (RegistryElementData)
1108 if (PreviousElement)
1164 *StoreHandle = HiveHandle;
1184 HANDLE DescriptionHandle;
1190 DescriptionHandle =
NULL;
1223 if (DescriptionHandle)
1249 PVOID LocalElements;
1251 ULONG LocalElementCount, LocalElementSize;
1254 if (!(ElementSize) || !(ElementCount) || ((Elements) && (!*ElementSize)))
1263 LocalElementSize = 0;
1264 LocalElementCount = 0;
1273 &LocalElementCount);
1296 &LocalElementCount);
1303 *ElementCount = LocalElementCount;
1309 &LocalElementCount);
1313 *ElementCount = LocalElementCount;
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG _In_ ULONG _Out_ PULONG ReturnedLength
NTSTATUS BcdDeleteElement(_In_ HANDLE ObjectHandle, _In_ ULONG Type)
NTSTATUS BcdOpenStoreFromFile(_In_ PUNICODE_STRING FileName, _In_ PHANDLE BcdHandle)
VOID BiNotifyEnumerationError(_In_ HANDLE ObjectHandle, _In_ PWCHAR ElementName, _In_ NTSTATUS Status)
NTSTATUS BiEnumerateElements(_In_ HANDLE BcdHandle, _In_ HANDLE ObjectHandle, _In_ ULONG RootElementType, _In_ ULONG Flags, _Out_opt_ PBCD_PACKED_ELEMENT Elements, _Inout_ PULONG ElementSize, _Out_ PULONG ElementCount)
ULONG BiConvertElementFormatToValueType(_In_ ULONG Format)
NTSTATUS BiConvertBcdElements(_In_ PBCD_PACKED_ELEMENT Elements, _Out_opt_ PBCD_ELEMENT Buffer, _Inout_ PULONG BufferSize, _Inout_ PULONG ElementCount)
NTSTATUS BiAddStoreFromFile(_In_ PBL_FILE_PATH_DESCRIPTOR FilePath, _Out_ PHANDLE StoreHandle)
NTSTATUS BiEnumerateSubElements(_In_ HANDLE BcdHandle, _In_ PVOID Object, _In_ ULONG ElementType, _In_ ULONG Flags, _Out_opt_ PBCD_PACKED_ELEMENT *Elements, _Inout_ PULONG ElementSize, _Out_ PULONG ElementCount)
NTSTATUS BcdOpenObject(_In_ HANDLE BcdHandle, _In_ PGUID ObjectId, _Out_ PHANDLE ObjectHandle)
NTSTATUS BiConvertRegistryDataToElement(_In_ HANDLE ObjectHandle, _In_ PVOID Data, _In_ ULONG DataLength, _In_ BcdElementType ElementType, _Out_ PVOID Element, _Out_ PULONG ElementSize)
NTSTATUS BiGetObjectDescription(_In_ HANDLE ObjectHandle, _Out_ PBCD_OBJECT_DESCRIPTION Description)
NTSTATUS BcdEnumerateAndUnpackElements(_In_ HANDLE BcdHandle, _In_ HANDLE ObjectHandle, _Out_opt_ PBCD_ELEMENT Elements, _Inout_ PULONG ElementSize, _Out_ PULONG ElementCount)
NTSTATUS BiEnumerateSubObjectElements(_In_ HANDLE BcdHandle, _Out_ PGUID SubObjectList, _In_ ULONG SubObjectCount, _In_ ULONG Flags, _Out_opt_ PBCD_PACKED_ELEMENT Elements, _Inout_ PULONG ElementSize, _Out_ PULONG ElementCount)
#define BCD_ENUMERATE_FLAG_DEEP
#define BCD_ENUMERATE_FLAG_DEVICES
struct _BCD_DEVICE_OPTION * PBCD_DEVICE_OPTION
#define BCD_ENUMERATE_FLAG_IN_ORDER
#define BCD_TYPE_INTEGER_LIST
#define BCD_TYPE_OBJECT_LIST
@ BcdLibraryObjectList_InheritedObjects
struct _BCD_PACKED_ELEMENT * PBCD_PACKED_ELEMENT
NTSTATUS BiGetRegistryValue(_In_ HANDLE KeyHandle, _In_ PWCHAR ValueName, _In_ ULONG Type, _Out_ PVOID *Buffer, _Out_ PULONG ValueLength)
NTSTATUS BiOpenKey(_In_ HANDLE ParentHandle, _In_ PWCHAR KeyName, _Out_ PHANDLE Handle)
VOID EfiPrintf(_In_ PWCHAR Format,...)
VOID BiDereferenceHive(_In_ HANDLE KeyHandle)
PVOID BlMmAllocateHeap(_In_ SIZE_T Size)
VOID BiCloseKey(_In_ HANDLE KeyHandle)
NTSTATUS EfiStall(_In_ ULONG StallTime)
NTSTATUS BlMmFreeHeap(_In_ PVOID Buffer)
VOID BlStatusPrint(_In_ PCWCH Format,...)
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)
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
#define STATUS_NOT_SUPPORTED
#define STATUS_OBJECT_TYPE_MISMATCH
#define NT_SUCCESS(StatCode)
static const WCHAR Description[]
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
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 GLint GLint j
HLOCAL NTAPI LocalHandle(LPCVOID pMem)
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_CRTIMP wchar_t *__cdecl _ultow(_In_ unsigned long _Value, _Pre_notnull_ _Post_z_ wchar_t *_Dest, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI NTSTATUS WINAPI RtlGUIDFromString(PUNICODE_STRING, GUID *)
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
_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)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
#define UNREFERENCED_PARAMETER(P)
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define STATUS_BUFFER_TOO_SMALL
const KSDEVICE_DESCRIPTOR DeviceDescriptor
Data(int index, int value)
BL_DEVICE_DESCRIPTOR DeviceDescriptor
struct _BCD_PACKED_ELEMENT * NextEntry
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
#define STATUS_OBJECT_NAME_NOT_FOUND
#define ALIGN_DOWN(size, type)
_Must_inspect_result_ _In_ WDFDEVICE Device
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
_Must_inspect_result_ _In_ ULONG Flags