ReactOS 0.4.16-dev-290-g89a3b8f
appcache.c File Reference
#include <k32.h>
#include <debug.h>
Include dependency graph for appcache.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define APPHELP_VALID_RESULT   0x10000
 
#define APPHELP_RESULT_NOTFOUND   0x20000
 
#define APPHELP_RESULT_FOUND   0x40000
 

Typedefs

typedef BOOL(WINAPItApphelpCheckRunAppEx) (HANDLE FileHandle, PVOID Unk1, PVOID Unk2, PWCHAR ApplicationName, PVOID Environment, USHORT ExeType, PULONG Reason, PVOID *SdbQueryAppCompatData, PULONG SdbQueryAppCompatDataSize, PVOID *SxsData, PULONG SxsDataSize, PULONG FusionFlags, PULONG64 SomeFlag1, PULONG SomeFlag2)
 
typedef BOOL(WINAPItSdbPackAppCompatData) (PVOID hsdb, PVOID pQueryResult, PVOID *ppData, DWORD *dwSize)
 

Functions

BOOLEAN WINAPI IsShimInfrastructureDisabled (VOID)
 
BOOL BasepShimCacheCheckBypass (_In_ PCWSTR ApplicationName, _In_ HANDLE FileHandle, _In_opt_ PCWSTR Environment, _In_ BOOL bUnknown, _Out_opt_ PULONG pdwReason)
 
BOOL BasepShimCacheSearch (_In_ PCWSTR ApplicationName, _In_ HANDLE FileHandle)
 
BOOL BasepCheckCacheExcludeList (_In_ PCWSTR ApplicationName)
 
BOOL BasepCheckCacheExcludeCustom (_In_ PCWSTR ApplicationName)
 
VOID BasepShimCacheRemoveEntry (_In_ PCWSTR ApplicationName)
 
BOOL BasepShimCacheLookup (_In_ PCWSTR ApplicationName, _In_ HANDLE FileHandle)
 
BOOL WINAPI BaseCheckAppcompatCache (_In_ PCWSTR ApplicationName, _In_ HANDLE FileHandle, _In_opt_ PCWSTR Environment, _Out_opt_ PULONG pdwReason)
 
static VOID BaseInitApphelp (VOID)
 
BOOL WINAPI BaseCheckRunApp (IN HANDLE FileHandle, IN PWCHAR ApplicationName, IN PWCHAR Environment, IN USHORT ExeType, IN PULONG pReason, IN PVOID *SdbQueryAppCompatData, IN PULONG SdbQueryAppCompatDataSize, IN PVOID *SxsData, IN PULONG SxsDataSize, OUT PULONG FusionFlags)
 
NTSTATUS WINAPI BasepCheckBadapp (IN HANDLE FileHandle, IN PWCHAR ApplicationName, IN PWCHAR Environment, IN USHORT ExeType, IN PVOID *SdbQueryAppCompatData, IN PULONG SdbQueryAppCompatDataSize, IN PVOID *SxsData, IN PULONG SxsDataSize, OUT PULONG FusionFlags)
 
BOOL WINAPI BaseDumpAppcompatCache (VOID)
 
BOOL WINAPI BaseFlushAppcompatCache (VOID)
 
VOID WINAPI BasepFreeAppCompatData (IN PVOID AppCompatData, IN PVOID AppCompatSxsData)
 
VOID WINAPI BaseUpdateAppcompatCache (ULONG Unknown1, ULONG Unknown2, ULONG Unknown3)
 
NTSTATUS WINAPI BaseCleanupAppcompatCache (VOID)
 
NTSTATUS WINAPI BaseCleanupAppcompatCacheSupport (PVOID pUnknown)
 
BOOL WINAPI BaseInitAppcompatCache (VOID)
 
BOOL WINAPI BaseInitAppcompatCacheSupport (VOID)
 
PVOID WINAPI GetComPlusPackageInstallStatus (VOID)
 
BOOL WINAPI SetComPlusPackageInstallStatus (IN ULONG ComPlusPackage)
 
