| 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" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 SasInjectorWin::SasInjectorWin() : send_sas_(NULL) { | 124 SasInjectorWin::SasInjectorWin() : send_sas_(NULL) { |
| 125 } | 125 } |
| 126 | 126 |
| 127 SasInjectorWin::~SasInjectorWin() { | 127 SasInjectorWin::~SasInjectorWin() { |
| 128 } | 128 } |
| 129 | 129 |
| 130 bool SasInjectorWin::InjectSas() { | 130 bool SasInjectorWin::InjectSas() { |
| 131 // Load sas.dll. The library is expected to be in the same folder as this | 131 // Load sas.dll. The library is expected to be in the same folder as this |
| 132 // binary. | 132 // binary. |
| 133 if (!sas_dll_.is_valid()) { | 133 if (!sas_dll_.is_valid()) { |
| 134 FilePath exe_path; | 134 FilePath dir_path; |
| 135 if (!PathService::Get(base::FILE_EXE, &exe_path)) { | 135 if (!PathService::Get(base::DIR_EXE, &dir_path)) { |
| 136 LOG(ERROR) << "Failed to get the executable file name."; | 136 LOG(ERROR) << "Failed to get the executable file name."; |
| 137 return false; | 137 return false; |
| 138 } | 138 } |
| 139 | 139 |
| 140 sas_dll_.Reset(base::LoadNativeLibrary( | 140 sas_dll_.Reset(base::LoadNativeLibrary(dir_path.Append(kSasDllFileName), |
| 141 exe_path.DirName().Append(kSasDllFileName), NULL)); | 141 NULL)); |
| 142 } | 142 } |
| 143 if (!sas_dll_.is_valid()) { | 143 if (!sas_dll_.is_valid()) { |
| 144 LOG(ERROR) << "Failed to load '" << kSasDllFileName << "'"; | 144 LOG(ERROR) << "Failed to load '" << kSasDllFileName << "'"; |
| 145 return false; | 145 return false; |
| 146 } | 146 } |
| 147 | 147 |
| 148 // Get the pointer to sas!SendSAS(). | 148 // Get the pointer to sas!SendSAS(). |
| 149 if (send_sas_ == NULL) { | 149 if (send_sas_ == NULL) { |
| 150 send_sas_ = static_cast<SendSasFunc>( | 150 send_sas_ = static_cast<SendSasFunc>( |
| 151 sas_dll_.GetFunctionPointer(kSendSasName)); | 151 sas_dll_.GetFunctionPointer(kSendSasName)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 168 | 168 |
| 169 scoped_ptr<SasInjector> SasInjector::Create() { | 169 scoped_ptr<SasInjector> SasInjector::Create() { |
| 170 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { | 170 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { |
| 171 return scoped_ptr<SasInjector>(new SasInjectorWin()); | 171 return scoped_ptr<SasInjector>(new SasInjectorWin()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 return scoped_ptr<SasInjector>(); | 174 return scoped_ptr<SasInjector>(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace remoting | 177 } // namespace remoting |
| OLD | NEW |