C Programs in the mythical series cannot be decompiled.

Source: Internet
Author: User

Many C and C # myths are circulating on the Internet

After listening, I decided to break these beautiful myths .. Open your eyes and hope to reveal a myth ,.,,

 

Unlock my most mysterious waiting

 

 

C

Can the program be decompiled

C

Language programs?

 

Myth: it cannot be decompiled. It can only be explained through assembly.

Details:

The C language source program is compiled and optimized to obtain the target format. However, the target format cannot be used to obtain the C source code, because the target code may be optimized, no one can tell the extent to which these optimizations have been achieved, so no
There is an algorithm for this type of inversion, so it is impossible to obtain the C source code from the target format.

 

 

 

Today, I decompiled it myself.

This is an example of msdn.

 

// Crt_printf.c

// This program uses the printf and wprintf Functions

// To produce formatted output.

# Include <stdio. h>

Int main (void)

{

Char CH = 'h ',

* String = "computer ";

Wchar_t wch = L 'w ',

* Wstring = l "Unicode ";

Int COUNT =-9234;

// Display Integers

Printf ("integer formats:/N"

"Decimal: % d justified: %. 6D"

"Unsigned: % u/N ",

Count, count );

// Display Decimals

Printf ("decimal % d as:/n HEX: % XH"

"C HEX: 0x % x octal: % O/N ",

Count, count );

// Display in different radixes

Printf ("Digits 10 equal:/n HEX: % I"

"Octal: % I decimal: % I/N ",

0x10,010, 10 );

// Display characters

Printf ("characters in field (1):/N"

"% 10C % 5hc % 5c % 5lc/N ",

Ch, ch, wch, wch );

Wprintf (L "characters in field (2):/N"

L "% 10C % 5hc % 5c % 5lc/N ",

Ch, ch, wch, wch );

// Display strings

Printf ("strings in field (1):/n % 25 s/n"

"% 25.4hs/n % S % 25.3ls/N ",

String, String, wstring, wstring );

Wprintf (L "strings in field (2):/n % 25 s/n"

L "% 25.4hs/n % S % 25.3ls/N ",

String, String, wstring, wstring );

// Display real numbers

// Display pointer

Printf ("/naddress as: % P/N", & COUNT );

}

Vc2010 is used (there should be no doubt)

Compiling mode release

(The default value of Vc)

 

First, we must understand that it is unwise to directly decompile all of them,

Because the compiler generates a lot of information

We know that the program needs to go through the main function entry.

We only need to decompile this.

Let's take a look at the decompilation results:

 

Int _ cdecl main ()

{

Signed int V1; // [SP + 8 h] [bp-4h] @ 1

V1 =-9234;

_ Printf ("integer formats:/n decimal: % d justified: %. 6D unsigned: % u/N",-9234,-9234,-9234,-9234 );

_ Printf ("decimal % d as:/n HEX: % xh c hex: 0x % x octal: % O/N", V1, V1, V1, V1 );

_ Printf ("Digits 10 equal:/n HEX: % I octal: % I decimal: % I/N", 16, 8, 10 );

_ Printf ("characters in field (1):/n % 10C % 5hc % 5c % 5lc/N", 104,104,119,119 );

_ Wprintf (L "characters in field (2):/n % 10C % 5hc % 5c % 5lc/N", 104,104,119,119 );

_ Printf ("strings in field (1):/n % 25 s/n % 25.4hs/n % S % 25.3ls/N", "computer", "computer ", L "Unicode", l "Unicode ");

_ Wprintf (L "strings in field (2):/n % 25 s/n % 25.4hs/n % S % 25.3ls/N", "computer", "computer ", L "Unicode", l "Unicode ");

_ Printf ("/naddress as: % P/N", & V1 );

Return 0;

}

 

This code can be compiled after being modified!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.