You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.0 KiB
44 lines
1.0 KiB
#include <stdio.h>
|
|
#include <Windows.h>
|
|
|
|
#include "unload.h"
|
|
#include "hooks.h"
|
|
|
|
void __cdecl main_entry(pimage_data process_image_data)
|
|
{
|
|
LoadLibraryA("user32.dll");
|
|
MessageBoxA(NULL, "injected into notepad", "INFO", NULL);
|
|
OFSTRUCT data;
|
|
hooks::winhttp_log_handle =
|
|
reinterpret_cast<HANDLE>(
|
|
::OpenFile(
|
|
"WinHttp.log",
|
|
&data,
|
|
OF_CREATE
|
|
));
|
|
|
|
MessageBoxA(NULL, "created logs for WinHttp & Kernel32 functions.", "INFO", NULL);
|
|
auto result = hooks::iat_hook(
|
|
process_image_data->image_base,
|
|
"WinHttpOpen",
|
|
&hooks::win_http_open
|
|
);
|
|
|
|
if(result)
|
|
MessageBoxA(NULL, "hooked WinHttpOpen.", "INFO", NULL);
|
|
else
|
|
MessageBoxA(NULL, "failed to hook WinHttpOpen.", "INFO", NULL);
|
|
|
|
result = hooks::iat_hook(
|
|
process_image_data->image_base,
|
|
"GetModuleHandleA",
|
|
&hooks::get_module_handle
|
|
);
|
|
|
|
if (result)
|
|
MessageBoxA(NULL, "hooked GetModuleHandleA.", "INFO", NULL);
|
|
else
|
|
MessageBoxA(NULL, "failed to hook GetModuleHandleA.", "INFO", NULL);
|
|
|
|
MessageBoxA(NULL, "hooked WinHttpOpen & Kernel32 functions.", "INFO", NULL);
|
|
} |