Sha256: f1ba221ba638d352c84cab2c0046f6e01b1382eed3bf22cf1a0d59e2d29d0aaf

Contents?: true

Size: 1.06 KB

Versions: 10

Compression:

Stored size: 1.06 KB

Contents

require 'ruby_smb/dcerpc/ndr'

module RubySMB
  module Dcerpc

    # A RRP_UNICODE_STRING structure as defined in
    # [2.2.4 RRP_UNICODE_STRING](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rrp/c0c90f11-a4c4-496a-ac09-8a8a3697ceef)
    class RrpUnicodeString < BinData::Primitive
      endian :little

      uint16     :buffer_length
      uint16     :maximum_length
      ndr_lp_str :buffer

      def get
        self.buffer
      end

      def set(buf)
        self.buffer = buf
        self.buffer_length = self.buffer == :null ? 0 : self.buffer.referent.actual_count * 2
        # Don't reset maximum_length if the buffer is NULL to make sure we can
        # set it independently of the buffer size
        return if self.maximum_length > 0 && self.buffer == :null
        self.maximum_length = self.buffer.referent.max_count * 2
      end
    end

    # A pointer to a RRP_UNICODE_STRING structure
    class PrrpUnicodeString < Ndr::NdrPointer
      endian :little

      rrp_unicode_string :referent, onlyif: -> { self.referent_id != 0 }
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ruby_smb-2.0.12 lib/ruby_smb/dcerpc/rrp_unicode_string.rb
ruby_smb-2.0.11 lib/ruby_smb/dcerpc/rrp_unicode_string.rb
ruby_smb-2.0.10 lib/ruby_smb/dcerpc/rrp_unicode_string.rb
ruby_smb-2.0.9 lib/ruby_smb/dcerpc/rrp_unicode_string.rb
ruby_smb-2.0.8 lib/ruby_smb/dcerpc/rrp_unicode_string.rb
ruby_smb-2.0.7 lib/ruby_smb/dcerpc/rrp_unicode_string.rb
ruby_smb-2.0.6 lib/ruby_smb/dcerpc/rrp_unicode_string.rb
ruby_smb-2.0.5 lib/ruby_smb/dcerpc/rrp_unicode_string.rb
ruby_smb-2.0.4 lib/ruby_smb/dcerpc/rrp_unicode_string.rb
ruby_smb-2.0.3 lib/ruby_smb/dcerpc/rrp_unicode_string.rb