All Questions
Tagged with decompilation c
31
questions
1
vote
1answer
73 views
Best way to protect source code of .exe program running on Python?
I am developing proprietary software that would be distributed in a form of .exe file. In order to use it, users will have to authenticate with their whitelist credentials (username + password).
The ...
1
vote
1answer
64 views
Why is fastcall used for replacing thiscall functions in memory instead of cdecl?
Assume I were to be reversing some game which processes all of it's movement client side and have determined some function to be of the type:
bool __thiscall Player::CanJump(Player *this)
that I ...
0
votes
0answers
79 views
What is, and why, “byte[ ] + number” in this IDA pseudocode?
This is a decompile of an .so file, so it originated from C or C++. Can you kindly try to explain to me what this does?
How would one rewrite this into readable code? I don't mind any programming ...
-1
votes
1answer
147 views
How can I convert the following assembly code to pseudo code?
I got the following disassembly code in IDA pro. I really find it hard to convert it into pseudo code.
push ebp
mov ebp, esp
sub esp, 14h
mov dword ptr [ebp-14h], 1
mov dword ptr [ebp-10h], 2
mov ...
0
votes
1answer
147 views
Is there any decompiler, which can produce a compilable result?
I would like to decompile a 32bit linux executable to C, modify some parts of it, and then compile it back. I do not care if the C code is not pretty and really hard to maintain. The only thing I care ...
1
vote
1answer
2k views
What does this assembly language program output?
I have been struggling with this for a long time. I have the following assembly language code:
.intel_syntax noprefix
.bits 32
.global asm0
asm0:
push ebp
mov ebp,esp
mov eax,DWORD ...
0
votes
1answer
216 views
Translating ida macros and pseudocode into C++/C
What would be the translated C output of this hexrays decompiler pseudocode? The values of v6 and v5 are floats just as v8. The value of xmmword_108365D0 is 7FFFFFFF7FFFFFFF7FFFFFFF7FFFFFFFh
v8 = (...
2
votes
3answers
920 views
Android- hiding private keys in .so file
I am working on an application where we need to encrypt certain assets at compile time in Gradle. We then need to decrypt them with the same private key, so we are using a symmetric key system but we ...
1
vote
5answers
290 views
C representation of simple assembly
I have the following very simple X86 assembly:
shr cx, 1
jae short <addr>
So basically, the jump will be taken if the Carry flag is not set. In the case of shr, CF will be set to the value of ...
1
vote
0answers
74 views
Decompiled code calls a function with unitialized variables
I'm working on decompiling the scripting engine from the game Rayman 2. It's going pretty well, but I'm getting stuck on a particular function which calls another function with arguments that aren't ...
4
votes
2answers
1k views
How do I approach this CTF Debugging Program?
I have an ELF executable I'm working on (got it from a previous CTF competition). The executable simply asks for a password, and then it prints out "congrats".
The code snippets and my annotations ...
1
vote
1answer
139 views
Unknown comparison
I'm trying to decompile some singleplayer code for a game (C++ on X86 architecture Linux). I do this with the help of some already available source code, a file (compiled on linux) with debug ...
3
votes
1answer
855 views
Identifying possible structs in C/C++ disassembly
I'm currently working on taking apart a game (Soul Reaver: Legacy of Kain) and I often come across odd looking sections such as this in the decompiler
*(_DWORD *)(a2 + 16) = a2 + 624;
*(_DWORD *)(...
0
votes
1answer
2k views
IDA pseudo code decompilation
I am trying to reverse engineer exe file and have some difficulties of pseudo code understanding.
Can someone please help me understand what is doing the code below:
char __userpurge sub_41C140@<...
3
votes
1answer
319 views
move with sign extension in c code
I'm quite confused with the
movsx(move with sign extension)
I'm trying to convert assembly code to C.
but stuck with movsx part.
this is the code I got so far.
#include <stdio.h>
#...
2
votes
1answer
2k views
Help me reverse this
It's been 4 nights I'm struggling decompiling this one. It's an Android native library that I ran through IDA to get C code.
Java signature :
byte[] resultArray = new byte[-2 + dataArray.length];
...
1
vote
1answer
6k views
Hex Rays - strange functions __ROL4__ and __ROR4__
What's purpose of functions ROL and ROR?
For both of them, first arg is int, and second is byte
I suppose that's bitwise shifts
]1s]2
0
votes
1answer
583 views
Arm Assembly: LDRH instruction to C
I've been reversing an asm checksum code for the last days, and I've managed to understand how it completly works, except for one instruction; ldrh
The info I've been able to found says that it's ...
1
vote
1answer
159 views
Does empty enumeration in C structure creates unnamed field?
I was parsing some modified C++ headers with IDA when I come to some strange behavior. Imagine we have a structure like this (stored in a C header):
struct S
{
enum {EN0, EN1};
int m1;
} ;
...
-2
votes
1answer
359 views
Help Coverting ASM to C [closed]
I need assistance decompiling the following from ASM to pseudo C.
Code 1
...
mov edx, Var1 # Move Var1 to edx
mov ecx, Var2 # Move Var2 to ecx
mov eax, edx # Move EDX (Var1) to EAX
...
-1
votes
1answer
226 views
Mapping a high level statement back in assembly dump
Say, I have compiled a large code base, e.g. gzip/gmp/python/php etc. on Linux. Is there any means to map a high level C construct, e.g. assignment/if-else/for/while/Math expression back in the ...
3
votes
1answer
11k views
what's the function of LODWORD and HIDWORD?
I'm trying to figure out what does this piece of code exactly:
LODWORD(fMax) = *(_DWORD *)v12;
HIDWORD(fMax) = v13;
I was reading on IDA\Plugins\defs.h the definition, but I don't understand ...
-1
votes
2answers
34k views
EXE to C source code decompiler [duplicate]
Is there any decompiler out there which can take a .exe file and decompile it into C code (the execution file was also written in C)? Obviously I'm not looking for a 1 to 1 results with the original ...
9
votes
1answer
1k views
Becoming A Better Reverse Engineer
I have been looking on the net and all I see when it comes to reverse engineering are a bunch of silly crackme tutorials. I want to be better at taking code from assembly to c or c++. I am getting the ...
4
votes
6answers
7k views
How to match disassembled instructions back to C/C++ source?
Basically here's what I want to know, if you have a disassembled instruction say:
jz 0x8048e1a
And, you also have the source code. How do you go about figuring out what this instruction relates to ...
2
votes
1answer
998 views
C What kind of sorting algorithm is this?
I decompiled a application and found what seems like some kind of sorting algorithm, I was told it's not even a sorting algorithm, but a binary search on stackoverflow
I just don't know which one it ...
6
votes
2answers
1k views
Understanding x86 C main function preamble created by Visual C++
I was debugging a simple x86-64 program in Visual Studio 2010 and I noticed that the main function preamble is different from the GNU GCC compiled version of the same C program.
To illustrate what I ...
6
votes
4answers
109k views
Converting assembly code to c
I have the following assembly code over Linux distro:
# using the .data section for write permission
# instead of .text section
.section .data
.globl _start
_start:
# displaying some characters ...
9
votes
1answer
490 views
How to convert this one-liner asm to C
I want to convert this to C:
SHR CL,1
rECX is the name of the (32bit unsigned int)register variable. It should be simple, but I can't figure out the proper pointer magic :/
8
votes
3answers
437 views
How to differentiate from different hex files of different families of microcontrollers?
Is there any way to differentiate different microcontroller's hex files? I have a hex file and now I have forgotten of which micro-controller it belongs. Is there any available tool to tell this? or ...
7
votes
5answers
813 views
Is it possible to hide the details of which compiler was used?
The compiler adds system information to the output/object file that is created on compilation.
Is there any compiler option that can prevent this information from being added?
Can the compiler ...