mscorlib(4.0.0.0) API with additions
SafeCertStoreHandle.cs
1 using Microsoft.Win32.SafeHandles;
4 
6 {
7  internal sealed class SafeCertStoreHandle : SafeHandleZeroOrMinusOneIsInvalid
8  {
9  internal static SafeCertStoreHandle InvalidHandle => new SafeCertStoreHandle(IntPtr.Zero);
10 
11  private SafeCertStoreHandle()
12  : base(ownsHandle: true)
13  {
14  }
15 
16  internal SafeCertStoreHandle(IntPtr handle)
17  : base(ownsHandle: true)
18  {
19  SetHandle(handle);
20  }
21 
22  [DllImport("crypt32.dll", SetLastError = true)]
23  [SuppressUnmanagedCodeSecurity]
24  [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
25  private static extern bool CertCloseStore(IntPtr hCertStore, uint dwFlags);
26 
27  protected override bool ReleaseHandle()
28  {
29  return CertCloseStore(handle, 0u);
30  }
31  }
32 }
Definition: __Canon.cs:3
Cer
Specifies a method's behavior when called within a constrained execution region.
Definition: Cer.cs:5
Consistency
Specifies a reliability contract.
Definition: Consistency.cs:5