78 lines
2.2 KiB
C#
78 lines
2.2 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: Global.FuncShareMemory
|
|
// Assembly: Global, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
|
// MVID: C0AE7A64-EC5F-4076-AA61-B93AC1193B2E
|
|
// Assembly location: C:\Users\auvkk\Desktop\x64SimIR2\Global.dll
|
|
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
namespace Global
|
|
{
|
|
public class FuncShareMemory
|
|
{
|
|
[DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]
|
|
public static extern IntPtr CreateFile(
|
|
string lpFileName,
|
|
int dwDesiredAccess,
|
|
int dwShareMode,
|
|
IntPtr lpSecurityAttributes,
|
|
int dwCreationDisposition,
|
|
int dwFlagsAndAttributes,
|
|
IntPtr hTemplateFile);
|
|
|
|
[DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]
|
|
public static extern IntPtr CreateFileMapping(
|
|
IntPtr hFile,
|
|
IntPtr lpAttributes,
|
|
int flProtect,
|
|
int dwMaximumSizeLow,
|
|
int dwMaximumSizeHigh,
|
|
string lpName);
|
|
|
|
[DllImport("kernel32", SetLastError = true)]
|
|
public static extern bool FlushViewOfFile(IntPtr lpBaseAddress, IntPtr dwNumBytesToFlush);
|
|
|
|
[DllImport("kernel32", SetLastError = true)]
|
|
public static extern IntPtr MapViewOfFile(
|
|
IntPtr hFileMappingObject,
|
|
int dwDesiredAccess,
|
|
int dwFileOffsetHigh,
|
|
int dwFileOffsetLow,
|
|
IntPtr dwNumBytesToMap);
|
|
|
|
[DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]
|
|
public static extern IntPtr OpenFileMapping(
|
|
int dwDesiredAccess,
|
|
bool bInheritHandle,
|
|
string lpName);
|
|
|
|
[DllImport("kernel32", SetLastError = true)]
|
|
public static extern bool UnmapViewOfFile(IntPtr lpBaseAddress);
|
|
|
|
[DllImport("kernel32", SetLastError = true)]
|
|
public static extern bool CloseHandle(IntPtr handle);
|
|
|
|
public enum MapProtection
|
|
{
|
|
PageNone = 0,
|
|
PageReadOnly = 2,
|
|
PageReadWrite = 4,
|
|
PageWriteCopy = 8,
|
|
SecImage = 16777216, // 0x01000000
|
|
SecReserve = 67108864, // 0x04000000
|
|
SecCommit = 134217728, // 0x08000000
|
|
SecNoCache = 268435456, // 0x10000000
|
|
}
|
|
|
|
public enum MapAccess
|
|
{
|
|
FileMapCopy = 1,
|
|
FileMapWrite = 2,
|
|
FileMapRead = 4,
|
|
FileMapAllAccess = 31, // 0x0000001F
|
|
}
|
|
}
|
|
}
|