PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Use conditions
  • Using an archive encrypted with a password
  • Miscellaneous
  • Error codes
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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.
Versions 19 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 19
Universal Windows 10 App This function is now available in Windows Store apps mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
ArchivePath is string = CompleteDir(fCurrentDir()) + "Archive.ZIP"
IF fExtractPath(ArchivePath, fExtension) ~= ".zip" THEN
IF zipOpen("MyArchive", ArchivePath) = 0 THEN
 // Encrypt the archive
 zipPassword("MyArchive", "Password")
 zipAddFile("MyArchive", "C:\MyFile.txt")
 // Add the file. The file is encrypted by the password
END
END
 
MyArchive is zipArchive
 
ArchivePath is string = CompleteDir(fCurrentDir()) + "Archive.ZIP"
IF fExtractPath(ArchivePath, fExtension) ~= ".zip" THEN
IF zipOpen(MyArchive, ArchivePath) = 0 THEN
 // Encrypt the archive
 zipPassword(MyArchive, "Password")
 zipAddFile(MyArchive, "C:\MyFile.txt")
 // Add the file. The file is encrypted by the password
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 (with quotes) or zipArchive variable
Name of archive to use.
This name can correspond to:
<Password>: Character string (with quotes)
Password used to encrypt the added files or to decrypt the extracted files. This password must use characters whose ASCII code is included 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 ("").
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 and TGZ (TAR.GZ) format: This function is not available.
Reminder:
  • LinuxUniversal Windows 10 App Only the archives in ZIP, TAR and TGZ (TAR.GZ) format are available.

Using an archive encrypted with a password

The password is defined by zipPassword. Once the password is defined, it is used for all the following archiving operations:
  • File addition: the added files will be encrypted with this password
  • File extraction: the password will be used to decrypt all the extracted files.
The password is active for the archive on which it was defined. The password is lost when the archive is destroyed (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. Whenever a file is added or extracted, use zipPassword and specify the password expected by the file to add or to extract.
  • 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 for this archive format.
The message corresponding to the error code is returned by zipMsgError.
Component : wd250zip.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment