Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UnsafeNativeMethods.cs
Go to the documentation of this file.
1using System;
3
5
6internal static class UnsafeNativeMethods
7{
8 public struct SecurityAttributes
9 {
10 private int Length;
11
13
14 private int InheritHandle;
15
16 public unsafe SecurityAttributes(bool inheritHandle)
17 {
18 Length = sizeof(SecurityAttributes);
20 InheritHandle = (inheritHandle ? 1 : 0);
21 }
22 }
23
24 public const int INFINITE = -1;
25
26 public const uint STATUS_DLL_NOT_FOUND = 3221225781u;
27
28 public const int PAGE_READONLY = 2;
29
30 public const int PAGE_READWRITE = 4;
31
32 public const int PAGE_WRITECOPY = 8;
33
34 public const int FILE_MAP_WRITE = 2;
35
36 public const int FILE_MAP_READ = 4;
37
38 public static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1);
39
40 [DllImport("Kernel32.dll")]
41 public static extern int CloseHandle(IntPtr hObject);
42
43 [DllImport("Kernel32.dll")]
44 public static extern IntPtr CreateEvent(ref SecurityAttributes lpEventAttributes, [MarshalAs(UnmanagedType.Bool)] bool bManualReset, [MarshalAs(UnmanagedType.Bool)] bool bInitialState, IntPtr lpName);
45
46 [DllImport("Kernel32.dll")]
47 public static extern int SetEvent(IntPtr hEvent);
48
49 [DllImport("Kernel32.dll")]
50 public unsafe static extern int WaitForMultipleObjects(int nCount, IntPtr* handles, [MarshalAs(UnmanagedType.Bool)] bool bWaitAll, int dwMilliseconds);
51
52 [DllImport("Kernel32.dll")]
53 public unsafe static extern IntPtr CreateFileMapping(IntPtr hFile, SecurityAttributes* lpFileMappingAttributes, int flProtect, int dwMaximumSizeHigh, int dwMaximumSizeLow, string lpName);
54
55 [DllImport("Kernel32.dll")]
56 public static extern IntPtr MapViewOfFile(IntPtr hFileMappingObject, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, int dwNumberOfBytesToMap);
57
58 [DllImport("Kernel32.dll")]
59 public static extern int UnmapViewOfFile(IntPtr lpBaseAddress);
60}
static unsafe int WaitForMultipleObjects(int nCount, IntPtr *handles, [MarshalAs(UnmanagedType.Bool)] bool bWaitAll, int dwMilliseconds)
static IntPtr CreateEvent(ref SecurityAttributes lpEventAttributes, [MarshalAs(UnmanagedType.Bool)] bool bManualReset, [MarshalAs(UnmanagedType.Bool)] bool bInitialState, IntPtr lpName)
static int CloseHandle(IntPtr hObject)
static unsafe IntPtr CreateFileMapping(IntPtr hFile, SecurityAttributes *lpFileMappingAttributes, int flProtect, int dwMaximumSizeHigh, int dwMaximumSizeLow, string lpName)
static int UnmapViewOfFile(IntPtr lpBaseAddress)
static IntPtr MapViewOfFile(IntPtr hFileMappingObject, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, int dwNumberOfBytesToMap)
static readonly IntPtr Zero
Definition IntPtr.cs:18