Class: LibMsPack::MsCab::MsCabdCabinet

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/libmspack/mscab.rb

Overview

A structure which represents a single cabinet file.

If this cabinet is part of a merged cabinet set, the files and folders fields are common to all cabinets in the set, and will be identical.

Instance Method Summary collapse

Instance Method Details

#base_offsetFixnum

The file offset of cabinet within the physical file it resides in.

Returns:

  • (Fixnum)


246
247
248
# File 'lib/libmspack/mscab.rb', line 246

def base_offset
    self[:base_offset]
end

#filenameString

The filename of the cabinet.

More correctly, the filename of the physical file that the cabinet resides in. This is given by the library user and may be in any format.

Returns:

  • (String)


239
240
241
# File 'lib/libmspack/mscab.rb', line 239

def filename
    self[:filename]
end

#filesMsCabdFile?

A list of all files in the cabinet or cabinet set.

Returns:



304
305
306
307
# File 'lib/libmspack/mscab.rb', line 304

def files
    return nil if self[:files].pointer.address.zero?
    self[:files]
end

#flagsFixnum

Header flags.

  • MSCAB_HDR_PREVCAB indicates the cabinet is part of a cabinet set, and has a predecessor cabinet.
  • MSCAB_HDR_NEXTCAB indicates the cabinet is part of a cabinet set, and has a successor cabinet.
  • MSCAB_HDR_RESV indicates the cabinet has reserved header space.

Returns:

  • (Fixnum)

See Also:



357
358
359
# File 'lib/libmspack/mscab.rb', line 357

def flags
    self[:flags]
end

#foldersMsCabdFolder?

A list of all folders in the cabinet or cabinet set.

Returns:



312
313
314
315
# File 'lib/libmspack/mscab.rb', line 312

def folders
    return nil if self[:folders].pointer.address.zero?
    self[:folders]
end

#header_resvFixnum

The number of bytes reserved in the header area of the cabinet.

If this is non-zero and flags has MSCAB_HDR_RESV set, this data can be read by the calling application. It is of the given length, located at offset (base_offset + MSCAB_HDR_RESV_OFFSET) in the cabinet file.

Returns:

  • (Fixnum)

See Also:



341
342
343
# File 'lib/libmspack/mscab.rb', line 341

def header_resv
    self[:header_resv]
end

#lengthFixnum

The length of the cabinet file in bytes.

Returns:

  • (Fixnum)


253
254
255
# File 'lib/libmspack/mscab.rb', line 253

def length
    self[:length]
end

#nextMsCabdCabinet?

The next cabinet in a chained list, if this cabinet was opened with MsCabDecompressor#search

May be nil to mark the end of the list.

Returns:



229
230
231
232
# File 'lib/libmspack/mscab.rb', line 229

def next
    return nil if self[:next].pointer.address.zero?
    self[:next]
end

#nextcabMsCabdCabinet?

The next cabinet in a cabinet set, or nil.

Returns:



268
269
270
271
# File 'lib/libmspack/mscab.rb', line 268

def nextcab
    return nil if self[:nextcab].pointer.address.zero?
    self[:nextcab]
end

#nextinfoString

The name of the disk containing the next cabinet in a cabinet set, or nil.

Returns:

  • (String)


297
298
299
# File 'lib/libmspack/mscab.rb', line 297

def nextinfo
    self[:nextinfo]
end

#nextnameString

The filename of the next cabinet in a cabinet set, or nil.

Returns:

  • (String)


283
284
285
# File 'lib/libmspack/mscab.rb', line 283

def nextname
    self[:nextname]
end

#prevcabMsCabdCabinet?

The previous cabinet in a cabinet set, or nil.

Returns:



260
261
262
263
# File 'lib/libmspack/mscab.rb', line 260

def prevcab
    return nil if self[:prevcab].pointer.address.zero?
    self[:prevcab]
end

#previnfoString

The name of the disk containing the previous cabinet in a cabinet set, or nil.

Returns:

  • (String)


290
291
292
# File 'lib/libmspack/mscab.rb', line 290

def previnfo
    self[:previnfo]
end

#prevnameString

The filename of the previous cabinet in a cabinet set, or nil.

Returns:

  • (String)


276
277
278
# File 'lib/libmspack/mscab.rb', line 276

def prevname
    self[:prevname]
end

#set_idFixnum

The set ID of the cabinet.

All cabinets in the same set should have the same set ID.

Returns:

  • (Fixnum)


322
323
324
# File 'lib/libmspack/mscab.rb', line 322

def set_id
    self[:set_id]
end

#set_indexFixnum

The index number of the cabinet within the set.

Numbering should start from 0 for the first cabinet in the set, and increment by 1 for each following cabinet.

Returns:

  • (Fixnum)


331
332
333
# File 'lib/libmspack/mscab.rb', line 331

def set_index
    self[:set_index]
end