Learned something new today. Writing a windows service for delivering alerts, but this is the first time I’ve written something on Windows 64 bit (Windows 7 RC to be exact). When I started writing the service it was on 32-bit, so when I moved to x64 I just dumped the email account settings for my service into a .reg file and imported it on the new OS (I don’t have a complete installer for it yet). The settings were written into HKLM\Software\NHS, same as on my 32-bit OS. When I started the service, it crashed. On debugging it, I discovered that the registry settings were not being loaded. My immediate thought was “permissions”, but no the permissions were fine. Eventually it dawned on me that perhaps 32-bit programs are pointed at a different part of the registry when they try to load HKLM with e.g. Registry.LocalMachine.OpenSubKey(“Software”, false). This is indeed the case, your 32-bit programs will all be directed to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node. So now my 32-bit service starts correctly because it now looks in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\NHS for its email settings.

Advertisements