Sha256: 26cc0553305a6c51e108d9a253ddbe8aa696ba3e21d396763877d3a96bf1c413

Contents?: true

Size: 1.5 KB

Versions: 9

Compression:

Stored size: 1.5 KB

Contents

require 'uuidtools'

module NTFS
  # There is no real data definition for this class - it consists entirely of GUIDs.
  #
  # struct GUID - GUID structures store globally unique identifiers (GUID).
  #
  # A GUID is a 128-bit value consisting of one group of eight hexadecimal
  # digits, followed by three groups of four hexadecimal digits each, followed
  # by one group of twelve hexadecimal digits. GUIDs are Microsoft's
  # implementation of the distributed computing environment (DCE) universally
  # unique identifier (UUID).
  #
  # Example of a GUID:
  #  1F010768-5A73-BC91-0010-A52216A7227B
  #

  class ObjectId
    attr_reader :objectId, :birthVolumeId, :birthObjectId, :domainId

    def initialize(buf)
      raise "MIQ(NTFS::ObjectId.initialize) Nil buffer" if buf.nil?
      buf = buf.read(buf.length) if buf.kind_of?(DataRun)
      len = 16
      @objectId       = UUIDTools::UUID.parse_raw(buf[len * 0, len])
      @birthVolumeId  = UUIDTools::UUID.parse_raw(buf[len * 1, len]) if buf.length > 16
      @birthObjectId  = UUIDTools::UUID.parse_raw(buf[len * 2, len]) if buf.length > 16
      @domainId       = UUIDTools::UUID.parse_raw(buf[len * 3, len]) if buf.length > 16
    end

    def dump
      out = "\#<#{self.class}:0x#{'%08x' % object_id}>\n"
      out << "  Object id      : #{@objectId}\n"
      out << "  Birth volume id: #{@birthVolumeId}\n"
      out << "  Birth object id: #{@birthObjectId}\n"
      out << "  Domain id      : #{@domainId}\n"
      out << "---\n"
    end
  end
end # module NTFS

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
manageiq-smartstate-0.10.1 lib/fs/ntfs/attrib_object_id.rb
manageiq-smartstate-0.10.0 lib/fs/ntfs/attrib_object_id.rb
manageiq-smartstate-0.9.0 lib/fs/ntfs/attrib_object_id.rb
manageiq-smartstate-0.8.1 lib/fs/ntfs/attrib_object_id.rb
manageiq-smartstate-0.8.0 lib/fs/ntfs/attrib_object_id.rb
manageiq-smartstate-0.7.0 lib/fs/ntfs/attrib_object_id.rb
manageiq-smartstate-0.6.2 lib/fs/ntfs/attrib_object_id.rb
manageiq-smartstate-0.6.1 lib/fs/ntfs/attrib_object_id.rb
manageiq-smartstate-0.6.0 lib/fs/ntfs/attrib_object_id.rb