Posted: Tue Apr 16, 2024 1:30 am Post subject: [?] developing a c++ plugin
hi all
im trying to make a simple veh hook plugin.
there's a problem i encountered. to avoid fps drop i decided to copy a whole page and then jump to it by veh. now what should i do if the page does not start with a valid instruction? i.e an instruction is at boundary of two pages.
Joined: 09 May 2003 Posts: 25669 Location: The netherlands
Posted: Tue Apr 16, 2024 4:14 am Post subject:
copy the surrounding pages as well and adapt them so all their logic jumps back to the original code (e.g int3's in all instructions except the boundary instructions and on int3 make it jump to the corresponding page)
also adjust all rip relative instructions in case you haven't done that yet _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping
copy the surrounding pages as well and adapt them so all their logic jumps back to the original code (e.g int3's in all instructions except the boundary instructions and on int3 make it jump to the corresponding page)
also adjust all rip relative instructions in case you haven't done that yet
i think i get the idea. fill the before and after pages with 0xCC and catch them with EXCEPTION_BREAKPOINT then jump to original location.
but, what if its a very long jump or a distant call?
and so said "except the boundary instructions". that's my problem. how can i do that code-wise? how can i find out if a page begins or ends with incomplete instruction?
would really appreciate a pseudo code. its easy if implementing it for one location but becomes a challenge when trying to create a universal solution.
there's also PAGE_EXECUTE_WRITECOPY. is it possible to exploit (write to that copied page) this too? i mean even if only in kernel level, its worth a try.
Joined: 09 May 2003 Posts: 25669 Location: The netherlands
Posted: Tue Apr 16, 2024 11:35 pm Post subject:
disassemble it all
and as i said adjust all rip relative instructions. That includes long jumps (short jumps are fine as they can never jump beyond the int3 pages) _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping
there are "Disassembler" and "disassembleEx" exported functions. how are they different?
i know I'm being dumb here but when you say "disassemble it all" i don't really get where this "all" starts so that i can pass its address to those exported functions.
i can go back another 0x1000 bytes and start copying from there but what if that page also doesn't start with a complete instruction? what if i enter another function?
Joined: 09 May 2003 Posts: 25669 Location: The netherlands
Posted: Wed Apr 17, 2024 1:17 am Post subject:
I recommend invoking ce's lua so you have access to the lastDisassembleData which contains info like rip relativity etc... There's also a riprelative scanner in lua
Normally when you are at a wrong offset and disassemble it eventually snaps back to the correct code . If you start 0x1000 bytes before you should snap back correctly before the last instruction which is the important one
you can of course also scan for known function start markers and start the disassembler from there
I think the stealthedit plugin also uses ce's lua to do something like this _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping
i know there's the *L from CE C interface but how exactly should i call lastDisassembleData with that?
is there any debug capability (via VS or any other tool) that makes it possible to view returned object by lastDisassembleData? in real-time.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum