'LZMA 解码，解压缩 （不支持64位，因为没64位库）
#Include Once "inc/lzma.bi"

'--------------------------------------------------------------------------
Function LzmaDecode(inBy() As UByte, OutBy() As UByte) As Integer '
   Dim As UInteger InBufferSize,OutLen,Scr,LzmaRet
   Dim Hdr As Lzma_FileHdr Ptr
   Hdr = @inBy(0) '头部
   InBufferSize = UBound(inBy) + 1 - SizeOf(Lzma_FileHdr) '减去头部长度
   OutLen = Hdr->FileSize '原长度，保存在头部
   Scr = @InBy(0) + SizeOf(Lzma_FileHdr) '实际内容开始位置
   ReDim OutBy(OutLen -1)
   LzmaRet = LzmaUncompress(@OutBy(0), OutLen, Scr, InBufferSize, @Hdr->LzmaProp(0), LZMA_PROPS_SIZE)
   If LzmaRet = SZ_OK Then
      Function = OutLen
   Else
      Function = 0
   End If
   
End Function