The following call functions are all functions used in the project. Therefore, you do not need to modify the c ++ functions one by one to the functions supported by c # In msdn.
[Csharp]
// Create a file ing
[DllImport ("kernel32.dll", EntryPoint = "CreateFileMapping", SetLastError = true, CharSet = CharSet. Ansi)]
Public static extern IntPtr CreateFileMapping (int hFile, IntPtr lpattriing, uint flProtected, uint dwMaximumSizeHigh, uint dwMaximumSizeLow, string lpName );
// Open the file ing object
[DllImport ("kernel32.dll", EntryPoint = "OpenFileMapping", SetLastError = true, CharSet = CharSet. Auto)]
Private static extern IntPtr OpenFileMapping (uint dwDesiredAccess, bool bInheritHandle, String lpName );
// Map the file data to the address space of the process
[DllImport ("Kernel32.dll")]
Private static extern IntPtr MapViewOfFile (IntPtr hFileMappingObject, uint dwDesiredAccess, uint dwFileOffsetHigh, uint dwFileOffsetLow, uint dwNumberOfBytesToMap );
// Release the file data image from the address space of the calling thread
[DllImport ("Kernel32.dll", EntryPoint = "UnmapViewOfFile", SetLastError = true, CharSet = CharSet. Auto)]
Private static extern bool UnmapViewOfFile (IntPtr lpBaseAddress );
// Close an opened file handle
[DllImport ("kernel32.dll", EntryPoint = "CloseHandle", SetLastError = true, CharSet = CharSet. Auto)]
Private static extern bool CloseHandle (IntPtr hHandle );
// Obtain the last error message
[DllImport ("kernel32.dll", EntryPoint = "GetLastError", SetLastError = true, CharSet = CharSet. Auto)]
Private static extern uint GetLastError ();
// The function www.2cto.com is required to send messages.
[DllImport ("User32.dll", EntryPoint = "FindWindow", CharSet = CharSet. Ansi)]
Public static extern IntPtr FindWindow (string lpClassName, string lpWindowName );
[DllImport ("User32.dll", EntryPoint = "PostMessage", CharSet = CharSet. Ansi)]
Public static extern bool PostMessage (IntPtr hWnd, uint Msg, uint wParam, uint lParam );
//
Const int ERROR_ALREADY_EXISTS = 183;
// File access permission used in the OpenFileMapping and MapViewOf Functions
Const int FILE_MAP_COPY = 0x0001;
Const int FILE_MAP_WRITE = 0x0002;
Const int FILE_MAP_READ = 0x0004;
Const int FILE_MAP_ALL_ACCESS = 0x0002 | 0x0004;
// Protect attributes during file ing in the CreateFileMapping Function
Const int PAGE_READONLY = 0x02;
Const int PAGE_READWRITE = 0x04;
Const int PAGE_WRITECOPY = 0x08;
Const int PAGE_EXECUTE = 0x10;
Const int PAGE_EXECUTE_READ = 0x20;
Const int PAGE_EXECUTE_READWRITE = 0x40;
//
Const int INVALID_HANDLE_VALUE =-1;
From richerg85's column