stevemk14ebr / PolyHook_2_0

C++20, x86/x64 Hooking Libary v2.0
MIT License
1.6k stars 227 forks source link

Helper function for creating hardware breakpoints #109

Closed pitoriex closed 2 years ago

pitoriex commented 2 years ago

Hello, I was wondering if there are any plans to add a helper function that registers a hardware breakpoint on all threads at once in the current process. The current way a hardware breakpoint is created with the thread handle parameter looks more like a library-internal function than one that should be used by the end user.

Like, what would be the suggested way of using it? Using CreateToolhelp32Snapshot, Thread32First and Thread32Next to iterate all threads and create a PLH::HWBreakPointHook for each thread? That doesn't sound very end user friendly.

Thanks for any thoughts!

stevemk14ebr commented 2 years ago

It was intentionally done this way to give the user freedom to choose how they want to get a handle. There are other ways than just toolhelp to get a handle, and sometimes you might already have one. If you want to contribute a PR to add a handle enumerator helper or something I would review it, but I will not implement this myself.