mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 521923 - Stop client-side Windows "throttling". r=jmathies
This commit is contained in:
parent
601b8f05da
commit
df0c0ee8d7
@ -57,7 +57,8 @@
|
||||
#include "common/windows/string_utils-inl.h"
|
||||
|
||||
#define CRASH_REPORTER_VALUE L"Enabled"
|
||||
#define SUBMIT_REPORT_VALUE L"SubmitReport"
|
||||
#define SUBMIT_REPORT_VALUE L"SubmitCrashReport"
|
||||
#define SUBMIT_REPORT_OLD L"SubmitReport"
|
||||
#define INCLUDE_URL_VALUE L"IncludeURL"
|
||||
#define EMAIL_ME_VALUE L"EmailMe"
|
||||
#define EMAIL_VALUE L"Email"
|
||||
@ -158,6 +159,24 @@ static bool GetBoolValue(HKEY hRegKey, LPCTSTR valueName, DWORD* value)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Removes a value from HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER, if it exists.
|
||||
static void RemoveUnusedValues(const wchar_t* key, LPCTSTR valueName)
|
||||
{
|
||||
HKEY hRegKey;
|
||||
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_SET_VALUE, &hRegKey)
|
||||
== ERROR_SUCCESS) {
|
||||
RegDeleteValue(hRegKey, valueName);
|
||||
RegCloseKey(hRegKey);
|
||||
}
|
||||
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, key, 0, KEY_SET_VALUE, &hRegKey)
|
||||
== ERROR_SUCCESS) {
|
||||
RegDeleteValue(hRegKey, valueName);
|
||||
RegCloseKey(hRegKey);
|
||||
}
|
||||
}
|
||||
|
||||
static bool CheckBoolKey(const wchar_t* key,
|
||||
const wchar_t* valueName,
|
||||
bool* enabled)
|
||||
@ -190,6 +209,10 @@ static bool CheckBoolKey(const wchar_t* key,
|
||||
static void SetBoolKey(const wchar_t* key, const wchar_t* value, bool enabled)
|
||||
{
|
||||
HKEY hRegKey;
|
||||
|
||||
// remove the old value from the registry if it exists
|
||||
RemoveUnusedValues(key, SUBMIT_REPORT_OLD);
|
||||
|
||||
if (RegCreateKey(HKEY_CURRENT_USER, key, &hRegKey) == ERROR_SUCCESS) {
|
||||
DWORD data = (enabled ? 1 : 0);
|
||||
RegSetValueEx(hRegKey, value, 0, REG_DWORD, (LPBYTE)&data, sizeof(data));
|
||||
|
Loading…
Reference in New Issue
Block a user