Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ libc = "0.2.149"
libloading = "0.8"
log = "0.4.*"
highfleet-mod-api = { path = "crates/highfleet-mod-api" }
patchy = { package = "patchy-rs", git = "https://github.com/logdot/patchy-rs.git", rev = "84993c490f7db47e915d7e0b4270eb3f36f614de" }
patchy = { package = "patchy-rs", git = "https://github.com/logdot/patchy-rs.git", rev = "19e4f77b8987329fc46cfe6c886f11e4e67528a6" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sha2 = "0.10.*"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ manifest and call `patchy::export_patchy!()` once at the crate root.
`PatchSession::new()` then returns a loader-owned session or an error if the
service was unavailable or incompatible. `overwrite`, `patch_call`, and
`install_permanently` use the usual Patchy call shape. `overwrite_named`
supplies a diagnostic name. `detour_trampoline_with` uses the shared Patchy
supplies a diagnostic name. `detour_trampoline` uses the shared Patchy
builder on the mod side, while the loader resolves placement, replay, and
resume. Replay is verbatim; it does not relocate displaced instructions.
There is no local Patchy fallback. See the
Expand Down
2 changes: 1 addition & 1 deletion crates/highfleet-patchy-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish = false

[dependencies]
highfleet-mod-api = { path = "../highfleet-mod-api" }
patchy-code = { git = "https://github.com/logdot/patchy-rs.git", rev = "84993c490f7db47e915d7e0b4270eb3f36f614de" }
patchy-code = { git = "https://github.com/logdot/patchy-rs.git", rev = "19e4f77b8987329fc46cfe6c886f11e4e67528a6" }
thiserror = "2"

[target.'cfg(windows)'.dependencies]
Expand Down
15 changes: 1 addition & 14 deletions crates/highfleet-patchy-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,19 +282,6 @@ impl PatchSession {
}
}

/// Stages an already built custom trampoline.
///
/// # Safety
/// The site and trampoline must satisfy [`Self::detour_trampoline_with`].
pub unsafe fn detour_trampoline(
&mut self,
address: usize,
size: usize,
trampoline: Trampoline,
) -> Result<Patch> {
unsafe { self.detour_trampoline_with(address, size, |_| Ok(trampoline)) }
}

/// Builds a custom trampoline locally, then sends the compiled plan to
/// the loader. The host captures the source bytes and resolves placement.
/// No closure crosses the ABI.
Expand All @@ -305,7 +292,7 @@ impl PatchSession {
/// The generated code must leave valid machine state on every exit.
/// Any replay must satisfy [`DetourSite::replay_verbatim`], and referenced
/// callbacks and data must stay live through process exit if installed.
pub unsafe fn detour_trampoline_with<F>(
pub unsafe fn detour_trampoline<F>(
&mut self,
address: usize,
size: usize,
Expand Down
2 changes: 1 addition & 1 deletion crates/highfleet-patchy-client/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ fn custom_detour_sends_replay_and_resume_as_fixups() {
let (calls, host) = mock();
let mut session = PatchSession::from_host(host).unwrap();
let patch = unsafe {
session.detour_trampoline_with(0x1000, 5, |site| {
session.detour_trampoline(0x1000, 5, |site| {
let mut code = Trampoline::new();
site.replay_verbatim(&mut code);
site.resume(&mut code);
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/patchy-mod/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn stage_conditional_replay(session: &mut PatchSession) -> patchy::Result {
// SAFETY: The fixture owns the source and only calls it before or after
// installation. The displaced instructions can be replayed verbatim.
unsafe {
session.detour_trampoline_with(address, 5, |site| {
session.detour_trampoline(address, 5, |site| {
let mut code = Trampoline::new();
let skip = code.new_label();
code.bytes(&[0x85, 0xc9]); // TEST ECX, ECX
Expand Down