Studio:Delegating ISHELL SendEvent
Jump to navigation
Jump to search
When trying to dynamically intercept a call for the application under test, intercepting only the call/method of interest was difficult when delegating the IShell Virtual Table, as it allows all methods to be intercepted for all callers.
Delegating the user's call to the IShell helper macro ISHELL_SendEvent is a better method. ISHELL_SendEvent is defined in AEEShell.h as follows:
#define ISHELL_SendEvent(p,cls,ec,wp,dw)
GET_PVTBL(p,IShell)->SendEvent(p,0,cls,ec,wp,dw)
This requires a small amount of instrumentation to the calling application, essentially to define the Group ID and include IM.h. You must also complete the following steps:
- Ensure that the calling application is using the helper macro to call the Send event.
- Add the following code to the AEEShell.h file instead of the #ifdef _SCL conditional block:
- Create a user-mangled dynamic delegate for the function ISHELL_SendEvent.
- Add the instrumentation to the calling application's code:
#undef ISHELL_SendEvent
int ISHELL_SendEvent(IShell *po, AEECLSID cls, AEEEvent eCode, uint16 wParam, uint32 dwParam);
#pragma scl_function(ISHELL_SendEvent)
#pragma scl_ptr_opaque(ISHELL_SendEvent,po)
#define <groupid-name>
#include <name>IM.h
This allows you to dynamically intercept the call for the application under test.