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 namespace blacklist { | 8 namespace blacklist { |
9 | 9 |
10 // Max size of the DLL blacklist. | 10 // Max size of the DLL blacklist. |
11 const int kTroublesomeDllsMaxCount = 64; | 11 const int kTroublesomeDllsMaxCount = 64; |
12 | 12 |
13 // The DLL blacklist. | 13 // The DLL blacklist. |
14 extern const wchar_t* g_troublesome_dlls[kTroublesomeDllsMaxCount]; | 14 extern const wchar_t* g_troublesome_dlls[kTroublesomeDllsMaxCount]; |
15 | 15 |
16 // Cursor to the current last element in the blacklist. | 16 // Cursor to the current last element in the blacklist. |
17 extern int g_troublesome_dlls_cur_index; | 17 extern int g_troublesome_dlls_cur_index; |
18 | 18 |
19 // The registry path of the blacklist beacon. Exposed here for testing. | 19 // The registry path of the blacklist beacon. |
20 extern const wchar_t kRegistryBeaconPath[]; | 20 extern const wchar_t kRegistryBeaconPath[]; |
21 | 21 |
22 // Attempts to create a beacon in the current user's registry hive. | 22 // The properties for the blacklist beacon. |
23 // If the beacon already exists or any other error occurs when creating the | 23 extern const wchar_t kBeaconVersion[]; |
24 // beacon, returns false. Otherwise returns true. | 24 extern const wchar_t kBeaconState[]; |
25 | |
26 // The states for the blacklist setup code. | |
27 enum BlacklistState { | |
28 BLACKLIST_DISABLED = 0, | |
29 BLACKLIST_ENABLED, | |
30 // The blacklist setup code is running. If this is still set at startup, | |
31 // it means the last setup crashed. | |
32 BLACKLIST_SETUP_RUNNING, | |
33 }; | |
34 | |
35 // Attempts to leave a beacon in the current user's registry hive. | |
36 // If the blacklist beacon doesn't say it is enabled or there are any other | |
37 // errors when creating the beacon, returns false. Otherwise returns true. | |
25 // The intent of the beacon is to act as an extra failure mode protection | 38 // The intent of the beacon is to act as an extra failure mode protection |
26 // whereby if Chrome for some reason fails to start during blacklist setup, | 39 // whereby if Chrome for some reason fails to start during blacklist setup, |
27 // it will skip blacklisting on the subsequent run. | 40 // it will skip blacklisting on the subsequent run. |
28 bool CreateBeacon(); | 41 bool LeaveSetupBeacon(); |
29 | 42 |
30 // Looks for the beacon that CreateBeacon() creates and attempts to delete it. | 43 // Looks for the beacon that LeaveSetupBeacon() creates and reset it to |
robertshield
2013/12/27 03:24:29
s/reset/resets
csharp
2014/01/02 19:55:36
Done.
| |
31 // Returns true if the beacon was found and deleted. | 44 // to show the setup was successful. |
32 bool ClearBeacon(); | 45 // Returns true if the beacon was successfully deleted. |
robertshield
2013/12/27 03:24:29
Update this last sentence.
csharp
2014/01/02 19:55:36
Done.
| |
46 bool ResetBeacon(); | |
33 | 47 |
34 // Adds the given dll name to the blacklist. Returns true if the dll name is in | 48 // Adds the given dll name to the blacklist. Returns true if the dll name is in |
35 // the blacklist when this returns, false on error. Note that this will copy | 49 // the blacklist when this returns, false on error. Note that this will copy |
36 // |dll_name| and will leak it on exit if the string is not subsequently removed | 50 // |dll_name| and will leak it on exit if the string is not subsequently removed |
37 // using RemoveDllFromBlacklist. | 51 // using RemoveDllFromBlacklist. |
38 extern "C" bool AddDllToBlacklist(const wchar_t* dll_name); | 52 extern "C" bool AddDllToBlacklist(const wchar_t* dll_name); |
39 | 53 |
40 // Removes the given dll name from the blacklist. Returns true if it was | 54 // Removes the given dll name from the blacklist. Returns true if it was |
41 // removed, false on error. | 55 // removed, false on error. |
42 extern "C" bool RemoveDllFromBlacklist(const wchar_t* dll_name); | 56 extern "C" bool RemoveDllFromBlacklist(const wchar_t* dll_name); |
43 | 57 |
44 // Initializes the DLL blacklist in the current process. This should be called | 58 // Initializes the DLL blacklist in the current process. This should be called |
45 // before any undesirable DLLs might be loaded. If |force| is set to true, then | 59 // before any undesirable DLLs might be loaded. If |force| is set to true, then |
46 // initialization will take place even if a beacon is present. This is useful | 60 // initialization will take place even if a beacon is present. This is useful |
47 // for tests. | 61 // for tests. |
48 bool Initialize(bool force); | 62 bool Initialize(bool force); |
49 | 63 |
50 } // namespace blacklist | 64 } // namespace blacklist |
51 | 65 |
52 #endif // CHROME_ELF_BLACKLIST_BLACKLIST_H_ | 66 #endif // CHROME_ELF_BLACKLIST_BLACKLIST_H_ |
OLD | NEW |