Native, Managed . , , IL . , , CIL Native . , , .
. . CLR . , .
SOS SOSEX WinDBG, , . (Native Managed) .
[12] Rut-Time .NET Framework. JIT- . The just-in-time (JIT) compiler generates x86 instructions and stores them on the JIT Code Heap [12]. . 5 , VMMap SysinternalsSuite [13]
. 5.
. 5 , (Managed Heap) , (Execute), (Write) (Read) . , 64- NX- (XD- Intel), [14].
, Run-Time . , CIL , . . 6.
6. IL main Ida Pro () WinDBG ()
Native, Managed . , Microsoft Visual C++ Mixed , -. (Native Managed) . , , - , ( ) ..NET CIL.
|
|
. , , , , JIT . , Native Managed, Mixed .
[1] http://ru.wikipedia.org/wiki/.NET_Framework ( : 01.10.2013)
[2] http://developer.android.com/sdk/index.html ( : 01.10.2013)
[3] https://www.hex-rays.com/products/ida/index.shtml ( : 01.10.2013)
[4] http://www.red-gate.com/products/dotnet-development/reflector/ ( : 01.10.2013)
[5] http://www.jetbrains.com/decompiler/ ( : 01.10.2013)
[6] Fuzzing. , : , , , : -, ISBN 978-5-93286-147-9; 2009 .
[7] http://en.wikipedia.org/wiki/Assembler_(computing)#Assembler ( : 01.10.2013)
[8] http://msdn.microsoft.com/ru-ru/library/c1h23y6c.aspx ( : 02.10.2013)
[9] http://en.wikipedia.org/wiki/Common_Intermediate_Language ( : 02.10.2013)
[10] http://msdn.microsoft.com/ru-ru/library/f7dy01k1.aspx ( : 02.10.2013)
[11] http://technet.microsoft.com/en-us/sysinternals/bb842062.aspx ( : 02.10.2013)
[12] http://msdn.microsoft.com/en-us/magazine/cc163791.aspx ( : 02.10.2013)
[13] http://technet.microsoft.com/en-us/sysinternals/bb842062.aspx ( : 02.10.2013)
[14] http://ru.wikipedia.org/wiki/NX_bit ( : 02.10.2013)
1. .1.
#include <Windows.h>
int main(int argc, char** argv)
{
MessageBox(0, TEXT("WinAPI message from unmanaged C/C++."), TEXT("Message"), MB_YESNO | MB_ICONQUESTION);
return 0;
}
2. .2-3.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace CSharp_MessageBoxWinAPI
{
class Program
{
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern int MessageBox(IntPtr hWnd, String text, String caption, uint type);
enum MsgType: ulong
{
MB_ABORTRETRYIGNORE = 0x00000002L,
MB_CANCELTRYCONTINUE = 0x00000006L,
MB_HELP = 0x00004000L,
MB_OK = 0x00000000L,
MB_OKCANCEL = 0x00000001L,
MB_RETRYCANCEL = 0x00000005L,
MB_YESNO = 0x00000004L,
MB_YESNOCANCEL = 0x00000003L
};
enum IconType: ulong
{
MB_ICONEXCLAMATION = 0x00000030L,
MB_ICONWARNING = 0x00000030L,
MB_ICONINFORMATION = 0x00000040L,
MB_ICONASTERISK = 0x00000040L,
MB_ICONQUESTION = 0x00000020L,
MB_ICONSTOP = 0x00000010L,
MB_ICONERROR = 0x00000010L,
MB_ICONHAND = 0x00000010L
};
static void Main(string[] args)
{
MessageBox(IntPtr.Zero, "WinAPI message from c#.", "Message", (uint)((ulong)MsgType.MB_YESNO | (ulong)IconType.MB_ICONQUESTION));
}
}
}
3. .4.
#using <mscorlib.dll>
#include <stdio.h>
|
|
using namespace System;
#pragma unmanaged
void print(char *message)
{
printf("%s\n", message);
}
#pragma managed
int main()
{
Console::WriteLine("Managed write line.");
print("Unmanaged write line.");
Console::ReadLine();
return 0;
}