sourcehook/test/testhookmangen.cpp
branchhookman_autogen
changeset 465 c86a55fbcd88
parent 463 7a413a63426f
child 466 c733f5be0e5d
     1.1 --- a/sourcehook/test/testhookmangen.cpp	Sun Nov 18 13:12:51 2007 +0000
     1.2 +++ b/sourcehook/test/testhookmangen.cpp	Sun Nov 18 15:08:03 2007 +0000
     1.3 @@ -565,8 +565,488 @@
     1.4  			ADD_STATE(State_Hello_Func79_PreHook);
     1.5  		}
     1.6  	};
     1.7 +
     1.8 +	bool Tests1(std::string &error)
     1.9 +	{
    1.10 +		THGM_DO_TEST_void(0, ());
    1.11 +
    1.12 +		THGM_DO_TEST_void(1, (100));
    1.13 +		
    1.14 +		THGM_DO_TEST_void(2, (0x1F00));
    1.15 +
    1.16 +		THGM_DO_TEST_void(3, (0x1F000000));
    1.17 +
    1.18 +		THGM_DO_TEST_void(4, (0.5f));
    1.19 +
    1.20 +		THGM_DO_TEST_void(5, (5.5));
    1.21 +
    1.22 +		THGM_DO_TEST_void(6, (100, 0x1f00, 0x1f000000, 0.5f, 5.5));
    1.23 +
    1.24 +		return true;
    1.25 +	}
    1.26 +
    1.27 +	bool Tests2(std::string &error)
    1.28 +	{
    1.29 +		char a = 5;
    1.30 +		double b = 233.33;
    1.31 +		THGM_DO_TEST_void(7, (a, b));
    1.32 +
    1.33 +		POD<7> pod7 = MakeRet< POD<7> >::Do(78);
    1.34 +		THGM_DO_TEST_void(8, (pod7));
    1.35 +
    1.36 +		POD<600> pod600 = MakeRet< POD<600> >::Do(34);
    1.37 +		THGM_DO_TEST_void(9, (pod600));
    1.38 +		
    1.39 +		THGM_DO_TEST_void(10, (pod600));
    1.40 +
    1.41 +		// Test11: Special: constructors/destructors
    1.42 +		PtrBuf_Clear();
    1.43 +		Object<3> *obj3_real = new Object<3>(33);
    1.44 +		Object<600> *obj600_real = new Object<600>(21);
    1.45 +
    1.46 +		Object<3> & obj3 = *obj3_real;
    1.47 +		Object<600> & obj600 = *obj600_real;
    1.48 +
    1.49 +		CHECK_STATES((&g_States,
    1.50 +			new State_ObjOCtor_Called(3),
    1.51 +			new State_ObjOCtor_Called(600),
    1.52 +			NULL), "Test11 Part0");
    1.53 +
    1.54 +		setuppi_11();
    1.55 +		SourceHook::HookManagerPubFunc myhookman11 = g_HMAGPtr->MakeHookMan(protoinfo_11, 0, 0); \
    1.56 +		CAutoReleaseHookMan arhm_11(myhookman11); \
    1.57 +		int hook1_11, hook2_11, hook3_11, hook4_11;
    1.58 +		
    1.59 +		TestClass11 *pTest11 = new TestClass11;
    1.60 +		CAutoPtrDestruction<TestClass11> apd11(pTest11);
    1.61 +		
    1.62 +		/* no hooks - no hooks */
    1.63 +		PtrBuf_Clear();
    1.64 +		pTest11->Func(obj3, obj600);
    1.65 +
    1.66 +		g_Inside_LeafFunc = true;
    1.67 +		CHECK_STATES((&g_States,
    1.68 +			new State_ObjCCtor_Called(3),
    1.69 +			new State_Func11(pTest11, ParamState_m11 (obj3, obj600)),
    1.70 +			new State_ObjODtor_Called(3),
    1.71 +			NULL), "Test" "11" " Part1");
    1.72 +		g_Inside_LeafFunc = false;
    1.73 +
    1.74 +		/* hook1 - no hooks */
    1.75 +		THGM_ADD_HOOK(11, 1);
    1.76 +		
    1.77 +		PtrBuf_Clear();
    1.78 +		pTest11->Func(obj3, obj600);
    1.79 +		g_Inside_LeafFunc = true;
    1.80 +		CHECK_STATES((&g_States,
    1.81 +			new State_ObjCCtor_Called(3),
    1.82 +
    1.83 +			new State_ObjCCtor_Called(3),
    1.84 +			new State_Deleg_11(1, pTest11, 0, ParamState_m11 (obj3, obj600)),
    1.85 +			new State_ObjODtor_Called(3),
    1.86 +
    1.87 +			new State_ObjCCtor_Called(3),
    1.88 +			new State_Func11(pTest11, ParamState_m11 (obj3, obj600)),
    1.89 +			new State_ObjODtor_Called(3),
    1.90 +
    1.91 +			new State_ObjODtor_Called(3),
    1.92 +			NULL), "Test" "11" " Part2");
    1.93 +		g_Inside_LeafFunc = false;
    1.94 +
    1.95 +		THGM_REMOVE_HOOK(11, 1);
    1.96 +
    1.97 +		/* hook1, hook2 - hook3, hook4 */
    1.98 +		THGM_ADD_HOOK(11, 1);
    1.99 +		THGM_ADD_HOOK(11, 2);
   1.100 +		THGM_ADD_HOOK(11, 3);
   1.101 +		THGM_ADD_HOOK(11, 4);
   1.102 +		PtrBuf_Clear();
   1.103 +		pTest11->Func(obj3, obj600);
   1.104 +		g_Inside_LeafFunc = true;
   1.105 +		CHECK_STATES((&g_States,
   1.106 +			new State_ObjCCtor_Called(3),
   1.107 +
   1.108 +			new State_ObjCCtor_Called(3),
   1.109 +			new	State_Deleg_11(1, pTest11, 0, ParamState_m11 (obj3, obj600)),
   1.110 +			new State_ObjODtor_Called(3),
   1.111 +
   1.112 +			new State_ObjCCtor_Called(3),
   1.113 +			new State_Deleg_11(2, pTest11, 1, ParamState_m11 (obj3, obj600)),
   1.114 +			new State_ObjODtor_Called(3),
   1.115 +
   1.116 +			new State_ObjCCtor_Called(3),
   1.117 +			new State_Deleg_11(3, pTest11, 2, ParamState_m11 (obj3, obj600)),
   1.118 +			new State_ObjODtor_Called(3),
   1.119 +
   1.120 +			new State_ObjCCtor_Called(3),
   1.121 +			new State_Deleg_11(4, pTest11, 3, ParamState_m11 (obj3, obj600)),
   1.122 +			new State_ObjODtor_Called(3),
   1.123 +
   1.124 +			new State_ObjODtor_Called(3),
   1.125 +		NULL), "Test" "11" " Part3");
   1.126 +		g_Inside_LeafFunc = false;
   1.127 +
   1.128 +		/* hook1 - hook3, hook4 WITH RECALLS */
   1.129 +		THGM_REMOVE_HOOK(11, 2);
   1.130 +		PtrBuf_Clear();
   1.131 +		TestClass11::ms_DoRecall = true;
   1.132 +		pTest11->Func(obj3, obj600);
   1.133 +		g_Inside_LeafFunc = true;
   1.134 +		CHECK_STATES((&g_States,
   1.135 +			new State_ObjCCtor_Called(3),
   1.136 +
   1.137 +			new State_ObjCCtor_Called(3),
   1.138 +			new	State_Deleg_11(1, pTest11, 0 /* first deleg ptr */, ParamState_m11 (obj3, obj600)),
   1.139 +
   1.140 +			// recall !
   1.141 +				// second hookfunc -> new copy
   1.142 +				new State_ObjCCtor_Called(3),
   1.143 +
   1.144 +				// in second hookfunc now
   1.145 +				//   -> calls orig func
   1.146 +
   1.147 +				new State_ObjCCtor_Called(3),
   1.148 +				new State_Func11(pTest11, ParamState_m11 (obj3, obj600)(1)),
   1.149 +				new State_ObjODtor_Called(3),
   1.150 +
   1.151 +				// calls first posthook
   1.152 +				new State_ObjCCtor_Called(3),
   1.153 +				new State_Deleg_11(3, pTest11, 1 /* second deleg ptr */, ParamState_m11 (obj3, obj600)(1)),
   1.154 +
   1.155 +				// recall!
   1.156 +					// third hookfunc -> new copy
   1.157 +					new State_ObjCCtor_Called(3),
   1.158 +
   1.159 +					// calls second posthook
   1.160 +
   1.161 +					new State_ObjCCtor_Called(3),
   1.162 +					new State_Deleg_11(4, pTest11, 2 /* third deleg ptr */, ParamState_m11 (obj3, obj600)(2)),
   1.163 +
   1.164 +					// recall!
   1.165 +						// fourth hookfunc -> new copy
   1.166 +						new State_ObjCCtor_Called(3),
   1.167 +
   1.168 +						// has nothing to do though!
   1.169 +
   1.170 +						// fourth hookfunc done -> ret
   1.171 +						new State_ObjODtor_Called(3),
   1.172 +
   1.173 +					// third hookfunc done -> ret
   1.174 +					new State_ObjODtor_Called(3),
   1.175 +					// ret from hookhandler which did the recall
   1.176 +					new State_ObjODtor_Called(3),
   1.177 +
   1.178 +				// second hookfunc done -> ret
   1.179 +				new State_ObjODtor_Called(3),
   1.180 +				// ret from hookhandler which did the recall
   1.181 +				new State_ObjODtor_Called(3),
   1.182 +
   1.183 +			// deleg1's instance
   1.184 +			new State_ObjODtor_Called(3),
   1.185 +			// first hookfunc done -> ret
   1.186 +			new State_ObjODtor_Called(3),
   1.187 +			NULL), "Test" "11" " Part4");
   1.188 +		g_Inside_LeafFunc = false;
   1.189 +
   1.190 +		THGM_REMOVE_HOOK(11, 1);
   1.191 +		THGM_REMOVE_HOOK(11, 3);
   1.192 +		THGM_REMOVE_HOOK(11, 4);
   1.193 +
   1.194 +		delete obj3_real;
   1.195 +		delete obj600_real;
   1.196 +
   1.197 +		CHECK_STATES((&g_States,
   1.198 +			new State_ObjODtor_Called(3),
   1.199 +			new State_ObjODtor_Called(600),
   1.200 +			NULL), "Test11 Part100");
   1.201 +
   1.202 +		return true;
   1.203 +	}
   1.204 +
   1.205 +	bool Tests3(std::string &error)
   1.206 +	{
   1.207 +		THGM_DO_TEST(101, ());
   1.208 +
   1.209 +		THGM_DO_TEST(102, ());
   1.210 +
   1.211 +		THGM_DO_TEST(103, ());
   1.212 +
   1.213 +		THGM_DO_TEST(104, ());
   1.214 +
   1.215 +		THGM_DO_TEST(105, ());
   1.216 +
   1.217 +		// pod returns
   1.218 +		THGM_DO_TEST(106, (5));
   1.219 +		THGM_DO_TEST(107, (5));
   1.220 +		THGM_DO_TEST(108, (5));
   1.221 +		THGM_DO_TEST(109, (5));
   1.222 +
   1.223 +		return true;
   1.224 +	}
   1.225 +
   1.226 +	bool Tests4(std::string &error)
   1.227 +	{
   1.228 +		// Test110: Special: constructors/destructors on return
   1.229 +		PtrBuf_Clear();
   1.230 +		ObjRet13 *obj13_real = new ObjRet13;
   1.231 +		ObjRet13 &obj13 = *obj13_real;
   1.232 +
   1.233 +		CHECK_STATES((&g_States,
   1.234 +			new State_ObjOCtor_Called(13),
   1.235 +			NULL), "Test110 Part0");
   1.236 +
   1.237 +		setuppi_110();
   1.238 +		setupri_110();
   1.239 +
   1.240 +		SourceHook::HookManagerPubFunc myhookman110 = g_HMAGPtr->MakeHookMan(protoinfo_110, 0, 0); \
   1.241 +		CAutoReleaseHookMan arhm_110(myhookman110); \
   1.242 +		int hook1_110, hook2_110, hook3_110, hook4_110;
   1.243 +
   1.244 +		TestClass110 *pTest110 = new TestClass110;
   1.245 +		CAutoPtrDestruction<TestClass110> apd110(pTest110);
   1.246 +
   1.247 +		/* no hooks - no hooks */
   1.248 +		PtrBuf_Clear();
   1.249 +		obj13 = pTest110->Func(5);
   1.250 +
   1.251 +		g_Inside_LeafFunc = true;
   1.252 +		CHECK_STATES((&g_States,
   1.253 +			new State_Func110(pTest110, ParamState_m110 (5)),
   1.254 +			new State_ObjOCtor_Called(13),			// MakeRet: Construction of x
   1.255 +			new State_ObjCCtor_Called(13),			// Return from MakeRet	-> construct temporary object in our stack
   1.256 +			new State_ObjODtor_Called(13),			// MakeRet: Destruction of x
   1.257 +
   1.258 +			new State_ObjAssignOp_Called(13),		// assign: obj13 = temporary object in our stack
   1.259 +			new State_ObjODtor_Called(13),			// Func110: destruction of temporary object
   1.260 +			NULL), "Test" "110" " Part1");
   1.261 +		g_Inside_LeafFunc = false;
   1.262 +
   1.263 +		/* hook1 - no hooks */
   1.264 +		THGM_ADD_HOOK(110, 1);
   1.265 +
   1.266 +		PtrBuf_Clear();
   1.267 +		obj13 = pTest110->Func(5);
   1.268 +		g_Inside_LeafFunc = true;
   1.269 +		CHECK_STATES((&g_States,
   1.270 +			// HookFunc: construct orig_ret/override_ret/plugin_ret objects
   1.271 +			new State_ObjOCtor_Called(13),
   1.272 +			new State_ObjOCtor_Called(13),
   1.273 +			new State_ObjOCtor_Called(13),
   1.274 +
   1.275 +			// Calling delegate
   1.276 +				new State_Deleg_110(1, pTest110, 0, ParamState_m110 (5)),
   1.277 +
   1.278 +				new State_ObjOCtor_Called(13),	// MakeRet: Construction of x
   1.279 +				new State_ObjCCtor_Called(13),	// Return from MakeRet	-> construct temporary object in HookFunc's stack
   1.280 +				new State_ObjODtor_Called(13),	// MakeRet: Destruction of x
   1.281 +
   1.282 +			// back in hookfunc
   1.283 +			new State_ObjAssignOp_Called(13),	// assign: plugin_ret = temporary object in HookFunc's stack
   1.284 +			new State_ObjODtor_Called(13),		// destruction of temporary object in HookFunc's stack
   1.285 +
   1.286 +			// Calling orig function Func110
   1.287 +				new State_Func110(pTest110, ParamState_m110 (5)),
   1.288 +				new State_ObjOCtor_Called(13),	// MakeRet: Construction of x
   1.289 +				new State_ObjCCtor_Called(13),	// Return from MakeRet	-> construct temporary object in HookFunc's stack
   1.290 +				new State_ObjODtor_Called(13),	// MakeRet: Destruction of x
   1.291 +
   1.292 +			// back in hookfunc
   1.293 +			new State_ObjAssignOp_Called(13),	// assign: orig_ret = temporary object in HookFunc's stack
   1.294 +			new State_ObjODtor_Called(13),		// destruction of temporary object in HookFunc's stack
   1.295 +
   1.296 +			// hookfunc is returning:
   1.297 +			new State_ObjCCtor_Called(13),		// copy to temp object in our stack
   1.298 +
   1.299 +			// hookfunc cleans up its stack -> destroys plugin_ret/override_ret/orig_ret
   1.300 +			new State_ObjODtor_Called(13),
   1.301 +			new State_ObjODtor_Called(13),
   1.302 +			new State_ObjODtor_Called(13),
   1.303 +			
   1.304 +			// we are in our function: assign 
   1.305 +			new State_ObjAssignOp_Called(13),	// assign: obj13 = temporary object in our stack
   1.306 +			new State_ObjODtor_Called(13),		// Func110: destruction of temporary object
   1.307 +
   1.308 +			NULL), "Test" "11" " Part2");
   1.309 +		
   1.310 +		CHECK_COND(obj13 == 0, "Test" "11" " Part 2.1");
   1.311 +		g_Inside_LeafFunc = false;
   1.312 +
   1.313 +		THGM_REMOVE_HOOK(110, 1);
   1.314 +
   1.315 +		/* hook1, hook2 - hook3, hook4 */
   1.316 +		THGM_ADD_HOOK(110, 1);
   1.317 +		THGM_ADD_HOOK(110, 2);
   1.318 +		THGM_ADD_HOOK(110, 3);
   1.319 +		THGM_ADD_HOOK(110, 4);
   1.320 +
   1.321 +		PtrBuf_Clear();
   1.322 +		obj13 = pTest110->Func(5);
   1.323 +		g_Inside_LeafFunc = true;
   1.324 +		CHECK_STATES((&g_States,
   1.325 +			// HookFunc: construct orig_ret/override_ret/plugin_ret objects
   1.326 +			new State_ObjOCtor_Called(13),
   1.327 +			new State_ObjOCtor_Called(13),
   1.328 +			new State_ObjOCtor_Called(13),
   1.329 +
   1.330 +			// Calling delegate1
   1.331 +				new State_Deleg_110(1, pTest110, 0, ParamState_m110 (5)),
   1.332 +
   1.333 +				new State_ObjOCtor_Called(13),	// MakeRet: Construction of x
   1.334 +				new State_ObjCCtor_Called(13),	// Return from MakeRet	-> construct temporary object in HookFunc's stack
   1.335 +				new State_ObjODtor_Called(13),	// MakeRet: Destruction of x
   1.336 +
   1.337 +			// back in hookfunc
   1.338 +			new State_ObjAssignOp_Called(13),	// assign: plugin_ret = temporary object in HookFunc's stack
   1.339 +			new State_ObjODtor_Called(13),		// destruction of temporary object in HookFunc's stack
   1.340 +
   1.341 +
   1.342 +			// Calling delegate2
   1.343 +				new State_Deleg_110(2, pTest110, 1, ParamState_m110 (5)),
   1.344 +
   1.345 +				new State_ObjOCtor_Called(13),	// MakeRet: Construction of x
   1.346 +				new State_ObjCCtor_Called(13),	// Return from MakeRet	-> construct temporary object in HookFunc's stack
   1.347 +				new State_ObjODtor_Called(13),	// MakeRet: Destruction of x
   1.348 +
   1.349 +			// back in hookfunc
   1.350 +			new State_ObjAssignOp_Called(13),	// assign: plugin_ret = temporary object in HookFunc's stack
   1.351 +			new State_ObjODtor_Called(13),		// destruction of temporary object in HookFunc's stack
   1.352 +
   1.353 +			// hookfunc finds out that the hook wanted to SUPERCEDE --> copy to override_Ret
   1.354 +			new State_ObjAssignOp_Called(13),
   1.355 +
   1.356 +			// SUPERCEDE -> orig function is not called
   1.357 +			// instead: orig_ret = override_ret
   1.358 +			new State_ObjAssignOp_Called(13),
   1.359 +
   1.360 +			// Calling delegate3
   1.361 +				new State_Deleg_110(3, pTest110, 2, ParamState_m110 (5)),
   1.362 +
   1.363 +				new State_ObjOCtor_Called(13),	// MakeRet: Construction of x
   1.364 +				new State_ObjCCtor_Called(13),	// Return from MakeRet	-> construct temporary object in HookFunc's stack
   1.365 +				new State_ObjODtor_Called(13),	// MakeRet: Destruction of x
   1.366 +
   1.367 +			// back in hookfunc
   1.368 +			new State_ObjAssignOp_Called(13),	// assign: plugin_ret = temporary object in HookFunc's stack
   1.369 +			new State_ObjODtor_Called(13),		// destruction of temporary object in HookFunc's stack
   1.370 +
   1.371 +			// Calling delegate4
   1.372 +				new State_Deleg_110(4, pTest110, 3, ParamState_m110 (5)),
   1.373 +
   1.374 +				new State_ObjOCtor_Called(13),	// MakeRet: Construction of x
   1.375 +				new State_ObjCCtor_Called(13),	// Return from MakeRet	-> construct temporary object in HookFunc's stack
   1.376 +				new State_ObjODtor_Called(13),	// MakeRet: Destruction of x
   1.377 +
   1.378 +			// back in hookfunc
   1.379 +			new State_ObjAssignOp_Called(13),	// assign: plugin_ret = temporary object in HookFunc's stack
   1.380 +			new State_ObjODtor_Called(13),		// destruction of temporary object in HookFunc's stack
   1.381 +
   1.382 +			// hookfunc finds out that the hook wanted to SUPERCEDE --> copy to override_Ret (yes really, we overwrite the old value!)
   1.383 +			new State_ObjAssignOp_Called(13),
   1.384 +
   1.385 +			// hookfunc is returning:
   1.386 +			new State_ObjCCtor_Called(13),		// copy to temp object in our stack
   1.387 +
   1.388 +			// hookfunc cleans up its stack -> destroys plugin_ret/override_ret/orig_ret
   1.389 +			new State_ObjODtor_Called(13),
   1.390 +			new State_ObjODtor_Called(13),
   1.391 +			new State_ObjODtor_Called(13),
   1.392 +
   1.393 +			// we are in our function: assign 
   1.394 +			new State_ObjAssignOp_Called(13),	// assign: obj13 = temporary object in our stack
   1.395 +			new State_ObjODtor_Called(13),		// Func110: destruction of temporary object
   1.396 +
   1.397 +			NULL), "Test" "11" " Part3");
   1.398 +
   1.399 +		CHECK_COND(obj13 == 4, "Test" "11" " Part 3.1");
   1.400 +		g_Inside_LeafFunc = false;
   1.401 +
   1.402 +		THGM_REMOVE_HOOK(110, 1);
   1.403 +		THGM_REMOVE_HOOK(110, 2);
   1.404 +		THGM_REMOVE_HOOK(110, 3);
   1.405 +		THGM_REMOVE_HOOK(110, 4);
   1.406 +
   1.407 +		delete obj13_real;
   1.408 +
   1.409 +		CHECK_STATES((&g_States,
   1.410 +			new State_ObjODtor_Called(13),
   1.411 +			NULL), "Test110 Part100");
   1.412 +
   1.413 +		return true;
   1.414 +	}
   1.415 +
   1.416 +	bool Tests5(std::string &error)
   1.417 +	{
   1.418 +		// RefRet
   1.419 +		THGM_DO_TEST(111, ());
   1.420 +
   1.421 +		// Vafmt
   1.422 +
   1.423 +		THGM_DO_TEST_void(200, ("Hello %s%d%s", "BA", 1, "L!"));
   1.424 +
   1.425 +		THGM_DO_TEST_void(201, (100, "Hello %s%d%s", "BA", 1, "L!"));
   1.426 +		
   1.427 +		THGM_DO_TEST_void(203, (0x1F000000, "Hello %s%d%s", "BA", 1, "L!"));
   1.428 +
   1.429 +		THGM_DO_TEST_void(206, (100, 0x1f00, 0x1f000000, 0.5f, 5.5, "Hello %s%d%s", "BA", 1, "L!"));
   1.430 +
   1.431 +		char a = 5;
   1.432 +		double b = 233.33;
   1.433 +		THGM_DO_TEST_void(207, (a, b, "Hello %s%d%s", "BA", 1, "L!"));
   1.434 +
   1.435 +		POD<7> pod7 = MakeRet< POD<7> >::Do(78);
   1.436 +		THGM_DO_TEST_void(208, (pod7, "Hello %s%d%s", "BA", 1, "L!"));
   1.437 +	
   1.438 +		POD<600> pod600 = MakeRet< POD<600> >::Do(34);
   1.439 +		THGM_DO_TEST_void(210, (pod600, "Hello %s%d%s", "BA", 1, "L!"));
   1.440 +		
   1.441 +		// Test for lange vtable indices
   1.442 +		Hello *pHello = new Hello;
   1.443 +		SourceHook::CProtoInfoBuilder helloPi(SourceHook::ProtoInfo::CallConv_ThisCall);
   1.444 +		SourceHook::HookManagerPubFunc helloHM_4 = g_HMAGPtr->MakeHookMan(helloPi, 0, 4);
   1.445 +		SourceHook::HookManagerPubFunc helloHM_79 = g_HMAGPtr->MakeHookMan(helloPi, 0, 79);
   1.446 +
   1.447 +		pHello->Func4();
   1.448 +		pHello->Func79();
   1.449 +		SH_CALL(pHello, &Hello::Func4)();
   1.450 +		SH_CALL(pHello, &Hello::Func79)();
   1.451 +		CHECK_STATES((&g_States,
   1.452 +			new State_Hello_Func4_Called,
   1.453 +			new State_Hello_Func79_Called,
   1.454 +			new State_Hello_Func4_Called,
   1.455 +			new State_Hello_Func79_Called,
   1.456 +			NULL), "Test" "Hello" " Part1");
   1.457 +
   1.458 +		int helloHook4 = g_SHPtr->AddHook(g_PLID, SourceHook::ISourceHook::Hook_Normal, reinterpret_cast<void*>(pHello),
   1.459 +			0, helloHM_4, new Hello_Func4_Deleg, false);
   1.460 +
   1.461 +		int helloHook79 = g_SHPtr->AddHook(g_PLID, SourceHook::ISourceHook::Hook_Normal, reinterpret_cast<void*>(pHello),
   1.462 +			0, helloHM_79, new Hello_Func79_Deleg, false);
   1.463 +
   1.464 +		pHello->Func4();
   1.465 +		pHello->Func79();
   1.466 +		SH_CALL(pHello, &Hello::Func4)();
   1.467 +		SH_CALL(pHello, &Hello::Func79)();
   1.468 +
   1.469 +		CHECK_STATES((&g_States,
   1.470 +			new State_Hello_Func4_PreHook,
   1.471 +			new State_Hello_Func4_Called,
   1.472 +			new State_Hello_Func79_PreHook,
   1.473 +			new State_Hello_Func79_Called,
   1.474 +			new State_Hello_Func4_Called,
   1.475 +			new State_Hello_Func79_Called,
   1.476 +			NULL), "Test" "Hello" " Part2");
   1.477 +
   1.478 +		g_SHPtr->RemoveHookByID(helloHook4);
   1.479 +		g_SHPtr->RemoveHookByID(helloHook79);
   1.480 +
   1.481 +		g_HMAGPtr->ReleaseHookMan(helloHM_4);
   1.482 +		g_HMAGPtr->ReleaseHookMan(helloHM_79);
   1.483 +
   1.484 +		return true;
   1.485 +	}
   1.486  }
   1.487  
   1.488 +
   1.489  bool TestHookManGen(std::string &error)
   1.490  {
   1.491  	GET_SHPTR(g_SHPtr);
   1.492 @@ -582,441 +1062,16 @@
   1.493  		new State_ObjOCtor_Called(111),
   1.494  		NULL), "GlobCtors");
   1.495  
   1.496 -	THGM_DO_TEST_void(0, ());
   1.497 -
   1.498 -	THGM_DO_TEST_void(1, (100));
   1.499 -	
   1.500 -	THGM_DO_TEST_void(2, (0x1F00));
   1.501 -
   1.502 -	THGM_DO_TEST_void(3, (0x1F000000));
   1.503 -
   1.504 -	THGM_DO_TEST_void(4, (0.5f));
   1.505 -
   1.506 -	THGM_DO_TEST_void(5, (5.5));
   1.507 -
   1.508 -	THGM_DO_TEST_void(6, (100, 0x1f00, 0x1f000000, 0.5f, 5.5));
   1.509 -
   1.510 -	char a = 5;
   1.511 -	double b = 233.33;
   1.512 -	THGM_DO_TEST_void(7, (a, b));
   1.513 -
   1.514 -	POD<7> pod7 = MakeRet< POD<7> >::Do(78);
   1.515 -	THGM_DO_TEST_void(8, (pod7));
   1.516 -
   1.517 -	POD<600> pod600 = MakeRet< POD<600> >::Do(34);
   1.518 -	THGM_DO_TEST_void(9, (pod600));
   1.519 -	
   1.520 -	THGM_DO_TEST_void(10, (pod600));
   1.521 -
   1.522 -	// Test11: Special: constructors/destructors
   1.523 -	PtrBuf_Clear();
   1.524 -	Object<3> obj3(33);
   1.525 -	Object<600> obj600(21);
   1.526 -
   1.527 -	CHECK_STATES((&g_States,
   1.528 -		new State_ObjOCtor_Called(3),
   1.529 -		new State_ObjOCtor_Called(600),
   1.530 -		NULL), "Test11 Part0");
   1.531 -
   1.532 -	setuppi_11();
   1.533 -	SourceHook::HookManagerPubFunc myhookman11 = g_HMAGPtr->MakeHookMan(protoinfo_11, 0, 0); \
   1.534 -	CAutoReleaseHookMan arhm_11(myhookman11); \
   1.535 -	int hook1_11, hook2_11, hook3_11, hook4_11;
   1.536 -	
   1.537 -	TestClass11 *pTest11 = new TestClass11;
   1.538 -	CAutoPtrDestruction<TestClass11> apd11(pTest11);
   1.539 -	
   1.540 -	/* no hooks - no hooks */
   1.541 -	PtrBuf_Clear();
   1.542 -	pTest11->Func(obj3, obj600);
   1.543 -
   1.544 -	g_Inside_LeafFunc = true;
   1.545 -	CHECK_STATES((&g_States,
   1.546 -		new State_ObjCCtor_Called(3),
   1.547 -		new State_Func11(pTest11, ParamState_m11 (obj3, obj600)),
   1.548 -		new State_ObjODtor_Called(3),
   1.549 -		NULL), "Test" "11" " Part1");
   1.550 -	g_Inside_LeafFunc = false;
   1.551 -
   1.552 -	/* hook1 - no hooks */
   1.553 -	THGM_ADD_HOOK(11, 1);
   1.554 -	
   1.555 -	PtrBuf_Clear();
   1.556 -	pTest11->Func(obj3, obj600);
   1.557 -	g_Inside_LeafFunc = true;
   1.558 -	CHECK_STATES((&g_States,
   1.559 -		new State_ObjCCtor_Called(3),
   1.560 -
   1.561 -		new State_ObjCCtor_Called(3),
   1.562 -		new State_Deleg1_11(pTest11, 0, ParamState_m11 (obj3, obj600)),
   1.563 -		new State_ObjODtor_Called(3),
   1.564 -
   1.565 -		new State_ObjCCtor_Called(3),
   1.566 -		new State_Func11(pTest11, ParamState_m11 (obj3, obj600)),
   1.567 -		new State_ObjODtor_Called(3),
   1.568 -
   1.569 -		new State_ObjODtor_Called(3),
   1.570 -		NULL), "Test" "11" " Part2");
   1.571 -	g_Inside_LeafFunc = false;
   1.572 -
   1.573 -	THGM_REMOVE_HOOK(11, 1);
   1.574 -
   1.575 -	/* hook1, hook2 - hook3, hook4 */
   1.576 -	THGM_ADD_HOOK(11, 1);
   1.577 -	THGM_ADD_HOOK(11, 2);
   1.578 -	THGM_ADD_HOOK(11, 3);
   1.579 -	THGM_ADD_HOOK(11, 4);
   1.580 -	PtrBuf_Clear();
   1.581 -	pTest11->Func(obj3, obj600);
   1.582 -	g_Inside_LeafFunc = true;
   1.583 -	CHECK_STATES((&g_States,
   1.584 -		new State_ObjCCtor_Called(3),
   1.585 -
   1.586 -		new State_ObjCCtor_Called(3),
   1.587 -		new	State_Deleg1_11(pTest11, 0, ParamState_m11 (obj3, obj600)),
   1.588 -		new State_ObjODtor_Called(3),
   1.589 -
   1.590 -		new State_ObjCCtor_Called(3),
   1.591 -		new State_Deleg2_11(pTest11, 1, ParamState_m11 (obj3, obj600)),
   1.592 -		new State_ObjODtor_Called(3),
   1.593 -
   1.594 -		new State_ObjCCtor_Called(3),
   1.595 -		new State_Deleg3_11(pTest11, 2, ParamState_m11 (obj3, obj600)),
   1.596 -		new State_ObjODtor_Called(3),
   1.597 -
   1.598 -		new State_ObjCCtor_Called(3),
   1.599 -		new State_Deleg4_11(pTest11, 3, ParamState_m11 (obj3, obj600)),
   1.600 -		new State_ObjODtor_Called(3),
   1.601 -
   1.602 -		new State_ObjODtor_Called(3),
   1.603 -	NULL), "Test" "11" " Part3");
   1.604 -	g_Inside_LeafFunc = false;
   1.605 -
   1.606 -	/* hook1 - hook3, hook4 WITH RECALLS */
   1.607 -	THGM_REMOVE_HOOK(11, 2);
   1.608 -	PtrBuf_Clear();
   1.609 -	TestClass11::ms_DoRecall = true;
   1.610 -	pTest11->Func(obj3, obj600);
   1.611 -	g_Inside_LeafFunc = true;
   1.612 -	CHECK_STATES((&g_States,
   1.613 -		new State_ObjCCtor_Called(3),
   1.614 -
   1.615 -		new State_ObjCCtor_Called(3),
   1.616 -		new	State_Deleg1_11(pTest11, 0 /* first deleg ptr */, ParamState_m11 (obj3, obj600)),
   1.617 -
   1.618 -		// recall !
   1.619 -			// second hookfunc -> new copy
   1.620 -			new State_ObjCCtor_Called(3),
   1.621 -
   1.622 -			// in second hookfunc now
   1.623 -			//   -> calls orig func
   1.624 -
   1.625 -			new State_ObjCCtor_Called(3),
   1.626 -			new State_Func11(pTest11, ParamState_m11 (obj3, obj600)(1)),
   1.627 -			new State_ObjODtor_Called(3),
   1.628 -
   1.629 -			// calls first posthook
   1.630 -			new State_ObjCCtor_Called(3),
   1.631 -			new State_Deleg3_11(pTest11, 1 /* second deleg ptr */, ParamState_m11 (obj3, obj600)(1)),
   1.632 -
   1.633 -			// recall!
   1.634 -				// third hookfunc -> new copy
   1.635 -				new State_ObjCCtor_Called(3),
   1.636 -
   1.637 -				// calls second posthook
   1.638 -
   1.639 -				new State_ObjCCtor_Called(3),
   1.640 -				new State_Deleg4_11(pTest11, 2 /* third deleg ptr */, ParamState_m11 (obj3, obj600)(2)),
   1.641 -
   1.642 -				// recall!
   1.643 -					// fourth hookfunc -> new copy
   1.644 -					new State_ObjCCtor_Called(3),
   1.645 -
   1.646 -					// has nothing to do though!
   1.647 -
   1.648 -					// fourth hookfunc done -> ret
   1.649 -					new State_ObjODtor_Called(3),
   1.650 -
   1.651 -				// third hookfunc done -> ret
   1.652 -				new State_ObjODtor_Called(3),
   1.653 -				// ret from hookhandler which did the recall
   1.654 -				new State_ObjODtor_Called(3),
   1.655 -
   1.656 -			// second hookfunc done -> ret
   1.657 -			new State_ObjODtor_Called(3),
   1.658 -			// ret from hookhandler which did the recall
   1.659 -			new State_ObjODtor_Called(3),
   1.660 -
   1.661 -		// deleg1's instance
   1.662 -		new State_ObjODtor_Called(3),
   1.663 -		// first hookfunc done -> ret
   1.664 -		new State_ObjODtor_Called(3),
   1.665 -		NULL), "Test" "11" " Part4");
   1.666 -	g_Inside_LeafFunc = false;
   1.667 -
   1.668 -	THGM_REMOVE_HOOK(11, 1);
   1.669 -	THGM_REMOVE_HOOK(11, 3);
   1.670 -	THGM_REMOVE_HOOK(11, 4);
   1.671 -
   1.672 -	THGM_DO_TEST(101, ());
   1.673 -
   1.674 -	THGM_DO_TEST(102, ());
   1.675 -
   1.676 -	THGM_DO_TEST(103, ());
   1.677 -
   1.678 -	THGM_DO_TEST(104, ());
   1.679 -
   1.680 -	THGM_DO_TEST(105, ());
   1.681 -
   1.682 -	// pod returns
   1.683 -	THGM_DO_TEST(106, (5));
   1.684 -	THGM_DO_TEST(107, (5));
   1.685 -	THGM_DO_TEST(108, (5));
   1.686 -	THGM_DO_TEST(109, (5));
   1.687 -
   1.688 -	// Test110: Special: constructors/destructors on return
   1.689 -	PtrBuf_Clear();
   1.690 -	ObjRet13 obj13;
   1.691 -
   1.692 -	CHECK_STATES((&g_States,
   1.693 -		new State_ObjOCtor_Called(13),
   1.694 -		NULL), "Test110 Part0");
   1.695 -
   1.696 -	setuppi_110();
   1.697 -	setupri_110();
   1.698 -
   1.699 -	SourceHook::HookManagerPubFunc myhookman110 = g_HMAGPtr->MakeHookMan(protoinfo_110, 0, 0); \
   1.700 -	CAutoReleaseHookMan arhm_110(myhookman110); \
   1.701 -	int hook1_110, hook2_110, hook3_110, hook4_110;
   1.702 -
   1.703 -	TestClass110 *pTest110 = new TestClass110;
   1.704 -	CAutoPtrDestruction<TestClass110> apd110(pTest110);
   1.705 -
   1.706 -	/* no hooks - no hooks */
   1.707 -	PtrBuf_Clear();
   1.708 -	obj13 = pTest110->Func(5);
   1.709 -
   1.710 -	g_Inside_LeafFunc = true;
   1.711 -	CHECK_STATES((&g_States,
   1.712 -		new State_Func110(pTest110, ParamState_m110 (5)),
   1.713 -		new State_ObjOCtor_Called(13),			// MakeRet: Construction of x
   1.714 -		new State_ObjCCtor_Called(13),			// Return from MakeRet	-> construct temporary object in our stack
   1.715 -		new State_ObjODtor_Called(13),			// MakeRet: Destruction of x
   1.716 -
   1.717 -		new State_ObjAssignOp_Called(13),		// assign: obj13 = temporary object in our stack
   1.718 -		new State_ObjODtor_Called(13),			// Func110: destruction of temporary object
   1.719 -		NULL), "Test" "110" " Part1");
   1.720 -	g_Inside_LeafFunc = false;
   1.721 -
   1.722 -	/* hook1 - no hooks */
   1.723 -	THGM_ADD_HOOK(110, 1);
   1.724 -
   1.725 -	PtrBuf_Clear();
   1.726 -	obj13 = pTest110->Func(5);
   1.727 -	g_Inside_LeafFunc = true;
   1.728 -	CHECK_STATES((&g_States,
   1.729 -		// HookFunc: construct orig_ret/override_ret/plugin_ret objects
   1.730 -		new State_ObjOCtor_Called(13),
   1.731 -		new State_ObjOCtor_Called(13),
   1.732 -		new State_ObjOCtor_Called(13),
   1.733 -
   1.734 -		// Calling delegate
   1.735 -			new State_Deleg1_110(pTest110, 0, ParamState_m110 (5)),
   1.736 -
   1.737 -			new State_ObjOCtor_Called(13),	// MakeRet: Construction of x
   1.738 -			new State_ObjCCtor_Called(13),	// Return from MakeRet	-> construct temporary object in HookFunc's stack
   1.739 -			new State_ObjODtor_Called(13),	// MakeRet: Destruction of x
   1.740 -
   1.741 -		// back in hookfunc
   1.742 -		new State_ObjAssignOp_Called(13),	// assign: plugin_ret = temporary object in HookFunc's stack
   1.743 -		new State_ObjODtor_Called(13),		// destruction of temporary object in HookFunc's stack
   1.744 -
   1.745 -		// Calling orig function Func110
   1.746 -			new State_Func110(pTest110, ParamState_m110 (5)),
   1.747 -			new State_ObjOCtor_Called(13),	// MakeRet: Construction of x
   1.748 -			new State_ObjCCtor_Called(13),	// Return from MakeRet	-> construct temporary object in HookFunc's stack
   1.749 -			new State_ObjODtor_Called(13),	// MakeRet: Destruction of x
   1.750 -
   1.751 -		// back in hookfunc
   1.752 -		new State_ObjAssignOp_Called(13),	// assign: orig_ret = temporary object in HookFunc's stack
   1.753 -		new State_ObjODtor_Called(13),		// destruction of temporary object in HookFunc's stack
   1.754 -
   1.755 -		// hookfunc is returning:
   1.756 -		new State_ObjCCtor_Called(13),		// copy to temp object in our stack
   1.757 -
   1.758 -		// hookfunc cleans up its stack -> destroys plugin_ret/override_ret/orig_ret
   1.759 -		new State_ObjODtor_Called(13),
   1.760 -		new State_ObjODtor_Called(13),
   1.761 -		new State_ObjODtor_Called(13),
   1.762 -		
   1.763 -		// we are in our function: assign 
   1.764 -		new State_ObjAssignOp_Called(13),	// assign: obj13 = temporary object in our stack
   1.765 -		new State_ObjODtor_Called(13),		// Func110: destruction of temporary object
   1.766 -
   1.767 -		NULL), "Test" "11" " Part2");
   1.768 -	
   1.769 -	CHECK_COND(obj13 == 0, "Test" "11" " Part 2.1");
   1.770 -	g_Inside_LeafFunc = false;
   1.771 -
   1.772 -	THGM_REMOVE_HOOK(11, 1);
   1.773 -
   1.774 -	/* hook1, hook2 - hook3, hook4 */
   1.775 -	THGM_ADD_HOOK(110, 1);
   1.776 -	THGM_ADD_HOOK(110, 2);
   1.777 -	THGM_ADD_HOOK(110, 3);
   1.778 -	THGM_ADD_HOOK(110, 4);
   1.779 -
   1.780 -	PtrBuf_Clear();
   1.781 -	obj13 = pTest110->Func(5);
   1.782 -	g_Inside_LeafFunc = true;
   1.783 -	CHECK_STATES((&g_States,
   1.784 -		// HookFunc: construct orig_ret/override_ret/plugin_ret objects
   1.785 -		new State_ObjOCtor_Called(13),
   1.786 -		new State_ObjOCtor_Called(13),
   1.787 -		new State_ObjOCtor_Called(13),
   1.788 -
   1.789 -		// Calling delegate1
   1.790 -			new State_Deleg1_110(pTest110, 0, ParamState_m110 (5)),
   1.791 -
   1.792 -			new State_ObjOCtor_Called(13),	// MakeRet: Construction of x
   1.793 -			new State_ObjCCtor_Called(13),	// Return from MakeRet	-> construct temporary object in HookFunc's stack
   1.794 -			new State_ObjODtor_Called(13),	// MakeRet: Destruction of x
   1.795 -
   1.796 -		// back in hookfunc
   1.797 -		new State_ObjAssignOp_Called(13),	// assign: plugin_ret = temporary object in HookFunc's stack
   1.798 -		new State_ObjODtor_Called(13),		// destruction of temporary object in HookFunc's stack
   1.799 -
   1.800 -
   1.801 -		// Calling delegate2
   1.802 -			new State_Deleg2_110(pTest110, 1, ParamState_m110 (5)),
   1.803 -
   1.804 -			new State_ObjOCtor_Called(13),	// MakeRet: Construction of x
   1.805 -			new State_ObjCCtor_Called(13),	// Return from MakeRet	-> construct temporary object in HookFunc's stack
   1.806 -			new State_ObjODtor_Called(13),	// MakeRet: Destruction of x
   1.807 -
   1.808 -		// back in hookfunc
   1.809 -		new State_ObjAssignOp_Called(13),	// assign: plugin_ret = temporary object in HookFunc's stack
   1.810 -		new State_ObjODtor_Called(13),		// destruction of temporary object in HookFunc's stack
   1.811 -
   1.812 -		// hookfunc finds out that the hook wanted to SUPERCEDE --> copy to override_Ret
   1.813 -		new State_ObjAssignOp_Called(13),
   1.814 -
   1.815 -		// SUPERCEDE -> orig function is not called
   1.816 -		// instead: orig_ret = override_ret
   1.817 -		new State_ObjAssignOp_Called(13),
   1.818 -
   1.819 -		// Calling delegate3
   1.820 -			new State_Deleg3_110(pTest110, 2, ParamState_m110 (5)),
   1.821 -
   1.822 -			new State_ObjOCtor_Called(13),	// MakeRet: Construction of x
   1.823 -			new State_ObjCCtor_Called(13),	// Return from MakeRet	-> construct temporary object in HookFunc's stack
   1.824 -			new State_ObjODtor_Called(13),	// MakeRet: Destruction of x
   1.825 -
   1.826 -		// back in hookfunc
   1.827 -		new State_ObjAssignOp_Called(13),	// assign: plugin_ret = temporary object in HookFunc's stack
   1.828 -		new State_ObjODtor_Called(13),		// destruction of temporary object in HookFunc's stack
   1.829 -
   1.830 -		// Calling delegate4
   1.831 -			new State_Deleg4_110(pTest110, 3, ParamState_m110 (5)),
   1.832 -
   1.833 -			new State_ObjOCtor_Called(13),	// MakeRet: Construction of x
   1.834 -			new State_ObjCCtor_Called(13),	// Return from MakeRet	-> construct temporary object in HookFunc's stack
   1.835 -			new State_ObjODtor_Called(13),	// MakeRet: Destruction of x
   1.836 -
   1.837 -		// back in hookfunc
   1.838 -		new State_ObjAssignOp_Called(13),	// assign: plugin_ret = temporary object in HookFunc's stack
   1.839 -		new State_ObjODtor_Called(13),		// destruction of temporary object in HookFunc's stack
   1.840 -
   1.841 -		// hookfunc finds out that the hook wanted to SUPERCEDE --> copy to override_Ret (yes really, we overwrite the old value!)
   1.842 -		new State_ObjAssignOp_Called(13),
   1.843 -
   1.844 -		// hookfunc is returning:
   1.845 -		new State_ObjCCtor_Called(13),		// copy to temp object in our stack
   1.846 -
   1.847 -		// hookfunc cleans up its stack -> destroys plugin_ret/override_ret/orig_ret
   1.848 -		new State_ObjODtor_Called(13),
   1.849 -		new State_ObjODtor_Called(13),
   1.850 -		new State_ObjODtor_Called(13),
   1.851 -
   1.852 -		// we are in our function: assign 
   1.853 -		new State_ObjAssignOp_Called(13),	// assign: obj13 = temporary object in our stack
   1.854 -		new State_ObjODtor_Called(13),		// Func110: destruction of temporary object
   1.855 -
   1.856 -		NULL), "Test" "11" " Part3");
   1.857 -
   1.858 -	CHECK_COND(obj13 == 4, "Test" "11" " Part 3.1");
   1.859 -	g_Inside_LeafFunc = false;
   1.860 -
   1.861 -	THGM_REMOVE_HOOK(110, 1);
   1.862 -	THGM_REMOVE_HOOK(110, 2);
   1.863 -	THGM_REMOVE_HOOK(110, 3);
   1.864 -	THGM_REMOVE_HOOK(110, 4);
   1.865 -
   1.866 -
   1.867 -	// RefRet
   1.868 -	THGM_DO_TEST(111, ());
   1.869 -
   1.870 -	// Vafmt
   1.871 -
   1.872 -	THGM_DO_TEST_void(200, ("Hello %s%d%s", "BA", 1, "L!"));
   1.873 -
   1.874 -	THGM_DO_TEST_void(201, (100, "Hello %s%d%s", "BA", 1, "L!"));
   1.875 -	
   1.876 -	THGM_DO_TEST_void(203, (0x1F000000, "Hello %s%d%s", "BA", 1, "L!"));
   1.877 -
   1.878 -	THGM_DO_TEST_void(206, (100, 0x1f00, 0x1f000000, 0.5f, 5.5, "Hello %s%d%s", "BA", 1, "L!"));
   1.879 -
   1.880 -	a = 5;
   1.881 -	b = 233.33;
   1.882 -	THGM_DO_TEST_void(207, (a, b, "Hello %s%d%s", "BA", 1, "L!"));
   1.883 -
   1.884 -	pod7 = MakeRet< POD<7> >::Do(78);
   1.885 -	THGM_DO_TEST_void(208, (pod7, "Hello %s%d%s", "BA", 1, "L!"));
   1.886 -	
   1.887 -	THGM_DO_TEST_void(210, (pod600, "Hello %s%d%s", "BA", 1, "L!"));
   1.888 -	
   1.889 -	// Test for lange vtable indices
   1.890 -	Hello *pHello = new Hello;
   1.891 -	SourceHook::CProtoInfoBuilder helloPi(SourceHook::ProtoInfo::CallConv_ThisCall);
   1.892 -	SourceHook::HookManagerPubFunc helloHM_4 = g_HMAGPtr->MakeHookMan(helloPi, 0, 4);
   1.893 -	SourceHook::HookManagerPubFunc helloHM_79 = g_HMAGPtr->MakeHookMan(helloPi, 0, 79);
   1.894 -
   1.895 -	pHello->Func4();
   1.896 -	pHello->Func79();
   1.897 -	SH_CALL(pHello, &Hello::Func4)();
   1.898 -	SH_CALL(pHello, &Hello::Func79)();
   1.899 -	CHECK_STATES((&g_States,
   1.900 -		new State_Hello_Func4_Called,
   1.901 -		new State_Hello_Func79_Called,
   1.902 -		new State_Hello_Func4_Called,
   1.903 -		new State_Hello_Func79_Called,
   1.904 -		NULL), "Test" "Hello" " Part1");
   1.905 -
   1.906 -	int helloHook4 = g_SHPtr->AddHook(g_PLID, SourceHook::ISourceHook::Hook_Normal, reinterpret_cast<void*>(pHello),
   1.907 -		0, helloHM_4, new Hello_Func4_Deleg, false);
   1.908 -
   1.909 -	int helloHook79 = g_SHPtr->AddHook(g_PLID, SourceHook::ISourceHook::Hook_Normal, reinterpret_cast<void*>(pHello),
   1.910 -		0, helloHM_79, new Hello_Func79_Deleg, false);
   1.911 -
   1.912 -	pHello->Func4();
   1.913 -	pHello->Func79();
   1.914 -	SH_CALL(pHello, &Hello::Func4)();
   1.915 -	SH_CALL(pHello, &Hello::Func79)();
   1.916 -
   1.917 -	CHECK_STATES((&g_States,
   1.918 -		new State_Hello_Func4_PreHook,
   1.919 -		new State_Hello_Func4_Called,
   1.920 -		new State_Hello_Func79_PreHook,
   1.921 -		new State_Hello_Func79_Called,
   1.922 -		new State_Hello_Func4_Called,
   1.923 -		new State_Hello_Func79_Called,
   1.924 -		NULL), "Test" "Hello" " Part2");
   1.925 -
   1.926 -	g_SHPtr->RemoveHookByID(helloHook4);
   1.927 -	g_SHPtr->RemoveHookByID(helloHook79);
   1.928 -
   1.929 -	g_HMAGPtr->ReleaseHookMan(helloHM_4);
   1.930 -	g_HMAGPtr->ReleaseHookMan(helloHM_79);
   1.931 +	if (!Tests1(error))
   1.932 +		return false;
   1.933 +	if (!Tests2(error))
   1.934 +		return false;
   1.935 +	if (!Tests3(error))
   1.936 +		return false;
   1.937 +	if (!Tests4(error))
   1.938 +		return false;
   1.939 +	if (!Tests5(error))
   1.940 +		return false;
   1.941  
   1.942  	// Shutdown now!
   1.943  	// If we don't SH will auto-shutdown _after_ genc's destructor is called