Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SafeHashHandle.cs
Go to the documentation of this file.
2
4
6{
8
10
12 : base(ownsHandle: true)
13 {
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}
static T GetInvalidHandle(Func< T > invalidHandleFactory)
void DangerousAddRef(ref bool success)
Definition SafeHandle.cs:76
override void Dispose(bool disposing)
static readonly IntPtr Zero
Definition IntPtr.cs:18