Skip to content

Commit acefa5c

Browse files
Merge 536168d into 2b2f347
2 parents 2b2f347 + 536168d commit acefa5c

2 files changed

Lines changed: 33 additions & 5 deletions

File tree

source/NVDAObjects/UIA/__init__.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,10 +1109,10 @@ def findOverlayClasses(self, clsList): # NOQA: C901
11091109
clsList.append(spartanEdge.EdgeList)
11101110
else:
11111111
clsList.append(spartanEdge.EdgeNode)
1112-
elif self.windowClassName == "Chrome_WidgetWin_1" and self.UIATextPattern:
1113-
from . import chromium
1114-
clsList.append(chromium.ChromiumUIA)
1115-
elif self.windowClassName == "Chrome_RenderWidgetHostHWND":
1112+
elif (
1113+
self.windowClassName == "Chrome_RenderWidgetHostHWND"
1114+
or self.UIAElement.cachedFrameworkID == "Chrome"
1115+
):
11161116
from . import chromium
11171117
from . import web
11181118
if (
@@ -1126,6 +1126,15 @@ def findOverlayClasses(self, clsList): # NOQA: C901
11261126
if self.role == controlTypes.Role.LIST:
11271127
clsList.append(web.List)
11281128
clsList.append(chromium.ChromiumUIA)
1129+
elif (
1130+
(
1131+
self.windowClassName == "Chrome_WidgetWin_1"
1132+
or self.UIAElement.cachedFrameworkID == "Chrome"
1133+
)
1134+
and self.UIATextPattern
1135+
):
1136+
from . import chromium
1137+
clsList.append(chromium.ChromiumUIA)
11291138
elif (
11301139
self.role == controlTypes.Role.DOCUMENT
11311140
and UIAAutomationId == "Microsoft.Windows.PDF.DocumentView"

source/UIAHandler/__init__.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777

7878
# The name of the WDAG (Windows Defender Application Guard) process
7979
WDAG_PROCESS_NAME=u'hvsirdpclient'
80+
# The window class of the WDAG (Windows Defender Application Guard) main window
81+
WDAG_WINDOW_CLASS_NAME=u'RAIL_WINDOW'
8082

8183
goodUIAWindowClassNames = (
8284
# A WDAG (Windows Defender Application Guard) Window is always native UIA, even if it doesn't report as such.
@@ -1214,10 +1216,27 @@ def getNearestWindowHandle(self, UIAElement):
12141216
return None
12151217
appModule = appModuleHandler.getAppModuleFromProcessID(processID)
12161218
# WDAG (Windows Defender application Guard) UIA elements should be treated as being from a remote machine, and therefore their window handles are completely invalid on this machine.
1217-
# Therefore, jump all the way up to the root of the WDAG process and use that window handle as it is local to this machine.
1219+
# Unfortunately the remote UIA tree is not parented into the local tree.
1220+
# Therefore, just use the currently active WDAG local window as the nearest window.
12181221
if appModule.appName == WDAG_PROCESS_NAME:
12191222
if _isDebug():
12201223
log.debug("Detected WDAG element")
1224+
gi = winUser.getGUIThreadInfo(0)
1225+
if (
1226+
winUser.getClassName(gi.hwndActive) == WDAG_WINDOW_CLASS_NAME
1227+
and winUser.getWindowThreadProcessID(gi.hwndActive)[0] == processID
1228+
):
1229+
if _isDebug():
1230+
log.debug(
1231+
f"using active WDAG local window {self.getWindowHandleDebugString(gi.hwndActive)}"
1232+
)
1233+
return gi.hwndActive
1234+
else:
1235+
if _isDebug():
1236+
log.debug(
1237+
f"Active window is not WDAG or is wrong instance: {self.getWindowHandleDebugString(gi.hwndActive)}"
1238+
)
1239+
return None
12211240
condition = utils.createUIAMultiPropertyCondition(
12221241
{UIA.UIA_ClassNamePropertyId: ['ApplicationFrameWindow', 'CabinetWClass']}
12231242
)

0 commit comments

Comments
 (0)