OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "remoting/host/sas_injector.h" | 5 #include "remoting/host/sas_injector.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 } // namespace | 103 } // namespace |
104 | 104 |
105 // Sends Secure Attention Sequence using the SendSAS() function from sas.dll. | 105 // Sends Secure Attention Sequence using the SendSAS() function from sas.dll. |
106 // This library is shipped starting from Win7/W2K8 R2 only. However Win7 SDK | 106 // This library is shipped starting from Win7/W2K8 R2 only. However Win7 SDK |
107 // includes a redistributable verion of the same library that works on | 107 // includes a redistributable verion of the same library that works on |
108 // Vista/W2K8. We install the latter along with our binaries. | 108 // Vista/W2K8. We install the latter along with our binaries. |
109 class SasInjectorWin : public SasInjector { | 109 class SasInjectorWin : public SasInjector { |
110 public: | 110 public: |
111 SasInjectorWin(); | 111 SasInjectorWin(); |
112 virtual ~SasInjectorWin(); | 112 ~SasInjectorWin() override; |
113 | 113 |
114 // SasInjector implementation. | 114 // SasInjector implementation. |
115 virtual bool InjectSas() override; | 115 bool InjectSas() override; |
116 | 116 |
117 private: | 117 private: |
118 base::ScopedNativeLibrary sas_dll_; | 118 base::ScopedNativeLibrary sas_dll_; |
119 SendSasFunc send_sas_; | 119 SendSasFunc send_sas_; |
120 }; | 120 }; |
121 | 121 |
122 // Emulates Secure Attention Sequence (Ctrl+Alt+Del) by switching to | 122 // Emulates Secure Attention Sequence (Ctrl+Alt+Del) by switching to |
123 // the Winlogon desktop and injecting Ctrl+Alt+Del as a hot key. | 123 // the Winlogon desktop and injecting Ctrl+Alt+Del as a hot key. |
124 // N.B. Windows XP/W2K3 only. | 124 // N.B. Windows XP/W2K3 only. |
125 class SasInjectorXp : public SasInjector { | 125 class SasInjectorXp : public SasInjector { |
126 public: | 126 public: |
127 SasInjectorXp(); | 127 SasInjectorXp(); |
128 virtual ~SasInjectorXp(); | 128 ~SasInjectorXp() override; |
129 | 129 |
130 // SasInjector implementation. | 130 // SasInjector implementation. |
131 virtual bool InjectSas() override; | 131 bool InjectSas() override; |
132 }; | 132 }; |
133 | 133 |
134 SasInjectorWin::SasInjectorWin() : send_sas_(nullptr) { | 134 SasInjectorWin::SasInjectorWin() : send_sas_(nullptr) { |
135 } | 135 } |
136 | 136 |
137 SasInjectorWin::~SasInjectorWin() { | 137 SasInjectorWin::~SasInjectorWin() { |
138 } | 138 } |
139 | 139 |
140 bool SasInjectorWin::InjectSas() { | 140 bool SasInjectorWin::InjectSas() { |
141 // Load sas.dll. The library is expected to be in the same folder as this | 141 // Load sas.dll. The library is expected to be in the same folder as this |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 220 |
221 scoped_ptr<SasInjector> SasInjector::Create() { | 221 scoped_ptr<SasInjector> SasInjector::Create() { |
222 if (base::win::GetVersion() < base::win::VERSION_VISTA) { | 222 if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
223 return make_scoped_ptr(new SasInjectorXp()); | 223 return make_scoped_ptr(new SasInjectorXp()); |
224 } else { | 224 } else { |
225 return make_scoped_ptr(new SasInjectorWin()); | 225 return make_scoped_ptr(new SasInjectorWin()); |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 } // namespace remoting | 229 } // namespace remoting |
OLD | NEW |