C#与C++的汇编

C#的一个简单函数。

 

 

using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;


namespace Cross3389 {
    class Program {
        static void Main(string[] args) {
            Console.ReadKey();
        }
    }
}

 

汇编

--- D:\work_projects\Cross3389\Cross3389\Cross3389\Program.cs ------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;


namespace Cross3389 {
    class Program {
        static void Main(string[] args) {
00000000  push        ebp 
00000001  mov         ebp,esp
00000003  push        edi 
00000004  push        esi 
00000005  push        ebx 
00000006  sub         esp,3Ch
00000009  xor         eax,eax
0000000b  mov         dword ptr [ebp-10h],eax
0000000e  xor         eax,eax
00000010  mov         dword ptr [ebp-1Ch],eax
00000013  mov         dword ptr [ebp-3Ch],ecx
00000016  cmp         dword ptr ds:[00988D90h],0
0000001d  je          00000024
0000001f  call        78EC8F39
00000024  nop             
            Console.ReadKey();
00000025  lea         ecx,[ebp-48h]
00000028  call        785922B4
0000002d  nop             
        }
0000002e  nop             
0000002f  lea         esp,[ebp-0Ch]
00000032  pop         ebx 
00000033  pop         esi 
00000034  pop         edi 
00000035  pop         ebp 
00000036  ret             

 

C++:

 

// Cross_3389.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include "windows.h"
#include  <iostream>
using  namespace  std;

#include <conio.h>

int _tmain(int argc, _TCHAR* argv[])
{

 getch();
 return 0;
}

 

 

--- d:\work_projects\cross3389\cross3389\cross_3389\cross_3389.cpp -------------
// Cross_3389.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include "windows.h"
#include  <iostream>
using  namespace  std;

#include <conio.h>

int _tmain(int argc, _TCHAR* argv[])
{
0042D6A0  push        ebp 
0042D6A1  mov         ebp,esp
0042D6A3  sub         esp,0C0h
0042D6A9  push        ebx 
0042D6AA  push        esi 
0042D6AB  push        edi 
0042D6AC  lea         edi,[ebp-0C0h]
0042D6B2  mov         ecx,30h
0042D6B7  mov         eax,0CCCCCCCCh
0042D6BC  rep stos    dword ptr es:[edi]

 getch();
0042D6BE  call        @ILT+1490(_getch) (42B5D7h)
 return 0;
0042D6C3  xor         eax,eax
}
0042D6C5  pop         edi 
0042D6C6  pop         esi 
0042D6C7  pop         ebx 
0042D6C8  add         esp,0C0h
0042D6CE  cmp         ebp,esp
0042D6D0  call        @ILT+3480(__RTC_CheckEsp) (42BD9Dh)
0042D6D5  mov         esp,ebp
0042D6D7  pop         ebp 
0042D6D8  ret             

posted on 2008-12-19 14:16  yurow  阅读(408)  评论(2编辑  收藏  举报

导航