Root/
Source at commit 1166 created 13 years 10 days ago. By meklort, Fixed recent Makefile changes. Please do not use /Users/evan/SourceCode/tmp/chameleon/trunk or VPATH. the *only* time you should use /Users/evan/SourceCode/tmp/chameleon/trunk is when setting the SRCROOT variable. Also note that very soon make pkg is going to be removed. The pkg build script in trunk is very out of date. Instead please use the package maker at http://forge.voodooprojects.org/p/chameleonApplications/. Once this is ready for trunk it will be merged. | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 2009 Evan Lojewski. All rights reserved.␊ |
3 | *␊ |
4 | */␊ |
5 | #include <cstdlib>␊ |
6 | #include <iostream>␊ |
7 | #include <modules>␊ |
8 | ␊ |
9 | extern "C"␊ |
10 | {␊ |
11 | void HelloWorld_start();␊ |
12 | }␊ |
13 | ␊ |
14 | ␊ |
15 | using namespace std;␊ |
16 | ␊ |
17 | class HW {␊ |
18 | private:␊ |
19 | ␉int id;␊ |
20 | public:␊ |
21 | ␉virtual void setId( int id );␊ |
22 | ␉virtual void printHello( void );␊ |
23 | };␊ |
24 | ␊ |
25 | void helloWorld(void* binary, void* arg2, void* arg3, void* arg4)␊ |
26 | {␊ |
27 | ␉HW* obj = new HW;␊ |
28 | ␉HW* obj2 = new HW;␊ |
29 | ␉obj->setId(1);␊ |
30 | ␉obj->printHello();␊ |
31 | ␉delete obj;␊ |
32 | ␉␊ |
33 | ␉obj2->setId(2);␊ |
34 | ␉obj2->printHello();␊ |
35 | ␉delete obj2;␊ |
36 | ␊ |
37 | ␉printf("Hello world from ExecKernel hook. Binary located at 0x%X\n", binary);␊ |
38 | ␉getchar();␊ |
39 | }␊ |
40 | ␊ |
41 | void HelloWorld_start()␊ |
42 | {␊ |
43 | ␉//printf("Hooking 'ExecKernel'\n");␊ |
44 | ␉register_hook_callback("ExecKernel", &helloWorld);␊ |
45 | ␉register_hook_callback("Kernel Start", &helloWorld);␊ |
46 | }␊ |
47 | ␊ |
48 | void HW::printHello()␊ |
49 | {␊ |
50 | ␉//cout << "[" << id << "] HelloWorld from a c++ function\n";␊ |
51 | ␉printf("[%d] HelloWorld from a c++ function\n", id);␊ |
52 | }␊ |
53 | ␊ |
54 | void HW::setId(int id)␊ |
55 | {␊ |
56 | ␉this->id = id;␊ |
57 | }␊ |
58 |