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

Side by Side Diff: sandbox/win/src/process_mitigations_win32k_dispatcher.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_DISPATCHER_H_ 5 #ifndef SANDBOX_SRC_PROCESS_MITIGATIONS_WIN32K_DISPATCHER_H_
6 #define SANDBOX_SRC_PROCESS_MITIGATIONS_WIN32K_DISPATCHER_H_ 6 #define SANDBOX_SRC_PROCESS_MITIGATIONS_WIN32K_DISPATCHER_H_
7 7
8 #include <map>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/strings/string16.h"
13 #include "base/synchronization/lock.h"
9 #include "sandbox/win/src/sandbox_policy_base.h" 14 #include "sandbox/win/src/sandbox_policy_base.h"
10 15
11 namespace sandbox { 16 namespace sandbox {
12 17
18 // Class to maintain a reference to a OPM protected output handle.
19 class ProtectedVideoOutput
20 : public base::RefCountedThreadSafe<ProtectedVideoOutput> {
21 public:
22 ProtectedVideoOutput(HANDLE handle) : handle_(handle) {}
23 HANDLE handle() { return handle_; }
24
25 private:
26 friend class base::RefCountedThreadSafe<ProtectedVideoOutput>;
27 ~ProtectedVideoOutput();
28
29 HANDLE handle_;
30
31 DISALLOW_COPY_AND_ASSIGN(ProtectedVideoOutput);
32 };
33
13 // This class sets up intercepts for the Win32K lockdown policy which is set 34 // This class sets up intercepts for the Win32K lockdown policy which is set
14 // on Windows 8 and beyond. 35 // on Windows 8 and beyond.
15 class ProcessMitigationsWin32KDispatcher : public Dispatcher { 36 class ProcessMitigationsWin32KDispatcher : public Dispatcher {
16 public: 37 public:
17 explicit ProcessMitigationsWin32KDispatcher(PolicyBase* policy_base); 38 explicit ProcessMitigationsWin32KDispatcher(PolicyBase* policy_base);
18 ~ProcessMitigationsWin32KDispatcher() override {} 39 ~ProcessMitigationsWin32KDispatcher() override;
19 40
20 // Dispatcher interface. 41 // Dispatcher interface.
21 bool SetupService(InterceptionManager* manager, int service) override; 42 bool SetupService(InterceptionManager* manager, int service) override;
22 43
44 bool EnumDisplayMonitors(IPCInfo* ipc, CountedBuffer* buffer);
45 bool GetMonitorInfo(IPCInfo* ipc, void* monitor, CountedBuffer* buffer);
46 bool GetSuggestedOPMProtectedOutputArraySize(IPCInfo* ipc,
47 base::string16* device_name);
48 bool CreateOPMProtectedOutputs(IPCInfo* ipc,
49 base::string16* device_name,
50 CountedBuffer* protected_outputs);
51 bool GetCertificateSize(IPCInfo* ipc,
52 base::string16* device_name,
53 void* protected_output);
54 bool GetCertificate(IPCInfo* ipc,
55 base::string16* device_name,
56 void* protected_output,
57 void* shared_buffer_handle,
58 uint32_t shared_buffer_size);
59 bool DestroyOPMProtectedOutput(IPCInfo* ipc, void* protected_output);
60 bool GetOPMRandomNumber(IPCInfo* ipc,
61 void* protected_output,
62 CountedBuffer* random_number);
63 bool SetOPMSigningKeyAndSequenceNumbers(IPCInfo* ipc,
64 void* protected_output,
65 CountedBuffer* parameters);
66 bool ConfigureOPMProtectedOutput(IPCInfo* ipc,
67 void* protected_output,
68 void* shared_buffer_handle);
69 bool GetOPMInformation(IPCInfo* ipc,
70 void* protected_output,
71 void* shared_buffer_handle);
72
23 private: 73 private:
74 scoped_refptr<ProtectedVideoOutput> GetProtectedVideoOutput(
75 HANDLE handle,
76 bool destroy_output);
77
24 PolicyBase* policy_base_; 78 PolicyBase* policy_base_;
79 std::map<HANDLE, scoped_refptr<ProtectedVideoOutput>> protected_outputs_;
80 base::Lock protected_outputs_lock_;
25 81
26 DISALLOW_COPY_AND_ASSIGN(ProcessMitigationsWin32KDispatcher); 82 DISALLOW_COPY_AND_ASSIGN(ProcessMitigationsWin32KDispatcher);
27 }; 83 };
28 84
29 } // namespace sandbox 85 } // namespace sandbox
30 86
31 #endif // SANDBOX_SRC_PROCESS_MITIGATIONS_WIN32K_DISPATCHER_H_ 87 #endif // SANDBOX_SRC_PROCESS_MITIGATIONS_WIN32K_DISPATCHER_H_
OLDNEW
« no previous file with comments | « sandbox/win/src/process_mitigations_test.cc ('k') | sandbox/win/src/process_mitigations_win32k_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698