示例#1
0
 /// <summary>
 /// Throws the NT status value as an exception if it is an error or warning.
 /// </summary>
 /// <param name="status">The NT status value.</param>
 public static void ThrowIf(this NtStatus status)
 {
     if (status.IsError() || status.IsWarning())
     {
         status.Throw();
     }
 }
示例#2
0
        private MemoryAlloc GetPropertiesInformation()
        {
            int retLength;

            MemoryAlloc data = new MemoryAlloc(0x1000);

            NtStatus status = Win32.NtQueryInformationTransaction(
                this,
                TransactionInformationClass.TransactionPropertiesInformation,
                data,
                data.Size,
                out retLength
                );

            if (status == NtStatus.BufferTooSmall)
            {
                // Resize the buffer and try again.
                data.ResizeNew(retLength);

                status = Win32.NtQueryInformationTransaction(
                    this,
                    TransactionInformationClass.TransactionPropertiesInformation,
                    data,
                    data.Size,
                    out retLength
                    );
            }

            if (status.IsError())
            {
                data.Dispose();
                status.Throw();
            }

            return(data);
        }