View previous topic :: View next topic |
Author |
Message |
Filipe_Br Master Cheater Reputation: 3
Joined: 07 Jan 2016 Posts: 272 Location: My house
|
Posted: Sun Sep 03, 2017 3:08 pm Post subject: How to get the size of an assembly instruction with C ++ |
|
|
Does anyone know any function to get the size of an assembly instruction?
Let's assume that address 07310000, contains the following instruction: mov eax, edi.
This instruction is formed by 2 bytes (8B, C7).
I would need to get the size of the instruction that is in a given address. _________________
... |
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Sun Sep 03, 2017 3:25 pm Post subject: |
|
|
celua.txt:
Quote: | getInstructionSize(address): Returns the size of an instruction (basically it disassembles the instruction and returns the number of bytes for you) |
Edit: didn't see C++, but you can still look at CE's source and see what it's doing.
Writing this on your own isn't terribly hard. Look at Intel's software developer's manual volume 2A chapter 2 "Instruction Format" for most of the information you'll need. _________________
I don't know where I'm going, but I'll figure it out when I get there.
Last edited by ParkourPenguin on Mon Sep 04, 2017 8:46 am; edited 1 time in total |
|
Back to top |
|
|
dl748 Advanced Cheater Reputation: 0
Joined: 05 Mar 2016 Posts: 75
|
Posted: Sun Sep 03, 2017 11:47 pm Post subject: |
|
|
C++ doesn't have the capabilities. |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Mon Sep 04, 2017 1:12 am Post subject: |
|
|
write a basic disassembler that just gets the instruction size (prefixes, multibyte opcodes, modrm, sib, ...) _________________
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 |
|
Back to top |
|
|
Filipe_Br Master Cheater Reputation: 3
Joined: 07 Jan 2016 Posts: 272 Location: My house
|
Posted: Mon Sep 04, 2017 5:54 am Post subject: |
|
|
Dark Byte wrote: | write a basic disassembler that just gets the instruction size (prefixes, multibyte opcodes, modrm, sib, ...) |
So there are no ready-made libraries that can do this?
CE disassembly, you should either create it from the beginning, or some library aided in it. _________________
... |
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Mon Sep 04, 2017 6:12 am Post subject: |
|
|
Filipe_Br wrote: | So there are no ready-made libraries that can do this? | of course there are, just google disassembly library. Of course you'd probably learn more and it may be smaller than a full disassembly library to create your own if all you need to do is determine the size (disclaimer: I don't know how the disassembly works, it may be very dependent on the data requiring nearly a full disassembly to determine the size, for CISC architectures anyhow, but maybe it doesn't) |
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Tue Sep 05, 2017 9:45 pm Post subject: |
|
|
There are a handful of disassembler libraries available to do this.
- ADE32/64
- HDE32/64
- LDE32/64
- BeaEngine
- Capstone
- Distorm
- Zyan Disassembler Engine
- etc.
Or pulling out Cheat Engines engine and using it in an external dll would work too. _________________
- Retired. |
|
Back to top |
|
|
|