ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Archive functions
  • Use conditions
  • Using an archive encrypted with a password
  • Miscellaneous
  • Error codes
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Defines the password used to add files into the specified archive and to extract files from the specified archive (RAR, ZIP and WDZ format). The password is associated with each archive file.
Example
MonArchive is zipArchive

ArchiveChemin is string = CompleteDir(fCurrentDir()) + "Archive.ZIP"
IF fExtractPath(ArchiveChemin, fExtension) ~= ".zip" THEN
	IF zipOpen(MonArchive, ArchiveChemin) = 0 THEN
		 // Crypte l'archive
		 zipPassword(MonArchive, "MotDePasse")
		 zipAddFile(MonArchive, "C:\MonFic.txt")
		 // Ajout du fichier. Le fichier est crypté par le mot de passe
	END
END
Syntax
<Result> = zipPassword(<Archive> , <Password>)
<Result>: Integer
  • 0 if the password was defined properly,
  • An error code (value greater than 0) otherwise.
<Archive>: Character string or zipArchive variable
Name of the archive to be used.
This name can correspond to:
<Password>: Character string or Secret string
Password used to encrypt the added files or to decrypt the extracted files. This password must use characters with an ASCII code between 1 and 127. This password cannot exceed 255 characters.
To avoid encrypting the added files or the extracted files, you have the ability to use an empty string ("").
New in version 2025
Secret strings: If you use the secret string vault, the type of secret string used for this parameter must be "ANSI or Unicode string".
To learn more about secret strings and how to use the vault, see Secret string vault.
New in version 2025
AndroidAndroid Widget Secret strings are not available for this parameter in Android/Android widget applications.
Remarks

Use conditions

  • The RAR, ZIP and WDZ formats do not protect the archive when it is opened. The password is required for extracting the files from the archive and for adding the files into the archive.
  • Archives in 7z format: This function is not available.
  • Archives in TAR, gzip and TGZ format (TAR.GZ): This function is not available.
LinuxiPhone/iPadIOS WidgetMac Catalyst Reminder: Only archives in ZIP, TAR, gzip and TGZ (TAR.GZ) formats are available.

Using an archive encrypted with a password

The password is defined with zipPassword. Once the password is defined, it is used for all the following archiving operations:
  • Add files added files will be encrypted with this password
  • File extraction password will be used to decrypt all extracted files.
The password is active for the archive on which it was defined. The password is lost when the archive is deleted (zipClose). It must be specified again after zipOpen or zipCreate.

Miscellaneous

  • A different password can be specified for each added or extracted file in the same archive. Each time a file is added or extracted, use zipPassword and specify the password expected by the file to be added or extracted.
  • Unable to directly modify the password of a file found in an archive. You must extract the file, delete it from the archive and re-add it to the archive with the new password.
  • zipInfoFile is used to find out whether a file in the archive is encrypted (+) or normal (N).

Error codes

The following error codes are returned:
  • 23: Feature not available on this archive format.
The message corresponding to the error code is returned by zipMsgError.
Business / UI classification: Business Logic
Component: wd300zip.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/16/2025

Send a report | Local help