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

HWBreakPointHook call original function? #141

Closed
illumen opened this issue Jun 11, 2022 · 1 comment
Closed

HWBreakPointHook call original function? #141

illumen opened this issue Jun 11, 2022 · 1 comment

Comments

@illumen
Copy link

illumen commented Jun 11, 2022

Hi,

Is it possible to call the original function from the hook without getting into an infinite loop?
The code below will loop indefinitely:

#include "polyhook2/Exceptions/HWBreakPointHook.hpp"

PLH::HWBreakPointHook* hook;

NOINLINE void __cdecl TestFn()
{
	std::cout << "test" << std::endl;
}

NOINLINE void __cdecl TestFnH()
{
	hook->getProtectionObject();

	std::cout << "test2" << std::endl;

	return TestFn();
}

int main()
{
	hook = new PLH::HWBreakPointHook((char*)&TestFn, (char*)&TestFnH, GetCurrentThread());
	hook->hook();

	TestFn();

	return 0;
}
@illumen illumen closed this as completed Jun 11, 2022
@stevemk14ebr
Copy link
Owner

stevemk14ebr commented Jun 11, 2022

What was the issue. Not setting the protection object to a local variable perhaps?

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

2 participants