Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(937)

Unified Diff: sandbox/win/src/process_mitigations_win32k_interception.cc

Issue 333773005: Intercept the user32!SystemParametersInfoW API in the win32k user gdi lockdown mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sandbox/win/src/process_mitigations_win32k_interception.cc
diff --git a/sandbox/win/src/process_mitigations_win32k_interception.cc b/sandbox/win/src/process_mitigations_win32k_interception.cc
index ee24fbf434c8e8c6d6c9680e1e71978fe88cd237..297826ab3b166a95af592c3e1127bf501e2b1212 100644
--- a/sandbox/win/src/process_mitigations_win32k_interception.cc
+++ b/sandbox/win/src/process_mitigations_win32k_interception.cc
@@ -25,5 +25,34 @@ ATOM WINAPI TargetRegisterClassW(
return TRUE;
}
+BOOL WINAPI TargetSystemParametersInfoW(
+ SystemParametersInfoWFunction orig_system_parameters_info,
+ UINT action,
+ UINT ui_param,
+ PVOID value,
+ UINT win_ini) {
+ // The SystemParametersInfo API fails for the following font related
+ // parameters in the win32k lockdown mode. We fake the values for
+ // SPI_GETFONTSMOOTHING and SPI_GETFONTSMOOTHINGTYPE for now and default to
+ // smooth and FE_FONTSMOOTHINGCLEARTYPE for now. This should be ok given that
+ // this code only runs on Windows 8 and above.
+ // TODO(ananta)
+ // Revisit and handle this via browser side IPCs if needed.
+ if (action == SPI_GETFONTSMOOTHING) {
+ BOOL* smoothing = reinterpret_cast<BOOL*>(value);
+ if (smoothing) {
+ *smoothing = TRUE;
+ return TRUE;
+ }
+ } else if (action == SPI_GETFONTSMOOTHINGTYPE) {
+ UINT* smooth_type = reinterpret_cast<UINT*>(value);
+ if (smooth_type) {
+ *smooth_type = FE_FONTSMOOTHINGCLEARTYPE;
+ return TRUE;
+ }
+ }
+ return orig_system_parameters_info(action, ui_param, value, win_ini);
+}
+
} // namespace sandbox
« no previous file with comments | « sandbox/win/src/process_mitigations_win32k_interception.h ('k') | sandbox/win/src/process_mitigations_win32k_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698