Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SafeHashHandle.cs
Go to the documentation of this file.
1
using
Microsoft.Win32.SafeHandles
;
2
3
namespace
System.Security.Cryptography
;
4
5
internal
sealed
class
SafeHashHandle
:
SafeHandleZeroOrMinusOneIsInvalid
6
{
7
private
SafeProvHandle
_parent
;
8
9
internal
static
SafeHashHandle
InvalidHandle
=>
SafeHandleCache<SafeHashHandle>
.
GetInvalidHandle
(() =>
new
SafeHashHandle
());
10
11
public
SafeHashHandle
()
12
: base(ownsHandle: true)
13
{
14
SetHandle
(
IntPtr
.
Zero
);
15
}
16
17
internal
void
SetParent
(
SafeProvHandle
parent)
18
{
19
if
(!
IsInvalid
&& !base.IsClosed)
20
{
21
_parent
= parent;
22
bool
success =
false
;
23
_parent
.
DangerousAddRef
(ref success);
24
}
25
}
26
27
protected
override
void
Dispose
(
bool
disposing)
28
{
29
if
(!
SafeHandleCache<SafeHashHandle>
.IsCachedInvalidHandle(
this
))
30
{
31
base.Dispose(disposing);
32
}
33
}
34
35
protected
override
bool
ReleaseHandle
()
36
{
37
bool
result = global::Interop.Advapi32.CryptDestroyHash(
handle
);
38
SafeProvHandle
parent =
_parent
;
39
_parent
=
null
;
40
parent?.
DangerousRelease
();
41
return
result;
42
}
43
}
Microsoft.Win32.SafeHandles.SafeHandleCache.GetInvalidHandle
static T GetInvalidHandle(Func< T > invalidHandleFactory)
Definition
SafeHandleCache.cs:11
Microsoft.Win32.SafeHandles.SafeHandleCache
Definition
SafeHandleCache.cs:8
Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid.IsInvalid
override bool IsInvalid
Definition
SafeHandleZeroOrMinusOneIsInvalid.cs:9
Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
Definition
SafeHandleZeroOrMinusOneIsInvalid.cs:7
System.Runtime.InteropServices.SafeHandle.DangerousAddRef
void DangerousAddRef(ref bool success)
Definition
SafeHandle.cs:76
System.Runtime.InteropServices.SafeHandle.DangerousRelease
void DangerousRelease()
Definition
SafeHandle.cs:93
System.Runtime.InteropServices.SafeHandle.SetHandle
void SetHandle(IntPtr handle)
Definition
SafeHandle.cs:42
System.Runtime.InteropServices.SafeHandle.handle
IntPtr handle
Definition
SafeHandle.cs:8
System.Security.Cryptography.SafeHashHandle.ReleaseHandle
override bool ReleaseHandle()
Definition
SafeHashHandle.cs:35
System.Security.Cryptography.SafeHashHandle.SafeHashHandle
SafeHashHandle()
Definition
SafeHashHandle.cs:11
System.Security.Cryptography.SafeHashHandle._parent
SafeProvHandle _parent
Definition
SafeHashHandle.cs:7
System.Security.Cryptography.SafeHashHandle.SetParent
void SetParent(SafeProvHandle parent)
Definition
SafeHashHandle.cs:17
System.Security.Cryptography.SafeHashHandle.InvalidHandle
static SafeHashHandle InvalidHandle
Definition
SafeHashHandle.cs:9
System.Security.Cryptography.SafeHashHandle.Dispose
override void Dispose(bool disposing)
Definition
SafeHashHandle.cs:27
System.Security.Cryptography.SafeHashHandle
Definition
SafeHashHandle.cs:6
System.Security.Cryptography.SafeProvHandle
Definition
SafeProvHandle.cs:6
Microsoft.Win32.SafeHandles
Definition
SafeProcessHandle.cs:3
System.Security.Cryptography
Definition
CryptoPool.cs:3
System.IntPtr.Zero
static readonly IntPtr Zero
Definition
IntPtr.cs:18
System.IntPtr
Definition
IntPtr.cs:14
source
System.Security.Cryptography.Csp
System.Security.Cryptography
SafeHashHandle.cs
Generated by
1.10.0