VOID WINAPI SetTermsrvAppInstallMode (IN BOOL bInstallMode)
 
BOOL WINAPI TermsrvAppInstallMode (VOID)
 

Variables

ULONG g_ShimsDisabled = -1
 
static BOOL g_ApphelpInitialized = FALSE
 
static PVOID g_pApphelpCheckRunAppEx
 
static PVOID g_pSdbPackAppCompatData
 

Macro Definition Documentation

◆ APPHELP_RESULT_FOUND

#define APPHELP_RESULT_FOUND   0x40000

Definition at line 30 of file appcache.c.

◆ APPHELP_RESULT_NOTFOUND

#define APPHELP_RESULT_NOTFOUND   0x20000

Definition at line 29 of file appcache.c.

◆ APPHELP_VALID_RESULT

#define APPHELP_VALID_RESULT   0x10000

Definition at line 28 of file appcache.c.

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file appcache.c.

Typedef Documentation

◆ tApphelpCheckRunAppEx

◆ tSdbPackAppCompatData

typedef BOOL(WINAPI * tSdbPackAppCompatData) (PVOID hsdb, PVOID pQueryResult, PVOID *ppData, DWORD *dwSize)

Definition at line 26 of file appcache.c.

Function Documentation

◆ BaseCheckAppcompatCache()

BOOL WINAPI BaseCheckAppcompatCache ( _In_ PCWSTR  ApplicationName,
_In_ HANDLE  FileHandle,
_In_opt_ PCWSTR  Environment,
_Out_opt_ PULONG  pdwReason 
)

Definition at line 229 of file appcache.c.

234{
235 BOOL ret = FALSE;
237
238 DPRINT("(%S, %p, %S, %p)\n", ApplicationName, FileHandle, Environment, pdwReason);
239
240 dwReason = 0;
242 {
243 dwReason |= 2;
244 }
245 else
246 {
248 if (!ret)
249 dwReason |= 1;
250 }
251
252 if (pdwReason)
253 *pdwReason = dwReason;
254
255 return ret;
256}
BOOL BasepShimCacheCheckBypass(_In_ PCWSTR ApplicationName, _In_ HANDLE FileHandle, _In_opt_ PCWSTR Environment, _In_ BOOL bUnknown, _Out_opt_ PULONG pdwReason)
Definition: appcache.c:142
BOOL BasepShimCacheLookup(_In_ PCWSTR ApplicationName, _In_ HANDLE FileHandle)
Definition: appcache.c:205
DWORD dwReason
Definition: misc.cpp:141
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
PVOID PVOID PWCHAR PVOID Environment
Definition: env.c:47
PVOID PVOID PWCHAR ApplicationName
Definition: env.c:47
#define DPRINT
Definition: sndvol32.h:73
uint32_t ULONG
Definition: typedefs.h:59
int ret

Referenced by BasepCheckBadapp(), and Imm32CheckAndApplyAppCompat().

◆ BaseCheckRunApp()

BOOL WINAPI BaseCheckRunApp ( IN HANDLE  FileHandle,
IN PWCHAR  ApplicationName,
IN PWCHAR  Environment,
IN USHORT  ExeType,
IN PULONG  pReason,
IN PVOID SdbQueryAppCompatData,
IN PULONG  SdbQueryAppCompatDataSize,
IN PVOID SxsData,
IN PULONG  SxsDataSize,
OUT PULONG  FusionFlags 
)

Definition at line 295 of file appcache.c.

