NVDA Helper
In-process and lite high-speed utilities for NVDA
|
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <windows.h>
#include <shlwapi.h>
#include <sddl.h>
#include <common/log.h>
#include <common/apiHook.h>
#include <remote/nvdaController.h>
#include <remote/nvdaControllerInternal.h>
#include <common/lock.h>
#include <common/winIPCUtils.h>
#include "dllmain.h"
#include "nvdaHelperRemote.h"
#include "inProcess.h"
#include "rpcSrv.h"
Go to the source code of this file.
Macros | |
#define | WIN32_LEAN_AND_MEAN |
Typedefs | |
typedef HHOOK(WINAPI * | SetWindowsHookEx_funcType) (int, HOOKPROC, HINSTANCE, DWORD) |
Functions | |
void CALLBACK | inproc_winEventCallback (HWINEVENTHOOK hookID, DWORD eventID, HWND hwnd, long objectID, long childID, DWORD threadID, DWORD time) |
HHOOK WINAPI | fake_SetWindowsHookExA (int IdHook, HOOKPROC lpfn, HINSTANCE hMod, DWORD dwThreadId) |
void | killRunningWindowsHooks () |
DWORD WINAPI | inprocMgrThreadFunc (LPVOID data) |
bool | initInprocManagerThreadIfNeeded () |
void CALLBACK | injection_winEventCallback (HWINEVENTHOOK hookID, DWORD eventID, HWND hwnd, long objectID, long childID, DWORD threadID, DWORD time) |
DWORD WINAPI | outprocMgrThreadFunc (LPVOID data) |
BOOL | injection_initialize () |
Initializes the out-of-process code for NVDAHelper. | |
BOOL | injection_terminate () |
Terminates nvdaHelperRemote, allowing it to uninject from any processes. | |
BOOL WINAPI | DllMain (HINSTANCE hModule, DWORD reason, LPVOID lpReserved) |
Variables | |
HINSTANCE | dllHandle =NULL |
wchar_t | dllDirectory [MAX_PATH] |
wchar_t | desktopSpecificNamespace [64] |
LockableObject | inprocThreadsLock |
HANDLE | inprocMgrThreadHandle =NULL |
HWINEVENTHOOK | inprocWinEventHookID =0 |
map< long, HHOOK > | callWndProcHooksByThread |
map< long, HHOOK > | getMessageHooksByThread |
long | tlsIndex_inThreadInjectionID =0 |
bool | isProcessExiting =false |
SetWindowsHookEx_funcType | real_SetWindowsHookExA =NULL |
HANDLE | outprocMgrThreadHandle =NULL |
DWORD | outprocMgrThreadID =0 |
BOOL | outprocInitialized =FALSE |
#define WIN32_LEAN_AND_MEAN |
typedef HHOOK(WINAPI * SetWindowsHookEx_funcType) (int, HOOKPROC, HINSTANCE, DWORD) |
void CALLBACK inproc_winEventCallback | ( | HWINEVENTHOOK | hookID, |
DWORD | eventID, | ||
HWND | hwnd, | ||
long | objectID, | ||
long | childID, | ||
DWORD | threadID, | ||
DWORD | time ) |
References LockableObject::acquire(), callWndProcHooksByThread, dllHandle, getMessageHooksByThread, inProcess_callWndProcHook(), inProcess_getMessageHook(), inProcess_winEventCallback(), inprocThreadsLock, LOG_DEBUGWARNING, LPVOID(), LockableObject::release(), and tlsIndex_inThreadInjectionID.
Referenced by injection_winEventCallback(), and inprocMgrThreadFunc().
HHOOK WINAPI fake_SetWindowsHookExA | ( | int | IdHook, |
HOOKPROC | lpfn, | ||
HINSTANCE | hMod, | ||
DWORD | dwThreadId ) |
void killRunningWindowsHooks | ( | ) |
References callWndProcHooksByThread, and getMessageHooksByThread.
Referenced by DllMain(), and inprocMgrThreadFunc().
DWORD WINAPI inprocMgrThreadFunc | ( | LPVOID | data | ) |
References LockableObject::acquire(), apiHook_beginTransaction(), apiHook_commitTransaction(), apiHook_hookFunction_safe(), apiHook_terminate(), dllHandle, fake_SetWindowsHookExA(), inproc_winEventCallback(), inProcess_initialize(), inProcess_terminate(), inprocMgrThreadHandle, inprocThreadsLock, inprocWinEventHookID, killRunningWindowsHooks(), LOG_ERROR, log_flushQueue(), nhAssert, nvdaUnregisteredEvent, real_SetWindowsHookExA, LockableObject::release(), rpcSrv_initialize(), and rpcSrv_terminate().
Referenced by initInprocManagerThreadIfNeeded().
bool initInprocManagerThreadIfNeeded | ( | ) |
References LockableObject::acquire(), inprocMgrThreadFunc(), inprocMgrThreadHandle, inprocThreadsLock, LOG_ERROR, LPVOID(), and LockableObject::release().
Referenced by injection_winEventCallback().
void CALLBACK injection_winEventCallback | ( | HWINEVENTHOOK | hookID, |
DWORD | eventID, | ||
HWND | hwnd, | ||
long | objectID, | ||
long | childID, | ||
DWORD | threadID, | ||
DWORD | time ) |
References initInprocManagerThreadIfNeeded(), inproc_winEventCallback(), inprocWinEventHookID, and isProcessExiting.
Referenced by outprocMgrThreadFunc().
DWORD WINAPI outprocMgrThreadFunc | ( | LPVOID | data | ) |
References dllHandle, and injection_winEventCallback().
Referenced by injection_initialize().
BOOL injection_initialize | ( | ) |
Initializes the out-of-process code for NVDAHelper.
Initializes nvdaHelperRemote, and allows it to inject in to processes.
References dllHandle, nhAssert, outprocInitialized, outprocMgrThreadFunc(), outprocMgrThreadHandle, and outprocMgrThreadID.
Referenced by WinMain().
BOOL injection_terminate | ( | ) |
Terminates nvdaHelperRemote, allowing it to uninject from any processes.
References outprocInitialized, outprocMgrThreadHandle, and outprocMgrThreadID.
Referenced by WinMain().
References apiHook_terminate(), callWndProcHooksByThread, desktopSpecificNamespace, dllDirectory, dllHandle, generateDesktopSpecificNamespace(), getMessageHooksByThread, inprocMgrThreadHandle, inprocWinEventHookID, isProcessExiting, killRunningWindowsHooks(), NVDALogCrtReportHook(), and tlsIndex_inThreadInjectionID.
HINSTANCE dllHandle =NULL |
wchar_t dllDirectory[MAX_PATH] |
Referenced by DllMain(), and registerCOMProxy().
wchar_t desktopSpecificNamespace[64] |
Referenced by DllMain(), and startServer().
LockableObject inprocThreadsLock |
HANDLE inprocMgrThreadHandle =NULL |
HWINEVENTHOOK inprocWinEventHookID =0 |
Referenced by DllMain(), injection_winEventCallback(), and inprocMgrThreadFunc().
map<long,HHOOK> callWndProcHooksByThread |
Referenced by DllMain(), fake_SetWindowsHookExA(), inproc_winEventCallback(), and killRunningWindowsHooks().
map<long,HHOOK> getMessageHooksByThread |
Referenced by DllMain(), fake_SetWindowsHookExA(), inproc_winEventCallback(), and killRunningWindowsHooks().
long tlsIndex_inThreadInjectionID =0 |
Referenced by DllMain(), and inproc_winEventCallback().
bool isProcessExiting =false |
Referenced by DllMain(), and injection_winEventCallback().
SetWindowsHookEx_funcType real_SetWindowsHookExA =NULL |
Referenced by fake_SetWindowsHookExA(), and inprocMgrThreadFunc().
HANDLE outprocMgrThreadHandle =NULL |
Referenced by injection_initialize(), and injection_terminate().
DWORD outprocMgrThreadID =0 |
Referenced by injection_initialize(), and injection_terminate().
BOOL outprocInitialized =FALSE |
Referenced by injection_initialize(), and injection_terminate().