sourcehook/test/testhookmangen.cpp
branchhookman_autogen
changeset 455 deec66cea8cc
parent 451 a39d347d9991
child 458 4a0c5136f5e1
     1.1 --- a/sourcehook/test/testhookmangen.cpp	Fri Nov 09 21:14:37 2007 +0000
     1.2 +++ b/sourcehook/test/testhookmangen.cpp	Sat Nov 10 16:10:55 2007 +0000
     1.3 @@ -2,7 +2,6 @@
     1.4  #include "sourcehook.h"
     1.5  #include "sourcehook_test.h"
     1.6  #include "testevents.h"
     1.7 -#include "sourcehook_hookmangen.h"
     1.8  #include "sh_memory.h"
     1.9  #include "sh_pagealloc.h"
    1.10  
    1.11 @@ -23,6 +22,8 @@
    1.12  	SourceHook::ISourceHook *g_SHPtr;
    1.13  	SourceHook::Plugin g_PLID;
    1.14  
    1.15 +	SourceHook::IHookManagerAutoGen *g_HMAGPtr;
    1.16 +
    1.17  	// PtrBuf(ptr) gives ptrs unique numbers
    1.18  	// in the order they appear
    1.19  	SourceHook::List<const void*> g_PtrHash;
    1.20 @@ -254,7 +255,6 @@
    1.21  		}
    1.22  	}
    1.23  
    1.24 -
    1.25  	// MyDelegate base class for other delegates
    1.26  	class MyDelegate : public SourceHook::ISHDelegate
    1.27  	{
    1.28 @@ -415,6 +415,7 @@
    1.29  bool TestHookManGen(std::string &error)
    1.30  {
    1.31  	GET_SHPTR(g_SHPtr);
    1.32 +	GET_HMAG(g_HMAGPtr, g_SHPtr);
    1.33  	g_PLID = 1337;
    1.34  
    1.35  	// 5 Global constructors (g_O111_*)
    1.36 @@ -463,9 +464,8 @@
    1.37  		NULL), "Test11 Part0");
    1.38  
    1.39  	setuppi_11();
    1.40 -	g_Genc11 = new SourceHook::Impl::GenContext(&protoinfo_11, 0, 0, g_SHPtr);
    1.41 -	g_Genc_ad11.set(g_Genc11);
    1.42 -	SourceHook::HookManagerPubFunc myhookman11 = g_Genc11->Generate();
    1.43 +	SourceHook::HookManagerPubFunc myhookman11 = g_HMAGPtr->MakeHookMan(&protoinfo_11, 0, 0); \
    1.44 +	CAutoReleaseHookMan arhm_11(myhookman11); \
    1.45  	int hook1_11, hook2_11, hook3_11, hook4_11;
    1.46  	
    1.47  	TestClass11 *pTest11 = new TestClass11;
    1.48 @@ -630,9 +630,8 @@
    1.49  	setuppi_110();
    1.50  	setupri_110();
    1.51  
    1.52 -	g_Genc110 = new SourceHook::Impl::GenContext(&protoinfo_110, 0, 0, g_SHPtr);
    1.53 -	g_Genc_ad110.set(g_Genc110);
    1.54 -	SourceHook::HookManagerPubFunc myhookman110 = g_Genc110->Generate();
    1.55 +	SourceHook::HookManagerPubFunc myhookman110 = g_HMAGPtr->MakeHookMan(&protoinfo_110, 0, 0); \
    1.56 +	CAutoReleaseHookMan arhm_110(myhookman110); \
    1.57  	int hook1_110, hook2_110, hook3_110, hook4_110;
    1.58  
    1.59  	TestClass110 *pTest110 = new TestClass110;