305{
306 ULONG Reason = 0;
307 ULONG64 Flags1 = 0;
308 ULONG Flags2 = 0;
309 BOOL Continue, NeedCleanup = FALSE;
310 tApphelpCheckRunAppEx pApphelpCheckRunAppEx;
311 tSdbPackAppCompatData pSdbPackAppCompatData;
312 PVOID QueryResult = NULL;
313 ULONG QueryResultSize = 0;
314
316 {
319 }
320
321 pApphelpCheckRunAppEx = RtlDecodeSystemPointer(g_pApphelpCheckRunAppEx);
322 pSdbPackAppCompatData = RtlDecodeSystemPointer(g_pSdbPackAppCompatData);
323
324 if (!pApphelpCheckRunAppEx || !pSdbPackAppCompatData)
325 return TRUE;
326
327 if (pReason)
328 Reason = *pReason;
329
330 Continue = pApphelpCheckRunAppEx(FileHandle, NULL, NULL, ApplicationName, Environment, ExeType, &Reason,
331 &QueryResult, &QueryResultSize, SxsData, SxsDataSize, FusionFlags, &Flags1, &Flags2);
332
333 if (pReason)
334 *pReason = Reason;
335
336 if (Continue)
337 {
339 {
340 if (!pSdbPackAppCompatData(NULL, QueryResult, SdbQueryAppCompatData, SdbQueryAppCompatDataSize))
341 {
342 DPRINT1("SdbPackAppCompatData returned a failure!\n");
343 NeedCleanup = TRUE;
344 }
345 }
346 else
347 {
348 NeedCleanup = TRUE;
349 }
350 }
351
352 if (QueryResult)
353 RtlFreeHeap(RtlGetProcessHeap(), 0, QueryResult);
354
355 if (NeedCleanup)
356 {
361 *SxsData = NULL;
362 if (SxsDataSize)
363 *SxsDataSize = 0;
364 }
365
366 return Continue;
367}
static PVOID g_pSdbPackAppCompatData
Definition: appcache.c:21
BOOL(WINAPI * tApphelpCheckRunAppEx)(HANDLE FileHandle, PVOID Unk1, PVOID Unk2, PWCHAR ApplicationName, PVOID Environment, USHORT ExeType, PULONG Reason, PVOID *SdbQueryAppCompatData, PULONG SdbQueryAppCompatDataSize, PVOID *SxsData, PULONG SxsDataSize, PULONG FusionFlags, PULONG64 SomeFlag1, PULONG SomeFlag2)
Definition: appcache.c:23
#define APPHELP_VALID_RESULT
Definition: appcache.c:28
static VOID BaseInitApphelp(VOID)
Definition: appcache.c:260
VOID WINAPI BasepFreeAppCompatData(IN PVOID AppCompatData, IN PVOID AppCompatSxsData)
Definition: appcache.c:444
static PVOID g_pApphelpCheckRunAppEx
Definition: appcache.c:20
static BOOL g_ApphelpInitialized
Definition: appcache.c:19
BOOL(WINAPI * tSdbPackAppCompatData)(PVOID hsdb, PVOID pQueryResult, PVOID *ppData, DWORD *dwSize)
Definition: appcache.c:26
#define APPHELP_RESULT_FOUND
Definition: appcache.c:30
#define DPRINT1
Definition: precomp.h:8
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
#define NULL
Definition: types.h:112
localAdvHdr Flags2
Definition: fsrtlfuncs.h:1692
unsigned __int64 ULONG64
Definition: imports.h:198
PVOID PVOID PWCHAR PVOID USHORT ExeType
Definition: env.c:47
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
Definition: env.c:47
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID * SdbQueryAppCompatData
Definition: env.c:48
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG SxsDataSize
Definition: env.c:48
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID * SxsData
Definition: env.c:48
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG PULONG FusionFlags
Definition: env.c:49
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG SdbQueryAppCompatDataSize
Definition: env.c:48
PVOID NTAPI RtlDecodeSystemPointer(IN PVOID Pointer)
Definition: process.c:439

Referenced by BasepCheckBadapp().

◆ BaseCleanupAppcompatCache()

NTSTATUS WINAPI BaseCleanupAppcompatCache ( VOID  )

Definition at line 469 of file appcache.c.

470{
471 STUB;
473}
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
#define STUB
Definition: kernel32.h:27

◆ BaseCleanupAppcompatCacheSupport()

NTSTATUS WINAPI BaseCleanupAppcompatCacheSupport ( PVOID  pUnknown)

Definition at line 480 of file appcache.c.

481{
482 STUB;
484}

◆ BaseDumpAppcompatCache()

BOOL WINAPI BaseDumpAppcompatCache ( VOID  )

Definition at line 418 of file appcache.c.

419{
421
423 return NT_SUCCESS(Status);
424}
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:25
@ ApphelpCacheServiceDump
Definition: pstypes.h:978
NTSTATUS NTAPI NtApphelpCacheControl(_In_ APPHELPCACHESERVICECLASS Service, _In_opt_ PAPPHELP_CACHE_SERVICE_LOOKUP ServiceData)
Definition: apphelp.c:728

Referenced by ShimDumpCache().

◆ BaseFlushAppcompatCache()

BOOL WINAPI BaseFlushAppcompatCache ( VOID  )

Definition at line 431 of file appcache.c.

432{
434
436 return NT_SUCCESS(Status);
437}
@ ApphelpCacheServiceFlush
Definition: pstypes.h:977

Referenced by ShimFlushCache().

◆ BaseInitAppcompatCache()

BOOL WINAPI BaseInitAppcompatCache ( VOID  )

Definition at line 491 of file appcache.c.

492{
493 STUB;
494 return FALSE;
495}

◆ BaseInitAppcompatCacheSupport()

BOOL WINAPI BaseInitAppcompatCacheSupport ( VOID  )

Definition at line 502 of file appcache.c.

503{
504 STUB;
505 return FALSE;
506}

◆ BaseInitApphelp()

static VOID BaseInitApphelp ( VOID  )
static

Definition at line 260 of file appcache.c.

261{
264 PVOID ApphelpAddress;
265 PVOID pApphelpCheckRunAppEx = NULL, pSdbPackAppCompatData = NULL;
266
267 RtlInitEmptyUnicodeString(&DllPath, Buffer, sizeof(Buffer));
269 RtlAppendUnicodeToString(&DllPath, L"\\system32\\apphelp.dll");
270
271 if (NT_SUCCESS(LdrLoadDll(NULL, NULL, &DllPath, &ApphelpAddress)))
272 {
273 ANSI_STRING ProcName;
274
275 RtlInitAnsiString(&ProcName, "ApphelpCheckRunAppEx");
276 if (!NT_SUCCESS(LdrGetProcedureAddress(ApphelpAddress, &ProcName, 0, &pApphelpCheckRunAppEx)))
277 pApphelpCheckRunAppEx = NULL;
278
279 RtlInitAnsiString(&ProcName, "SdbPackAppCompatData");
280 if (!NT_SUCCESS(LdrGetProcedureAddress(ApphelpAddress, &ProcName, 0, &pSdbPackAppCompatData)))
281 pSdbPackAppCompatData = NULL;
282 }
283
285 {
286 g_pSdbPackAppCompatData = RtlEncodeSystemPointer(pSdbPackAppCompatData);
287 }
288}
Definition: bufpool.h:45
#define MAX_PATH
Definition: compat.h:34
UNICODE_STRING BaseWindowsDirectory
Definition: path.c:20
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
NTSTATUS NTAPI DECLSPEC_HOTPATCH LdrLoadDll(_In_opt_ PWSTR SearchPath, _In_opt_ PULONG DllCharacteristics, _In_ PUNICODE_STRING DllName, _Out_ PVOID *BaseAddress)
Definition: ldrapi.c:312
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)
Definition: ldrapi.c:789
static const char const char * DllPath
Definition: image.c:34
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define L(x)
Definition: ntvdm.h:50
PVOID NTAPI RtlEncodeSystemPointer(IN PVOID Pointer)
Definition: process.c:429
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by BaseCheckRunApp().

◆ BasepCheckBadapp()

NTSTATUS WINAPI BasepCheckBadapp ( IN HANDLE  FileHandle,
IN PWCHAR  ApplicationName,
IN PWCHAR  Environment,
IN USHORT  ExeType,
IN PVOID SdbQueryAppCompatData,
IN PULONG  SdbQueryAppCompatDataSize,
IN PVOID SxsData,
IN PULONG  SxsDataSize,
OUT PULONG  FusionFlags 
)

