Changeset 1554 for branches/eraser6/CodeReview/Eraser.Util/Security.cs
- Timestamp:
- 1/18/2010 5:38:32 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/CodeReview/Eraser.Util/Security.cs
r1552 r1554 26 26 using System.Security.Principal; 27 27 using System.Runtime.InteropServices; 28 using Microsoft.Win32.SafeHandles; 28 29 29 30 namespace Eraser.Util … … 153 154 } 154 155 155 internal sealed class CryptApi : IDisposable156 internal sealed class CryptApi 156 157 { 157 158 /// <summary> … … 187 188 } 188 189 189 #region IDisposable Members190 ~CryptApi()191 {192 Dispose(false);193 }194 195 public void Dispose(bool disposing)196 {197 if (disposing)198 handle.Close();199 }200 201 public void Dispose()202 {203 Dispose(true);204 GC.SuppressFinalize(this);205 }206 #endregion207 208 190 /// <summary> 209 191 /// The GenRandom function fills a buffer with cryptographically random bytes. … … 230 212 } 231 213 232 internal class SafeCryptHandle : SafeHandle 214 internal class SafeCryptHandle : SafeHandleZeroOrMinusOneIsInvalid 233 215 { 234 216 public SafeCryptHandle() 235 : base(IntPtr.Zero, true) 236 { 237 } 238 239 public override bool IsInvalid 240 { 241 get { return handle == IntPtr.Zero; } 217 : base(true) 218 { 242 219 } 243 220 … … 250 227 } 251 228 252 internal class SafeTokenHandle : SafeHandle 229 internal class SafeTokenHandle : SafeHandleZeroOrMinusOneIsInvalid 253 230 { 254 231 public SafeTokenHandle() 255 : base(IntPtr.Zero, true) 256 { 257 } 258 259 public override bool IsInvalid 260 { 261 get { return handle == IntPtr.Zero; } 232 : base(true) 233 { 262 234 } 263 235
Note: See TracChangeset
for help on using the changeset viewer.
