-
Notifications
You must be signed in to change notification settings - Fork 10
Add Qt backend #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add Qt backend #10
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
d2c4a89
Сreated package and Wheel build along with DLL files
qzmech 1f1321d
Delete __init__.py from project root
qzmech e77710b
Added build for 32 and 64-bit platform and new README
qzmech 901f10e
Fixed to match code style
qzmech 332702e
Update README.md
qzmech 19e6ad4
Update README.md
qzmech f414e2a
Fixed to match code style 2
qzmech c039cc4
Update README.md
qzmech 3c5e451
Add Qt backend
Makarov-AA 98e9640
Fix required issues
Makarov-AA 39d1590
Fix more issues
Makarov-AA d834e98
Return old dotnet version
Makarov-AA 721e4d9
Remove custom logger support
Makarov-AA bdc36e9
Remove unused import
Makarov-AA f5f9ba6
Return binary files
Makarov-AA fc66eaf
Make requested changes
Makarov-AA b560ddf
Update deprecated version of github actions upload-artifact
Makarov-AA 5262a37
Align cmake versions
Makarov-AA 0f942cf
Try new vs studio version
Makarov-AA f04995b
Fix more codeql issues
Makarov-AA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Requirements for development purposes | ||
|
|
||
| * setuptools >= 65.5.1 | ||
| * wheel >= 0.38.4 | ||
| * .NET Framework Targeting Pack >= 4.8 | ||
| * .NET Compiler Platform | ||
| * MSBuild | ||
| * MSVC >= 143 | ||
| * cmake >= 3.26.3 | ||
|
|
||
| **NOTE**: You may use PyCharm + Visual Studio with C++/C# components for development |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| include injected/libs/dotnet/x86/bootstrap.dll | ||
| include injected/libs/dotnet/x86/Newtonsoft.Json.dll | ||
| include injected/libs/dotnet/x86/worker_wpf.dll | ||
|
|
||
| include injected/libs/dotnet/x64/bootstrap.dll | ||
| include injected/libs/dotnet/x64/Newtonsoft.Json.dll | ||
| include injected/libs/dotnet/x64/worker_wpf.dll | ||
|
|
||
|
|
||
| include injected/libs/hook/x86/pywinmsg32.dll | ||
| include injected/libs/hook/x86/pywinmsg32u.dll | ||
|
|
||
| include injected/libs/hook/x64/pywinmsg64.dll | ||
| include injected/libs/hook/x64/pywinmsg64u.dll |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,65 @@ | ||
| # injected | ||
| Source code of DLLs / assemblies for injection into target process | ||
|
|
||
| usage: | ||
| py -2.7 example_injector.py \<Process name\> \<path to dll\> | ||
| injected 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 process, | ||
| * and client Python code for data exchange with an injected DLL. | ||
|
|
||
| Link to PyPi: <https://pypi.org/project/injected/> | ||
|
|
||
| ## How to use | ||
|
|
||
| python.exe example_injector.py \<Process name\> \<path to dll\> | ||
|
|
||
| ## Development | ||
|
|
||
| 1. Clone repository: <https://github.com/pywinauto/injected.git> | ||
| 2. Create new features or improve exiting (for the injected package) | ||
| 3. After work run setup.py from project root to check standalone | ||
|
|
||
| python.exe setup.py bdist_wheel | ||
|
|
||
| ## Requirements | ||
|
|
||
| ### For use as package | ||
|
|
||
| * Python >= 3.7 | ||
| * pywin32 >= 306 | ||
|
|
||
| ### For development purpose | ||
|
|
||
| * setuptools >= 65.5.1 | ||
| * wheel >= 0.38.4 | ||
| * .NET Framework Targeting Pack >= 4.8 | ||
| * .NET Compiler Platform | ||
| * MSBuild | ||
| * MSVC >= 143 | ||
| * cmake >= 3.26.3 | ||
|
|
||
| **NOTE**: You may use PyCharm + Visual Studio with C++/C# components for | ||
| development | ||
|
|
||
| ## License | ||
|
|
||
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| cmake_minimum_required(VERSION 3.10) | ||
| project(injected_hook) | ||
| add_subdirectory("src/winmsg_listener") | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| cmake_minimum_required(VERSION 3.10) | ||
| project(Testfile) | ||
| add_subdirectory("src/winmsg_listener") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| cmake_minimum_required(VERSION 3.10) | ||
| project(qt_srv LANGUAGES CXX) | ||
|
|
||
| # Make Qt's moc run automatically for files with Q_OBJECT | ||
| set(CMAKE_AUTOMOC ON) | ||
|
|
||
| # Qt5/Qt6 compatible find_package | ||
| find_package(QT NAMES Qt5 COMPONENTS | ||
| Core | ||
| Network | ||
| Gui | ||
| Widgets | ||
| REQUIRED) | ||
| find_package(Qt${QT_VERSION_MAJOR} COMPONENTS | ||
| Core | ||
| Network | ||
| Gui | ||
| Widgets | ||
| REQUIRED) | ||
|
|
||
| add_library(qt_srv SHARED | ||
| dllmain.cpp | ||
| qt_server.h | ||
| qt_server.cpp | ||
| ) | ||
|
|
||
| target_link_libraries(qt_srv PRIVATE | ||
| Qt${QT_VERSION_MAJOR}::Core | ||
| Qt${QT_VERSION_MAJOR}::Network | ||
| Qt${QT_VERSION_MAJOR}::Gui | ||
| Qt${QT_VERSION_MAJOR}::Widgets | ||
| ) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
|
||
| # Optional but nice: stable DLL name | ||
| set_target_properties(qt_srv PROPERTIES OUTPUT_NAME "qt_srv") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #include <windows.h> | ||
| #include <thread> | ||
| #include "qt_server.h" | ||
|
|
||
| // Keep DllMain small and start server in Qt GUI thread | ||
| BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID) { | ||
| switch (ul_reason_for_call) { | ||
| case DLL_PROCESS_ATTACH: | ||
| DisableThreadLibraryCalls(hModule); | ||
|
|
||
| // Spawn a detached worker that will bootstrap on its own time. | ||
| std::thread([] { | ||
| QtHelloServer::bootstrap(); // waits for QCoreApplication, then queues start() on Qt thread | ||
| }).detach(); | ||
| break; | ||
|
|
||
| case DLL_PROCESS_DETACH: | ||
| // Stop on the Qt thread | ||
| QtHelloServer::shutdown(); | ||
| break; | ||
|
|
||
| default: | ||
| break; | ||
| } | ||
| return TRUE; | ||
| } | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.