What is the diff between RegDeleteKeyValue and RegDeleteValue?

winapi

Solution

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().

Problem

I want to know what is the different between RegDeleteKeyValue and RegDeleteValue in Win32API.

Original source