Hmm..... i think i see where the confusion comes from.
KEY_WOW64_32KEY defines the Access-Rights i request when accessing the Registry.
If i'm lazy i could just request KEY_ACCESS_ALL (or whatever it's called)
No, KEY_WOW64_xxKEY and KEY_ACCESS_ALL are two different things.
If you have a 32 bit application and you want
total access to the
entire registry tree (including the 64 bit ones in SOFTWARE) then you pass KEY_WOW64_64KEY. In that case you have the 32 bit registry in the WOW6432Node. But you passed KEY_WOW64_32KEY for 32 bit app in your example. Then you only have access to the 32 bit and you don't get a WOW6432Node node (konikula confirmed that).
But... directly accessing WOW6432Node (via KEY_WOW64_64KEY) isn't advised supported (see that article from Microsoft).
So you should pass KEY_WOW64_32KEY if your searching for 32 bit but then you don't have the WOW6432Node because you are already in that.
BTW. In my program I do KEY_WOW64_64KEY and access both Software and Software/WOW6432Node because then you can do it in one go. If you want to check for 32 AND 64 bit then you would officially need to close and reopen the registry (which with KEY_WOW64_64KEY isn't nessecary because you have that 'forbidden' WOW6432Node).
I may suffice without ifdef, and without further recognising version of OS. Am I right?
Yes.
If you only target 32 bit ODBC because you have a 32 bit application, you don't even need to do anything special. Your 32 bit application will only search for 32 bit ODBC in Software (which is Software/WOW6432Node on 64 bit OS and Software on a 32 bit OS). You only need the special KEY_WOW if you want to detect another bitness of the ODBC (which you don't need to).