| | 1 | | using System; |
| | 2 | | using Microsoft.Win32.SafeHandles; |
| | 3 | | using SharpHoundRPC.LSANative; |
| | 4 | |
|
| | 5 | | namespace SharpHoundRPC.Handles |
| | 6 | | { |
| | 7 | | public class LSAHandle : SafeHandleZeroOrMinusOneIsInvalid |
| | 8 | | { |
| 0 | 9 | | public LSAHandle() : base(true) |
| 0 | 10 | | { |
| 0 | 11 | | } |
| | 12 | |
|
| 0 | 13 | | public LSAHandle(IntPtr handle, bool ownsHandle) : base(ownsHandle) |
| 0 | 14 | | { |
| 0 | 15 | | SetHandle(handle); |
| 0 | 16 | | } |
| | 17 | |
|
| 0 | 18 | | public LSAHandle(bool ownsHandle) : base(true) |
| 0 | 19 | | { |
| 0 | 20 | | } |
| | 21 | |
|
| | 22 | | protected override bool ReleaseHandle() |
| 0 | 23 | | { |
| 0 | 24 | | if (handle == IntPtr.Zero) return true; |
| 0 | 25 | | return LSAMethods.LsaClose(handle) == NtStatus.StatusSuccess; |
| 0 | 26 | | } |
| | 27 | |
|
| | 28 | | ~LSAHandle() |
| 0 | 29 | | { |
| 0 | 30 | | Dispose(); |
| 0 | 31 | | } |
| | 32 | | } |
| | 33 | | } |