PureLZMA-Packer-Mem library

Overview

This PB4.3x user library is an extension for the PureLZMA Packer library.
It allows to read PureLZMA archives included in data sections.

Note : the PureLZMA library is required !

Functions

PureLZMA_MemArchive_Read(*ArchiveBuffer, ArchiveBufferLen.l)

Opens a memory archive for reading.

Parameters :

*ArchiveBuffer	: pointer to the memory archive
ArchiveBufferLen	: memory archive length

Returned value :

- #Null if failed
- else : success
PureLZMA_MemArchive_Close()

Close the current memory archive.
PureLZMA_MemArchive_Extract(FileName.s [, EncryptionKey.s])

Extract current record from archive

Parameters :

Filename		: Extracted data filename
EncryptionKey	: Optional RC4 encryption key [if data was encrypted]

Returned values :
	
Success :		: #True
Failure :		:  0 -> no current record
		: -1 -> memory allocation error
		: -2 -> file access error
		: -3 -> unpack error

PureLZMA_MemArchive_ExtractMem(*MemoryBuffer, MemoryBufferLen.l [, EncryptionKey.s])

Extract current record from archive to memory buffer.


Parameters :

*MemoryBuffer	: Destination memory buffer
MemoryBufferLen	: Destination memory buffer length
EncryptionKey	: Optional RC4 encryption key [if data was encrypted]

Returned values :
	
Success :		: #True
Failure :		:  0 -> no current record
		: -1 -> memory allocation error
		: -2 -> file access error
		: -3 -> unpack error

PureLZMA_MemArchive_FindFirst()

Find the first record in the archive.

To be used with PureLZMA_MemArchive_FindNext().

Returned value :

- #True if success
- #False if failed

PureLZMA_MemArchive_FindNext()

Find the next record in the archive.

To be used after PureLZMA_MemArchive_FindFirst().

Returned value :

- #True if success
- #False if failed

PureLZMA_MemArchive_GetArchiveInfo(*ArchiveInfo.LZMA_ArchiveInfo)

Get archived record information.

Parameter :

*ArchiveInfo : pointer to a LZMA_ArchiveInfo structure.

Structure LZMA_ArchiveInfo
  CRCUnpacked.l	; Unpacked data CRC32
  CRCPacked.l	; Packed data CRC32
  LengthUnpacked.l	; Unpacked data length
  LengthPacked.l	; Packed data length
  LZMAFlags.l	; LZMA Packer flags
  FileAttributes.l	; Packed file attributes
  Filename.s	; Filename for packed data
EndStructure

LZMAFlags :	#LZMA_Flag_Stored = 0	-> data is stored
		#LZMA_Flag_Compressed = 1	-> data is compressed [LZMA]
		#LZMA_Flag_Crypted = 2	-> data is crypted [RC4]
		#LZMA_Flag_Deleted = 4	-> record is marked for deletion

Returned value :

- #True if success
- #False if failed

PureLZMA_MemArchive_GetCRC()

Calculate the CRC32 for current archived record.

Useful to check record integrity.