I dug into this a bit. RegGetValue() is a new registry call that takes care of some underlying nastiness of the traditional way of querying the registry (RegQueryValueEx). There's some good info about the difference here: http://blogs.msdn.com/larryosterman/archive/2006/01/12/512115.aspx
If you need backwards compatibility, RegGetValue() isn't going to work, so you should be using RegQueryValueEx to read data from the registry.
And now on to what I think is the real question:
- What do you get back when you use RegQueryValueEx() ?
- How do you know that the values stored in the registry are in utf-8 encoding? Is it stored as a byte array in the registry, or as a REG_SZ?
- Have you looked at the value using regedit? What do you see?
So if the question is how to convert a UTF-8 encoded string to an ascii null terminated string, then you should probably change the title of your question. For reference, I found this library that may be of use:
http://utfcpp.sourceforge.net
When I tried the link a few minutes ago, the server timed out - probably SF maintenance going on.
But I would suggest that you make real sure that the values in the registry aren't stored as REG_SZ entries already.