Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SafeKeyHandle.cs
Go to the documentation of this file.
2
4
6{
7 private int _keySpec;
8
9 private bool _fPublicOnly;
10
12
13 internal int KeySpec
14 {
15 set
16 {
18 }
19 }
20
21 internal bool PublicOnly
22 {
23 get
24 {
25 return _fPublicOnly;
26 }
27 set
28 {
30 }
31 }
32
34
36 : base(ownsHandle: true)
37 {
39 _keySpec = 0;
40 _fPublicOnly = false;
41 }
42
43 internal void SetParent(SafeProvHandle parent)
44 {
45 if (!IsInvalid && !base.IsClosed)
46 {
47 _parent = parent;
48 bool success = false;
49 _parent.DangerousAddRef(ref success);
50 }
51 }
52
53 protected override void Dispose(bool disposing)
54 {
55 if (!SafeHandleCache<SafeKeyHandle>.IsCachedInvalidHandle(this))
56 {
57 base.Dispose(disposing);
58 }
59 }
60
61 protected override bool ReleaseHandle()
62 {
63 bool result = global::Interop.Advapi32.CryptDestroyKey(handle);
64 SafeProvHandle parent = _parent;
65 _parent = null;
66 parent?.DangerousRelease();
67 return result;
68 }
69}
static T GetInvalidHandle(Func< T > invalidHandleFactory)
void DangerousAddRef(ref bool success)
Definition SafeHandle.cs:76
override void Dispose(bool disposing)
void SetParent(SafeProvHandle parent)
static readonly IntPtr Zero
Definition IntPtr.cs:18