OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "sandbox/win/src/win_utils.h" | 5 #include "sandbox/win/src/win_utils.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 for (size_t i = 0; i < arraysize(kKnownKey); ++i) { | 125 for (size_t i = 0; i < arraysize(kKnownKey); ++i) { |
126 if (name == kKnownKey[i].name) | 126 if (name == kKnownKey[i].name) |
127 return kKnownKey[i].key; | 127 return kKnownKey[i].key; |
128 } | 128 } |
129 | 129 |
130 return NULL; | 130 return NULL; |
131 } | 131 } |
132 | 132 |
133 bool ResolveRegistryName(base::string16 name, base::string16* resolved_name) { | 133 bool ResolveRegistryName(base::string16 name, base::string16* resolved_name) { |
134 for (size_t i = 0; i < arraysize(kKnownKey); ++i) { | 134 for (size_t i = 0; i < arraysize(kKnownKey); ++i) { |
135 if (base::StartsWith(name, kKnownKey[i].name, | 135 if (name.find(kKnownKey[i].name) == 0) { |
136 base::CompareCase::SENSITIVE)) { | |
137 HKEY key; | 136 HKEY key; |
138 DWORD disposition; | 137 DWORD disposition; |
139 if (ERROR_SUCCESS != ::RegCreateKeyEx(kKnownKey[i].key, L"", 0, NULL, 0, | 138 if (ERROR_SUCCESS != ::RegCreateKeyEx(kKnownKey[i].key, L"", 0, NULL, 0, |
140 MAXIMUM_ALLOWED, NULL, &key, | 139 MAXIMUM_ALLOWED, NULL, &key, |
141 &disposition)) | 140 &disposition)) |
142 return false; | 141 return false; |
143 | 142 |
144 bool result = GetPathFromHandle(key, resolved_name); | 143 bool result = GetPathFromHandle(key, resolved_name); |
145 ::RegCloseKey(key); | 144 ::RegCloseKey(key); |
146 | 145 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 ::InterlockedCompareExchangePointer( | 424 ::InterlockedCompareExchangePointer( |
426 reinterpret_cast<PVOID volatile*>(&ntdll), ntdll_local, NULL); | 425 reinterpret_cast<PVOID volatile*>(&ntdll), ntdll_local, NULL); |
427 | 426 |
428 } | 427 } |
429 | 428 |
430 CHECK_NT(ntdll); | 429 CHECK_NT(ntdll); |
431 FARPROC* function_ptr = reinterpret_cast<FARPROC*>(ptr); | 430 FARPROC* function_ptr = reinterpret_cast<FARPROC*>(ptr); |
432 *function_ptr = ::GetProcAddress(ntdll, name); | 431 *function_ptr = ::GetProcAddress(ntdll, name); |
433 CHECK_NT(*function_ptr); | 432 CHECK_NT(*function_ptr); |
434 } | 433 } |
OLD | NEW |