|
|
@ -1,5 +1,5 @@
|
|
|
|
#include <iostream>
|
|
|
|
#include <iostream>
|
|
|
|
#include "Hook.hpp"
|
|
|
|
#include "hook.hpp"
|
|
|
|
using namespace std;
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
BOOL HookWriteFile(
|
|
|
|
BOOL HookWriteFile(
|
|
|
@ -10,20 +10,23 @@ BOOL HookWriteFile(
|
|
|
|
LPOVERLAPPED lpOverlapped
|
|
|
|
LPOVERLAPPED lpOverlapped
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//this will change the output to "shithooked!\n"
|
|
|
|
|
|
|
|
|
|
|
|
memset((void *)lpBuffer, NULL, nNumberOfBytesToWrite);
|
|
|
|
memset((void *)lpBuffer, NULL, nNumberOfBytesToWrite);
|
|
|
|
memcpy((void*)lpBuffer, "LOL HACKED?\n", sizeof("LOL HACKED?\n"));
|
|
|
|
memcpy((void*)lpBuffer, "shithooked!?\n", sizeof("shithooked!\n"));
|
|
|
|
Hook::Disable((uintptr_t)&WriteFile);
|
|
|
|
hook::disable(&WriteFile);
|
|
|
|
BOOL result = WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped);
|
|
|
|
BOOL result = WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped);
|
|
|
|
Hook::Enable((uintptr_t)&WriteFile);
|
|
|
|
hook::enable(&WriteFile);
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cout << "Hello world" << endl;
|
|
|
|
cout << "Hello world" << endl;
|
|
|
|
Hook::Install(
|
|
|
|
hook::install(
|
|
|
|
(uintptr_t) &WriteFile,
|
|
|
|
&WriteFile,
|
|
|
|
(uintptr_t) &HookWriteFile
|
|
|
|
&HookWriteFile
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
OFSTRUCT ofstruct;
|
|
|
|
OFSTRUCT ofstruct;
|
|
|
|