Chameleon

Chameleon Svn Source Tree

Root/branches/meklort/i386/modules/HelloWorld/HelloWorld.cpp

Source at commit 660 created 13 years 4 months ago.
By meklort, Added includes dir for modules (c++ includes only at the moment, may ad klibc includes later on). Includes path is now included for modules
1/*
2 * Copyright (c) 2009 Evan Lojewski. All rights reserved.
3 *
4 */
5#include <cstdlib>
6#include <iostream>
7#include <modules>
8
9using namespace std;
10
11class HW {
12private:
13int id;
14public:
15virtual void setId( int id );
16virtual void printHello( void );
17};
18
19void helloWorld(void* binary, void* arg2, void* arg3, void* arg4)
20{
21HW* obj = new HW;
22HW* obj2 = new HW;
23obj->setId(1);
24obj->printHello();
25delete obj;
26
27obj2->setId(2);
28obj2->printHello();
29delete obj2;
30
31printf("Hello world from ExecKernel hook. Binary located at 0x%X\n", binary);
32getchar();
33
34}
35
36void HelloWorld_start()
37{
38//printf("Hooking 'ExecKernel'\n");
39register_hook_callback("ExecKernel", &helloWorld);
40register_hook_callback("Kernel Start", &helloWorld);
41
42}
43
44void HW::printHello()
45{
46//cout << "[" << id << "] HelloWorld from a c++ function\n";
47printf("[%d] HelloWorld from a c++ function\n", id);
48}
49
50void HW::setId(int id)
51{
52this->id = id;
53}
54

Archive Download this file

Revision: 660