I want to know what is the different between RegDeleteKeyValue and RegDeleteValue in Win32API.
RegDeleteValue() is the legacy function, it has been around for 22 years. RegDeleteKeyValue() was an addition, first available on Vista. Major version 6, you must set the _WIN32_WINNT macro to 0x600 or higher to be able to use it. Won't work on Windows XP, Server 2003 or earlier.
Version 6 altered the behavior of several registry related functions, otherwise without a fantastic documented rationale that I've ever seen. The changes however look like Microsoft tried to make them less easy to exploit by malware. RegDeleteValue() fits, it is quite a dangerous function. Whacking the hKey
argument with a buffer overflow, giving it one of the predefined values like HKEY_CURRENT_USER and an attacked program can instantly destroy the user's machine. I think, never tried it :)
So you definitely want to consider RegDeleteKeyValue().
Both RegDeleteValue
and RegDeleteKeyValue
remove a value from the Registry. The difference is one of convenience: Applications and system components often structure registry data in groups of subkeys, each holding a list of values. RegDeleteKeyValue
allows reuse of the parent key handle when deleting values from several subkeys. With RegDeleteValue
you have to open a handle to each subkey individually.
Additional reading:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With