diff --git a/source/NVDAHelper.py b/source/NVDAHelper.py index 0d833ffbbbb..3ab07dea725 100755 --- a/source/NVDAHelper.py +++ b/source/NVDAHelper.py @@ -511,11 +511,14 @@ def initialize(): if config.isAppX: log.info("Remote injection disabled due to running as a Windows Store Application") return - #Load nvdaHelperRemote.dll but with an altered search path so it can pick up other dlls in lib + # Load nvdaHelperRemote.dll h = windll.kernel32.LoadLibraryExW( os.path.join(versionedLibPath, "nvdaHelperRemote.dll"), 0, - 0x8 + # Using an altered search path is necessary here + # As NVDAHelperRemote needs to locate dependent dlls in the same directory + # such as minhook.dll. + winKernel.LOAD_WITH_ALTERED_SEARCH_PATH ) if not h: log.critical("Error loading nvdaHelperRemote.dll: %s" % WinError()) diff --git a/source/nvda_slave.pyw b/source/nvda_slave.pyw index aeb18e639bb..81412162954 100755 --- a/source/nvda_slave.pyw +++ b/source/nvda_slave.pyw @@ -11,6 +11,7 @@ Performs miscellaneous tasks which need to be performed in a separate process. import sys import os import globalVars +import winKernel # Initialise comtypes.client.gen_dir and the comtypes.gen search path @@ -95,7 +96,10 @@ def main(): h = ctypes.windll.kernel32.LoadLibraryExW( os.path.join(globalVars.appDir, "lib", versionInfo.version, "nvdaHelperRemote.dll"), 0, - 0x8 + # Using an altered search path is necessary here + # As NVDAHelperRemote needs to locate dependent dlls in the same directory + # such as minhook.dll. + winKernel.LOAD_WITH_ALTERED_SEARCH_PATH ) remoteLib=ctypes.WinDLL("nvdaHelperRemote",handle=h) ret = remoteLib.nvdaControllerInternal_installAddonPackageFromPath(addonPath) diff --git a/source/winKernel.py b/source/winKernel.py index 5dfda1880af..8645d295103 100644 --- a/source/winKernel.py +++ b/source/winKernel.py @@ -48,6 +48,9 @@ WAIT_FAILED = 0xffffffff # Image file machine constants IMAGE_FILE_MACHINE_UNKNOWN = 0 +# LoadLibraryEx constants +LOAD_WITH_ALTERED_SEARCH_PATH = 0x8 + def GetStdHandle(handleID): h=kernel32.GetStdHandle(handleID)