What's the difference between RegSetKeyValue and RegSetValueEx?

Viewed 428

I want to set a registry value in my C++ code and I wonder what's the best way to do so. There are two different functions in the Microsoft documentation. What's the difference between both functions?

The only difference I see is the datatype of the lpData parameter. The data that the registry value is supposed to hold is passed to that parameter. It is defined like this:

  • LPCVOID lpData in the RegSetKeyValue function
  • const BYTE *lpData in the RegSetValueEx function

But what's the difference between both variants? The pointer you pass is the same. The type of data and its size is defined using different parameters. Therefor both functions have these two parameters: DWORD dwType, DWORD cbData.

Are there any use cases in which one of the two functions is favorable?

Is there a difference under the hood of both functions?

0 Answers
Related