-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path756d4f5427ac4be9e5a0a18c2378e7f58685800e.diff
30 lines (27 loc) · 1.26 KB
/
756d4f5427ac4be9e5a0a18c2378e7f58685800e.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
diff --git a/base/process/process_util_unittest.cc b/base/process/process_util_unittest.cc
index 18bed2128814c..d563938dc4e2e 100644
--- a/base/process/process_util_unittest.cc
+++ b/base/process/process_util_unittest.cc
@@ -829,11 +829,19 @@ TEST_F(ProcessUtilTest, LaunchAsUser) {
}
MULTIPROCESS_TEST_MAIN(ChildVerifiesCetDisabled) {
- // Policy not defined for Win < Win10 20H1 but that's ok.
+ auto get_process_mitigation_policy =
+ reinterpret_cast<decltype(&GetProcessMitigationPolicy)>(::GetProcAddress(
+ ::GetModuleHandleW(L"kernel32.dll"), "GetProcessMitigationPolicy"));
+
+ // Not available for Win7 but this process should still work.
+ if (!get_process_mitigation_policy)
+ return kSuccess;
+
+ // Policy not defined for Win < Win10 20H1 but that's also ok.
PROCESS_MITIGATION_USER_SHADOW_STACK_POLICY policy = {};
- if (GetProcessMitigationPolicy(GetCurrentProcess(),
- ProcessUserShadowStackPolicy, &policy,
- sizeof(policy))) {
+ if (get_process_mitigation_policy(GetCurrentProcess(),
+ ProcessUserShadowStackPolicy, &policy,
+ sizeof(policy))) {
if (policy.EnableUserShadowStack)
return 1;
}