wqweto / ZipArchive

A single-class pure VB6 library for zip with ASM speed
MIT License
55 stars 23 forks source link

Unzip with password not working #20

Closed MaheshPMane closed 2 years ago

MaheshPMane commented 2 years ago

Hi Please check and guide me on below code

With m_oZip .OpenArchive "c:\temp\crdata.zip" Set m_oExtractInMemory = m_oZip bResult = .Extract("c:\temp\", , "1111") Set m_oExtractInMemory = Nothing sLastError = .LastError End With

wqweto commented 2 years ago

Make sure to set Conditional Compilation in Make tab in project's properties dialog to include ZIP_CRYPTO = 1 setting for crypto support to get compiled from sources. By default crypto support is not compiled to reduce footprint on the final executable size.

Your code should work ok but here is another minimal sample code with error checking

With New cZipArchive
    If Not .OpenArchive("c:\temp\crdata.zip") Then
        Debug.Print .LastError
    End If
    If Not .Extract("c:\temp", Password:="1111") Then
        Debug.Print .LastError
    End If
End With

Note that if the password you supply is not correct then Extract will fail with an error message in LastError property.

If after setting ZIP_CRYPTO conditional compilation constant this is still not working can you provide (here in this thread) a password protected .zip file you are having troubles extracting from?

MaheshPMane commented 2 years ago

Hello Sir,

It works, Thank You