Fix deletion of registry keys from alternate registry view
Since being able to access the 64 bit registry from 32 bit code and vice
versa (a5c468483d
) the updated code in wxRegKey::DeleteKey hasn't worked
properly for keys that are redirected. It is for example not possible
from 32 bit code to delete keys from the 64 bit view of (parts of)
HKLM/SOFTWARE/ . And in 64 bit code it's not possible to delete keys
from the 32 bit view of HKLM/SOFTWARE/ which is at
HKLM/SOFTWARE/WOW6432Node/ . Fix by trying to call the correct DLL
function (RegDeleteKeyExW or RegDeleteKeyExA), instead of non-existing
RegDeleteKeyEx.
This commit is contained in:
parent
a963edca41
commit
8d2ed7bdf0
@ -757,11 +757,10 @@ bool wxRegKey::DeleteSelf()
|
||||
#if wxUSE_DYNLIB_CLASS
|
||||
wxDynamicLibrary dllAdvapi32(wxT("advapi32"));
|
||||
// Minimum supported OS for RegDeleteKeyEx: Vista, XP Pro x64, Win Server 2008, Win Server 2003 SP1
|
||||
if(dllAdvapi32.HasSymbol(wxT("RegDeleteKeyEx")))
|
||||
typedef LONG (WINAPI *RegDeleteKeyEx_t)(HKEY, LPCTSTR, REGSAM, DWORD);
|
||||
RegDeleteKeyEx_t wxDL_INIT_FUNC_AW(pfn, RegDeleteKeyEx, dllAdvapi32);
|
||||
if (pfnRegDeleteKeyEx)
|
||||
{
|
||||
typedef LONG (WINAPI *RegDeleteKeyEx_t)(HKEY, LPCTSTR, REGSAM, DWORD);
|
||||
wxDYNLIB_FUNCTION(RegDeleteKeyEx_t, RegDeleteKeyEx, dllAdvapi32);
|
||||
|
||||
m_dwLastError = (*pfnRegDeleteKeyEx)((HKEY) m_hRootKey, m_strKey.t_str(),
|
||||
GetMSWViewFlags(m_viewMode),
|
||||
0); // This parameter is reserved and must be zero.
|
||||
|
Loading…
Reference in New Issue
Block a user