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

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: Removed header Created 4 years, 7 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* GetMonitorInfoWFunction)(HMONITOR monitor,
46 MONITORINFO* monitor_info);
47 typedef BOOL(WINAPI* GetMonitorInfoAFunction)(HMONITOR monitor,
48 MONITORINFO* monitor_info);
49
24 // Interceptor for the GdiDllInitialize function. 50 // Interceptor for the GdiDllInitialize function.
25 SANDBOX_INTERCEPT BOOL WINAPI TargetGdiDllInitialize( 51 SANDBOX_INTERCEPT BOOL WINAPI TargetGdiDllInitialize(
26 GdiDllInitializeFunction orig_gdi_dll_initialize, 52 GdiDllInitializeFunction orig_gdi_dll_initialize,
27 HANDLE dll, 53 HANDLE dll,
28 DWORD reason); 54 DWORD reason);
29 55
30 // Interceptor for the GetStockObject function. 56 // Interceptor for the GetStockObject function.
31 SANDBOX_INTERCEPT HGDIOBJ WINAPI TargetGetStockObject( 57 SANDBOX_INTERCEPT HGDIOBJ WINAPI TargetGetStockObject(
32 GetStockObjectFunction orig_get_stock_object, 58 GetStockObjectFunction orig_get_stock_object,
33 int object); 59 int object);
34 60
35 // Interceptor for the RegisterClassW function. 61 // Interceptor for the RegisterClassW function.
36 SANDBOX_INTERCEPT ATOM WINAPI TargetRegisterClassW( 62 SANDBOX_INTERCEPT ATOM WINAPI TargetRegisterClassW(
37 RegisterClassWFunction orig_register_class_function, 63 RegisterClassWFunction orig_register_class_function,
38 const WNDCLASS* wnd_class); 64 const WNDCLASS* wnd_class);
39 65
66 SANDBOX_INTERCEPT BOOL WINAPI TargetEnumDisplayMonitors(
67 EnumDisplayMonitorsFunction orig_enum_display_monitors_function,
68 HDC hdc,
69 LPCRECT clip_rect,
70 MONITORENUMPROC enum_function,
71 LPARAM data);
72
73 SANDBOX_INTERCEPT BOOL WINAPI TargetEnumDisplayDevicesA(
74 EnumDisplayDevicesAFunction orig_enum_display_devices_function,
75 LPCSTR device,
76 DWORD device_number,
77 PDISPLAY_DEVICEA display_device,
78 DWORD flags);
79
80 SANDBOX_INTERCEPT BOOL WINAPI
81 TargetGetMonitorInfoA(GetMonitorInfoAFunction orig_get_monitor_info_function,
82 HMONITOR monitor,
83 LPMONITORINFO monitor_info);
84
85 SANDBOX_INTERCEPT BOOL WINAPI
86 TargetGetMonitorInfoW(GetMonitorInfoWFunction orig_get_monitor_info_function,
87 HMONITOR monitor,
88 LPMONITORINFO monitor_info);
89
90 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetCreateOPMProtectedOutputs(
91 CreateOPMProtectedOutputsFunction orig_create_proceted_outputs_function,
92 PUNICODE_STRING device_name,
93 DXGKMDT_OPM_VIDEO_OUTPUT_SEMANTICS vos,
94 DWORD protected_output_array_size,
95 DWORD* output_array_size,
96 OPM_PROTECTED_OUTPUT_HANDLE* protected_outputs);
97
98 SANDBOX_INTERCEPT NTSTATUS WINAPI
99 TargetGetCertificate(GetCertificateFunction orig_get_certificate_function,
100 PUNICODE_STRING device_name,
101 DXGKMDT_CERTIFICATE_TYPE certificate_type,
102 BYTE* certificate,
103 ULONG certificate_length);
104
105 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetGetCertificateSize(
106 GetCertificateSizeFunction orig_get_certificate_size_function,
107 PUNICODE_STRING device_name,
108 DXGKMDT_CERTIFICATE_TYPE certificate_type,
109 ULONG* certificate_length);
110
111 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetGetCertificateByHandle(
112 GetCertificateByHandleFunction orig_get_certificate_function,
113 OPM_PROTECTED_OUTPUT_HANDLE protected_output,
114 DXGKMDT_CERTIFICATE_TYPE certificate_type,
115 BYTE* certificate,
116 ULONG certificate_length);
117
118 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetGetCertificateSizeByHandle(
119 GetCertificateSizeByHandleFunction orig_get_certificate_size_function,
120 OPM_PROTECTED_OUTPUT_HANDLE protected_output,
121 DXGKMDT_CERTIFICATE_TYPE certificate_type,
122 ULONG* certificate_length);
123
124 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetDestroyOPMProtectedOutput(
125 DestroyOPMProtectedOutputFunction orig_destroy_protected_output_function,
126 OPM_PROTECTED_OUTPUT_HANDLE protected_output);
127
128 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetConfigureOPMProtectedOutput(
129 ConfigureOPMProtectedOutputFunction
130 origin_configure_protected_output_function,
131 OPM_PROTECTED_OUTPUT_HANDLE protected_output,
132 const DXGKMDT_OPM_CONFIGURE_PARAMETERS* parameters,
133 ULONG additional_parameters_size,
134 const BYTE* additional_parameters);
135
136 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetGetOPMInformation(
137 GetOPMInformationFunction origin_get_information_function,
138 OPM_PROTECTED_OUTPUT_HANDLE protected_output,
139 const DXGKMDT_OPM_GET_INFO_PARAMETERS* parameters,
140 DXGKMDT_OPM_REQUESTED_INFORMATION* requested_information);
141
142 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetGetOPMRandomNumber(
143 GetOPMRandomNumberFunction orig_get_random_number_function,
144 OPM_PROTECTED_OUTPUT_HANDLE protected_output,
145 DXGKMDT_OPM_RANDOM_NUMBER* random_number);
146
147 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetGetSuggestedOPMProtectedOutputArraySize(
148 GetSuggestedOPMProtectedOutputArraySizeFunction
149 orig_get_suggested_size_function,
150 PUNICODE_STRING device_name,
151 DWORD* suggested_output_array_size);
152
153 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetSetOPMSigningKeyAndSequenceNumbers(
154 SetOPMSigningKeyAndSequenceNumbersFunction orig_set_signing_keys_function,
155 OPM_PROTECTED_OUTPUT_HANDLE protected_output,
156 const DXGKMDT_OPM_ENCRYPTED_PARAMETERS* parameters);
157
40 } // extern "C" 158 } // extern "C"
41 159
42 } // namespace sandbox 160 } // namespace sandbox
43 161
44 #endif // SANDBOX_SRC_PROCESS_MITIGATIONS_WIN32K_INTERCEPTION_H_ 162 #endif // SANDBOX_SRC_PROCESS_MITIGATIONS_WIN32K_INTERCEPTION_H_
45 163
OLDNEW
« no previous file with comments | « sandbox/win/src/process_mitigations_win32k_dispatcher.cc ('k') | sandbox/win/src/process_mitigations_win32k_interception.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698