mirror of
https://github.com/reactos/reactos.git
synced 2024-10-07 01:44:21 +00:00
[KERNEL32] Fix IsShimInfrastructureDisabled. CORE-13352
svn path=/trunk/; revision=74760
This commit is contained in:
parent
63eb4b623a
commit
eb88e1e349
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
/* GLOBALS ********************************************************************/
|
/* GLOBALS ********************************************************************/
|
||||||
|
|
||||||
ULONG g_ShimsEnabled = -1;
|
ULONG g_ShimsDisabled = -1;
|
||||||
static BOOL g_ApphelpInitialized = FALSE;
|
static BOOL g_ApphelpInitialized = FALSE;
|
||||||
static PVOID g_pApphelpCheckRunAppEx;
|
static PVOID g_pApphelpCheckRunAppEx;
|
||||||
static PVOID g_pSdbPackAppCompatData;
|
static PVOID g_pSdbPackAppCompatData;
|
||||||
|
@ -54,8 +54,10 @@ IsShimInfrastructureDisabled(VOID)
|
||||||
* This is a TROOLEAN, -1 means we haven't yet figured it out.
|
* This is a TROOLEAN, -1 means we haven't yet figured it out.
|
||||||
* 0 means shims are enabled, and 1 means shims are disabled!
|
* 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 */
|
/* Open the safe mode key */
|
||||||
Status = NtOpenKey(&KeyHandle, KEY_QUERY_VALUE, &OptionKeyAttributes);
|
Status = NtOpenKey(&KeyHandle, KEY_QUERY_VALUE, &OptionKeyAttributes);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
|
@ -74,66 +76,63 @@ IsShimInfrastructureDisabled(VOID)
|
||||||
(KeyInfo.Data[0] == TRUE))
|
(KeyInfo.Data[0] == TRUE))
|
||||||
{
|
{
|
||||||
/* It is, so disable shims! */
|
/* 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 */
|
/* Check if the app compat engine is turned off */
|
||||||
Status = NtOpenKey(&KeyHandle, KEY_QUERY_VALUE, &AppCompatKeyAttributes);
|
Status = NtQueryValueKey(KeyHandle,
|
||||||
if (NT_SUCCESS(Status))
|
&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 */
|
/* It is, so disable shims! */
|
||||||
Status = NtQueryValueKey(KeyHandle,
|
DisableShims = TRUE;
|
||||||
&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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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 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