神话系列之一 C 程序不能反编译
网上流传很多C和C# 神话
我听了以后,决定打破这些美丽的神话。。给大家开开眼界,更希望能说明一个神话,。,,
解开我 最神秘的等待
C
程序怎样反编译成
C
语言的程序?
神话:无法反编译的,,只能通过汇编来解释。
详细:
C语言源程序经过编译、优化,得到目标格式,但由目标格式不能逆推得到C源码,因为目标码可能是经过优化的,谁也不能说这些优化做到了哪样的程度,因而没
有算法进行这样的逆推,所以不可能从目标格式得到C源码。
今天我反编译的是我自己写的
小东西,其实就是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, count, count );
// Display decimals
printf( "Decimal %d as:\n Hex: %Xh "
"C hex: 0x%x Octal: %o\n",
count, count, count, count );
// Display in different radixes
printf( "Digits 10 equal:\n Hex: %i "
"Octal: %i Decimal: %i\n",
&
相关文档:
转自:http://dev.yesky.com/12/3067012.shtml
动态连接库的创建步骤:
一、创建Non-MFC DLL动态链接库
1、打开File —> New —> Project选项,选择Win32 Dynamic-Link Library —>sample project
—>工程名:DllDemo
2、新建一个.h文件DllDemo.h
以下是引用片段:
......
extern是C/C++语言中表明函数和全局变量作用范围(可见性).
它告诉编译器,其声明的函数和变量可以在本模块或其它模块中使用。
1。对于extern变量来说,仅仅是一个变量的声明,其并不是在定义分配内存空间。如果该变量定义多次,会有连接错误
2。通常,在模块的头文件中对本模块提供给其它模块引用的函数和 ......
//某水王的发帖数超过总贴数的一半,找出之
int find(int *ID, int N)
{
int candidate;
int nTimes, i;
for (i = nTimes = 0; i < N; i++)
{
if (nTimes == 0)
{
candidate = ID[i];
nTimes = 1;
}
else if (candidate == ID[i])
{
nTimes++;
}
else
{
nTimes--;
......
/*
思路:递归算法
从开始往后递增地写数字,当前从now值开始,存储的位置从cur开始,
则显然加上,now..n,都是新的组合数,对于每一个,{ 输出之,然后递归,处理 _c(n, cur+1, a, i+1) }
*/
/* 输出1,2,3,..,n的组合数 */
#include <stdio.h>
#include <assert.h>
#include <malloc.h>
void ......
/*
思路:递归算法
前0..cur-1位置上已经排好,当前cur位置取一个和前面都不一样的,然后递归处理后面的。
*/
/* 输出1,2,3,..,n的排列数 */
#include <stdio.h>
#include <assert.h>
#include <malloc.h>
void p(int n)
{
extern void _p(int n, int cur, int *a);
int *a;
a = ......