Upload New File

master
xerox 5 years ago
parent 3a6f3ae2fa
commit 992db93708

@ -0,0 +1,40 @@
#include <iostream>
#include "Hook.hpp"
using namespace std;
BOOL HookWriteFile(
HANDLE hFile,
LPCVOID lpBuffer,
DWORD nNumberOfBytesToWrite,
LPDWORD lpNumberOfBytesWritten,
LPOVERLAPPED lpOverlapped
)
{
memset((void *)lpBuffer, NULL, nNumberOfBytesToWrite);
memcpy((void*)lpBuffer, "LOL HACKED?\n", sizeof("LOL HACKED?\n"));
Hook::Disable((uintptr_t)&WriteFile);
BOOL result = WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped);
Hook::Enable((uintptr_t)&WriteFile);
return result;
}
int main()
{
cout << "Hello world" << endl;
Hook::Install(
(uintptr_t) &WriteFile,
(uintptr_t) &HookWriteFile
);
OFSTRUCT ofstruct;
OpenFile("output.txt", &ofstruct, OF_CREATE);
HFILE result = OpenFile("output.txt", &ofstruct, OF_READWRITE);
while (true)
{
Sleep(1000);
char aString[] = "Hello world!\n";
WriteFile((HANDLE)result, aString, sizeof(aString), NULL, NULL);
}
}
Loading…
Cancel
Save