Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DWORD AirMemory::AutoVMHook(DWORD Address, void *Function, DWORD *RetAddr, DWORD MinAddr){
- DWORD i, VMSection, VMSection_Ret;
- Address = GetAbsoluteAddress(Address);
- for(i=Address; ;i++){
- if(*(BYTE *)i == JMP){
- VMSection = *(DWORD *)(i + 1) + i + 5;
- if((VMSection > Memory_Start) && (VMSection < Memory_End)){
- break;
- }
- }
- }
- for(i=VMSection; ;i++){
- switch(*(BYTE *)i){
- case JMP:
- VMSection_Ret = *(DWORD *)(i + 1) + i + 5;
- if((VMSection_Ret > Memory_Start) && (VMSection_Ret < Memory_End)){
- if(MinAddr && i < MinAddr){
- i = VMSection_Ret;
- break;
- }
- WriteHook(i, JMP, Function);
- *RetAddr = VMSection_Ret;
- return i;
- }
- break;
- case CALL:
- VMSection_Ret = *(DWORD *)(i + 1) + i + 5;
- if((VMSection_Ret > Memory_Start) && (VMSection_Ret < Memory_End)){
- if(MinAddr && i < MinAddr){
- i = VMSection_Ret;
- break;
- }
- WriteHook(i, CALL, Function);
- *RetAddr = VMSection_Ret;
- return i;
- }
- break;
- default:
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment