- /* Check if the app compat engine is turned off */
- Status = NtQueryValueKey(KeyHandle,
- &DisableAppCompat,
- KeyValuePartialInformation,
- &KeyInfo,
- sizeof(KeyInfo),
- &ResultLength);
- NtClose(KeyHandle);
- if ((NT_SUCCESS(Status)) &&
- (KeyInfo.Type == REG_DWORD) &&
- (KeyInfo.DataLength == sizeof(ULONG)) &&
- (KeyInfo.Data[0] == TRUE))
- {
- /* It is, so disable shims! */
- g_ShimsEnabled = TRUE;
- }
- else
- {
- /* Finally, open the app compatibility policy key */
- Status = NtOpenKey(&KeyHandle, KEY_QUERY_VALUE, &PolicyKeyAttributes);
- if (NT_SUCCESS(Status))
- {
- /* Check if the system policy disables app compat */
- Status = NtQueryValueKey(KeyHandle,
- &DisableEngine,
- KeyValuePartialInformation,
- &KeyInfo,
- sizeof(KeyInfo),
- &ResultLength);
- NtClose(KeyHandle);
- if ((NT_SUCCESS(Status)) &&
- (KeyInfo.Type == REG_DWORD) &&
- (KeyInfo.DataLength == sizeof(ULONG)) &&
- (KeyInfo.Data[0] == TRUE))
- {
- /* It does, so disable shims! */
- g_ShimsEnabled = TRUE;
- }
- else
- {
- /* No keys are set, so enable shims! */
- g_ShimsEnabled = FALSE;
- }
- }
- }