16static const GUID GUID_DATABASE_MSI = {0xd8ff6d16,0x6a3a,0x468a, {0x8b,0x44,0x01,0x71,0x4d,0xdc,0x49,0xea}};
17static const GUID GUID_DATABASE_SHIM = {0x11111111,0x1111,0x1111, {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11}};
18static const GUID GUID_DATABASE_DRIVERS = {0xf9ab2228,0x3312,0x4a73, {0xb6,0xf9,0x93,0x6d,0x70,0xe1,0x12,0xef}};
28void SdbpDebugHeapInit(
HANDLE privateHeapPtr);
29void SdbpDebugHeapDeinit(
void);
45 SdbpDebugHeapDeinit();
115 SHIM_ERR(
"Failed to allocate memory for shim database\n");
303 SHIM_ERR(
"Failed to read shim database header\n");
310 SHIM_ERR(
"Shim database header is invalid\n");
338 if (
pdb->major != 2 &&
pdb->major != 3)
341 SHIM_ERR(
"Invalid shim database version\n");
348 SHIM_INFO(
"Failed to get the database id\n");
360 if (!
pdb->database_name)
362 SHIM_INFO(
"Failed to get the database name\n");
380 if (
pdb->string_buffer)
382 if (
pdb->string_lookup)
433 static GUID NullGuid = { 0 };
460 SHIM_ERR(
"Cannot obtain database guid for databases other than main\n");
486 *VersionHi =
pdb->major;
487 *VersionLo =
pdb->minor;
616 TAGID tiData, tiValueType, tiValue;
617 DWORD dwDataType, dwSizeRequired, dwInputSize;
636 SHIM_WARN(
"Data tag (0x%x) without valuetype\n", tiData);
654 SHIM_WARN(
"Unsupported dwDataType=0x%x\n", dwDataType);
663 SHIM_WARN(
"Data tag (0x%x) without data\n", tiData);
674 if (lpStringData ==
NULL)
687 SHIM_WARN(
"dwInputSize %u not sufficient to hold %u bytes\n", dwInputSize, dwSizeRequired);
927 return L"InvalidTag";
NTSTATUS NTAPI NtUnmapViewOfSection(IN HANDLE ProcessHandle, IN PVOID BaseAddress)
NTSTATUS NTAPI NtCreateSection(OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER MaximumSize OPTIONAL, IN ULONG SectionPageProtection OPTIONAL, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL)
NTSTATUS NTAPI NtMapViewOfSection(IN HANDLE SectionHandle, IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress, IN ULONG_PTR ZeroBits, IN SIZE_T CommitSize, IN OUT PLARGE_INTEGER SectionOffset OPTIONAL, IN OUT PSIZE_T ViewSize, IN SECTION_INHERIT InheritDisposition, IN ULONG AllocationType, IN ULONG Protect)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define SDB_DATABASE_MAIN_SHIM
DWORD WINAPI SdbGetTagDataSize(PDB pdb, TAGID tagid)
#define DB_INFO_FLAGS_VALID_GUID
BOOL WINAPI SdbGetDatabaseID(PDB pdb, GUID *Guid)
TAG WINAPI SdbGetTagFromTagID(PDB pdb, TAGID tagid)
TAGID WINAPI SdbFindFirstTag(PDB pdb, TAGID parent, TAG tag)
#define SDB_DATABASE_MAIN_MSI
LPWSTR WINAPI SdbpGetString(PDB pdb, TAGID tagid, PDWORD size)
BOOL WINAPI SdbpReadData(PDB pdb, PVOID dest, DWORD offset, DWORD num)
#define HID_DATABASE_TYPE_MASK
BOOL WINAPI SdbTagIDToTagRef(HSDB hsdb, PDB pdb, TAGID tiWhich, TAGREF *ptrWhich)
#define SDB_DATABASE_MAIN_DRIVERS
TAGID WINAPI SdbFindNextTag(PDB pdb, TAGID parent, TAGID prev_child)
DWORD WINAPI SdbReadDWORDTag(PDB pdb, TAGID tagid, DWORD ret)
LPWSTR WINAPI SdbGetStringTagPtr(PDB pdb, TAGID tagid)
#define FILE_NON_DIRECTORY_FILE
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
static TAGREF LPCWSTR lpszDataName
static PDB_INFORMATION information
#define TAG_APP_NAME_RC_ID
static TAGID TAGID TAGID LPCWSTR find_name
#define TAG_SUMMARY_MSG_RC_ID
#define TAG_WILDCARD_NAME
#define TAG_MATCHING_FILE
#define TAG_PROBLEMSEVERITY
static TAGREF LPCWSTR LPDWORD lpdwDataType
#define TAG_COMPILER_VERSION
#define TAG_APPHELP_DETAILS
static TAGID LPCWSTR LPDWORD LPVOID LPDWORD TAGID * ptiData
#define TAG_VENDOR_NAME_RC_ID
#define TAG_APPHELP_TITLE
static TAGID TAGID TAGID nametag
#define TAG_STRINGTABLE_ITEM
static TAGREF LPCWSTR LPDWORD LPVOID LPDWORD lpcbBufferSize
#define ERROR_INSUFFICIENT_BUFFER
#define NT_SUCCESS(StatCode)
#define ERROR_INVALID_PARAMETER
#define FILE_ATTRIBUTE_NORMAL
struct _FileName FileName
#define FILE_SYNCHRONOUS_IO_NONALERT
GLuint GLuint GLsizei GLenum type
GLenum GLenum GLenum GLenum mapping
GLenum GLuint GLint GLint layer
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_CASE_INSENSITIVE
NTSYSAPI PVOID WINAPI RtlReAllocateHeap(HANDLE, ULONG, PVOID, SIZE_T)
NTSYSAPI NTSTATUS WINAPI RtlGUIDFromString(PUNICODE_STRING, GUID *)
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
#define memcpy(s1, s2, n)
#define TAG_UPTO_BIN_FILE_VERSION
#define TAG_ORIGINAL_FILENAME
#define TAG_LINKER_VERSION
#define TAG_16BIT_DESCRIPTION
#define TAG_UPTO_LINK_DATE
#define TAG_FILE_DESCRIPTION
#define TAG_BIN_FILE_VERSION
#define TAG_UPTO_BIN_PRODUCT_VERSION
#define TAG_LEGAL_COPYRIGHT
#define TAG_16BIT_MODULE_NAME
#define TAG_BIN_PRODUCT_VERSION
#define TAG_INTERNAL_NAME
#define TAG_PRODUCT_VERSION
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
static OUT PIO_STATUS_BLOCK IoStatusBlock
#define InitializeObjectAttributes(p, n, a, r, s)
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
NTSYSAPI PVOID NTAPI RtlDestroyHeap(IN PVOID HeapHandle)
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
NTSYSAPI NTSTATUS NTAPI NtWriteFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID WriteBuffer, IN ULONG WriteBufferLength, IN PLARGE_INTEGER FileOffset OPTIONAL, IN PULONG LockOperationKey OPTIONAL)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI PVOID NTAPI RtlCreateHeap(IN ULONG Flags, IN PVOID HeapBase OPTIONAL, IN ULONG ReserveSize OPTIONAL, IN ULONG CommitSize OPTIONAL, IN PVOID Lock OPTIONAL, IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL)
#define NtCurrentProcess()
NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, OUT PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
#define FILE_GENERIC_READ
#define FILE_GENERIC_WRITE
#define STANDARD_RIGHTS_REQUIRED
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define STATUS_OBJECT_PATH_SYNTAX_BAD
#define STATUS_MAPPED_FILE_SIZE_ZERO
#define FileStandardInformation
#define IsEqualGUID(rguid1, rguid2)
DWORD SdbpStrsize(PCWSTR string)
BOOL WINAPI SdbGUIDFromString(PCWSTR GuidString, GUID *Guid)
LONGLONG WINAPI SdbMakeIndexKeyFromString(LPCWSTR str)
void WINAPI SdbCloseDatabase(PDB pdb)
BOOL WINAPI SdbpCheckTagType(TAG tag, WORD type)
BOOL WINAPI SdbGetDatabaseInformation(PDB pdb, PDB_INFORMATION information)
LPCWSTR WINAPI SdbTagToString(TAG tag)
BOOL WINAPI SdbGetStandardDatabaseGUID(DWORD Flags, GUID *Guid)
DWORD WINAPI SdbQueryDataExTagID(PDB pdb, TAGID tiExe, LPCWSTR lpszDataName, LPDWORD lpdwDataType, LPVOID lpBuffer, LPDWORD lpcbBufferSize, TAGID *ptiData)
LPVOID SdbpAlloc(SIZE_T size)
TAGID WINAPI SdbFindFirstNamedTag(PDB pdb, TAGID root, TAGID find, TAGID nametag, LPCWSTR find_name)
void WINAPI SdbpCloseMemMappedFile(PMEMMAPPED mapping)
static HANDLE SdbpHeap(void)
TAGREF WINAPI SdbGetLayerTagRef(HSDB hsdb, LPCWSTR layerName)
PDB SdbpOpenDatabase(LPCWSTR path, PATH_TYPE type)
LPVOID SdbpReAlloc(LPVOID mem, SIZE_T size, SIZE_T oldSize)
PWSTR SdbpStrDup(LPCWSTR string)
static const GUID GUID_DATABASE_DRIVERS
BOOL WINAPI SdbGUIDToString(CONST GUID *Guid, PWSTR GuidString, SIZE_T Length)
PDB WINAPI SdbOpenDatabase(LPCWSTR path, PATH_TYPE type)
BOOL WINAPI SdbIsNullGUID(CONST GUID *Guid)
void WINAPI SdbpFlush(PDB pdb)
VOID WINAPI SdbFreeDatabaseInformation(PDB_INFORMATION information)
static const GUID GUID_DATABASE_MSI
BOOL WINAPI SdbGetDatabaseVersion(LPCWSTR database, PDWORD VersionHi, PDWORD VersionLo)
void SdbpHeapDeinit(void)
BOOL WINAPI SdbpCheckTagIDType(PDB pdb, TAGID tagid, WORD type)
BOOL WINAPI SdbpOpenMemMappedFile(LPCWSTR path, PMEMMAPPED mapping)
void SdbpFree(LPVOID mem)
static const GUID GUID_DATABASE_SHIM
DWORD SdbpStrlen(PCWSTR string)
PDB WINAPI SdbpCreate(LPCWSTR path, PATH_TYPE type, BOOL write)
#define SHIM_INFO(fmt,...)
#define SHIM_WARN(fmt,...)
#define SHIM_ERR(fmt,...)
void SdbpTableDestroy(struct SdbStringHashTable **pTable)
#define TAG_MSI_TRANSFORM_REF
#define TAG_DESCRIPTION_RC_ID
#define TAG_FLAG_MASK_SHELL
#define TAG_SHIM_ENGINE_OFF
#define TAG_CONTEXT_PLATFORM_ID
#define TAG_FLAG_PROCESSPARAM
#define TAG_TELEMETRY_OFF
#define TAG_APPLY_ALL_SHIMS
#define TAG_PREVOSMINORVER
#define TAG_USE_SERVICE_PACK_FILES
#define TAG_DATA_VALUETYPE
#define TAG_CONTEXT_BRANCH_ID
#define TAG_LAYER_PROPAGATION_OFF
#define TAG_INCLUDEEXCLUDEDLL
#define TAG_MATCH_LOGIC_NOT
#define TAG_MITIGATION_OS
#define TAG_OS_SERVICE_PACK
#define TAG_RUNTIME_PLATFORM
#define TAG_CONTEXT_TAGID
#define TAG_FLAG_MASK_KERNEL
#define TAG_PARAMETER1_RC_ID
#define TAG_PREVOSMAJORVER
#define TAG_FLAG_MASK_USER
#define TAG_MSI_TRANSFORM
#define TAG_PREVOSBUILDNO
#define TAG_PREVOSPLATFORMID
#define TAG_REINSTALL_UPGRADE
#define TAG_MSI_TRANSFORM_TAGID
#define TAG_MSI_CUSTOM_ACTION
#define TAG_RAC_EVENT_OFF
#define TAG_FLAG_MASK_FUSION
#define TAG_MSI_PACKAGE_ID
#define TAG_APPHELP_CONTACT
#define TAG_LAYER_DISPLAYNAME
#define TAG_BLOCK_UPGRADE
#define TAG_MSI_TRANSFORM_FILE
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
NTSTATUS NTAPI NtReadFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key)
STRSAFEAPI StringCbCopyNW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToCopy)
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
#define RtlZeroMemory(Destination, Length)
#define STATUS_OBJECT_NAME_INVALID
struct _LARGE_INTEGER::@2302 u
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
#define ERROR_INTERNAL_DB_CORRUPTION
_Must_inspect_result_ _In_ ULONG Flags