Even as an admin you don't have KEY_ALL_ACCESS on HKLM when UAC is enabled. If you want or need KEY_ALL_ACCESS you Need to run your program elevated.
Reduce your rights to the needed Level. If you only want to read just use KEY_READ!
And take care that you have an embedded manifest, without a manifest you might get access, but tis access is virtualized and you don't get access to the real key.