Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SafeLocalAllocHandle.cs
Go to the documentation of this file.
1
using
System
;
2
using
System.Runtime.InteropServices
;
3
4
namespace
Microsoft.Win32.SafeHandles
;
5
6
internal
sealed
class
SafeLocalAllocHandle :
SafeBuffer
7
{
8
internal
static
SafeLocalAllocHandle
InvalidHandle
=>
new
SafeLocalAllocHandle
(
IntPtr
.
Zero
);
9
10
public
SafeLocalAllocHandle
()
11
: base(ownsHandle: true)
12
{
13
}
14
15
internal
static
SafeLocalAllocHandle
LocalAlloc
(
int
cb)
16
{
17
SafeLocalAllocHandle
safeLocalAllocHandle =
new
SafeLocalAllocHandle
();
18
safeLocalAllocHandle.SetHandle(
Marshal
.
AllocHGlobal
(cb));
19
safeLocalAllocHandle.Initialize((ulong)cb);
20
return
safeLocalAllocHandle;
21
}
22
23
internal
SafeLocalAllocHandle
(
IntPtr
handle
)
24
: base(ownsHandle: true)
25
{
26
SetHandle
(
handle
);
27
}
28
29
protected
override
bool
ReleaseHandle
()
30
{
31
Marshal
.
FreeHGlobal
(
handle
);
32
return
true
;
33
}
34
}
Microsoft.Win32.SafeHandles.SafeLocalAllocHandle.SafeLocalAllocHandle
SafeLocalAllocHandle()
Definition
SafeLocalAllocHandle.cs:9
Microsoft.Win32.SafeHandles.SafeLocalAllocHandle.LocalAlloc
static SafeLocalAllocHandle LocalAlloc(int cb)
Definition
SafeLocalAllocHandle.cs:15
Microsoft.Win32.SafeHandles.SafeLocalAllocHandle.ReleaseHandle
override bool ReleaseHandle()
Definition
SafeLocalAllocHandle.cs:29
Microsoft.Win32.SafeHandles.SafeLocalAllocHandle.InvalidHandle
static SafeLocalAllocHandle InvalidHandle
Definition
SafeLocalAllocHandle.cs:8
Microsoft.Win32.SafeHandles.SafeLocalAllocHandle.SafeLocalAllocHandle
SafeLocalAllocHandle(IntPtr handle)
Definition
SafeLocalAllocHandle.cs:23
Microsoft.Win32.SafeHandles.SafeLocalAllocHandle
Definition
SafeLocalAllocHandle.cs:6
System.Runtime.InteropServices.Marshal.FreeHGlobal
static void FreeHGlobal(IntPtr hglobal)
Definition
Marshal.cs:1680
System.Runtime.InteropServices.Marshal.AllocHGlobal
static IntPtr AllocHGlobal(int cb)
Definition
Marshal.cs:625
System.Runtime.InteropServices.Marshal
Definition
Marshal.cs:14
System.Runtime.InteropServices.SafeBuffer
Definition
SafeBuffer.cs:8
System.Runtime.InteropServices.SafeHandle.SetHandle
void SetHandle(IntPtr handle)
Definition
SafeHandle.cs:42
System.Runtime.InteropServices.SafeHandle.handle
IntPtr handle
Definition
SafeHandle.cs:8
Microsoft.Win32.SafeHandles
Definition
SafeProcessHandle.cs:3
System.Runtime.InteropServices
Definition
SequenceMarshal.cs:4
System
Definition
BlockingCollection.cs:8
System.IntPtr.Zero
static readonly IntPtr Zero
Definition
IntPtr.cs:18
System.IntPtr
Definition
IntPtr.cs:14
source
System.Security.Principal.Windows
Microsoft.Win32.SafeHandles
SafeLocalAllocHandle.cs
Generated by
1.10.0