Example #1
0
 private static LsaCallPackageResponse CreateResponse(NtStatus status, SafeLsaReturnBufferHandle buffer, int length)
 {
     if (!(buffer?.IsInvalid ?? true))
     {
         buffer?.Initialize((uint)length);
     }
     return(new LsaCallPackageResponse()
     {
         Status = status,
         Buffer = buffer
     });
 }
 public SafeLsaReturnBufferHandle Detach()
 {
     RuntimeHelpers.PrepareConstrainedRegions();
     try // Needed for constrained region.
     {
         IntPtr handle = DangerousGetHandle();
         SetHandleAsInvalid();
         var ret = new SafeLsaReturnBufferHandle(handle, true);
         ret.Initialize(ByteLength);
         return(ret);
     } finally {
     }
 }