Permalink
Browse files

Merge all vbufBackend dlls into nvdaHelperRemote.dll (#8866)

* All vbufBackend dlls have been merged into nvdaHelperRemote.dll.

* Address review comments.

* Update what's new.
  • Loading branch information...
michaelDCurran committed Oct 30, 2018
1 parent 5fe34c5 commit 24f5123748015daee35af2ea8e5921008843087b
@@ -29,8 +29,6 @@
"ISimpleDOM.dll",
"minHook.dll",
"nvdaHelperRemote.dll",
"VBufBackend_adobeFlash.dll",
"VBufBackend_gecko_ia2.dll",
]
DLL_FILES = [f
for dll in DLL_NAMES
@@ -51,12 +51,6 @@ excludedDistFiles=[
'lib/ISimpleDOM.dll',
'lib/minHook.dll',
'lib/NVDAHelperRemote.dll',
'lib/VBufBackend_adobeAcrobat.dll',
'lib/VBufBackend_adobeFlash.dll',
'lib/VBufBackend_gecko_ia2.dll',
'lib/VBufBackend_lotusNotesRichText.dll',
'lib/VBufBackend_mshtml.dll',
'lib/VBufBackend_webKit.dll',
'lib64/',
'uninstall.exe',
]
@@ -203,39 +203,6 @@ if TARGET_ARCH=='x86_64':
env.AddPostAction(remoteLoaderProgram,[signExec])
env.Install(libInstallDir,remoteLoaderProgram)
vbufBaseStaticLib=env.SConscript('vbufBase/sconscript')
Export('vbufBaseStaticLib')
adobeAcrobatVBufBackend=env.SConscript('vbufBackends/adobeAcrobat/sconscript')
if signExec:
env.AddPostAction(adobeAcrobatVBufBackend[0],[signExec])
env.Install(libInstallDir,adobeAcrobatVBufBackend)
adobeFlashVBufBackend=env.SConscript('vbufBackends/adobeFlash/sconscript')
if signExec:
env.AddPostAction(adobeFlashVBufBackend[0],[signExec])
env.Install(libInstallDir,adobeFlashVBufBackend)
lotusNotesRichTextVBufBackend=env.SConscript('vbufBackends/lotusNotesRichText/sconscript')
if signExec:
env.AddPostAction(lotusNotesRichTextVBufBackend[0],[signExec])
env.Install(libInstallDir,lotusNotesRichTextVBufBackend)
geckoVBufBackend=env.SConscript('vbufBackends/gecko_ia2/sconscript')
if signExec:
env.AddPostAction(geckoVBufBackend[0],[signExec])
env.Install(libInstallDir,geckoVBufBackend)
mshtmlVBufBackend=env.SConscript('vbufBackends/mshtml/sconscript')
if signExec:
env.AddPostAction(mshtmlVBufBackend[0],[signExec])
env.Install(libInstallDir,mshtmlVBufBackend)
webKitVBufBackend=env.SConscript('vbufBackends/webKit/sconscript')
if signExec:
env.AddPostAction(webKitVBufBackend[0],[signExec])
env.Install(libInstallDir,webKitVBufBackend)
if TARGET_ARCH=='x86':
env.SConscript('espeak/sconscript')
env.SConscript('liblouis/sconscript')
@@ -20,6 +20,16 @@ Import([
winIPCUtilsObj=env.Object("./winIPCUtils","../common/winIPCUtils.cpp")
vbufBackendLibs=[
env.SConscript('../vbufBase/sconscript'),
env.SConscript('../vbufBackends/adobeAcrobat/sconscript'),
env.SConscript('../vbufBackends/adobeFlash/sconscript'),
env.SConscript('../vbufBackends/lotusNotesRichText/sconscript'),
env.SConscript('../vbufBackends/gecko_ia2/sconscript'),
env.SConscript('../vbufBackends/mshtml/sconscript'),
env.SConscript('../vbufBackends/webKit/sconscript'),
]
controllerRPCHeader,controllerRPCClientSource=env.MSRPCStubs(
target="./nvdaController",
source=[
@@ -105,6 +115,7 @@ remoteLib=env.SharedLibrary(
displayModelRPCServerSource,
nvdaInProcUtilsRPCServerSource,
"nvdaHelperRemote.def",
vbufBackendLibs,
],
LIBS=[
"user32",
@@ -16,30 +16,42 @@ This license can be found at:
#include "vbufRemote.h"
#include <vbufBase/backend.h>
#include "dllmain.h"
#include <common/log.h>
using namespace std;
map<VBufBackend_t*,HINSTANCE> backendLibHandles;
const map<wstring,VBufBackend_create_proc> VBufBackendFactoryMap {
{L"adobeAcrobat",AdobeAcrobatVBufBackend_t_createInstance},
{L"adobeFlash",AdobeFlashVBufBackend_t_createInstance},
{L"gecko_ia2",GeckoVBufBackend_t_createInstance},
{L"mshtml",MshtmlVBufBackend_t_createInstance},
{L"lotusNotesRichText",lotusNotesRichTextVBufBackend_t_createInstance},
{L"webKit",WebKitVBufBackend_t_createInstance}
};
extern "C" {
VBufRemote_bufferHandle_t VBufRemote_createBuffer(handle_t bindingHandle, int docHandle, int ID, const wchar_t* backendName) {
wchar_t backendPath[MAX_PATH];
wsprintf(backendPath,L"%s\\VBufBackend_%s.dll",dllDirectory,backendName);
HINSTANCE backendLibHandle=LoadLibrary(backendPath);
if(backendLibHandle==NULL) return NULL;
VBufBackend_create_proc createBackend=(VBufBackend_create_proc)GetProcAddress((HMODULE)(backendLibHandle),"VBufBackend_create");
if(createBackend==NULL) {
FreeLibrary(backendLibHandle);
return NULL;
}
if(!backendName) {
LOG_ERROR(L"backendName is NULL");
return nullptr;
}
auto i=VBufBackendFactoryMap.find(backendName);
if(i==VBufBackendFactoryMap.end()) {
LOG_ERROR(L"Unknown backend: "<<backendName);
return nullptr;
}
VBufBackend_create_proc createBackend=i->second;
VBufBackend_t* backend=createBackend(docHandle,ID);
if(backend==NULL) {
FreeLibrary(backendLibHandle);
return NULL;
}
backendLibHandles[backend]=backendLibHandle;
backend->initialize();
// Stop nvdaHelperRemote from being unloaded while a backend exists.
HINSTANCE tempHandle=nullptr;
if(!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,reinterpret_cast<LPCWSTR>(dllHandle),&tempHandle)) {
LOG_ERROR(L"Could not keep nvdaHelperRemote loaded for backend!");
}
return (VBufRemote_bufferHandle_t)backend;
}
@@ -49,13 +61,9 @@ void VBufRemote_destroyBuffer(VBufRemote_bufferHandle_t* buffer) {
#endif
VBufBackend_t* backend=(VBufBackend_t*)*buffer;
backend->terminate();
map<VBufBackend_t*,HINSTANCE>::iterator i=backendLibHandles.find(backend);
if(i==backendLibHandles.end()) return;
HINSTANCE backendLibHandle=i->second;
backendLibHandles.erase(i);
backend->lock.acquire();
backend->destroy();
FreeLibrary(backendLibHandle);
FreeLibrary(dllHandle);
*buffer=NULL;
}
@@ -144,13 +152,12 @@ int VBufRemote_getTextLength(VBufRemote_bufferHandle_t buffer) {
int VBufRemote_getTextInRange(VBufRemote_bufferHandle_t buffer, int startOffset, int endOffset, wchar_t** text, boolean useMarkup) {
VBufBackend_t* backend=(VBufBackend_t*)buffer;
backend->lock.acquire();
VBufStorage_textContainer_t* textContainer=backend->getTextInRange(startOffset,endOffset,useMarkup!=false);
wstring textString=backend->getTextInRange(startOffset,endOffset,useMarkup!=false);
backend->lock.release();
if(textContainer==NULL) {
if(textString.empty()) {
return false;
}
*text=SysAllocString(textContainer->getString().c_str());
textContainer->destroy();
*text=SysAllocString(textString.c_str());
return true;
}
@@ -864,15 +864,9 @@ AdobeAcrobatVBufBackend_t::~AdobeAcrobatVBufBackend_t() {
LOG_DEBUG(L"AdobeAcrobat backend destructor");
}
extern "C" __declspec(dllexport) VBufBackend_t* VBufBackend_create(int docHandle, int ID) {
VBufBackend_t* AdobeAcrobatVBufBackend_t_createInstance(int docHandle, int ID) {
VBufBackend_t* backend=new AdobeAcrobatVBufBackend_t(docHandle,ID);
LOG_DEBUG(L"Created new backend at "<<backend);
return backend;
}
BOOL WINAPI DllMain(HINSTANCE hModule,DWORD reason,LPVOID lpReserved) {
if(reason==DLL_PROCESS_ATTACH) {
_CrtSetReportHookW2(_CRT_RPTHOOK_INSTALL,(_CRT_REPORT_HOOKW)NVDALogCrtReportHook);
}
return true;
}
@@ -14,24 +14,12 @@
Import([
'env',
'vbufBaseStaticLib',
'acrobatAccessRPCStubs',
])
adobeAcrobatBackendLib=env.SharedLibrary(
target="VBufBackend_adobeAcrobat",
source=[
env['projectResFile'],
"adobeAcrobat.cpp",
env.Object('_acrobatAccess_i',acrobatAccessRPCStubs[2]),
],
LIBS=[
vbufBaseStaticLib,
"user32",
"kernel32",
"oleacc",
"oleaut32",
],
)
adobeAcrobatBackendLib=[
env.Object("adobeAcrobat.cpp"),
env.Object('_acrobatAccess_i',acrobatAccessRPCStubs[2]),
]
Return('adobeAcrobatBackendLib')
@@ -302,14 +302,7 @@ void AdobeFlashVBufBackend_t::render(VBufStorage_buffer_t* buffer, int docHandle
AdobeFlashVBufBackend_t::AdobeFlashVBufBackend_t(int docHandle, int ID): VBufBackend_t(docHandle,ID), accPropServices(NULL) {
}
extern "C" __declspec(dllexport) VBufBackend_t* VBufBackend_create(int docHandle, int ID) {
VBufBackend_t* AdobeFlashVBufBackend_t_createInstance(int docHandle, int ID) {
VBufBackend_t* backend=new AdobeFlashVBufBackend_t(docHandle,ID);
return backend;
}
BOOL WINAPI DllMain(HINSTANCE hModule,DWORD reason,LPVOID lpReserved) {
if(reason==DLL_PROCESS_ATTACH) {
_CrtSetReportHookW2(_CRT_RPTHOOK_INSTALL,(_CRT_REPORT_HOOKW)NVDALogCrtReportHook);
}
return true;
}
@@ -14,23 +14,8 @@
Import([
'env',
'vbufBaseStaticLib',
])
adobeFlashBackendLib=env.SharedLibrary(
target="VBufBackend_adobeFlash",
source=[
env['projectResFile'],
"adobeFlash.cpp",
],
LIBS=[
vbufBaseStaticLib,
"user32",
"kernel32",
"oleacc",
"oleaut32",
"ole32",
],
)
adobeFlashBackendLib=env.Object("adobeFlash.cpp")
Return('adobeFlashBackendLib')
@@ -84,7 +84,7 @@ HWND findRealMozillaWindow(HWND hwnd) {
return hwnd;
}
IAccessible2* IAccessible2FromIdentifier(int docHandle, int ID) {
static IAccessible2* IAccessible2FromIdentifier(int docHandle, int ID) {
IAccessible* pacc=NULL;
IServiceProvider* pserv=NULL;
IAccessible2* pacc2=NULL;
@@ -1128,14 +1128,7 @@ GeckoVBufBackend_t::GeckoVBufBackend_t(int docHandle, int ID): VBufBackend_t(doc
GeckoVBufBackend_t::~GeckoVBufBackend_t() {
}
extern "C" __declspec(dllexport) VBufBackend_t* VBufBackend_create(int docHandle, int ID) {
VBufBackend_t* GeckoVBufBackend_t_createInstance(int docHandle, int ID) {
VBufBackend_t* backend=new GeckoVBufBackend_t(docHandle,ID);
return backend;
}
BOOL WINAPI DllMain(HINSTANCE hModule,DWORD reason,LPVOID lpReserved) {
if(reason==DLL_PROCESS_ATTACH) {
_CrtSetReportHookW2(_CRT_RPTHOOK_INSTALL,(_CRT_REPORT_HOOKW)NVDALogCrtReportHook);
}
return true;
}
@@ -14,28 +14,8 @@
Import([
'env',
'vbufBaseStaticLib',
'ia2RPCStubs',
])
ia2utilsObj=env.Object("./ia2utils","../../common/ia2utils.cpp")
geckoBackendLib=env.SharedLibrary(
target="VBufBackend_gecko_ia2",
source=[
env['projectResFile'],
"gecko_ia2.cpp",
ia2utilsObj,
env.Object('_ia2_i',ia2RPCStubs[3]),
],
LIBS=[
vbufBaseStaticLib,
"user32",
"kernel32",
"oleacc",
"oleaut32",
"ole32",
],
)
geckoBackendLib=env.Object("gecko_ia2.cpp")
Return('geckoBackendLib')
@@ -187,14 +187,7 @@ void lotusNotesRichTextVBufBackend_t::render(VBufStorage_buffer_t* buffer, int d
lotusNotesRichTextVBufBackend_t::lotusNotesRichTextVBufBackend_t(int docHandle, int ID): VBufBackend_t(docHandle,ID) {
}
extern "C" __declspec(dllexport) VBufBackend_t* VBufBackend_create(int docHandle, int ID) {
VBufBackend_t* lotusNotesRichTextVBufBackend_t_createInstance(int docHandle, int ID) {
VBufBackend_t* backend=new lotusNotesRichTextVBufBackend_t(docHandle,ID);
return backend;
}
BOOL WINAPI DllMain(HINSTANCE hModule,DWORD reason,LPVOID lpReserved) {
if(reason==DLL_PROCESS_ATTACH) {
_CrtSetReportHookW2(_CRT_RPTHOOK_INSTALL,(_CRT_REPORT_HOOKW)NVDALogCrtReportHook);
}
return true;
}
@@ -14,22 +14,8 @@
Import([
'env',
'vbufBaseStaticLib',
])
lotusNotesRichTextBackendLib=env.SharedLibrary(
target="VBufBackend_lotusNotesRichText",
source=[
env['projectResFile'],
"lotusNotesRichText.cpp",
],
LIBS=[
vbufBaseStaticLib,
"user32",
"kernel32",
"oleacc",
"oleaut32",
],
)
lotusNotesRichTextBackendLib=env.Object("lotusNotesRichText.cpp")
Return('lotusNotesRichTextBackendLib')
Oops, something went wrong.

0 comments on commit 24f5123

Please sign in to comment.