| 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> |
| 11 | 11 |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/file_version_info.h" | 13 #include "base/file_version_info.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/shared_memory.h" | 16 #include "base/shared_memory.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/sys_info.h" | |
| 19 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 20 #include "base/version.h" | 19 #include "base/version.h" |
| 21 #include "base/win/windows_version.h" | 20 #include "base/win/windows_version.h" |
| 22 #include "chrome_frame/utils.h" | 21 #include "chrome_frame/utils.h" |
| 23 | 22 |
| 24 const wchar_t kSharedMemoryName[] = L"ChromeFrameVersionBeacon_"; | 23 const wchar_t kSharedMemoryName[] = L"ChromeFrameVersionBeacon_"; |
| 25 const uint32 kSharedMemorySize = 128; | 24 const uint32 kSharedMemorySize = 128; |
| 26 const uint32 kSharedMemoryLockTimeoutMs = 1000; | 25 const uint32 kSharedMemoryLockTimeoutMs = 1000; |
| 27 | 26 |
| 28 // static | 27 // static |
| (...skipping 21 matching lines...) Expand all Loading... |
| 50 } | 49 } |
| 51 | 50 |
| 52 // static | 51 // static |
| 53 DllRedirector* DllRedirector::GetInstance() { | 52 DllRedirector* DllRedirector::GetInstance() { |
| 54 return Singleton<DllRedirector>::get(); | 53 return Singleton<DllRedirector>::get(); |
| 55 } | 54 } |
| 56 | 55 |
| 57 bool DllRedirector::BuildSecurityAttributesForLock( | 56 bool DllRedirector::BuildSecurityAttributesForLock( |
| 58 CSecurityAttributes* sec_attr) { | 57 CSecurityAttributes* sec_attr) { |
| 59 DCHECK(sec_attr); | 58 DCHECK(sec_attr); |
| 60 int32 major_version, minor_version, fix_version; | 59 if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
| 61 base::SysInfo::OperatingSystemVersionNumbers(&major_version, | |
| 62 &minor_version, | |
| 63 &fix_version); | |
| 64 if (major_version < 6) { | |
| 65 // Don't bother with changing ACLs on pre-vista. | 60 // Don't bother with changing ACLs on pre-vista. |
| 66 return false; | 61 return false; |
| 67 } | 62 } |
| 68 | 63 |
| 69 bool success = false; | 64 bool success = false; |
| 70 | 65 |
| 71 // Fill out the rest of the security descriptor from the process token. | 66 // Fill out the rest of the security descriptor from the process token. |
| 72 CAccessToken token; | 67 CAccessToken token; |
| 73 if (token.GetProcessToken(TOKEN_QUERY)) { | 68 if (token.GetProcessToken(TOKEN_QUERY)) { |
| 74 CSecurityDesc security_desc; | 69 CSecurityDesc security_desc; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 .Append(module_name); | 286 .Append(module_name); |
| 292 | 287 |
| 293 HMODULE hmodule = LoadLibrary(module_path.value().c_str()); | 288 HMODULE hmodule = LoadLibrary(module_path.value().c_str()); |
| 294 if (hmodule == NULL) { | 289 if (hmodule == NULL) { |
| 295 DPLOG(ERROR) << "Could not load reported module version " | 290 DPLOG(ERROR) << "Could not load reported module version " |
| 296 << version->GetString(); | 291 << version->GetString(); |
| 297 } | 292 } |
| 298 | 293 |
| 299 return hmodule; | 294 return hmodule; |
| 300 } | 295 } |
| OLD | NEW |