-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathmain.cpp
executable file
·71 lines (56 loc) · 1.87 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "../shared/swtfb.cpp"
#include <cstdio>
#include <iostream>
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <dlfcn.h>
#include <stdint.h>
void dump_qtClass(QObject* object) {
const QMetaObject *meta = object->metaObject();
qDebug() << meta->className();
qDebug() << "Methods";
for (int id = 0; id < meta->methodCount(); ++id) {
const QMetaMethod method = meta->method(id);
if (method.methodType() == QMetaMethod::Slot && method.access() == QMetaMethod::Public)
qDebug() << method.access() << method.name() << method.parameterNames() << method.parameterTypes();
}
qDebug() << "Properties";
for (int id = 0; id < meta->propertyCount(); ++id) {
const QMetaProperty property = meta->property(id);
qDebug() << property.name() << property.type();
}
qDebug() << "Enumerators";
for (int id = 0; id < meta->enumeratorCount(); ++id) {
const QMetaEnum en = meta->enumerator(id);
qDebug() << en.name();
for (int j = 0; j < en.keyCount(); j++) {
qDebug() << en.key(j);
}
qDebug() << "";
}
}
extern "C" {
static void _libhook_init() __attribute__((constructor));
static void _libhook_init() { printf("LIBHOOK INIT\n"); }
int main(int, char **, char **) {
swtfb::SwtFB fb;
while(true) {
cout << "Waiting: " << endl;
std::cin.ignore();
fb.FullScreen(0xFF);
cout << "again" << endl;
fb.DrawLine();
}
printf("END of our main\n");
}
int __libc_start_main(int (*)(int, char **, char **), int argc,
char **argv, int (*init)(int, char **, char **),
void (*fini)(void), void (*rtld_fini)(void),
void *stack_end) {
printf("LIBC START HOOK\n");
auto func_main =
(decltype(&__libc_start_main))dlsym(RTLD_NEXT, "__libc_start_main");
return func_main(main, argc, argv, init, fini, rtld_fini, stack_end);
};
};