mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 423176 - Crash with jaws 7.1 [@ jhook.dll@0x5311], r=aaronlev, sr=brendan
This commit is contained in:
parent
2e094fcb15
commit
fece706499
@ -37,6 +37,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAccessNodeWrap.h"
|
||||
#include <tchar.h>
|
||||
#include "ISimpleDOMNode_i.c"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
@ -66,6 +67,8 @@ LPFNNOTIFYWINEVENT nsAccessNodeWrap::gmNotifyWinEvent = nsnull;
|
||||
LPFNGETGUITHREADINFO nsAccessNodeWrap::gmGetGUIThreadInfo = nsnull;
|
||||
|
||||
PRBool nsAccessNodeWrap::gIsEnumVariantSupportDisabled = 0;
|
||||
// Used to determine whether an IAccessible2 compatible screen reader is loaded.
|
||||
PRBool nsAccessNodeWrap::gIsIA2Disabled = PR_FALSE;
|
||||
|
||||
nsIAccessibleTextChangeEvent *nsAccessNodeWrap::gTextEvent = nsnull;
|
||||
|
||||
@ -599,6 +602,8 @@ void nsAccessNodeWrap::InitAccessibility()
|
||||
gmGetGUIThreadInfo = (LPFNGETGUITHREADINFO)GetProcAddress(gmUserLib,"GetGUIThreadInfo");
|
||||
}
|
||||
|
||||
DoATSpecificProcessing();
|
||||
|
||||
nsAccessNode::InitXPAccessibility();
|
||||
}
|
||||
|
||||
@ -655,3 +660,40 @@ GetHRESULT(nsresult aResult)
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsAccessNodeWrap::IsOnlyMsaaCompatibleJawsPresent()
|
||||
{
|
||||
HMODULE jhookhandle = ::GetModuleHandleW(NS_LITERAL_STRING("jhook").get());
|
||||
if (!jhookhandle)
|
||||
return PR_FALSE; // No JAWS, or some other screen reader, use IA2
|
||||
|
||||
PRUnichar fileName[MAX_PATH];
|
||||
::GetModuleFileNameW(jhookhandle, fileName, MAX_PATH);
|
||||
|
||||
DWORD dummy;
|
||||
DWORD length = ::GetFileVersionInfoSizeW(fileName, &dummy);
|
||||
|
||||
LPBYTE versionInfo = new BYTE[length];
|
||||
::GetFileVersionInfoW(fileName, 0, length, versionInfo);
|
||||
|
||||
UINT uLen;
|
||||
VS_FIXEDFILEINFO *fixedFileInfo;
|
||||
::VerQueryValueW(versionInfo, L"\\", (LPVOID*)&fixedFileInfo, &uLen);
|
||||
DWORD dwFileVersionMS = fixedFileInfo->dwFileVersionMS;
|
||||
DWORD dwFileVersionLS = fixedFileInfo->dwFileVersionLS;
|
||||
delete [] versionInfo;
|
||||
|
||||
DWORD dwLeftMost = HIWORD(dwFileVersionMS);
|
||||
// DWORD dwSecondLeft = LOWORD(dwFileVersionMS);
|
||||
DWORD dwSecondRight = HIWORD(dwFileVersionLS);
|
||||
// DWORD dwRightMost = LOWORD(dwFileVersionLS);
|
||||
|
||||
return (dwLeftMost < 8
|
||||
|| (dwLeftMost == 8 && dwSecondRight < 2173));
|
||||
}
|
||||
|
||||
void nsAccessNodeWrap::DoATSpecificProcessing()
|
||||
{
|
||||
if (IsOnlyMsaaCompatibleJawsPresent())
|
||||
// All versions below 8.0.2173 are not compatible
|
||||
gIsIA2Disabled = PR_TRUE;
|
||||
}
|
||||
|
@ -158,12 +158,20 @@ class nsAccessNodeWrap : public nsAccessNode,
|
||||
|
||||
static int FilterA11yExceptions(unsigned int aCode, EXCEPTION_POINTERS *aExceptionInfo);
|
||||
|
||||
static PRBool IsOnlyMsaaCompatibleJawsPresent();
|
||||
static void DoATSpecificProcessing();
|
||||
protected:
|
||||
void GetAccessibleFor(nsIDOMNode *node, nsIAccessible **newAcc);
|
||||
ISimpleDOMNode* MakeAccessNode(nsIDOMNode *node);
|
||||
|
||||
static PRBool gIsEnumVariantSupportDisabled;
|
||||
|
||||
/**
|
||||
* Used to determine whether an IAccessible2 compatible screen reader is
|
||||
* loaded. Currently used for JAWS versions older than 8.0.2173.
|
||||
*/
|
||||
static PRBool gIsIA2Disabled;
|
||||
|
||||
/**
|
||||
* It is used in nsHyperTextAccessibleWrap for IA2::newText/oldText
|
||||
* implementation.
|
||||
|
@ -117,7 +117,7 @@ __try {
|
||||
*ppv = static_cast<IEnumVARIANT*>(this);
|
||||
} else if (IID_IServiceProvider == iid)
|
||||
*ppv = static_cast<IServiceProvider*>(this);
|
||||
else if (IID_IAccessible2 == iid)
|
||||
else if (IID_IAccessible2 == iid && !gIsIA2Disabled)
|
||||
*ppv = static_cast<IAccessible2*>(this);
|
||||
|
||||
if (NULL == *ppv) {
|
||||
|
Loading…
Reference in New Issue
Block a user