-
Notifications
You must be signed in to change notification settings - Fork 38
/
Main.cpp
50 lines (33 loc) · 923 Bytes
/
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
#include "LeoSpecial.h"
#include <time.h>
void(WINAPI *o_Sleep)(DWORD dwMilliseconds) = Sleep;
void hk_sleep(DWORD dwMilliseconds)
{
printf("[+] Hooked! Removing %d milliseconds worth of sleep!\n", dwMilliseconds);
return;
}
int main()
{
//Hook codes!
LeoHook Leo;
if (!Leo.Hook((uintptr_t)Sleep, (uintptr_t)hk_sleep))
printf("[-] Failed to hook...\n");
double time_spent = 0.0;
clock_t begin = clock();
//Hooked
Sleep(100000);
clock_t end = clock();
time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
printf("[+] Time elpased is %f seconds\n", time_spent);
//Unhook
if (!Leo.Unhook())
printf("[-] Failed to unhook...\n");
time_spent = 0.0;
begin = clock();
Sleep(1000);
end = clock();
time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
printf("[+] Time elpased is %f seconds\n", time_spent);
std::cin.get();
return 0;
}