| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_elf/blacklist/blacklist.h" | 5 #include "chrome_elf/blacklist/blacklist.h" |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 int size = -1; | 218 int size = -1; |
| 219 while (blacklist::g_troublesome_dlls[++size] != NULL) {} | 219 while (blacklist::g_troublesome_dlls[++size] != NULL) {} |
| 220 | 220 |
| 221 return size; | 221 return size; |
| 222 } | 222 } |
| 223 | 223 |
| 224 bool IsBlacklistInitialized() { | 224 bool IsBlacklistInitialized() { |
| 225 return g_blacklist_initialized; | 225 return g_blacklist_initialized; |
| 226 } | 226 } |
| 227 | 227 |
| 228 int GetBlacklistIndex(const wchar_t* dll_name) { |
| 229 for (int i = 0; i < kTroublesomeDllsMaxCount, g_troublesome_dlls[i]; ++i) { |
| 230 if (_wcsicmp(dll_name, g_troublesome_dlls[i]) == 0) |
| 231 return i; |
| 232 } |
| 233 return -1; |
| 234 } |
| 235 |
| 228 bool AddDllToBlacklist(const wchar_t* dll_name) { | 236 bool AddDllToBlacklist(const wchar_t* dll_name) { |
| 229 int blacklist_size = BlacklistSize(); | 237 int blacklist_size = BlacklistSize(); |
| 230 // We need to leave one space at the end for the null pointer. | 238 // We need to leave one space at the end for the null pointer. |
| 231 if (blacklist_size + 1 >= kTroublesomeDllsMaxCount) | 239 if (blacklist_size + 1 >= kTroublesomeDllsMaxCount) |
| 232 return false; | 240 return false; |
| 233 for (int i = 0; i < blacklist_size; ++i) { | 241 for (int i = 0; i < blacklist_size; ++i) { |
| 234 if (!_wcsicmp(g_troublesome_dlls[i], dll_name)) | 242 if (!_wcsicmp(g_troublesome_dlls[i], dll_name)) |
| 235 return true; | 243 return true; |
| 236 } | 244 } |
| 237 | 245 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 break; | 430 break; |
| 423 value_buffer[value_len - 1] = L'\0'; | 431 value_buffer[value_len - 1] = L'\0'; |
| 424 AddDllToBlacklist(&value_buffer[0]); | 432 AddDllToBlacklist(&value_buffer[0]); |
| 425 } | 433 } |
| 426 | 434 |
| 427 ::RegCloseKey(key); | 435 ::RegCloseKey(key); |
| 428 return; | 436 return; |
| 429 } | 437 } |
| 430 | 438 |
| 431 } // namespace blacklist | 439 } // namespace blacklist |
| OLD | NEW |