I have spent the last couple of weeks assisting one of our client re-mediate some of the hundreds of VB6, Word, Excel and Outlook VBA add-ins in preparation for their XP to Windows 7 upgrade. It is no small task, believe me.
One of the earliest issues we ran into was for verifying registry changes made. It looked like the registry keys these add-ins modify were not being saved.
Consider this scenario: A user logs into windows and a VB6 assembly is run that query’s active directory and sets a registry key value to true or false if they belong one a particular user group. This setting is stored under:
HKEY_CURRENT_USER > Software > CompanyName > Setting
When we try to verify that the setting has been saved we try to open regedit and are prompted to enter User Credentials, so we enter the Administrator’s. When we look for the setting it doesn’t exist. But why? Our code didn’t throw any errors and after adding debug information RegCreateKeyEx returned a successful result.
It turns out the issue was with our verification. If you supply Admin Credentials in Windows 7 to run regedit it shows the Admin users HKEY_CURRENT_USER settings… Arg! It turns out when you run regedit you can just re-enter the Standard User’s password again to gain access.