I'm creating a password protected zip file using SharpZipLib and inserting 3 files:
using the following code:
Protected _file As ZipFile
Public Sub New(ByVal pathName As String)
If Not File.Exists(pathName) Then
Try
_file = ZipFile.Create(pathName)
Catch ex As Exception
End Try
Else
Try
_file = New ZipFile(pathName)
Catch ex As Exception
End Try
End If
End Sub
Public Sub Insert(ByVal name As String,
ByVal streamFile As Stream)
Dim sds As New CustomStaticDataSource
sds.SetStream(streamFile)
Try
_file.BeginUpdate()
_file.Add(sds, name)
_file.CommitUpdate()
Catch ex As Exception
Throw
End Try
End Sub
Private Class CustomStaticDataSource
Implements IStaticDataSource
Private _stream As Stream
Public Function GetSource() As Stream Implements IStaticDataSource.GetSource
Return _stream
End Function
Public Sub SetStream(inputStream As Stream)
_stream = inputStream
_stream.Position = 0
End Sub
End Class
The file can be opened and unzipped with windows and 7zip.
When I try to open it and extract the first file from a C++ application on windows it fails regularly, I'm using ziparchive.
Ziparchive detect it as corrupted by checking the consistence of crc, compressed and original size.
The issue is that the uncompressed size is not correctly detected, but always detected as hex 04034b50 (decimal 67324752).
Is there any option that must be set in order to fix this issue?
Issue confirmed and fixed by ziparchive