Sha256: 53b1a0509a0efa3aa59b61e44ff167d5eb2b6845fc5c50603e9ec9dc50a6c970

Contents?: true

Size: 818 Bytes

Versions: 35

Compression:

Stored size: 818 Bytes

Contents

require 'windows_error/nt_status'

module RubySMB
  module Field
    # Represents an NTStatus code as defined in
    # [2.3.1 NTSTATUS values](https://msdn.microsoft.com/en-us/library/cc704588.aspx)
    class NtStatus < BinData::Primitive
      endian :little
      uint32 :val

      def get
        val.to_i
      end

      def set(value)
        case value
        when WindowsError::ErrorCode
          set(value.value)
        when Integer
          self.val = value
        else
          self.val = value.to_i
        end
        val
      end

      # Returns a meaningful error code parsed from the numeric value
      #
      # @return [WindowsError::ErrorCode] the ErrorCode object for this code
      def to_nt_status
        WindowsError::NTStatus.find_by_retval(value).first
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
ruby_smb-3.3.12 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.3.11 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.3.10 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.3.9 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.3.7 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.3.6 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.3.5 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.3.4 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.3.3 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.3.2 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.3.1 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.3.0 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.2.8 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.2.7 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.2.6 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.2.5 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.2.4 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.2.3 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.2.2 lib/ruby_smb/field/nt_status.rb
ruby_smb-3.2.1 lib/ruby_smb/field/nt_status.rb