VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2023-09-21 01:16:11 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2023-09-21 01:16:11 +0200
commit6c7e055f3fe3762caea499b0a37eea409a4e1e5c (patch)
tree4eee2de1ada0b363a029265de5f9273d864ce78c /src/Common
parent9e49a329427b34e9b8d26e3c6b0824b544e07367 (diff)
downloadVeraCrypt-6c7e055f3fe3762caea499b0a37eea409a4e1e5c.tar.gz
VeraCrypt-6c7e055f3fe3762caea499b0a37eea409a4e1e5c.zip
Windows: use separate name for SetProcessMitigationPolicy function point. Remove unneeded boolean
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Dlgcode.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index fb7184b4..9cac05a9 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -220,7 +220,6 @@ BOOL DisablePeriodicDeviceListUpdate = FALSE;
BOOL EnableMemoryProtection = FALSE;
BOOL MemoryProtectionActivated = FALSE;
-BOOL ProcessMitigationsActivated = FALSE;
BOOL WaitDialogDisplaying = FALSE;
@@ -14232,13 +14231,10 @@ typedef enum _PROCESS_MITIGATION_POLICY {
void ActivateProcessMitigations()
{
- if (ProcessMitigationsActivated)
- return;
-
// we load the function pointer of SetProcessMitigationPolicy dynamically because we are building with Windows 7 SDK that does not have the definition of this function
typedef BOOL (WINAPI *SetProcessMitigationPolicyFunc) (PROCESS_MITIGATION_POLICY MitigationPolicy, PVOID lpBuffer, SIZE_T dwLength);
- SetProcessMitigationPolicyFunc SetProcessMitigationPolicy = (SetProcessMitigationPolicyFunc) GetProcAddress (GetModuleHandle (L"kernel32.dll"), "SetProcessMitigationPolicy");
- if (SetProcessMitigationPolicy)
+ SetProcessMitigationPolicyFunc SetProcessMitigationPolicyPtr = (SetProcessMitigationPolicyFunc) GetProcAddress (GetModuleHandle (L"kernel32.dll"), "SetProcessMitigationPolicy");
+ if (SetProcessMitigationPolicyPtr)
{
PROCESS_MITIGATION_ASLR_POLICY aslrPolicy = { 0 };
PROCESS_MITIGATION_DYNAMIC_CODE_POLICY dynCodePolicy = { 0 };
@@ -14252,12 +14248,10 @@ void ActivateProcessMitigations()
extensionPointDisablePolicy.DisableExtensionPoints = TRUE;
- SetProcessMitigationPolicy (ProcessASLRPolicy, &aslrPolicy, sizeof (aslrPolicy));
- SetProcessMitigationPolicy (ProcessDynamicCodePolicy, &dynCodePolicy, sizeof (dynCodePolicy));
- SetProcessMitigationPolicy (ProcessExtensionPointDisablePolicy, &extensionPointDisablePolicy, sizeof (extensionPointDisablePolicy));
+ SetProcessMitigationPolicyPtr (ProcessASLRPolicy, &aslrPolicy, sizeof (aslrPolicy));
+ SetProcessMitigationPolicyPtr (ProcessDynamicCodePolicy, &dynCodePolicy, sizeof (dynCodePolicy));
+ SetProcessMitigationPolicyPtr (ProcessExtensionPointDisablePolicy, &extensionPointDisablePolicy, sizeof (extensionPointDisablePolicy));
}
-
- ProcessMitigationsActivated = TRUE;
}
// Based on sample code from: