set<HHOOK> inprocCurrentWindowsHooks;\r
long tlsIndex_inThreadInjectionID=0;\r
bool isProcessExiting=false;\r
+bool isSecureModeNVDAProcess=false;\r
\r
//Code executed in-process\r
\r
}\r
}\r
\r
+//A replacement OpenClipboard function to disable the use of the clipboard in a secure mode NVDA process\r
+//Simply returns false without calling the original OpenClipboard\r
+typedef BOOL(WINAPI *OpenClipboard_funcType)(HWND);\r
+OpenClipboard_funcType real_OpenClipboard=NULL;\r
+BOOL WINAPI fake_OpenClipboard(HWND hwndOwner) {\r
+ return false;\r
+}\r
+\r
//A thread function that runs while NVDA is injected in a process.\r
//Note that a mutex is used to make sure that there is never more than one copy of this thread in a given process at any given time.\r
//I.e. Another copy of NVDA is started while the first is still running.\r
}\r
//Initialize API hooking\r
apiHook_initialize();\r
+ //Fore secure mode NVDA process, hook OpenClipboard to disable usage of the clipboard\r
+ if(isSecureModeNVDAProcess) real_OpenClipboard=apiHook_hookFunction_safe("USER32.dll",OpenClipboard,fake_OpenClipboard);\r
//Initialize in-process subsystems\r
inProcess_initialize();\r
//Enable all registered API hooks\r
BOOL outprocInitialized=FALSE;\r
HANDLE injectionDoneEvent=NULL;\r
\r
-BOOL injection_initialize() {\r
+/**\r
+ * Initializes the out-of-process code for NVDAHelper \r
+ * @param secureMode 1 specifies that NVDA is running in seucre mode, 0 says not.\r
+ */ \r
+BOOL injection_initialize(int secureMode) {\r
+ if(secureMode) isSecureModeNVDAProcess=true;\r
if(outprocInitialized) {\r
MessageBox(NULL,L"Already initialized",L"nvdaHelperRemote (injection_initialize)",0);\r
return FALSE;\r
log.critical("Error loading nvdaHelperRemote.dll: %s" % WinError())\r
return\r
_remoteLib=CDLL("nvdaHelperRemote",handle=h)\r
- if _remoteLib.injection_initialize() == 0:\r
+ if _remoteLib.injection_initialize(globalVars.appArgs.secure) == 0:\r
raise RuntimeError("Error initializing NVDAHelperRemote")\r
if os.environ.get('PROCESSOR_ARCHITEW6432')=='AMD64':\r
_remoteLoader64=RemoteLoader64()\r