injectlib is a Python package that allows you to inject DLLs into running processes on Windows (32 or 64-bit).
This can be useful for various tasks, such as debugging or adding functionality to existing applications.
This is initially created for desktop GUI automation purpose (project pywinauto), because an injected DLL can access GUI widgets' text properties with much better precision and coverage than standard OS APIs like MS UI Automation API or Win32 API. Other use cases are potentially possible at your own risk according to the law and the project license.
It contains:
- initial DLL to be injected which is written in C,
- server-side DLL that can exchange data between injected DLL (server) and Python process (client),
- managed DLL which is able to get text properties of WPF applications,
- DLL which is able to get text properties of Qt applications,
- Python code to initiate the injection,
- and client Python code for data exchange with an injected DLL.
Link to PyPi: https://pypi.org/project/injectlib/
python.exe example_injector.py \<Process name\> \<path to dll\>
-
Clone repository: https://github.com/pywinauto/injectlib.git
-
Create new features or improve exiting (for the injectlib package)
-
After work run setup.py from project root to check standalone
python.exe setup.py bdist_wheel
- Python >= 3.7
- pywin32 >= 306
-
setuptools >= 65.5.1
-
wheel >= 0.38.4
-
.NET Framework Targeting Pack >= 4.8
-
.NET Compiler Platform
-
MSBuild
-
MSVC >= 143
-
cmake >= 3.26.3
-
Qt >= 5.15.2, < 6
NOTE: You may use PyCharm + Visual Studio with C++/C# components for development
This package compiles C++ binaries that link against Qt 5 (>=5.15.2, <6). Qt is not bundled and must be installed separately before building.
- Windows download options:
- download via Qt Online Installer and select the MSVC 2019 64-bit component. Registration required. Installation might be banned for some countries
- via mirrors, for example, https://mirror.yandex.ru/mirrors/qt.io. Base package for Qt 5.15.2 can be found here. No registration required.
Once installed, point CMake to your Qt installation by setting CMAKE_PREFIX_PATH:
# Windows (adjust version/compiler as needed)
set CMAKE_PREFIX_PATH=C:/Qt/5.15.2/msvc2019_64If CMake still cannot find Qt, verify the path contains a lib/cmake/Qt5 subdirectory.
This software is open-source under the BSD 3-Clause License.
See the LICENSE file in this repository.
Dependencies are licensed by their own licenses.