Skip to content

jonasblunck/DynHook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DynHook

Example library for how to dynamically/statically hook/intercept unmanaged functions and APIs

Example code for interepting COM call (excerpt taken from unit test):

	hr = LoadTypeLibEx(CComBSTR("UnitTests.tlb"), REGKIND_REGISTER, &spTypeLib);
	ISC::GetISC().AddTypeLibrary(spTypeLib);

	p = std::auto_ptr<FakeImpl>(new FakeImpl());
	hook.HookInterface(reinterpret_cast<IUnknown*>(p.get()), __uuidof(ITestInterface), &listener);

	p->MethodInt(123);

	Assert::AreEqual("ITestInterface->MethodInt(123)", listener.GetTrace());

Example code for intercepting normal __stdcall unmanaged code (again taken from unit test project):

		s_hookManager.InstallDynamicHook(
			TestDynamicHook::StringFunction, "StringFunction", &s_parameters, &s_listener);

		TestDynamicHook::IntFunction(100, 200);				
		
		Assert::AreEqual("IntFunction(100, 200)", s_listener.GetTrace());

About

Example library for how to dynamically/statically hook/intercept unmanaged functions and APIs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published