Definition at line 374 of file appcache.c.

383{
385 ULONG Reason = 0;
386
387 /* Is shimming enabled by group policy? */
389 {
390 /* Nothing to worry about */
392 }
393 else
394 {
395 /* It is, check if we know about this app */
399 &Reason))
400 {
403 {
405 }
406 }
407 }
408
409 /* Return caller the status */
410 return Status;
411}
BOOL WINAPI BaseCheckAppcompatCache(_In_ PCWSTR ApplicationName, _In_ HANDLE FileHandle, _In_opt_ PCWSTR Environment, _Out_opt_ PULONG pdwReason)
Definition: appcache.c:229
BOOL WINAPI BaseCheckRunApp(IN HANDLE FileHandle, IN PWCHAR ApplicationName, IN PWCHAR Environment, IN USHORT ExeType, IN PULONG pReason, IN PVOID *SdbQueryAppCompatData, IN PULONG SdbQueryAppCompatDataSize, IN PVOID *SxsData, IN PULONG SxsDataSize, OUT PULONG FusionFlags)
Definition: appcache.c:295
BOOLEAN WINAPI IsShimInfrastructureDisabled(VOID)
Definition: appcache.c:37
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145

Referenced by CreateProcessInternalW().

◆ BasepCheckCacheExcludeCustom()

BOOL BasepCheckCacheExcludeCustom ( _In_ PCWSTR  ApplicationName)

Definition at line 182 of file appcache.c.

184{
185 return FALSE;
186}

Referenced by BasepShimCacheLookup().

◆ BasepCheckCacheExcludeList()

BOOL BasepCheckCacheExcludeList ( _In_ PCWSTR  ApplicationName)

Definition at line 172 of file appcache.c.

174{
175 return FALSE;
176}

Referenced by BasepShimCacheLookup().

◆ BasepFreeAppCompatData()

VOID WINAPI BasepFreeAppCompatData ( IN PVOID  AppCompatData,
IN PVOID  AppCompatSxsData 
)

Definition at line 444 of file appcache.c.

446{
447 /* Free the input pointers if present */
448 if (AppCompatData) RtlFreeHeap(RtlGetProcessHeap(), 0, AppCompatData);
449 if (AppCompatSxsData) RtlFreeHeap(RtlGetProcessHeap(), 0, AppCompatSxsData);
450}

Referenced by BaseCheckRunApp(), and CreateProcessInternalW().

◆ BasepShimCacheCheckBypass()

BOOL BasepShimCacheCheckBypass ( _In_ PCWSTR  ApplicationName,
_In_ HANDLE  FileHandle,
_In_opt_ PCWSTR  Environment,
_In_ BOOL  bUnknown,
_Out_opt_ PULONG  pdwReason 
)

Definition at line 142 of file appcache.c.

148{
149 DPRINT("fixme:(%S, %p, %S, %d, %p)\n", ApplicationName, FileHandle, Environment, bUnknown,
150 pdwReason);
151 return FALSE;
152}

Referenced by BaseCheckAppcompatCache().

◆ BasepShimCacheLookup()

BOOL BasepShimCacheLookup ( _In_ PCWSTR  ApplicationName,
_In_ HANDLE  FileHandle 
)

Definition at line 205 of file appcache.c.

208{
209 DPRINT("fixme:(%S, %p)\n", ApplicationName, FileHandle);
210
212 return FALSE;
213
216 {
218 return FALSE;
219 }
220
221 return TRUE;
222}
VOID BasepShimCacheRemoveEntry(_In_ PCWSTR ApplicationName)
Definition: appcache.c:192
BOOL BasepShimCacheSearch(_In_ PCWSTR ApplicationName, _In_ HANDLE FileHandle)
Definition: appcache.c:158
BOOL BasepCheckCacheExcludeCustom(_In_ PCWSTR ApplicationName)
Definition: appcache.c:182
BOOL BasepCheckCacheExcludeList(_In_ PCWSTR ApplicationName)
Definition: appcache.c:172

