14#define DPFLTR_ERROR_LEVEL 0
31 xprintf(
"NtApphelpCacheControl returned 0x%x\n", (
unsigned int)
Status);
52 xprintf(
"Failed opening the file, using a NULL handle\n");
94 int MapIt =
argv[
n][1] == MapItChar;
99 xprintf(
"Error: no image name specified\n");
106#define TAG_TYPE_MASK 0xF000
107#define TAG_TYPE_DWORD 0x4000
108#define TAG_TYPE_QWORD 0x5000
109#define TAG_TYPE_STRINGREF 0x6000
111#define ATTRIBUTE_AVAILABLE 0x1
112#define ATTRIBUTE_FAILED 0x2
141 xprintf(
"Unable to load apphelp.dll\n");
150 xprintf(
"Unable to resolve functions\n");
173 else if (argn+1 >=
argc)
175 xprintf(
"Error: no image name specified\n");
186 if (pSdbGetFileAttributes(
FileName.Buffer, &
attr, &num_attr))
189 for (
n = 0;
n < num_attr; ++
n)
202 xprintf(
"<%ls>0x%lx</%ls>\n", tagName,
attr[
n].dwattr, tagName);
205 xprintf(
"<%ls>%ls</%ls>\n", tagName,
attr[
n].lpattr, tagName);
208 xprintf(
"<%ls>0x%I64x</%ls>\n", tagName,
attr[
n].qwattr, tagName);
211 xprintf(
"<!-- Unknown tag type: 0x%x (from 0x%x)\n", tagType,
attr[
n].
type);
219 xprintf(
"Unable to get attributes from %s\n",
arg);
230#define REG_BINARY ( 3 )
236 unsigned char *
line =
p;
237 unsigned int i, thisline,
offset = 0;
246 for (
i = 0;
i < thisline;
i++)
252 for (
i = 0;
i < thisline;
i++)
267 ULONG KeyInfoSize, ResultSize;
269 xprintf(
"Dumping AppCompatCache registry key\n");
275 sizeof(KeyValueObject), &ResultSize);
280 KeyValueInformation =
malloc(KeyInfoSize);
281 if (KeyValueInformation !=
NULL)
285 KeyInfoSize, &ResultSize);
299 xprintf(
"Failed reading AppCompatCache from registry (0x%lx)\n",
Status);
302 if (KeyValueInformation != &KeyValueObject)
303 free(KeyValueInformation);
313 int n, unhandled = 0, keepopen = 0;
320 xprintf(
"Calling ApphelpCacheServiceDump\n");
331 xprintf(
"Calling ApphelpCacheServiceFlush\n");
337 xprintf(
"Calling ApphelpDBGReadRegistry\n");
343 xprintf(
"Calling ApphelpDBGWriteRegistry\n");
375 if (unhandled ||
argc == 1)
377 xprintf(
"Usage: %s [-d|-z|-x|-h|-H|-f|-[l|L] <image>|-[u|U] <image>|-[r|R] <image>|-k]\n",
argv[0]);
378 xprintf(
" -d: Dump shim cache over debug output\n");
379 xprintf(
" -z: DEBUG Read shim cache from registry\n");
380 xprintf(
" -x: DEBUG Write shim cache to registry\n");
381 xprintf(
" -h: Hexdump shim registry key\n");
382 xprintf(
" -H: Crc + Length from shim registry key only\n");
383 xprintf(
" -f: Flush (clear) the shim cache\n");
384 xprintf(
" -l: Lookup <image> in the shim cache\n");
385 xprintf(
" -L: Lookup <image> in the shim cache without mapping it\n");
386 xprintf(
" -u: Update (insert) <image> in the shim cache\n");
387 xprintf(
" -U: Update (insert) <image> in the shim cache without mapping it\n");
388 xprintf(
" -r: Remove <image> from the shim cache\n");
389 xprintf(
" -R: Remove <image> from the shim cache without mapping it\n");
390 xprintf(
" -a: Dump file attributes as used in the appcompat database\n");
391 xprintf(
" -k: Keep the console open\n");
unsigned long long UINT64
ACPI_SIZE strlen(const char *String)
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
BOOL WINAPI SdbFreeFileAttributes(PATTRINFO attr_info)
LPCWSTR WINAPI SdbTagToString(TAG tag)
BOOL WINAPI SdbGetFileAttributes(LPCWSTR path, PATTRINFO *attr_info_ret, LPDWORD attr_count)
#define FILE_NON_DIRECTORY_FILE
static WCHAR ServiceName[]
#define NT_SUCCESS(StatCode)
#define _strnicmp(_String1, _String2, _MaxCount)
#define check(expected, result)
struct _FileName FileName
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
#define FILE_SYNCHRONOUS_IO_NONALERT
GLuint GLuint GLsizei GLenum type
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
_Check_return_opt_ _CRTIMP int __cdecl vprintf(_In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
enum _APPHELPCACHESERVICECLASS APPHELPCACHESERVICECLASS
@ ApphelpCacheServiceLookup
@ ApphelpCacheServiceRemove
@ ApphelpCacheServiceUpdate
@ ApphelpCacheServiceDump
@ ApphelpDBGWriteRegistry
@ ApphelpCacheServiceFlush
#define OBJ_CASE_INSENSITIVE
NTSTATUS NTAPI LdrUnloadDll(_In_ PVOID BaseAddress)
NTSTATUS NTAPI DECLSPEC_HOTPATCH LdrLoadDll(_In_opt_ PWSTR SearchPath, _In_opt_ PULONG DllCharacteristics, _In_ PUNICODE_STRING DllName, _Out_ PVOID *BaseAddress)
NTSTATUS NTAPI LdrGetProcedureAddress(_In_ PVOID BaseAddress, _In_opt_ _When_(Ordinal==0, _Notnull_) PANSI_STRING Name, _In_opt_ _When_(Name==NULL, _In_range_(>, 0)) ULONG Ordinal, _Out_ PVOID *ProcedureAddress)
static OUT PIO_STATUS_BLOCK IoStatusBlock
#define InitializeObjectAttributes(p, n, a, r, s)
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
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 NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
@ KeyValuePartialInformation
#define FILE_READ_ATTRIBUTES
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
#define FILE_SHARE_DELETE
struct _KEY_VALUE_PARTIAL_INFORMATION KEY_VALUE_PARTIAL_INFORMATION
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define RTL_CONSTANT_OBJECT_ATTRIBUTES(n, a)
NTSTATUS NTAPI NtApphelpCacheControl(_In_ APPHELPCACHESERVICECLASS Service, _In_opt_ PAPPHELP_CACHE_SERVICE_LOOKUP ServiceData)
#define STATUS_BUFFER_OVERFLOW
UNICODE_STRING AppCompatCacheValue
#define TAG_TYPE_STRINGREF
OBJECT_ATTRIBUTES AppCompatKeyAttributes
UNICODE_STRING AppCompatCacheKey
int HandleDumpAttributes(int argc, char *argv[], int *pn, const char *opt)
void xprintf(const char *fmt,...)
struct tagATTRINFO ATTRINFO
struct tagATTRINFO * PATTRINFO
void DumpRegistryData(int IncludeDump)
void CallApphelp(APPHELPCACHESERVICECLASS Service, PAPPHELP_CACHE_SERVICE_LOOKUP CacheEntry)
#define ATTRIBUTE_AVAILABLE
HANDLE MapFile(char *filename, UNICODE_STRING *PathName, int MapIt)
NTSYSAPI ULONG NTAPI vDbgPrintEx(_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ PCCH Format, _In_ va_list ap)
static BOOL InitApphelp()
int IsOpt(char *argv, const char *check)
void hexdump(unsigned char *p, unsigned int len)
#define DPFLTR_ERROR_LEVEL
void CallApphelpWithImage(char *filename, int MapIt, APPHELPCACHESERVICECLASS Service, char *ServiceName)
int HandleImageArg(int argc, char *argv[], int *pn, char MapItChar, APPHELPCACHESERVICECLASS Service, char *ServiceName)
#define RTL_CONSTANT_STRING(s)
void int int ULONGLONG int va_list * ap
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level