| 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 #ifndef CHROME_ELF_BLACKLIST_BLACKLIST_H_ | 5 #ifndef CHROME_ELF_BLACKLIST_BLACKLIST_H_ |
| 6 #define CHROME_ELF_BLACKLIST_BLACKLIST_H_ | 6 #define CHROME_ELF_BLACKLIST_BLACKLIST_H_ |
| 7 | 7 |
| 8 #if defined(_WIN64) | 8 #if defined(_WIN64) |
| 9 #include "sandbox/win/src/sandbox_nt_types.h" | 9 #include "sandbox/win/src/sandbox_nt_types.h" |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 namespace blacklist { | 12 namespace blacklist { |
| 13 | 13 |
| 14 // Max size of the DLL blacklist. | 14 // Max size of the DLL blacklist. |
| 15 const int kTroublesomeDllsMaxCount = 64; | 15 const size_t kTroublesomeDllsMaxCount = 64; |
| 16 | 16 |
| 17 // The DLL blacklist. | 17 // The DLL blacklist. |
| 18 extern const wchar_t* g_troublesome_dlls[kTroublesomeDllsMaxCount]; | 18 extern const wchar_t* g_troublesome_dlls[kTroublesomeDllsMaxCount]; |
| 19 | 19 |
| 20 #if defined(_WIN64) | 20 #if defined(_WIN64) |
| 21 extern NtMapViewOfSectionFunction g_nt_map_view_of_section_func; | 21 extern NtMapViewOfSectionFunction g_nt_map_view_of_section_func; |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 // Attempts to leave a beacon in the current user's registry hive. | 24 // Attempts to leave a beacon in the current user's registry hive. |
| 25 // If the blacklist beacon doesn't say it is enabled or there are any other | 25 // If the blacklist beacon doesn't say it is enabled or there are any other |
| (...skipping 11 matching lines...) Expand all Loading... |
| 37 // Return the size of the current blacklist. | 37 // Return the size of the current blacklist. |
| 38 int BlacklistSize(); | 38 int BlacklistSize(); |
| 39 | 39 |
| 40 // Returns if true if the blacklist has been initialized. | 40 // Returns if true if the blacklist has been initialized. |
| 41 extern "C" bool IsBlacklistInitialized(); | 41 extern "C" bool IsBlacklistInitialized(); |
| 42 | 42 |
| 43 // Adds the given dll name to the blacklist. Returns true if the dll name is in | 43 // Adds the given dll name to the blacklist. Returns true if the dll name is in |
| 44 // the blacklist when this returns, false on error. Note that this will copy | 44 // the blacklist when this returns, false on error. Note that this will copy |
| 45 // |dll_name| and will leak it on exit if the string is not subsequently removed | 45 // |dll_name| and will leak it on exit if the string is not subsequently removed |
| 46 // using RemoveDllFromBlacklist. | 46 // using RemoveDllFromBlacklist. |
| 47 // Exposed for testing only, this shouldn't be exported from chrome_elf.dll. |
| 47 extern "C" bool AddDllToBlacklist(const wchar_t* dll_name); | 48 extern "C" bool AddDllToBlacklist(const wchar_t* dll_name); |
| 48 | 49 |
| 49 // Removes the given dll name from the blacklist. Returns true if it was | 50 // Removes the given dll name from the blacklist. Returns true if it was |
| 50 // removed, false on error. | 51 // removed, false on error. |
| 52 // Exposed for testing only, this shouldn't be exported from chrome_elf.dll. |
| 51 extern "C" bool RemoveDllFromBlacklist(const wchar_t* dll_name); | 53 extern "C" bool RemoveDllFromBlacklist(const wchar_t* dll_name); |
| 52 | 54 |
| 55 // Returns a list of all the dlls that have been successfully blocked by the |
| 56 // blacklist via blocked_dlls, if there is enough space (according to |size|). |
| 57 // |size| will always be modified to be the number of dlls that were blocked. |
| 58 // The caller doesn't own the strings and isn't expected to free them. These |
| 59 // strings won't be hanging unless RemoveDllFromBlacklist is called, but it |
| 60 // is only exposed in tests (and should stay that way). |
| 61 extern "C" void SuccessfullyBlocked(const wchar_t** blocked_dlls, int* size); |
| 62 |
| 63 // Record that the dll at the given index was blocked. |
| 64 void BlockedDll(size_t blocked_index); |
| 65 |
| 53 // Initializes the DLL blacklist in the current process. This should be called | 66 // Initializes the DLL blacklist in the current process. This should be called |
| 54 // before any undesirable DLLs might be loaded. If |force| is set to true, then | 67 // before any undesirable DLLs might be loaded. If |force| is set to true, then |
| 55 // initialization will take place even if a beacon is present. This is useful | 68 // initialization will take place even if a beacon is present. This is useful |
| 56 // for tests. | 69 // for tests. |
| 57 bool Initialize(bool force); | 70 bool Initialize(bool force); |
| 58 | 71 |
| 59 } // namespace blacklist | 72 } // namespace blacklist |
| 60 | 73 |
| 61 #endif // CHROME_ELF_BLACKLIST_BLACKLIST_H_ | 74 #endif // CHROME_ELF_BLACKLIST_BLACKLIST_H_ |
| OLD | NEW |