| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome_frame/dll_redirector.h" | 5 #include "chrome_frame/dll_redirector.h" |
| 6 | 6 |
| 7 #include <aclapi.h> | 7 #include <aclapi.h> |
| 8 #include <atlbase.h> | 8 #include <atlbase.h> |
| 9 #include <atlsecurity.h> | 9 #include <atlsecurity.h> |
| 10 #include <sddl.h> | 10 #include <sddl.h> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 const wchar_t kSharedMemoryName[] = L"ChromeFrameVersionBeacon_"; | 23 const wchar_t kSharedMemoryName[] = L"ChromeFrameVersionBeacon_"; |
| 24 const uint32 kSharedMemorySize = 128; | 24 const uint32 kSharedMemorySize = 128; |
| 25 const uint32 kSharedMemoryLockTimeoutMs = 1000; | 25 const uint32 kSharedMemoryLockTimeoutMs = 1000; |
| 26 | 26 |
| 27 // static | 27 // static |
| 28 DllRedirector::DllRedirector() : first_module_handle_(NULL) { | 28 DllRedirector::DllRedirector() : first_module_handle_(NULL) { |
| 29 // TODO(robertshield): Allow for overrides to be taken from the environment. | 29 // TODO(robertshield): Allow for overrides to be taken from the environment. |
| 30 std::wstring beacon_name(kSharedMemoryName); | 30 std::wstring beacon_name(kSharedMemoryName); |
| 31 beacon_name += GetHostProcessName(false); | 31 beacon_name += GetHostProcessName(false); |
| 32 shared_memory_.reset(new base::SharedMemory(beacon_name)); | 32 shared_memory_.reset(new base::SharedMemory()); |
| 33 shared_memory_name_ = WideToUTF8(beacon_name); |
| 33 } | 34 } |
| 34 | 35 |
| 35 DllRedirector::DllRedirector(const char* shared_memory_name) | 36 DllRedirector::DllRedirector(const char* shared_memory_name) |
| 36 : shared_memory_name_(shared_memory_name), first_module_handle_(NULL) { | 37 : shared_memory_name_(shared_memory_name), first_module_handle_(NULL) { |
| 37 shared_memory_.reset(new base::SharedMemory(ASCIIToWide(shared_memory_name))); | 38 shared_memory_.reset(new base::SharedMemory(ASCIIToWide(shared_memory_name))); |
| 38 } | 39 } |
| 39 | 40 |
| 40 DllRedirector::~DllRedirector() { | 41 DllRedirector::~DllRedirector() { |
| 41 if (first_module_handle_) { | 42 if (first_module_handle_) { |
| 42 if (first_module_handle_ != reinterpret_cast<HMODULE>(&__ImageBase)) { | 43 if (first_module_handle_ != reinterpret_cast<HMODULE>(&__ImageBase)) { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 .Append(module_name); | 283 .Append(module_name); |
| 283 | 284 |
| 284 HMODULE hmodule = LoadLibrary(module_path.value().c_str()); | 285 HMODULE hmodule = LoadLibrary(module_path.value().c_str()); |
| 285 if (hmodule == NULL) { | 286 if (hmodule == NULL) { |
| 286 DPLOG(ERROR) << "Could not load reported module version " | 287 DPLOG(ERROR) << "Could not load reported module version " |
| 287 << version->GetString(); | 288 << version->GetString(); |
| 288 } | 289 } |
| 289 | 290 |
| 290 return hmodule; | 291 return hmodule; |
| 291 } | 292 } |
| OLD | NEW |