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)


233
234
235
# File 'lib/libmspack/mscab.rb', line 233

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)


226
227
228
# File 'lib/libmspack/mscab.rb', line 226

def filename
    self[:filename]
end

#filesMsCabdFile?

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

Returns:



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

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:



344
345
346
# File 'lib/libmspack/mscab.rb', line 344

def flags
    self[:flags]
end

#foldersMsCabdFolder?

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

Returns:



299
300
301
302
# File 'lib/libmspack/mscab.rb', line 299

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:



328
329
330
# File 'lib/libmspack/mscab.rb', line 328

def header_resv
    self[:header_resv]
end

#lengthFixnum

The length of the cabinet file in bytes.

Returns:

  • (Fixnum)


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

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:



216
217
218
219
# File 'lib/libmspack/mscab.rb', line 216

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

#nextcabMsCabdCabinet?

The next cabinet in a cabinet set, or nil.

Returns:



255
256
257
258
# File 'lib/libmspack/mscab.rb', line 255

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)


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

def nextinfo
    self[:nextinfo]
end

#nextnameString

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

Returns:

  • (String)


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

def nextname
    self[:nextname]
end

#prevcabMsCabdCabinet?

The previous cabinet in a cabinet set, or nil.

Returns:



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

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)


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

def previnfo
    self[:previnfo]
end

#prevnameString

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

Returns:

  • (String)


263
264
265
# File 'lib/libmspack/mscab.rb', line 263

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)


309
310
311
# File 'lib/libmspack/mscab.rb', line 309

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)


318
319
320
# File 'lib/libmspack/mscab.rb', line 318

def set_index
    self[:set_index]
end