| 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 "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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 HMODULE DllRedirector::LoadVersionedModule(Version* version) { | 272 HMODULE DllRedirector::LoadVersionedModule(Version* version) { |
| 273 DCHECK(version); | 273 DCHECK(version); |
| 274 | 274 |
| 275 HMODULE hmodule = NULL; | 275 HMODULE hmodule = NULL; |
| 276 wchar_t system_buffer[MAX_PATH]; | 276 wchar_t system_buffer[MAX_PATH]; |
| 277 HMODULE this_module = reinterpret_cast<HMODULE>(&__ImageBase); | 277 HMODULE this_module = reinterpret_cast<HMODULE>(&__ImageBase); |
| 278 system_buffer[0] = 0; | 278 system_buffer[0] = 0; |
| 279 if (GetModuleFileName(this_module, system_buffer, | 279 if (GetModuleFileName(this_module, system_buffer, |
| 280 arraysize(system_buffer)) != 0) { | 280 arraysize(system_buffer)) != 0) { |
| 281 FilePath module_path(system_buffer); | 281 base::FilePath module_path(system_buffer); |
| 282 | 282 |
| 283 // For a module located in | 283 // For a module located in |
| 284 // Foo\XXXXXXXXX\<module>.dll, load | 284 // Foo\XXXXXXXXX\<module>.dll, load |
| 285 // Foo\<version>\<module>.dll: | 285 // Foo\<version>\<module>.dll: |
| 286 FilePath module_name = module_path.BaseName(); | 286 base::FilePath module_name = module_path.BaseName(); |
| 287 module_path = module_path.DirName() | 287 module_path = module_path.DirName() |
| 288 .DirName() | 288 .DirName() |
| 289 .Append(ASCIIToWide(version->GetString())) | 289 .Append(ASCIIToWide(version->GetString())) |
| 290 .Append(module_name); | 290 .Append(module_name); |
| 291 | 291 |
| 292 hmodule = LoadLibrary(module_path.value().c_str()); | 292 hmodule = LoadLibrary(module_path.value().c_str()); |
| 293 if (hmodule == NULL) { | 293 if (hmodule == NULL) { |
| 294 DPLOG(ERROR) << "Could not load reported module version " | 294 DPLOG(ERROR) << "Could not load reported module version " |
| 295 << version->GetString(); | 295 << version->GetString(); |
| 296 } | 296 } |
| 297 } else { | 297 } else { |
| 298 DPLOG(FATAL) << "Failed to get module file name"; | 298 DPLOG(FATAL) << "Failed to get module file name"; |
| 299 } | 299 } |
| 300 return hmodule; | 300 return hmodule; |
| 301 } | 301 } |
| OLD | NEW |