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

Side by Side Diff: sandbox/win/src/process_mitigations_win32k_interception.h

Issue 1856993003: Implement sandbox hooks to forward OPM related GDI system calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replaced shared memory implementation. Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SANDBOX_SRC_PROCESS_MITIGATIONS_WIN32K_INTERCEPTION_H_ 5 #ifndef SANDBOX_SRC_PROCESS_MITIGATIONS_WIN32K_INTERCEPTION_H_
6 #define SANDBOX_SRC_PROCESS_MITIGATIONS_WIN32K_INTERCEPTION_H_ 6 #define SANDBOX_SRC_PROCESS_MITIGATIONS_WIN32K_INTERCEPTION_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9
10 #include "sandbox/win/src/nt_internals.h"
9 #include "sandbox/win/src/sandbox_types.h" 11 #include "sandbox/win/src/sandbox_types.h"
10 12
11 namespace sandbox { 13 namespace sandbox {
12 14
15 const DWORD kProtectedVideoOutputSectionSize = 16 * 1024;
16 const DWORD kMaxEnumMonitors = 32;
17
18 struct EnumMonitorsResult {
19 DWORD monitor_count;
20 HMONITOR monitors[kMaxEnumMonitors];
21 };
22
13 extern "C" { 23 extern "C" {
14 24
15 typedef BOOL (WINAPI* GdiDllInitializeFunction) ( 25 typedef BOOL (WINAPI* GdiDllInitializeFunction) (
16 HANDLE dll, 26 HANDLE dll,
17 DWORD reason, 27 DWORD reason,
18 LPVOID reserved); 28 LPVOID reserved);
19 29
20 typedef HGDIOBJ (WINAPI *GetStockObjectFunction) (int object); 30 typedef HGDIOBJ (WINAPI *GetStockObjectFunction) (int object);
21 31
22 typedef ATOM (WINAPI *RegisterClassWFunction) (const WNDCLASS* wnd_class); 32 typedef ATOM (WINAPI *RegisterClassWFunction) (const WNDCLASS* wnd_class);
23 33
34 typedef BOOL(WINAPI* EnumDisplayMonitorsFunction)(HDC hdc,
35 LPCRECT clip_rect,
36 MONITORENUMPROC enum_function,
37 LPARAM data);
38
39 typedef BOOL(WINAPI* EnumDisplayDevicesAFunction)(
40 LPCSTR device,
41 DWORD device_number,
42 PDISPLAY_DEVICEA display_device,
43 DWORD flags);
44
45 typedef BOOL(WINAPI* GetMonitorInfoFunction)(HMONITOR monitor,
46 LPMONITORINFO monitor_info);
47
24 // Interceptor for the GdiDllInitialize function. 48 // Interceptor for the GdiDllInitialize function.
25 SANDBOX_INTERCEPT BOOL WINAPI TargetGdiDllInitialize( 49 SANDBOX_INTERCEPT BOOL WINAPI TargetGdiDllInitialize(
26 GdiDllInitializeFunction orig_gdi_dll_initialize, 50 GdiDllInitializeFunction orig_gdi_dll_initialize,
27 HANDLE dll, 51 HANDLE dll,
28 DWORD reason); 52 DWORD reason);
29 53
30 // Interceptor for the GetStockObject function. 54 // Interceptor for the GetStockObject function.
31 SANDBOX_INTERCEPT HGDIOBJ WINAPI TargetGetStockObject( 55 SANDBOX_INTERCEPT HGDIOBJ WINAPI TargetGetStockObject(
32 GetStockObjectFunction orig_get_stock_object, 56 GetStockObjectFunction orig_get_stock_object,
33 int object); 57 int object);
34 58
35 // Interceptor for the RegisterClassW function. 59 // Interceptor for the RegisterClassW function.
36 SANDBOX_INTERCEPT ATOM WINAPI TargetRegisterClassW( 60 SANDBOX_INTERCEPT ATOM WINAPI TargetRegisterClassW(
37 RegisterClassWFunction orig_register_class_function, 61 RegisterClassWFunction orig_register_class_function,
38 const WNDCLASS* wnd_class); 62 const WNDCLASS* wnd_class);
39 63
64 SANDBOX_INTERCEPT BOOL WINAPI TargetEnumDisplayMonitors(
65 EnumDisplayMonitorsFunction orig_enum_display_monitors_function,
66 HDC hdc,
67 LPCRECT clip_rect,
68 MONITORENUMPROC enum_function,
69 LPARAM data);
70
71 SANDBOX_INTERCEPT BOOL WINAPI TargetEnumDisplayDevicesA(
72 EnumDisplayDevicesAFunction orig_enum_display_devices_function,
73 LPCSTR device,
74 DWORD device_number,
75 PDISPLAY_DEVICEA display_device,
76 DWORD flags);
77
78 SANDBOX_INTERCEPT BOOL WINAPI
79 TargetGetMonitorInfoA(GetMonitorInfoFunction orig_get_monitor_info_function,
80 HMONITOR monitor,
81 LPMONITORINFO monitor_info);
82
83 SANDBOX_INTERCEPT BOOL WINAPI
84 TargetGetMonitorInfoW(GetMonitorInfoFunction orig_get_monitor_info_function,
85 HMONITOR monitor,
86 LPMONITORINFO monitor_info);
87
88 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetCreateOPMProtectedOutputs(
89 CreateOPMProtectedOutputsFunction orig_create_proceted_outputs_function,
90 PUNICODE_STRING device_name,
91 DXGKMDT_OPM_VIDEO_OUTPUT_SEMANTICS vos,
92 DWORD protected_output_array_size,
93 DWORD* output_array_size,
94 OPM_PROTECTED_OUTPUT_HANDLE* protected_outputs);
95
96 SANDBOX_INTERCEPT NTSTATUS WINAPI
97 TargetGetCertificate(GetCertificateFunction orig_get_certificate_function,
98 PUNICODE_STRING device_name,
99 DXGKMDT_CERTIFICATE_TYPE certificate_type,
100 BYTE* certificate,
101 ULONG certificate_length);
102
103 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetGetCertificateSize(
104 GetCertificateSizeFunction orig_get_certificate_size_function,
105 PUNICODE_STRING device_name,
106 DXGKMDT_CERTIFICATE_TYPE certificate_type,
107 ULONG* certificate_length);
108
109 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetDestroyOPMProtectedOutput(
110 DestroyOPMProtectedOutputFunction orig_destroy_protected_output_function,
111 OPM_PROTECTED_OUTPUT_HANDLE protected_output);
112
113 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetConfigureOPMProtectedOutput(
114 ConfigureOPMProtectedOutputFunction
115 origin_configure_protected_output_function,
116 OPM_PROTECTED_OUTPUT_HANDLE protected_output,
117 const DXGKMDT_OPM_CONFIGURE_PARAMETERS* parameters,
118 ULONG additional_parameters_size,
119 const BYTE* additional_parameters);
120
121 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetGetOPMInformation(
122 GetOPMInformationFunction origin_get_information_function,
123 OPM_PROTECTED_OUTPUT_HANDLE protected_output,
124 const DXGKMDT_OPM_GET_INFO_PARAMETERS* parameters,
125 DXGKMDT_OPM_REQUESTED_INFORMATION* requested_information);
126
127 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetGetOPMRandomNumber(
128 GetOPMRandomNumberFunction orig_get_random_number_function,
129 OPM_PROTECTED_OUTPUT_HANDLE protected_output,
130 DXGKMDT_OPM_RANDOM_NUMBER* random_number);
131
132 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetGetSuggestedOPMProtectedOutputArraySize(
133 GetSuggestedOPMProtectedOutputArraySizeFunction
134 orig_get_suggested_size_function,
135 PUNICODE_STRING device_name,
136 DWORD* suggested_output_array_size);
137
138 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetSetOPMSigningKeyAndSequenceNumbers(
139 SetOPMSigningKeyAndSequenceNumbersFunction orig_set_signing_keys_function,
140 OPM_PROTECTED_OUTPUT_HANDLE protected_output,
141 const DXGKMDT_OPM_ENCRYPTED_PARAMETERS* parameters);
142
40 } // extern "C" 143 } // extern "C"
41 144
42 } // namespace sandbox 145 } // namespace sandbox
43 146
44 #endif // SANDBOX_SRC_PROCESS_MITIGATIONS_WIN32K_INTERCEPTION_H_ 147 #endif // SANDBOX_SRC_PROCESS_MITIGATIONS_WIN32K_INTERCEPTION_H_
45 148
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698