The first thing I notice is that you are calling "RegOpenKeyEx()" and "RegQueryValueEx()"... which don't exist. You'll want to explicitly use either "RegOpenKeyExA()" or "RegOpenKeyExW()", I suggest the later variant for both but it's more important to stay consistent then to listen to me. It will make your troubleshooting SO MUCH EASIER, just trust me.
The next thing I notice is the conspicuous absence of our friend GetLastError(). You should be calling this so often that you get sick of seeing it. He holds the answer to your questions, I guarantee it.