Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Source By Ru124 XD
- //RCMain.h My Windows Form
- #define jmp(frm, to) (int)(((int)to - (int)frm) - 5) // needed for some hacks.
- unsigned long ulStat = 0x0089307F;
- unsigned long ulStatReturn = 0x0089307F;
- long int HP = 0,
- MP = 0,
- MaxHP = 0,
- MaxMP = 0,
- Exp = 0,
- MaxExp = 0;
- void MakePageWritable(unsigned long ulAddress, unsigned long ulSize)
- {
- MEMORY_BASIC_INFORMATION* mbi = new MEMORY_BASIC_INFORMATION;
- VirtualQuery((void*)ulAddress, mbi, ulSize);
- if (mbi->Protect != PAGE_EXECUTE_READWRITE)
- {
- unsigned long* ulProtect = new unsigned long;
- VirtualProtect((void*)ulAddress, ulSize, PAGE_EXECUTE_READWRITE, ulProtect);
- delete ulProtect;
- }
- delete mbi;
- }
- void Jump( unsigned long ulAddress, //Address at which a long jump/call is placed
- void* Function, //A pointer to the destination of the long jump or call
- unsigned Nops ) //If the original opcode is longer than 5 bytes, you must nop the rest.
- {
- MakePageWritable(ulAddress, Nops + 5); //Make memory writable before any modifications are attempted
- *(unsigned char*)ulAddress = 0xE9; //E9 is the opcode for a long jump
- *(unsigned long*)(ulAddress + 1) = jmp(ulAddress, Function);//The next 4 bytes indicate the DISPLACEMENT of the destination
- memset((void*)(ulAddress + 5), 0x90, Nops); //nop the rest of the opcode
- }
- private: System::Void checkBoxStatHook_CheckedChanged(System::Object^ sender, System::EventArgs^ e) //CheckBox Toggle StatHook
- {
- if (checkBoxStatHook->CheckState == CheckState::Checked)
- {
- Jump(ulStat, StatHook, 0);
- }
- else
- {
- }
- }
- //ASMFunc.h My Header With ASM Code
- extern unsigned long ulStat;
- extern unsigned long ulStatReturn;
- extern long int HP;
- extern long int MP;
- extern long int MaxHP;
- extern long int MaxMP;
- extern long int Exp;
- extern long int MaxExp;
- void StatHook()
- {
- __asm
- {
- push eax
- mov eax,[ebp+0x08]
- mov [HP],eax
- mov eax,[ebp+0x0c]
- mov [MaxHP],eax
- mov eax,[ebp+0x10]
- mov [MP],eax
- mov eax,[ebp+0x14]
- mov [MaxMP],eax
- mov eax,[ebp+0x18]
- mov [Exp],eax
- mov eax,[ebp+0x1c]
- mov [MaxExp],eax
- pop eax
- lea ecx,[eax+eax*4]
- test ecx,ecx
- jmp ulStatReturn+5
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement