InfoZIP UnZip Wrapper for Delphi
This article is part of a backup. It was originally posted on Monday, March 15. 2004.
Many of todays applications require the capability of extracting certain files from a ZIP archive, either onto the disk or into memory. A perfect solution is the UnZip DLL from the InfoZIP project because it offers few API functions to solve just this task without the hassle of dealing with file streams, ZIP formats and compression in general. Unfortunately, this great library is barely documented, thus hard to use in Delphi projects.
Therefore I decided to write a small Delphi wrapper that provides all required data types and functions along with detailed documentation in order to give you direct access to the UnZip API. Since I completed this project in a single afternoon, it may not be free of errors. Feel free to contact me if you find any bugs, make any changes, add new functionality, or have any general suggestions I may incorporate into this version.
Download
Name: InfoZIP UnZip Wrapper for Delphi
Version: 1.0.0 Build 2
Download: delphiunzip.zip (334kB)
Note: By using the contents of the InfoZIP UnZip Wrapper for Delphi, in parts or as a whole, you agree to the disclaimer at the bottom of this file.
Contents
Wrapper (2 files):
- /Unzip.pas – DLL Wrapper for Delphi
- /readme.txt – this file
Demo (10 files):
- /demo/FormMain.dfm -DFM file for main window
- /demo/FormVersion.dfm -DFM file for version window
- /demo/FormMain.pas – Pascal source code for main window
- /demo/FormVersion.pas – Pascal source code for version window
- /demo/unzip32.dll – InfoZIP UnZip DLL, Version 5.5.0
- /demo/main.cfg – Configuration file for demo project
- /demo/main.dpr – Project file for demo project
- /demo/main.exe – Precompiled executable
- /demo/main.res – Ressource file for the demo
- /demo/testdata.zip – Sample ZIP archive used by the demo
Installation
Wrapper only:
Copy the file Unzip.pas into a folder of your choice and add that folder to the library path in the environment options of Delphi or to the directory paths of your project’s settings, or copy the file directly into the source code folder of your project.
Demo application:
Copy all files into a folder of your choice. Open the file main.dpr to view the source code in Delphi, or start main.exe to launch the demo.
Known Bugs and Issues
The demos for Wiz_SetOpts() and Wiz_Unzip() are currently not working, thus disabled. This might be fixed in a future release of this distribution. There are no known bugs in the UnZip DLL wrapper.
FAQ
- Q: Which versions of Borland Delphi are supported?
- A: The wrapper was developed in Delphi 7, but should work with all other versions of Borland Delphi too.
- A: How can I add Unzip functionalities to my application?
- Q: Simply add ‘Unzip’ to the uses clause. All DLL functions will be statically linked into your program.
- A: Is it possible to dynamically link the DLL using LoadLibrary()?
- Q: Yes, add dyn_unzip32 to the conditional defines in your project configuration. This will disable static linking and provide ready to use prototypes for the API functions which can then be bound using GetProcAddress().
- A: How can I create new ZIPs or add new files to an existing archive?
- Q: Not at all. As the name implies, unzip32.dll can be used to unpack only.
- A: How can I extract a certain file from a ZIP archive?
- Q: Using the Wiz_SingleEntryUnzip() function. See the included demo application for working sample code.
- A: How can I extract a certain file into memory, without saving it on disk?
- Q: Using the Wiz_UnzipToMemory() function. See the included demo application for working sample code.
- A: How can I convert the return values of API functions into readable text?
- Q: The wrapper provides Wiz_ErrorToStr() for this purpose.
- A: Why can’t I compile using object methods as callback functions?
- Q: Procedure pointers and pointers to methods of an instance object are incompatible. While procedure pointers can be used by the UnZip API, object methods can not. For further information search the Delphi help file for “Procedural types”.
- A: Where can I get the latest version of unzip32.dll?
- Q: http://www.info-zip.org/pub/infozip/UnZip.html
- A: Where can i get the latest version of Unzip.pas?
- Q: http://www.gerke-preussner.de
Disclaimer
Copyright (c) 2004 headcrash industries. All rights reserved.
This software is provided “as is,” without warranty of any kind, expressed or implied. In no event shall the author or its contributors be held liable for any direct, indirect, incidental, special or consequential damages arising out of the use of or inability to use this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
- 1. Redistributions of source code must retain the original copyright notices in the source code file header.
- 2. Redistributions of source code and compiled executables must reproduce the above copyright notice, disclaimer, and this list of conditions in
documentation and/or other materials provided with the distribution.
unzip32.dll is Copyright (c) 1990-2003 Info-ZIP. All rights reserved. Please visit the InfoZIP website for licensing, downloads and further information about UnZip.
No comments yet.