View Full Version : Question about conversions between assembly, binary, and c

07-17-2002, 11:01 AM
I have a program I'm testing for someone. Basically he wants me to crack his password security. So, I've got a couple of disassemblers hex editors, etc. I have one unique program that can convert binary files into corresponding c code (definetly easier to read than assembly). Anyhow, does that mean that the executable can be read by this program and turned into c code? Or is there some other file type i need to use. My thought was to dissasemble the exe to assembly, then convert that to binary, then that to c...but thinking about it I decided that perhaps it was possible to go straight from exe to C using the utility. Am I going down the wrong path here? thanks.

myprog.exe -->
assembly -->
0101010101000001111 -->


myprog.exe -->

07-17-2002, 11:15 AM
Which path to take depends on your tools. I don't know which tool you are using for converting binary files to C code, so I can't give an answer to that.

An EXE is a binary, which can be disassembled. Probably the generated assembly code can be translated to C, but ofcourse this will be very primitive.

It would help a lot if you told us which tools you are using.

07-17-2002, 11:30 AM
>>> Probably the generated assembly code can be translated to C,

However, there are several code sequences that could compile to the same object code, so there is no guarantee that the resulting code would be the same as the original. Disassembly is always very much hit and miss.

07-17-2002, 12:20 PM
Well i think my plans are pretty much shot anyway.
The freeware that converted the binary to C doesn't work, it has run time errors, (it's called 2ASM) I tried to email the author but it's a bogus email address. So I guess I'm stuck, The disassembler could be either W32Dasm or SoftIce or IDA disassembler (haven't decided which to use yet) I have hex workshop and hiew for hex editing. And for editing/compiler the C code i have MSVC 6. For compiling the Assembly (if needed) I have masm.

07-17-2002, 12:27 PM
You're using MSVC 6 only for C editing and compiling? Note that MSVC 6 also has a very good debugger, which shows you the disassembled code through which you can run. You can also inspect the registers etc. This could be useful to analyse the algorithm your friend has implemented.

07-17-2002, 01:48 PM
I did, debug, step into and got assembly code.
I've gotten another binary to C (the other actually turned out to just put hex code into a c struct) this new one DCC32 actually outputs real c code, but the only problem is, it says it can't read the new EXE type (maybe 16 bit vs 32) but it says it should work for win 95 and nt so i don't know why it can't read this exe, i also tried it on windows calc just to see if it was my buddies program and the same thing so i don't know whats up.

07-17-2002, 03:21 PM
I doubt you need all these fancy tools. I just use W32DASM and Hex Workshop for stuff like this. For programs like this, it's almost always as easy as changing a JE to a JNE.

If you have no idea what a JE or JNE are, go here: http://www1.lunarpages.com/istudios/tuts/asmfj.html

07-18-2002, 05:12 AM
;) yup sure do know what ya mean.
thanks, mostly i just got exited when i say a program that can take binary and spit out actual C code ie:
--> int main() {

maybe i'll use it sometime. thanks again.