edit: Sorry, I misunderstood the question. Do the flag thing. :p
If you are on a 64bit operating system, you will have a "folder" in the HKLM\Software and HKCU\Software keys named Wow6432Node. That is like a junction point that allows Windows to maintain backwards compatibility across architectures, and basically transparently redirects the 32bit program that is accessing the registry.
So even if you are executing 32bit code, if you are on a 64bit version of Windows, modifying HKLM\Software\Mysoftware is the 64bit registry. If you needed to modify the 32bit registry, it would HKLM\Software\Wow6432Node\MySoftware.
Here I am about to set 32bit ODBC connections, even on a 64bit OS. It also works on a 32bit OS. No flag setting is required. This code works.