mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
[KERNEL32] Fix IsShimInfrastructureDisabled. CORE-13352
svn path=/trunk/; revision=74760
This commit is contained in:
parent
63eb4b623a
commit
eb88e1e349
1 changed files with 52 additions and 53 deletions
|
@ -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 @@ IsShimInfrastructureDisabled(VOID)
|
|||
* 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 @@ IsShimInfrastructureDisabled(VOID)
|
|||
(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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue