Helper for hooking COM interfaces #10

Closed
spazzarama opened this Issue Aug 15, 2015 · 1 comment

Comments

Projects
None yet
1 participant
@spazzarama
Member

spazzarama commented Aug 15, 2015

Moved from CodePlex
Originally submitted by tleibnitz

Just FYI, a class that queries COM interfaces, so you can hook the function. Use it like this:

COMclassQuery.COMclassQuery.COMclassInfo cci = new COMclassQuery.COMclassQuery.COMclassInfo(typeof(AVRSimulatorMKIILib.SimulatorMKIIClass), typeof(AVRSimulatorMKIILib.IAvrTarget), "Run");
COMclassQuery.COMclassQuery.Query(cci);

hookSimMk2Run = EasyHook.LocalHook.Create(cci.FunctionPointer, new Delegate_SimulatorMKIIClass_IAvrTarget_Run(SimulatorMKIIClass_IAvrTarget_Run), null);
hookSimMk2Run.ThreadACL.SetExclusiveACL(new Int32[] { });

Sometimes rpcrt4.dll hijacks (puts proxies into) the vtable, so we need to go little deeper^^

See https://easyhook.codeplex.com/discussions/228910 for source

@spazzarama spazzarama added this to the 2.8 milestone Aug 15, 2015

@spazzarama spazzarama modified the milestones: 2.7 Stable, 2.8 Aug 26, 2015

@spazzarama spazzarama self-assigned this Aug 26, 2015

@spazzarama

This comment has been minimized.

Show comment
Hide comment
@spazzarama

spazzarama Aug 26, 2015

Member

The COM class info class will support using Types + method names or Guids + VTable indices (i.e. there is no need to define C# wrappers for the class / interfaces if you know the interface layout).

Member

spazzarama commented Aug 26, 2015

The COM class info class will support using Types + method names or Guids + VTable indices (i.e. there is no need to define C# wrappers for the class / interfaces if you know the interface layout).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment