Thanks for your feedback everyone.

I'm having this issue on more than one PC. I did wonder if something like group policy was affecting this, or something to do with our Windows installations, so I installed Windows 7 onto a PC and tried it fresh, without joining the domain. Unfortunately it made no difference at all.

I also tried writing to HKCU instead of HKLM - this worked correctly. Interestingly, it also worked correctly without setting the WOW64AlternateRegView flag to on...