Git Product home page Git Product logo

Comments (8)

 avatar commented on June 12, 2024

Sadly this is impossible without modifying detour source itself. I'll probably redisign it a bit, shortly.

from blackbone.

spinninglock avatar spinninglock commented on June 12, 2024

Alright, no worries.

Another thought - if there was some method like Detour.Original(...) then this would allow us to execute our both before and after which is pretty useful.

Cheers!

from blackbone.

 avatar commented on June 12, 2024

You could potentially copy over the last few bytes by including a function that searches through the function for 0xC3 (RET) and other wanted bytes for "return x;". It would look something like->

void *retloc = SaveReturn(function, detour);

I could try to make it if you're too busy DarthTon (though I suck at git in general ._. ).

from blackbone.

 avatar commented on June 12, 2024

Yeah, pull request will be nice.

from blackbone.

aeo24 avatar aeo24 commented on June 12, 2024

Can you not Returntype::new remove detour call original save result reapply detour and then return your value or the new value depending on criteria?

from blackbone.

neoz avatar neoz commented on June 12, 2024

I think current version support it already. My example code is working:

#define BLACKBONE_STATIC
#include <LocalHook/LocalHook.hpp>
#pragma comment(lib,"BlackBone.lib")

blackbone::Detour<decltype(&MessageBoxA)> det;

int WINAPI myMessageBoxA(
In_opt HWND & hWnd,
In_opt LPCSTR & lpText,
In_opt LPCSTR & lpCaption,
In UINT & uType)
{
return det.CallOriginal((HWND&&)hWnd, (LPCSTR&&)"Test", (LPCSTR&&)lpCaption, (UINT&&)uType);
return 0;
}

int _tmain(int argc, _TCHAR* argv[])
{
decltype(&MessageBoxA) orgaddr = (decltype(&MessageBoxA))GetProcAddress(GetModuleHandleA("user32.dll"), "MessageBoxA");
bool tmp = det.Hook(orgaddr, &myMessageBoxA, blackbone::HookType::HWBP,blackbone::CallOrder::NoOriginal,blackbone::ReturnMethod::UseNew);

MessageBoxA(0, 0, 0, 0);

det.Restore();

return 0;
}

from blackbone.

DaveHumph avatar DaveHumph commented on June 12, 2024

i have problem on blackbone detour.
im try input this. but (blackbone::Detour Detour;) no declaration. can help me? thanks.

from blackbone.

DaveHumph avatar DaveHumph commented on June 12, 2024

oh solved. thank you..
need "LocalHook.hpp"

from blackbone.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.