Commit 62e45a86 authored by wfh@chromium.org's avatar wfh@chromium.org

Fix issue where OpenKey() would call Close() and reset the wow64_access to 0...

Fix issue where OpenKey() would call Close() and reset the wow64_access to 0 causing subsequent OpenKey() to fail.

BUG=384587
TEST=base_unittests --gtest_filter=RegistryTest.SameWowFlags

Review URL: https://codereview.chromium.org/334973003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277889 0039d316-1c4b-4281-b951-d872f2087c98
parent f67ec25a
......@@ -105,6 +105,7 @@ LONG RegKey::CreateKey(const wchar_t* name, REGSAM access) {
if (result == ERROR_SUCCESS) {
Close();
key_ = subkey;
wow64access_ = access & kWow64AccessMask;
}
return result;
......@@ -143,6 +144,7 @@ LONG RegKey::OpenKey(const wchar_t* relative_key_name, REGSAM access) {
if (result == ERROR_SUCCESS) {
Close();
key_ = subkey;
wow64access_ = access & kWow64AccessMask;
}
return result;
}
......@@ -161,7 +163,6 @@ void RegKey::Set(HKEY key) {
if (key_ != key) {
Close();
key_ = key;
wow64access_ = 0;
}
}
......
......@@ -277,6 +277,24 @@ TEST_F(RegistryTest, DISABLED_Wow64RedirectedFromNative) {
ASSERT_EQ(ERROR_SUCCESS, key.DeleteKey(kRootKey));
}
// Test for the issue found in http://crbug.com/384587 where OpenKey would call
// Close() and reset wow64_access_ flag to 0 and cause a NOTREACHED to hit on a
// subsequent OpenKey call.
TEST_F(RegistryTest, SameWowFlags) {
RegKey key;
ASSERT_EQ(ERROR_SUCCESS,
key.Open(HKEY_LOCAL_MACHINE,
L"Software",
KEY_READ | KEY_WOW64_64KEY));
ASSERT_EQ(ERROR_SUCCESS,
key.OpenKey(L"Microsoft",
KEY_READ | KEY_WOW64_64KEY));
ASSERT_EQ(ERROR_SUCCESS,
key.OpenKey(L"Windows",
KEY_READ | KEY_WOW64_64KEY));
}
// TODO(wfh): flaky test on Vista. See http://crbug.com/377917
TEST_F(RegistryTest, DISABLED_Wow64NativeFromRedirected) {
if (!IsRedirectorPresent())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment