1 struct CAutoReleaseHookMan
3 SourceHook::HookManagerPubFunc m_Ptr;
4 CAutoReleaseHookMan(SourceHook::HookManagerPubFunc ptr) : m_Ptr(ptr)
9 g_HMAGPtr->ReleaseHookMan(m_Ptr);
14 template <class T> struct StripRef
19 template <class T> struct StripRef<T&>
24 // Address of constructor/destructor
30 void NormalConstructor()
35 void CopyConstructor(const T &other)
42 reinterpret_cast<T*>(this)->~T();
45 const T& AssignOp(const T &other)
47 return (*reinterpret_cast<T*>(this) = other);
53 void *FindFuncAddr(T mfp)
65 template <class T> struct MyRefCarrier
70 template <class T> struct MyRefCarrier<T&>
76 type() : m_StoredRef(NULL)
79 type(T& ref) : m_StoredRef(&ref)
94 bool operator== (const typename MyRefCarrier<T&>::type &other)
96 return m_StoredRef == other.m_StoredRef;
99 friend std::ostream& operator <<(std::ostream &os,const typename MyRefCarrier<T&>::type &obj)
101 os << *obj.m_StoredRef;
107 #if SH_COMP==SH_COMP_GCC
108 #define NO_OPTIMIZE __attribute__((noinline))
113 // Return value maker
124 struct MakeRet< POD<SIZE> >
126 static POD<SIZE> Do(int a)
129 memset(reinterpret_cast<void*>(x.x), a, SIZE);
134 // Stores parameter status
137 template<int dummy@[$2,1,$1:, class p$2@]>
140 @[$2,1,$1:typename MyRefCarrier<p$2>::type m_$2; @]
142 bool operator==(const ParamState$1<dummy@[$2,1,$1:, p$2@]> &other)
145 @[$2,1,$1: && m_$1 == other.m_$1@]
148 ParamState$1(@[$2,1,$1|, :p$2 a$2@]) @[$1!=0::@] @[$2,1,$1|, :m_$2(a$2)@]
152 ParamState$1<dummy@[$2,1,$1:, p$2@]> & operator() (int incrsteps)
156 for (i = 0; i < incrsteps; ++i)
157 Increment<typename StripRef< p$2 >::type >::Incr(m_$2);
164 @[$1!=0:template<@[$2,1,$1|, :class p$2@]>@]
165 std::ostream& operator <<(std::ostream &os,const ParamState$1<0@[$2,1,$1:, p$2@]> &obj)
167 @[$1!=0:os@] @[$2,1,$1:<< obj.m_$2@];
173 #define CAT2(a, b) a##b
174 #define CAT3(a, b, c) a##b##c
175 #define CAT4(a, b, c, d) a##b##c##d
178 // hook2: pre supercede
179 // hook3: post ignore
180 // hook4: post supercede
185 #define THGM_MAKE_TEST$1_void(id@[$2,1,$1:, param$2@]) \
186 struct TestClass##id; \
187 typedef ParamState$1<0@[$2,1,$1:, param$2@] > ParamState_m##id; \
188 MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
189 MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
190 MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
191 MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
192 MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
194 struct TestClass##id \
196 static bool ms_DoRecall; \
198 virtual void Func(@[$2,1,$1|, :param$2 p$2@]) \
200 g_Inside_LeafFunc = true; \
201 ADD_STATE(State_Func##id(this, ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
202 g_Inside_LeafFunc = false; \
205 struct Delegate1 : public MyDelegate \
207 virtual void Call(@[$2,1,$1|, :param$2 p$2@]) \
209 g_Inside_LeafFunc = true; \
210 ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
211 g_Inside_LeafFunc = false; \
214 @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
215 RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
218 RETURN_META(MRES_IGNORED); \
221 struct Delegate2 : public MyDelegate \
223 virtual void Call(@[$2,1,$1|, :param$2 p$2@]) \
225 g_Inside_LeafFunc = true; \
226 ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
227 g_Inside_LeafFunc = false; \
230 @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
231 RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
234 RETURN_META(MRES_SUPERCEDE); \
237 struct Delegate3 : public MyDelegate \
239 virtual void Call(@[$2,1,$1|, :param$2 p$2@]) \
241 g_Inside_LeafFunc = true; \
242 ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
243 g_Inside_LeafFunc = false; \
246 @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
247 RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
250 RETURN_META(MRES_IGNORED); \
253 struct Delegate4 : public MyDelegate \
255 virtual void Call(@[$2,1,$1|, :param$2 p$2@]) \
257 g_Inside_LeafFunc = true; \
258 ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
259 g_Inside_LeafFunc = false; \
262 @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
263 RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
266 RETURN_META(MRES_SUPERCEDE); \
271 bool TestClass##id::ms_DoRecall = false; \
272 SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall);
275 #define THGM_MAKE_TEST$1(id, ret_type@[$2,1,$1:, param$2@]) \
276 struct TestClass##id; \
277 typedef ret_type RetType##id; \
278 typedef ParamState$1<0@[$2,1,$1:, param$2@] > ParamState_m##id; \
279 MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
280 MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
281 MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
282 MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
283 MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
285 struct TestClass##id \
287 static bool ms_DoRecall; \
289 virtual ret_type Func(@[$2,1,$1|, :param$2 p$2@]) \
291 g_Inside_LeafFunc = true; \
292 ADD_STATE(State_Func##id(this, ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
293 g_Inside_LeafFunc = false; \
295 return MakeRet< ret_type >::Do(0); \
298 struct Delegate1 : public MyDelegate \
300 virtual ret_type Call(@[$2,1,$1|, :param$2 p$2@]) \
302 g_Inside_LeafFunc = true; \
303 ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
304 g_Inside_LeafFunc = false; \
307 @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
308 RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
311 RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
314 struct Delegate2 : public MyDelegate \
316 virtual ret_type Call(@[$2,1,$1|, :param$2 p$2@]) \
318 g_Inside_LeafFunc = true; \
319 ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
320 g_Inside_LeafFunc = false; \
323 @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
324 RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
327 RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
330 struct Delegate3 : public MyDelegate \
332 virtual ret_type Call(@[$2,1,$1|, :param$2 p$2@]) \
334 g_Inside_LeafFunc = true; \
335 ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
336 g_Inside_LeafFunc = false; \
339 @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
340 RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
343 RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
346 struct Delegate4 : public MyDelegate \
348 virtual ret_type Call(@[$2,1,$1|, :param$2 p$2@]) \
350 g_Inside_LeafFunc = true; \
351 ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
352 g_Inside_LeafFunc = false; \
355 @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
356 RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
359 RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
364 bool TestClass##id::ms_DoRecall = false; \
365 SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall);
367 #define THGM_SETUP_PI$1(id@[$2,1,$1:, p$2_type, p$2_passtype, p$2_flags@]) \
368 void setuppi_##id() \
371 protoinfo_##id.AddParam(sizeof(p$2_type), p$2_passtype, p$2_flags, \
372 (p$2_flags & SourceHook::PassInfo::PassFlag_OCtor) ? FindFuncAddr(&Ctor_Thunk<StripRef< p$2_type >::type>::NormalConstructor) : NULL, \
373 (p$2_flags & SourceHook::PassInfo::PassFlag_CCtor) ? FindFuncAddr(&Ctor_Thunk<StripRef< p$2_type >::type>::CopyConstructor) : NULL, \
374 (p$2_flags & SourceHook::PassInfo::PassFlag_ODtor) ? FindFuncAddr(&Ctor_Thunk<StripRef< p$2_type >::type>::Destructor) : NULL, \
375 (p$2_flags & SourceHook::PassInfo::PassFlag_AssignOp) ? FindFuncAddr(&Ctor_Thunk<StripRef< p$2_type >::type>::AssignOp) : NULL \
382 #define THGM_SETUP_RI(id, ret_type, ret_passtype, ret_flags) \
383 void setupri_##id() \
385 protoinfo_##id.SetReturnType(sizeof(ret_type), ret_passtype, ret_flags, \
386 (ret_flags & SourceHook::PassInfo::PassFlag_OCtor) ? FindFuncAddr(&Ctor_Thunk<StripRef< ret_type >::type>::NormalConstructor) : NULL, \
387 (ret_flags & SourceHook::PassInfo::PassFlag_CCtor) ? FindFuncAddr(&Ctor_Thunk<StripRef< ret_type >::type>::CopyConstructor) : NULL, \
388 (ret_flags & SourceHook::PassInfo::PassFlag_ODtor) ? FindFuncAddr(&Ctor_Thunk<StripRef< ret_type >::type>::Destructor) : NULL, \
389 (ret_flags & SourceHook::PassInfo::PassFlag_AssignOp) ? FindFuncAddr(&Ctor_Thunk<StripRef< ret_type >::type>::AssignOp) : NULL \
393 #define THGM_ADD_HOOK(id, num) \
394 CAT4(hook, num, _, id) = g_SHPtr->AddHook(g_PLID, SourceHook::ISourceHook::Hook_Normal, reinterpret_cast<void*>(pTest##id), \
395 0, myhookman##id, PtrBufPtr(new TestClass##id::Delegate##num), num >= 3);
397 #define THGM_REMOVE_HOOK(id, num) \
398 g_SHPtr->RemoveHookByID(CAT4(hook, num, _, id));
400 #define THGM_CALLS_void(id, call_params) \
401 pTest##id->Func call_params; \
402 SH_CALL(pTest##id, &TestClass##id::Func) call_params;
404 #define THGM_DO_TEST_void(id, call_params) \
406 SourceHook::HookManagerPubFunc myhookman##id = g_HMAGPtr->MakeHookMan(protoinfo_##id, 0, 0); \
407 CAutoReleaseHookMan arhm_##id(myhookman##id); \
408 int hook1_##id, hook2_##id, hook3_##id, hook4_##id; \
410 TestClass##id::ms_DoRecall = false; \
411 TestClass##id *pTest##id = new TestClass##id; \
412 CAutoPtrDestruction<TestClass##id> apd##id(pTest##id); \
414 /* no hooks - no hooks */ \
416 THGM_CALLS_void(id, call_params); \
417 CHECK_STATES((&g_States, \
418 new State_Func##id(pTest##id, ParamState_m##id call_params), \
419 new State_Func##id(pTest##id, ParamState_m##id call_params), \
420 NULL), "Test" #id " Part1"); \
422 /* hook1 - no hooks */ \
424 THGM_ADD_HOOK(id, 1); \
425 THGM_CALLS_void(id, call_params); \
426 CHECK_STATES((&g_States, \
427 new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
428 new State_Func##id(pTest##id, ParamState_m##id call_params), \
429 new State_Func##id(pTest##id, ParamState_m##id call_params), \
430 NULL), "Test" #id " Part2"); \
431 THGM_REMOVE_HOOK(id, 1); \
433 /* no hooks - hook3 */ \
435 THGM_ADD_HOOK(id, 3); \
436 THGM_CALLS_void(id, call_params); \
437 CHECK_STATES((&g_States, \
438 new State_Func##id(pTest##id, ParamState_m##id call_params), \
439 new State_Deleg3_##id(pTest##id, 0, ParamState_m##id call_params), \
440 new State_Func##id(pTest##id, ParamState_m##id call_params), \
441 NULL), "Test" #id " Part3"); \
442 THGM_REMOVE_HOOK(id, 3); \
444 /* hook1 - hook3 */ \
446 THGM_ADD_HOOK(id, 1); \
447 THGM_ADD_HOOK(id, 3); \
448 THGM_CALLS_void(id, call_params); \
449 CHECK_STATES((&g_States, \
450 new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
451 new State_Func##id(pTest##id, ParamState_m##id call_params), \
452 new State_Deleg3_##id(pTest##id, 1, ParamState_m##id call_params), \
453 new State_Func##id(pTest##id, ParamState_m##id call_params), \
454 NULL), "Test" #id " Part4"); \
455 THGM_REMOVE_HOOK(id, 1); \
456 THGM_REMOVE_HOOK(id, 3); \
458 /* hook1, hook2 - hook3 */ \
460 THGM_ADD_HOOK(id, 1); \
461 THGM_ADD_HOOK(id, 2); \
462 THGM_ADD_HOOK(id, 3); \
463 THGM_CALLS_void(id, call_params); \
464 CHECK_STATES((&g_States, \
465 new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
466 new State_Deleg2_##id(pTest##id, 1, ParamState_m##id call_params), \
467 new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params), \
468 new State_Func##id(pTest##id, ParamState_m##id call_params), \
469 NULL), "Test" #id " Part5"); \
470 THGM_REMOVE_HOOK(id, 1); \
471 THGM_REMOVE_HOOK(id, 2); \
472 THGM_REMOVE_HOOK(id, 3); \
473 /* hook1, hook2 - hook3, hook4 */ \
475 THGM_ADD_HOOK(id, 1); \
476 THGM_ADD_HOOK(id, 2); \
477 THGM_ADD_HOOK(id, 3); \
478 THGM_ADD_HOOK(id, 4); \
479 THGM_CALLS_void(id, call_params); \
480 CHECK_STATES((&g_States, \
481 new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
482 new State_Deleg2_##id(pTest##id, 1, ParamState_m##id call_params), \
483 new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params), \
484 new State_Deleg4_##id(pTest##id, 3, ParamState_m##id call_params), \
485 new State_Func##id(pTest##id, ParamState_m##id call_params), \
486 NULL), "Test" #id " Part6"); \
488 /* hook1 - hook3, hook4, with recalls! */ \
490 TestClass##id::ms_DoRecall = true; \
491 THGM_REMOVE_HOOK(id, 2); \
492 THGM_CALLS_void(id, call_params); \
493 CHECK_STATES((&g_States, \
494 new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params(0)), \
495 new State_Func##id(pTest##id, ParamState_m##id call_params(1)), \
496 new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params(1)), \
497 new State_Deleg4_##id(pTest##id, 3, ParamState_m##id call_params(2)), \
499 new State_Func##id(pTest##id, ParamState_m##id call_params), \
500 NULL), "Test" #id " Part7"); \
501 THGM_REMOVE_HOOK(id, 1); \
502 THGM_REMOVE_HOOK(id, 3); \
503 THGM_REMOVE_HOOK(id, 4);
512 T* ComparableRef(T& x)
517 #define THGM_CALLS(id, call_params, exp_ret_norm, exp_ret_shcall, err) \
518 CHECK_COND(ComparableRef<RetType##id>(pTest##id->Func call_params) == ComparableRef<RetType##id>(MakeRet< RetType##id >::Do(exp_ret_norm)), err " /retcallnorm"); \
519 CHECK_COND(ComparableRef<RetType##id>(SH_CALL(pTest##id, &TestClass##id::Func) call_params) == ComparableRef<RetType##id>(MakeRet< RetType##id >::Do(exp_ret_shcall)), err " /retcallshcall");
521 #define THGM_DO_TEST(id, call_params) \
524 SourceHook::HookManagerPubFunc myhookman##id = g_HMAGPtr->MakeHookMan(protoinfo_##id, 0, 0); \
525 CAutoReleaseHookMan arhm_##id(myhookman##id); \
526 int hook1_##id, hook2_##id, hook3_##id, hook4_##id; \
528 TestClass##id::ms_DoRecall = false; \
529 TestClass##id *pTest##id = new TestClass##id; \
530 CAutoPtrDestruction<TestClass##id> apd##id(pTest##id); \
532 /* no hooks - no hooks */ \
534 THGM_CALLS(id, call_params, 0, 0, "Part1"); \
535 CHECK_STATES((&g_States, \
536 new State_Func##id(pTest##id, ParamState_m##id call_params), \
537 new State_Func##id(pTest##id, ParamState_m##id call_params), \
538 NULL), "Test" #id " Part1"); \
540 /* hook1 - no hooks */ \
542 THGM_ADD_HOOK(id, 1); \
543 THGM_CALLS(id, call_params, 0, 0, "Part2"); \
544 CHECK_STATES((&g_States, \
545 new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
546 new State_Func##id(pTest##id, ParamState_m##id call_params), \
547 new State_Func##id(pTest##id, ParamState_m##id call_params), \
548 NULL), "Test" #id " Part2"); \
549 THGM_REMOVE_HOOK(id, 1); \
551 /* no hooks - hook3 */ \
553 THGM_ADD_HOOK(id, 3); \
554 THGM_CALLS(id, call_params, 0, 0, "Part3"); \
555 CHECK_STATES((&g_States, \
556 new State_Func##id(pTest##id, ParamState_m##id call_params), \
557 new State_Deleg3_##id(pTest##id, 0, ParamState_m##id call_params), \
558 new State_Func##id(pTest##id, ParamState_m##id call_params), \
559 NULL), "Test" #id " Part3"); \
560 THGM_REMOVE_HOOK(id, 3); \
562 /* hook1 - hook3 */ \
564 THGM_ADD_HOOK(id, 1); \
565 THGM_ADD_HOOK(id, 3); \
566 THGM_CALLS(id, call_params, 0, 0, "Part4"); \
567 CHECK_STATES((&g_States, \
568 new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
569 new State_Func##id(pTest##id, ParamState_m##id call_params), \
570 new State_Deleg3_##id(pTest##id, 1, ParamState_m##id call_params), \
571 new State_Func##id(pTest##id, ParamState_m##id call_params), \
572 NULL), "Test" #id " Part4"); \
573 THGM_REMOVE_HOOK(id, 1); \
574 THGM_REMOVE_HOOK(id, 3); \
576 /* hook1, hook2 - hook3 */ \
578 THGM_ADD_HOOK(id, 1); \
579 THGM_ADD_HOOK(id, 2); \
580 THGM_ADD_HOOK(id, 3); \
581 THGM_CALLS(id, call_params, 2, 0, "Part5"); \
582 CHECK_STATES((&g_States, \
583 new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
584 new State_Deleg2_##id(pTest##id, 1, ParamState_m##id call_params), \
585 new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params), \
586 new State_Func##id(pTest##id, ParamState_m##id call_params), \
587 NULL), "Test" #id " Part5"); \
588 THGM_REMOVE_HOOK(id, 1); \
589 THGM_REMOVE_HOOK(id, 2); \
590 THGM_REMOVE_HOOK(id, 3); \
591 /* hook1, hook2 - hook3, hook4 */ \
593 THGM_ADD_HOOK(id, 1); \
594 THGM_ADD_HOOK(id, 2); \
595 THGM_ADD_HOOK(id, 3); \
596 THGM_ADD_HOOK(id, 4); \
597 THGM_CALLS(id, call_params, 4, 0, "Part6"); \
598 CHECK_STATES((&g_States, \
599 new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
600 new State_Deleg2_##id(pTest##id, 1, ParamState_m##id call_params), \
601 new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params), \
602 new State_Deleg4_##id(pTest##id, 3, ParamState_m##id call_params), \
603 new State_Func##id(pTest##id, ParamState_m##id call_params), \
604 NULL), "Test" #id " Part6"); \
606 /* hook1 - hook3, hook4, with recalls! */ \
608 TestClass##id::ms_DoRecall = true; \
609 THGM_REMOVE_HOOK(id, 2); \
610 THGM_CALLS(id, call_params, 4, 0, "Part7"); \
611 CHECK_STATES((&g_States, \
612 new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params(0)), \
613 new State_Func##id(pTest##id, ParamState_m##id call_params(1)), \
614 new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params(1)), \
615 new State_Deleg4_##id(pTest##id, 3, ParamState_m##id call_params(2)), \
617 new State_Func##id(pTest##id, ParamState_m##id call_params), \
618 NULL), "Test" #id " Part7"); \
619 THGM_REMOVE_HOOK(id, 1); \
620 THGM_REMOVE_HOOK(id, 3); \
621 THGM_REMOVE_HOOK(id, 4);