Take a look at the following code:
LONG size = MAX_PATH;
The call to RegQueryValue() returns an error value of 13.
However, GetLastError() indicates there was no error, and the variables buffer and size get set to the correct values.
Where does this error 13 come from???
(I use RegQueryValue() and not RegQueryValueEx() because I want the default value associated with the key, and it is also simpler.)