enthought / enthought/comtypes

Access violations while using IUIA from UIAutomationClient.dll (Win8.1 x64, Py3.4 x64)

Open
#98 5 comments 0 reactions 0 assignees View on GitHub
64-bit bug
Dominant language
Python
Stars
345
Forks
105
PR merge metrics
No merged PRs in 30d

Description

We use `UIAutomationClient.dll` through comtypes in [pywinauto](https://github.com/pywinauto/pywinauto) GUI automation project. Everything worked fine until we started using `PropertyCondition` objects and other more complicated things.

I found out that comtypes raises strange access violation errors on Win8.1 and even Win7.

On Win7 x64 I could get rid of them by upgrading comtypes from 1.1.1 to 1.1.2.

But on Win8.1 x64 I'm still having such errors on comtypes 1.1.2 and ActivePython 3.4.1 (64-bit).

To reproduce it just download [UIA branch of pywinauto](https://github.com/pywinauto/pywinauto/tree/UIA) and run `python.exe .\pywinauto\unittests\test_UIAWrapper.py` on them. If many WPF app windows are not closed, just run `taskkill /F /T /IM WpfApplication1.exe` to clean them up.

The output of `test_UIAWrapper.py` contains the following errors:

``` python
Exception ignored in:
Traceback (most recent call last):
File "C:\Python34_x64\lib\site-packages\comtypes-1.1.2-py3.4.egg\comtypes\automation.py", line 193, in __del__
_VariantClear(self)
OSError: exception: stack overflow
Exception ignored in:
Traceback (most recent call last):
File "C:\Python34_x64\lib\site-packages\comtypes-1.1.2-py3.4.egg\comtypes\automation.py", line 193, in __del__
_VariantClear(self)
OSError: exception: access violation writing 0x0000000000420000
```

After that you may find pywinauto unit tests errors:

```
File ".\pywinauto\uia_defines.py", line 82, in build_condition
self.UIA_dll.UIA_ProcessIdPropertyId, process))
ctypes.ArgumentError: argument 2: : exception: access violation writing 0x0000000000420000
```

Just in case:

```
C:\Python34_x64\Scripts\pip.exe freeze
Pillow==2.7.0
comtypes==1.1.2
coverage==4.0a5
pypiwin32==219
pypm==1.4.3
pythonselect==1.3
pywin32==219
virtualenv==1.11.6
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.