View previous topic :: View next topic |
Author |
Message |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 958
|
Posted: Sun Jan 31, 2016 7:37 pm Post subject: getInstructionSize for C# |
|
|
As a practice, I've made/stolen a little csharp function. This is stolen from a non-open-source software, original is in a Lua dialect. I'm not sure the original is error free nor this conversion.
It should work like ce lua function getInstructionSize:
Code: | getInstructionSize(address): Returns the size of an instruction |
but the function is named as getCodeSize, and the input parameter is different.
Code: | int getCodeSize(byte[] b,int idxBegin) ; //or
int getCodeSize(LikeByteArray b,int idxBegin) ; |
In the later case, it is a delegate with int input and byte output. It may be adapted to read process memory.
If there is error, like the op code bytes is not well-formed, or index out of array range, the function return -1. Other function using this function should check if the returned code size is valid.
The CSharp source is in the table file of the attached CT, it can be save to disk.
Related topic in stackoverflow : http://stackoverflow.com/questions/23788236/get-size-of-assembly-instructions
bye~
Description: |
|
 Download |
Filename: |
x86codesize_csharp.CT |
Filesize: |
9.93 KB |
Downloaded: |
688 Time(s) |
_________________
- Retarded. |
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Jan 31, 2016 9:26 pm Post subject: |
|
|
If you need a full-on C# disassembler, you can check out the SharpDisasm project here:
https://sharpdisasm.codeplex.com/
I use it in a project of mine for removing the Steam DRM from exe's. Works well.
_________________
- Retired. |
|
Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 958
|
Posted: Mon Feb 01, 2016 1:30 am Post subject: |
|
|
Thank you~
Is there a 64bit runtime Assembler suggestion?
That's something like FASM.dll but FASM.dll seems 32bit only.
_________________
- Retarded. |
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Mon Feb 01, 2016 1:48 pm Post subject: |
|
|
panraven wrote: | Thank you~
Is there a 64bit runtime Assembler suggestion?
That's something like FASM.dll but FASM.dll seems 32bit only. |
Don't know of any off-hand. I rarely touch 64bit stuff since I do not need it.
_________________
- Retired. |
|
Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 958
|
Posted: Mon Feb 01, 2016 3:39 pm Post subject: |
|
|
FASM.DLL can generate 64bit or 32bit Assembler binary with the 'use' directive, only that the *.dll is 32bit only, which means says, a 64bit Trainer cannot simply link and use this dll. Google says that there is IPC method for a 64bit trainer app to use a 32bit dll, but seems complicated.
Thanks anyway~
_________________
- Retarded. |
|
Back to top |
|
 |
|