Repaired the COM Registration Fixing Tool so it is more effective on 64bit Windows (Partial fix of #9039).
Problems:
- The registerServer function called the 32-bit version of regsvr32.exe, even in 64-bit contexts.
- The applyRegistryPatch function called the 32-bit version of regedit, even in 64-bit contexts.
- The Win7 32-bit run did not take into account 32-bit only systems (no Program Files (x86) folder).
Remediation:
- Replaced applyRegistryPatch function with two new functions: apply32bitRegistryPatch and apply64bitRegistryPatch.
- Replaced registerServer function with register32bitServer and register64bitServer, to make clear what they do.
- The new functions don't check 32/64 bitness; they leave that to the caller and log errors on failure.
- Updated to more descriptive error logging.
- Adjusted the Windows 7 code to use server registration with proper bitness for each DLL.
Path remediations:
- Moved the OLEACC_REG_FILE_PATH constant to the top of the file with the rest.
- Added sysnative path to the list of path constants at the top of the file.
- Now use Sysnative in the path for intentional 64bit calls.
- Now use System32 in the path for 32-bit calls on either 32-bit or 64-bit systems.
- Now use reg.exe's import option to load .reg files instead of regedit.exe.
- Now check whether to use "Program Files" or "Program Files (x86)" on Win7.
- Removed now unused sysWow64 path constant.
Misc:
- Added docstring note about 32 and 64 bit functions needing attention if NVDA goes 64-bit in the future.
- Converted path constants to uppercase-with-underscore style, and corrected case on some Windows paths.
- Moved comments with discussion links into module docstring, and rearranged.
- Used subprocess.STARTUPINFO to prevent console windows from being shown.
- In gui/__init__.py: added a recommendation that the user restart the computer, to the completion message.