MyZIP.s = "C:\Test.zip"
MyZIPFile1.s = "C:\Compressor Xpert.exe"
MyZIPFile2.s = "C:\French.lng"
MyZIPFile3.s = "C:\English.lng"
MyZIPOutPut.s = "C:\TempZip"
If PureZIP_Archive_Create(MyZIP.s, #APPEND_STATUS_CREATE)
PureZIP_SetArchivePassword("azerty")
PureZIP_Archive_Compress(MyZIPFile1.s, #False)
PureZIP_Archive_Compress(MyZIPFile2.s, #False)
PureZIP_Archive_Compress(MyZIPFile3.s, #False)
PureZIP_Archive_Close()
EndIf
MessageRequester("Info","Success",0)
; i need to check if the password is correct before unzip files
; but i can't make it work !
Input.s = InputRequester("Zip is crypted", "Password:", "")
If PureZIP_Archive_Read(MyZIP.s)
If Input
If PureZIP_SetArchivePassword(Input)
ReturnValue.l = PureZIP_Archive_FindFirst() = #UNZ_OK
While ReturnValue = #UNZ_OK
PureZIP_Archive_Extract(MyZIPOutPut.s, #True)
ReturnValue = PureZIP_Archive_FindNext()
Wend:MessageRequester("Info","Files are extracted !",0)
Else: MessageRequester("Info","Error !",0):EndIf
Else:MessageRequester("Info","please input password !",0):EndIf
PureZIP_Archive_Close()
EndIf
For security reasons I don't think that zip files store that kind of information, I think you only know that a password is incorrect when you get errors during the uncompression.
DoubleDutch wrote:For security reasons I don't think that zip files store that kind of information, I think you only know that a password is incorrect when you get errors during the uncompression.
Exactly.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Micko: If what you want to do is find the password to a zip file, then you can find this IF one of the files is a known file. A known file is an original file before it was zipped.
That is why you should NEVER make password protected zips with files where some of the files are available unzipped. This would render the password protection virtually useless because it make it possible to reverse the process to find the original password for the encypted files.
know i try to extract files that are password protected and check if there is errors during the uncompression ?
here is the result i have
files are always extracted with size(0) , if the password is incorrect
gnozal i'm working with your last code but it seems to work when the total files in zip not Exceed 10 else i get this message "Extraction problem", but couldn't delete files.
Micko wrote:gnozal i'm working with your last code but it seems to work when the total files in zip not Exceed 10 else i get this message "Extraction problem", but couldn't delete files.
?!
I just tested the code with a crypted archive containing 28 files : no problem (all zero length files deleted).
If you can assume the password is the same for all files, this code may suffice : it quits after the first failure.
this line never return 0 but -1 when i test. if i change 0 to -1 it works.
so i think it is Inexistants file(PB help). every day should be the same to me because i catch something in my mind.
thanks gnozal
Gnozal i want to set zip size to quad i process file to support file > 2Go
did i do it like this