Author: mjansen
Date: Sat Jun 3 13:06:32 2017
New Revision: 74760
URL:
http://svn.reactos.org/svn/reactos?rev=74760&view=rev
Log:
[KERNEL32] Fix IsShimInfrastructureDisabled. CORE-13352
Modified:
trunk/reactos/dll/win32/kernel32/client/appcache.c
Modified: trunk/reactos/dll/win32/kernel32/client/appcache.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/appcache.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/appcache.c [iso-8859-1] Sat Jun 3 13:06:32
2017
@@ -15,7 +15,7 @@
/* GLOBALS ********************************************************************/
-ULONG g_ShimsEnabled = -1;
+ULONG g_ShimsDisabled = -1;
static BOOL g_ApphelpInitialized = FALSE;
static PVOID g_pApphelpCheckRunAppEx;
static PVOID g_pSdbPackAppCompatData;
@@ -54,8 +54,10 @@
* This is a TROOLEAN, -1 means we haven't yet figured it out.
* 0 means shims are enabled, and 1 means shims are disabled!
*/
- if (g_ShimsEnabled == -1)
- {
+ if (g_ShimsDisabled == -1)
+ {
+ ULONG DisableShims = FALSE;
+
/* Open the safe mode key */
Status = NtOpenKey(&KeyHandle, KEY_QUERY_VALUE, &OptionKeyAttributes);
if (NT_SUCCESS(Status))
@@ -74,66 +76,63 @@
(KeyInfo.Data[0] == TRUE))
{
/* It is, so disable shims! */
- g_ShimsEnabled = TRUE;
+ DisableShims = TRUE;
}
- else
+ }
+
+ if (!DisableShims)
+ {
+ /* Open the app compatibility engine settings key */
+ Status = NtOpenKey(&KeyHandle, KEY_QUERY_VALUE,
&AppCompatKeyAttributes);
+ if (NT_SUCCESS(Status))
{
- /* Open the app compatibility engine settings key */
- Status = NtOpenKey(&KeyHandle, KEY_QUERY_VALUE,
&AppCompatKeyAttributes);
- if (NT_SUCCESS(Status))
+ /* 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))
{
- /* 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;
- }
- }
- }
+ /* It is, so disable shims! */
+ DisableShims = TRUE;
}
}
}
+ if (!DisableShims)
+ {
+ /* 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! */
+ DisableShims = TRUE;
+ }
+ }
+ }
+ g_ShimsDisabled = DisableShims;
}
/* Return if shims are disabled or not ("Enabled == 1" means disabled!) */
- return g_ShimsEnabled ? TRUE : FALSE;
+ return g_ShimsDisabled ? TRUE : FALSE;
}
/*