ReadRAR



Option Explicit

' -------------------------------------------------------

' DLL- Version

' -------------------------------------------------------


Public Function InspectRARArchiveDLL(sFile As String, _
ByRef lMilliSeconds As Long, _
ByRef lNumFiles As Long, _
ByRef dblUnpackedBytes As Double, _
ByRef dblPackedBytes As Double, _
lblArchiv As Label) As Boolean
On Error GoTo ErrExit

Dim hArchive As Long
Dim tHeaderdata As RARHEADERDATA
Dim sFilename As String
Dim bMultVolume As Boolean

StartTimer

sFilename = sFile

hArchive = OpenRARArchive(sFilename, RAR_OM_LIST, bMultVolume)
If hArchive = 0 Then Exit Function

While RARReadHeader(hArchive, tHeaderdata) = 0
If Not lblArchiv Is Nothing Then
lblArchiv.Caption = modIni.LiesArchiv(tHeaderdata.Arcname)
lblArchiv.Refresh
End If

RARProcessFile hArchive, RAR_SKIP, vbNull, 0&
If (tHeaderdata.flags And &H1000) = 0 Then
' file continued flag not set

If tHeaderdata.FileAttr <> vbDirectory Then
lNumFiles = lNumFiles + 1&
dblUnpackedBytes = dblUnpackedBytes + tHeaderdata.UnpSize
dblPackedBytes = dblPackedBytes + tHeaderdata.PackSize
End If
End If
Wend

RARCloseArchive hArchive

InspectRARArchiveDLL = True

lMilliSeconds = MeasureTime

Exit Function

ErrExit:
ShowError

On Error Resume Next
RARCloseArchive hArchive
Exit Function
End Function

(readrar.html)- by Paolo Puglisi - Modifica del 25/3/2019