Skip to content
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

How can I use minhook in my project without vcpkg downloading (it's not working for me)? #126

Open
Feluxa opened this issue Feb 10, 2024 · 2 comments

Comments

@Feluxa
Copy link

Feluxa commented Feb 10, 2024

What should I add in my project?

@KnIfER
Copy link

KnIfER commented May 9, 2024

By dragging the source code into your visual studio project. It's very easy use integrate minhook into your project. Because this is a small (but mighty) library.

But notice the difference while building 32/64 dlls. you need to exclude certain files according to your target platform.

image


I'm using this library with GH-injector to make my chrome extension popup window bigger.

I even find a way to iterate very fast —— just write some hook logic use Minhook, press F5 in visual studio, and let AutoHotKey to automatically launch the browser and perform injection.

The GH-injector is awesome and easy to use. You can use their GUI , and from the GUI u can learn how to write an injection command . I then use AutoHotKey to run that command .

I can't find the manual of GH-injector, thus why I asked a question in their issues. but someone closed the entire issue region yesterday. Maybe they need some help?


There's another tool Frida . It's different. It use javascript to inspect
and modify android/windows application at runtime. Maybe it can intercept not only system call but also app functions.

@m417z
Copy link
Collaborator

m417z commented May 9, 2024

@KnIfER shameless self-promotion: If you like playing with the tools you mentioned, you'll also like Windhawk, which provides a convenient platform for developing and sharing Windows mods. It comes with global injection, hooking APIs, and other facilities such as symbol downloading and enumeration out of the box.

Here's a simple example of a mod that hooks a single function:
https://windhawk.net/mods/no-focus-rectangle

image

The implementation is basically this:

BOOL(*pOriginalDrawFocusRect)(
    HDC hDC,
    const RECT *lprc
);

BOOL DrawFocusRectHook(
    HDC hDC,
    const RECT *lprc
) {
    return TRUE; // Returning TRUE because returning FALSE would indicate that the function has failed.
}

BOOL Wh_ModInit() {
    HMODULE hUser32 = GetModuleHandle(L"user32.dll");
    void* origFunc = (void*)GetProcAddress(hUser32, "DrawFocusRect");
    Wh_SetFunctionHook(origFunc, (void*)DrawFocusRectHook, (void**)&pOriginalDrawFocusRect);

    return TRUE;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants