All pastes #258121 Raw Edit

Stuff

public text v1 · immutable
#258121 ·published 2006-11-26 03:58 UTC
rendered paste body
#include "hook.h"
#include <iostream>
#include <windows.h>
using namespace std;

typedef void (*BAR)();
RITZ::HOOK<BAR> hook;

void bar()
{
	cout << "bar" << endl;

}

void foo()
{
	cout << "foo" << endl;
}


DWORD WINAPI Hookinator(LPVOID p)
{

	for(;;)
	{
		hook.Unhook();
		hook.Rehook();
	}
}

int main()
{
	hook.Hook(foo, bar);
	CreateThread(0, 0, Hookinator, 0, 0, 0);
	for(;;)
	{
		foo();
	}
}