Код: Выделить всё
#include "pch.h"
#include
#include
#include "MinHook.h"
typedef void (WINAPI* GETSYSTEMTIME)(LPSYSTEMTIME);
GETSYSTEMTIME originalGetSystemTime = nullptr;
void WINAPI customGetSystemTime(LPSYSTEMTIME lpSystemTime) {
originalGetSystemTime(lpSystemTime);
char buffer[100];
sprintf_s(buffer, "Current time: %02d:%02d:%02d", lpSystemTime->wHour, lpSystemTime->wMinute, lpSystemTime->wSecond);
MessageBoxA(NULL, buffer, "Notification", MB_OK);
}
int setupHook() {
if (MH_Initialize() != MH_OK) {
return 1;
}
else {
MessageBoxA(NULL, "Hook initialized", "Notification", MB_OK);
}
if (MH_CreateHook(&GetSystemTime, &customGetSystemTime, reinterpret_cast(&originalGetSystemTime)) != MH_OK) {
return 1;
}
if (MH_EnableHook(&GetSystemTime) != MH_OK) {
return 1;
}
return 0;
}
// DLL entry point
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {
if (fdwReason == DLL_PROCESS_ATTACH) {
setupHook();
}
return TRUE;
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... -executing