Referenced by BaseCheckAppcompatCache().

◆ BasepShimCacheRemoveEntry()

VOID BasepShimCacheRemoveEntry ( _In_ PCWSTR  ApplicationName)

Definition at line 192 of file appcache.c.

194{
197 Lookup.ImageHandle = INVALID_HANDLE_VALUE;
199}
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
static void Lookup(RTF_Info *, char *)
Definition: reader.c:2228
@ ApphelpCacheServiceRemove
Definition: pstypes.h:975
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

Referenced by BasepShimCacheLookup().

◆ BasepShimCacheSearch()

BOOL BasepShimCacheSearch ( _In_ PCWSTR  ApplicationName,
_In_ HANDLE  FileHandle 
)

Definition at line 158 of file appcache.c.

Referenced by BasepShimCacheLookup().

◆ BaseUpdateAppcompatCache()

VOID WINAPI BaseUpdateAppcompatCache ( ULONG  Unknown1,
ULONG  Unknown2,
ULONG  Unknown3 
)

Definition at line 457 of file appcache.c.

460{
461 STUB;
462}

◆ GetComPlusPackageInstallStatus()

PVOID WINAPI GetComPlusPackageInstallStatus ( VOID  )

Definition at line 513 of file appcache.c.

514{
515 STUB;
516 return NULL;
517}

◆ IsShimInfrastructureDisabled()

BOOLEAN WINAPI IsShimInfrastructureDisabled ( VOID  )

Definition at line 37 of file appcache.c.

38{
43 UNICODE_STRING OptionKey = RTL_CONSTANT_STRING(L"\\Registry\\MACHINE\\System\\CurrentControlSet\\Control\\SafeBoot\\Option");
44 UNICODE_STRING AppCompatKey = RTL_CONSTANT_STRING(L"\\Registry\\MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\AppCompatibility");
45 UNICODE_STRING PolicyKey = RTL_CONSTANT_STRING(L"\\Registry\\MACHINE\\Software\\Policies\\Microsoft\\Windows\\AppCompat");
46 UNICODE_STRING OptionValue = RTL_CONSTANT_STRING(L"OptionValue");
47 UNICODE_STRING DisableAppCompat = RTL_CONSTANT_STRING(L"DisableAppCompat");
48 UNICODE_STRING DisableEngine = RTL_CONSTANT_STRING(L"DisableEngine");
52
53 /*
54 * This is a TROOLEAN, -1 means we haven't yet figured it out.
55 * 0 means shims are enabled, and 1 means shims are disabled!
56 */
57 if (g_ShimsDisabled == -1)
58 {
59 ULONG DisableShims = FALSE;
60
61 /* Open the safe mode key */
62 Status = NtOpenKey(&KeyHandle, KEY_QUERY_VALUE, &OptionKeyAttributes);
63 if (NT_SUCCESS(Status))
64 {
65 /* Check if this is safemode */
67 &OptionValue,
69 &KeyInfo,
70 sizeof(KeyInfo),
73 if ((NT_SUCCESS(Status)) &&
74 (KeyInfo.Type == REG_DWORD) &&
75 (KeyInfo.DataLength == sizeof(ULONG)) &&
76 (KeyInfo.Data[0] != FALSE))
77 {
78 /* It is, so disable shims! */
79 DisableShims = TRUE;
80 }
81 }
82
83 if (!DisableShims)
84 {
85 /* Open the app compatibility engine settings key */
87 if (NT_SUCCESS(Status))
88 {
89 /* Check if the app compat engine is turned off */
91 &DisableAppCompat,
93 &KeyInfo,
94 sizeof(KeyInfo),
97 if ((NT_SUCCESS(Status)) &&
98 (KeyInfo.Type == REG_DWORD) &&
99 (KeyInfo.DataLength == sizeof(ULONG)) &&
100 (KeyInfo.Data[0] == TRUE))
101 {
102 /* It is, so disable shims! */
103 DisableShims = TRUE;
104 }
105 }
106 }
107 if (!DisableShims)
108 {
109 /* Finally, open the app compatibility policy key */
110 Status = NtOpenKey(&KeyHandle, KEY_QUERY_VALUE, &PolicyKeyAttributes);
111 if (NT_SUCCESS(Status))
112 {
113 /* Check if the system policy disables app compat */
115 &DisableEngine,
117 &KeyInfo,
118 sizeof(KeyInfo),
119 &ResultLength);
121 if ((NT_SUCCESS(Status)) &&
122 (KeyInfo.Type == REG_DWORD) &&
123 (KeyInfo.DataLength == sizeof(ULONG)) &&
124 (KeyInfo.Data[0] == TRUE))
125 {
126 /* It does, so disable shims! */
127 DisableShims = TRUE;
128 }
129 }
130 }
131 g_ShimsDisabled = DisableShims;
132 }
133
134 /* Return if shims are disabled or not ("Enabled == 1" means disabled!) */
135 return g_ShimsDisabled ? TRUE : FALSE;
136}
ULONG g_ShimsDisabled
Definition: appcache.c:18
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
@ KeyValuePartialInformation
Definition: nt_native.h:1182
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 KEY_QUERY_VALUE
Definition: nt_native.h:1016
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define RTL_CONSTANT_OBJECT_ATTRIBUTES(n, a)
#define REG_DWORD
Definition: sdbapi.c:596
OBJECT_ATTRIBUTES AppCompatKeyAttributes
Definition: shimdbg.c:228
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776

