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 // The registry path of the blacklist beacon. | 20 // The registry path of the blacklist beacon. |
21 extern const wchar_t kRegistryBeaconPath[]; | 21 extern const wchar_t kRegistryBeaconPath[]; |
22 | 22 |
23 // The properties for the blacklist beacon. | 23 // The properties for the blacklist beacon. |
24 extern const wchar_t kBeaconVersion[]; | 24 extern const wchar_t kBeaconVersion[]; |
25 extern const wchar_t kBeaconState[]; | 25 extern const wchar_t kBeaconState[]; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 // Return the size of the current blacklist. | 61 // Return the size of the current blacklist. |
62 int BlacklistSize(); | 62 int BlacklistSize(); |
63 | 63 |
64 // Returns if true if the blacklist has been initialized. | 64 // Returns if true if the blacklist has been initialized. |
65 extern "C" bool IsBlacklistInitialized(); | 65 extern "C" bool IsBlacklistInitialized(); |
66 | 66 |
67 // Adds the given dll name to the blacklist. Returns true if the dll name is in | 67 // Adds the given dll name to the blacklist. Returns true if the dll name is in |
68 // the blacklist when this returns, false on error. Note that this will copy | 68 // the blacklist when this returns, false on error. Note that this will copy |
69 // |dll_name| and will leak it on exit if the string is not subsequently removed | 69 // |dll_name| and will leak it on exit if the string is not subsequently removed |
70 // using RemoveDllFromBlacklist. | 70 // using RemoveDllFromBlacklist. |
71 // Exposed for testing only, this shouldn't be exported from chrome_elf.dll. | |
71 extern "C" bool AddDllToBlacklist(const wchar_t* dll_name); | 72 extern "C" bool AddDllToBlacklist(const wchar_t* dll_name); |
72 | 73 |
73 // Removes the given dll name from the blacklist. Returns true if it was | 74 // Removes the given dll name from the blacklist. Returns true if it was |
74 // removed, false on error. | 75 // removed, false on error. |
76 // Exposed for testing only, this shouldn't be exported from chrome_elf.dll. | |
75 extern "C" bool RemoveDllFromBlacklist(const wchar_t* dll_name); | 77 extern "C" bool RemoveDllFromBlacklist(const wchar_t* dll_name); |
76 | 78 |
79 // Returns a list of all the dlls that have been successfully blocked by the | |
80 // blacklist via blocked_dlls, if there is enough space (according to |size|). | |
81 // |size| will always be modified to be the number of dlls that were blocked. | |
82 // The caller doesn't own the strings and isn't expected to free them. These | |
83 // strings won't be hanging unless RemoveDllFromBlacklist is called, but it | |
84 // is only exposed in tests (and should stay that way). | |
85 extern "C" void SuccessfullyBlocked(const wchar_t** blocked_dlls, int* size); | |
sky
2014/02/26 21:52:05
Is there a reason this can't return std::vector<st
csharp
2014/02/26 22:00:01
This is usually called from across a dll boundary
| |
86 | |
87 // Record that the dll at the given index was blocked. | |
88 void BlockedDll(size_t blocked_index); | |
89 | |
77 // Initializes the DLL blacklist in the current process. This should be called | 90 // Initializes the DLL blacklist in the current process. This should be called |
78 // before any undesirable DLLs might be loaded. If |force| is set to true, then | 91 // before any undesirable DLLs might be loaded. If |force| is set to true, then |
79 // initialization will take place even if a beacon is present. This is useful | 92 // initialization will take place even if a beacon is present. This is useful |
80 // for tests. | 93 // for tests. |
81 bool Initialize(bool force); | 94 bool Initialize(bool force); |
82 | 95 |
83 } // namespace blacklist | 96 } // namespace blacklist |
84 | 97 |
85 #endif // CHROME_ELF_BLACKLIST_BLACKLIST_H_ | 98 #endif // CHROME_ELF_BLACKLIST_BLACKLIST_H_ |
OLD | NEW |