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/logging.h" | 10 #include "base/logging.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/scoped_native_library.h" | 13 #include "base/scoped_native_library.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "base/win/registry.h" | 15 #include "base/win/registry.h" |
16 #include "base/win/windows_version.h" | 16 #include "base/win/windows_version.h" |
17 #include "media/video/capture/screen/win/desktop.h" | 17 #include "media/video/capture/screen/win/desktop.h" |
18 #include "media/video/capture/screen/win/scoped_thread_desktop.h" | 18 #include "media/video/capture/screen/win/scoped_thread_desktop.h" |
19 | 19 |
20 namespace remoting { | 20 namespace remoting { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 // Names of the API and library implementing software SAS generation. | 24 // Names of the API and library implementing software SAS generation. |
25 const FilePath::CharType kSasDllFileName[] = FILE_PATH_LITERAL("sas.dll"); | 25 const base::FilePath::CharType kSasDllFileName[] = FILE_PATH_LITERAL("sas.dll"); |
26 const char kSendSasName[] = "SendSAS"; | 26 const char kSendSasName[] = "SendSAS"; |
27 | 27 |
28 // The prototype of SendSAS(). | 28 // The prototype of SendSAS(). |
29 typedef VOID (WINAPI *SendSasFunc)(BOOL); | 29 typedef VOID (WINAPI *SendSasFunc)(BOOL); |
30 | 30 |
31 // The registry key and value holding the policy controlling software SAS | 31 // The registry key and value holding the policy controlling software SAS |
32 // generation. | 32 // generation. |
33 const wchar_t kSystemPolicyKeyName[] = | 33 const wchar_t kSystemPolicyKeyName[] = |
34 L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"; | 34 L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"; |
35 const wchar_t kSoftwareSasValueName[] = L"SoftwareSASGeneration"; | 35 const wchar_t kSoftwareSasValueName[] = L"SoftwareSASGeneration"; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 SasInjectorWin::SasInjectorWin() : send_sas_(NULL) { | 137 SasInjectorWin::SasInjectorWin() : send_sas_(NULL) { |
138 } | 138 } |
139 | 139 |
140 SasInjectorWin::~SasInjectorWin() { | 140 SasInjectorWin::~SasInjectorWin() { |
141 } | 141 } |
142 | 142 |
143 bool SasInjectorWin::InjectSas() { | 143 bool SasInjectorWin::InjectSas() { |
144 // Load sas.dll. The library is expected to be in the same folder as this | 144 // Load sas.dll. The library is expected to be in the same folder as this |
145 // binary. | 145 // binary. |
146 if (!sas_dll_.is_valid()) { | 146 if (!sas_dll_.is_valid()) { |
147 FilePath dir_path; | 147 base::FilePath dir_path; |
148 if (!PathService::Get(base::DIR_EXE, &dir_path)) { | 148 if (!PathService::Get(base::DIR_EXE, &dir_path)) { |
149 LOG(ERROR) << "Failed to get the executable file name."; | 149 LOG(ERROR) << "Failed to get the executable file name."; |
150 return false; | 150 return false; |
151 } | 151 } |
152 | 152 |
153 sas_dll_.Reset(base::LoadNativeLibrary(dir_path.Append(kSasDllFileName), | 153 sas_dll_.Reset(base::LoadNativeLibrary(dir_path.Append(kSasDllFileName), |
154 NULL)); | 154 NULL)); |
155 } | 155 } |
156 if (!sas_dll_.is_valid()) { | 156 if (!sas_dll_.is_valid()) { |
157 LOG(ERROR) << "Failed to load '" << kSasDllFileName << "'"; | 157 LOG(ERROR) << "Failed to load '" << kSasDllFileName << "'"; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 scoped_ptr<SasInjector> SasInjector::Create() { | 227 scoped_ptr<SasInjector> SasInjector::Create() { |
228 if (base::win::GetVersion() < base::win::VERSION_VISTA) { | 228 if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
229 return scoped_ptr<SasInjector>(new SasInjectorXp()); | 229 return scoped_ptr<SasInjector>(new SasInjectorXp()); |
230 } else { | 230 } else { |
231 return scoped_ptr<SasInjector>(new SasInjectorWin()); | 231 return scoped_ptr<SasInjector>(new SasInjectorWin()); |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 } // namespace remoting | 235 } // namespace remoting |
OLD | NEW |