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 51 52 53 54 55 56 57 58
|
#include <windows.h>
extern int Main();
void WINAPI MainThread()
{
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)HpMpHook, NULL, 0, NULL);
Main();
}
BOOL WINAPI DllMain ( HMODULE hModule, DWORD dwReason, LPVOID lpvReserved )
{
switch ( dwReason ) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hModule);
if ( CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)MainThread, NULL, 0, NULL) == NULL ) {
return FALSE;
}
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}
__inline ULONG_PTR ReadPointer(ULONG_PTR* ulBase, INT nOffset)
{
if (!IsBadReadPtr((VOID*)ulBase, sizeof(ULONG_PTR)))
{
if (!IsBadReadPtr((VOID*)((*(ULONG_PTR*)ulBase)+nOffset), sizeof(ULONG_PTR)))
{
return *(ULONG_PTR*)((*(ULONG_PTR*)ulBase)+nOffset);
}
}
return 0;
}
int HP, MP = 0;
void HpMpHook()
{
for(;;)
{
HP = (int)ReadPointer((ULONG_PTR*)0x00493D7F3, 0x00000D74);
MP = (int)ReadPointer((ULONG_PTR*)0x00493D7F3, 0x00000D78);
Sleep(50);
}
}
|