-
Notifications
You must be signed in to change notification settings - Fork 44
Feature:Support using Ctrl+C/X and Ctrl+V to invoke FastCopy #64
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
Open
b1xcy
wants to merge
9
commits into
HO-COOH:master
Choose a base branch
from
b1xcy:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d53c39a
Route Explorer clipboard paste through FastCopy
b1xcy 5f0c82a
Fix malformed MSBuild project closing tag
b1xcy ddf7c0b
Support the desktop as a paste target for Ctrl+V
b1xcy 84300a2
Address review: use WIL for resources and error handling in the keybo…
b1xcy 5b3ec15
Address review: extract ModulePath to Public/ and surface hook startu…
b1xcy 76f4878
Address review: store clipboard paths as wil::unique_cotaskmem_string
b1xcy 45408ad
Address review: keep per-entry skip/fallback semantics in ExplorerFol…
b1xcy 30fdbae
Address review: share shell window wrappers and split the hook into c…
b1xcy 247b2c1
Fix PasteWindow incorrect creation
HO-COOH 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
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
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,58 @@ | ||
| #include "pch.h" | ||
| #include "KeyboardHookController.h" | ||
| #include "../Public/KeyboardHookSettings.h" | ||
| #include "../Public/ModulePath.h" | ||
|
|
||
| #include <wil/resource.h> | ||
| #include <wil/result_macros.h> | ||
|
|
||
| #include <filesystem> | ||
|
|
||
| bool KeyboardHookController::IsEnabled() | ||
| { | ||
| return KeyboardHookSettings::IsEnabled(); | ||
| } | ||
|
|
||
| void KeyboardHookController::SetEnabled(bool enabled) | ||
| { | ||
| if (!KeyboardHookSettings::SetEnabled(enabled)) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| enabled ? Start() : Stop(); | ||
| } | ||
|
|
||
| void KeyboardHookController::Start() | ||
| { | ||
| if (!IsEnabled()) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| auto const hookPath = std::filesystem::path{ ModulePath() }.parent_path() / L"FastCopyKeyboardHook.exe"; | ||
| THROW_HR_IF(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), !std::filesystem::exists(hookPath)); | ||
|
|
||
| STARTUPINFOW startupInfo{ sizeof(startupInfo) }; | ||
| wil::unique_process_information processInfo; | ||
| THROW_IF_WIN32_BOOL_FALSE(CreateProcessW( | ||
| hookPath.c_str(), | ||
| nullptr, | ||
| nullptr, | ||
| nullptr, | ||
| FALSE, | ||
| CREATE_NO_WINDOW, | ||
| nullptr, | ||
| hookPath.parent_path().c_str(), | ||
| &startupInfo, | ||
| processInfo.addressof())); | ||
| } | ||
|
|
||
| void KeyboardHookController::Stop() | ||
| { | ||
| auto const window = FindWindowW(KeyboardHookSettings::WindowClassName, nullptr); | ||
| if (window) | ||
| { | ||
| PostMessageW(window, WM_CLOSE, 0, 0); | ||
| } | ||
| } | ||
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,9 @@ | ||
| #pragma once | ||
|
|
||
| namespace KeyboardHookController | ||
| { | ||
| [[nodiscard]] bool IsEnabled(); | ||
| void SetEnabled(bool enabled); | ||
| void Start(); | ||
| void Stop(); | ||
| } |
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stop cannot find hook window
High Severity
StopusesFindWindowWto locate the hook HWND, butPasteWindowis created as anHWND_MESSAGEwindow.FindWindowWnever searches message-only windows, so disable always fails to postWM_CLOSE. The registry flag flips off while the helper keeps interceptingCtrl+Vuntil reboot. The existingSettingsChangeListeneralready usesFindWindowEx(HWND_MESSAGE, ...)for this case.Additional Locations (1)
FastCopyKeyboardHook/PasteWindow.cpp#L15-L28Reviewed by Cursor Bugbot for commit 247b2c1. Configure here.