Skip to content

Commit

Permalink
more api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
altalk23 committed Nov 4, 2024
1 parent f469582 commit 4e5d607
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/target/DarwinTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ geode::Result<> DarwinTarget::writeMemory(void* destination, void const* source,
// (this causes a crash in the result destructor, which is not very good)

auto r1 = this->protectMemory(destination, size, this->getWritableProtection());
auto r2 = r1.isOk() ? this->rawWriteMemory(destination, source, size) : r1;
auto r3 = r1.isOk() ? this->protectMemory(destination, size, oldProtection) : r1;
auto r2 = r1.and_(this->rawWriteMemory(destination, source, size));
auto r3 = r2.and_(this->protectMemory(destination, size, oldProtection));

// permissions restored, it's safe to do result stuff now
if (r1.isErr() || r2.isErr() || r3.isErr()) {
if (r3.isErr()) {
// return the first error
return geode::Err(r1.errorOr(r2.errorOr(r3.unwrapErr())));
return geode::Err(r3.unwrapErr());
}
return geode::Ok();
}
Expand Down
2 changes: 1 addition & 1 deletion test/misc/Mod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void makeHookAndWrapper(void* target, T* func, U** orig) {
std::cout << "unable to create handler: " << handleResult.unwrapErr() << "\n";
exit(1);
}
auto handle = *handleResult;
auto handle = handleResult.unwrap();

auto h_metadata = HookMetadata {
.m_priority = 2
Expand Down

0 comments on commit 4e5d607

Please sign in to comment.