Referenced by BasepCheckBadapp().

◆ SetComPlusPackageInstallStatus()

BOOL WINAPI SetComPlusPackageInstallStatus ( IN ULONG  ComPlusPackage)

Definition at line 524 of file appcache.c.

525{
527
528 DPRINT("(0x%X)\n", ComPlusPackage);
529
530 if (ComPlusPackage & ~1)
531 {
532 DPRINT1("0x%lX\n", ComPlusPackage);
534 return FALSE;
535 }
536
537 Status = NtSetSystemInformation(SystemComPlusPackage, &ComPlusPackage, sizeof(ComPlusPackage));
538 if (!NT_SUCCESS(Status))
539 {
540 DPRINT1("0x%lX\n", Status);
542 return FALSE;
543 }
544
545 return TRUE;
546}
NTSYSAPI NTSTATUS NTAPI NtSetSystemInformation(IN INT SystemInformationClass, IN PVOID SystemInformation, IN ULONG SystemInformationLength)
@ SystemComPlusPackage
Definition: extypes.h:276
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:167
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

◆ SetTermsrvAppInstallMode()

VOID WINAPI SetTermsrvAppInstallMode ( IN BOOL  bInstallMode)

Definition at line 553 of file appcache.c.

554{
555 STUB;
556}

◆ TermsrvAppInstallMode()

BOOL WINAPI TermsrvAppInstallMode ( VOID  )

Definition at line 563 of file appcache.c.

564{
565 STUB;
566 return FALSE;
567}

Variable Documentation

◆ g_ApphelpInitialized

BOOL g_ApphelpInitialized = FALSE
static

Definition at line 19 of file appcache.c.

Referenced by BaseCheckRunApp().

◆ g_pApphelpCheckRunAppEx

PVOID g_pApphelpCheckRunAppEx
static

Definition at line 20 of file appcache.c.

Referenced by BaseCheckRunApp(), and BaseInitApphelp().

◆ g_pSdbPackAppCompatData

PVOID g_pSdbPackAppCompatData
static

Definition at line 21 of file appcache.c.

Referenced by BaseCheckRunApp(), and BaseInitApphelp().

◆ g_ShimsDisabled

ULONG g_ShimsDisabled = -1

Definition at line 18 of file appcache.c.

Referenced by IsShimInfrastructureDisabled().