From a963edca41666f28d9fc62c29431779619a34eb2 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Fri, 5 May 2017 19:28:15 +0400 Subject: [PATCH] Add a registry key deletion test that fails with WoW64 --- tests/config/regconf.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/config/regconf.cpp b/tests/config/regconf.cpp index 37763583c6..0521a18353 100644 --- a/tests/config/regconf.cpp +++ b/tests/config/regconf.cpp @@ -35,6 +35,7 @@ public: private: CPPUNIT_TEST_SUITE( RegConfigTestCase ); CPPUNIT_TEST( ReadWrite ); + CPPUNIT_TEST( DeleteRegistryKeyFromRedirectedView ); CPPUNIT_TEST_SUITE_END(); void ReadWrite(); @@ -80,5 +81,25 @@ void RegConfigTestCase::ReadWrite() delete config; } +void RegConfigTestCase::DeleteRegistryKeyFromRedirectedView() +{ + if ( !wxIsPlatform64Bit() ) + { + // Test needs WoW64. + return; + } + + // Test inside a key that's known to be redirected and is in HKCU so that + // admin rights are not required (unlike with HKLM). + wxRegKey key(wxRegKey::HKCU, "SOFTWARE\\Classes\\CLSID\\wxWidgetsTestKey", + sizeof(void *) == 4 + ? wxRegKey::WOW64ViewMode_64 + : wxRegKey::WOW64ViewMode_32); + + CPPUNIT_ASSERT( key.Create() ); + CPPUNIT_ASSERT( key.DeleteSelf() ); + CPPUNIT_ASSERT( !key.Exists() ); +} + #endif // wxUSE_CONFIG && wxUSE_REGKEY