⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zipdll.h

📁 zip算法的源码
💻 H
字号:
#ifndef ZipDLLH
#define ZipDLLH
// ZIPDLL.H   - C++ Builder translation of file "wizzip.h" by Eric W. Engler
/* Header file for ZIPDLL - put this into the "include" statement of any
   other unit that wants to access the DLL. */

//---------------------------------------------------------------------------
#include "CallBack.h"

#include <vcl\Windows.hpp>
#include <vcl\System.hpp>
#include "ZipLibs.h"
namespace ZipDLL {
//-- type declarations -------------------------------------------------------

/* This record is very critical.  Any changes in the order of items, the
  size of items, or modifying the number of items, may have disasterous
  results.  You have been warned! */
#pragma option -a1
/*
struct ZipParms1 {
	HWND	 fHandle;
	void  *fCaller; // "this" reference of the ZipBuilder class.
                  //    This is passed back to us in the callback function
                  //    so we can direct the info to the proper form instance
                  //    - thanks to Dennis Passmore for this idea.            
	long   fVersion;
	CallBack::ZFunctionPtrType ZCallbackFunc;
	BOOL  fTraceEnabled;

   //============== Begin Zip Flag section ==============
	char	*pZipPassword;		// password pointer (changed v1.3)
	char	*pSuffix;			// Enum of file extensions; files with this extensions will be stored. v1.6
	BOOL  fEncrypt;        // Encrypt files to be added?
	BOOL  fSystem;			// Add hidden system files.
	BOOL  fVolume;

   // Include extra file attributes (read-only, unix timestamps, etc)
	BOOL  fExtra;

   // Do not add directory names to .ZIP archive
   // see also: fJunkDir
	BOOL  fNoDirEntries;

   // Only add files newer a specified date
   // See the "Date" array below if you set this to TRUE
	BOOL  fUseDate;

   // Give a little more information to the user via message boxes
	BOOL  fVerboseEnabled;

   // Quiet operation - the DLL won't issue any messages at all.
   // BCB program MUST handle ALL errors via it's callback function.
	BOOL  fQuiet;

   // Compression level (0 - 9; 9=max, 0=none)
   // All of these levels are variations of deflate.
   // I strongly recommend you use one of 3 values here:
	// 	  0 = no compression, just store file
   //      3 = "fast" compression
   //      9 = "best" compression
	int   fLevel;

	BOOL  fComprSpecial;		// Not use any more (v1.6)
	BOOL  fCRLF_LF;				// translate text file end-of-lines

   // junk the directory names
   // If true, this says not to save dirnames as separate entries,
   //   in addition to being save with filenames. 
   // see also: fNoDirEntries
	BOOL  fJunkDir;
	//	DWord  fRecurse;		         // Recurse into subdirectories
	unsigned short fRecurse;			// Recurse into subdirectories
	unsigned short fNoRecurseFiles;	// Do not recurse if filespec is a file.
	BOOL  fGrow;          				// Allow appending to a zip file

   // Convert filenames to DOS 8x3 names - for compatibility
      with PKUNZIP v2.04g, which doesn't understand long filenames //
	BOOL  fForce;

   // Delete orig files that were added or updated in zip file
   // This is a variation of Add
	BOOL  fMove;
	BOOL  fDeleteEntries;   // Delete specified files from zip file

   // Update zip -- if true, rezip changed, and add new files in fspec
   // This is a variation of Add
	BOOL  fUpdate;

   // Freshen zip -- if true, rezip all changed files in fspec
   // This is a variation of Add
	BOOL  fFreshen;

   // junk the SFX prefix on the self-extracing .EXE archives
	BOOL  fJunkSFX;

   // Set zip file time to time of newest file in it
	BOOL  fLatestTime;
   // ============== End Zip Flag section ==============

   // Cutoff Date for Add-by-date; add files newer than this day
   // This is only used if the "fDate" option is TRUE
   // format = MMDDYY plus two trailing nulls
	char   fDate[8];

   // Count of files to add or delete - don't forget to set this!
	long   fArgc;
	char  *pZipFN;       // Ptr to name of zip file.
	int    fSeven;        // Pass a 7 here to validate struct size.

	// Array of filenames contained in the ZIP archive
	char  *pFileNames[FilesMax + 1]; // :=4097
};
*/
struct FileData {
	char					  *fFileSpec;			// Replaces pZipFN
	char					  *fFileComment;		//  z->comment and z->com
	char					  *fFileAltName;	
	char					  *fPassword;			//  Override in v1.60L
	BOOL						fEncrypt;			//  Override in v1.60L
	unsigned short int	fRecurse;			//  Override in v1.60L
	unsigned short int	fNoRecurseFiles;	//  Override
	BOOL						fDateUsed;			//  Override
	char						fDate[8];			//  Override
	char					  *fRootDir;			//  RootDir support for relative paths
	long						fNotUsed[16];	  
};

struct ExcludedFileSpec {
	char	  *fFileSpec;
};


struct ZipParms {
	HWND								fHandle;
	void							  *fCaller;
	long								fVersion;
	CallBack::ZFunctionPtrType ZCallbackFunc;
	BOOL								fTraceEnabled;
	char							  *pZipPassword;		// password pointer
	char							  *pSuffix;
	BOOL								fEncrypt;			// General encrypt, if not superseded by FileData.fEncrypt
	BOOL								fSystem;
	BOOL								fVolume;
	BOOL								fExtra;
	BOOL								fNoDirEntries;
	BOOL								fUseDate;			// General DateUsed, if not superseded by FileData.fDateUsed
	BOOL								fVerboseEnabled;
	BOOL								fQuiet;
	int								fLevel;
	BOOL								fComprSpecial;		// Not used any more. (v1.6) now fSuffix takes care of this.
	BOOL								fCRLF_LF;
	BOOL								fJunkDir;
	unsigned short int			fRecurse;
	unsigned short int			fNoRecurseFiles;
	BOOL								fGrow;
	BOOL								fForce;
	BOOL								fMove;
	BOOL								fDeleteEntries;
	BOOL								fUpdate;
	BOOL								fFreshen;
	BOOL								fJunkSFX;
	BOOL								fLatestTime;
	char								fDate[8];			// General Date, if not superseded by FileData.fDate
	long								fArgc;				// Changed, Number of FileData structures.
	char							  *pZipFN;				// Ptr to name of zip file.
	char							  *fTempPath;			//  b option
	char							  *fArchComment;		//  zcomment and zcomlen
	short int						fArchiveFilesOnly;//  when != 0 only zip when archive bit set
	short int						fResetArchiveBit;	//  when != 0 reset the archive bit after a successfull zip
	struct FileData			  *fFDS;					//  (Actually an array of FileData's)
	BOOL								fForceWin;			// 
	int								fTotExFileSpecs;	//  Number of ExcludedFileSpec structures.
	struct ExcludedFileSpec	  *fExFiles;	//  Array of file specs to exclude from zipping.
	BOOL								fUseOutStream; 	//  Use memory stream as output.
	void							  *fOutStream;	  		//  Pointer to the start of the output stream data.
	unsigned long					fOutStreamSize;	// Size of the Output data.
	BOOL								fUseInStream; 		// Use memory stream as input.
	void							  *fInStream;	  		// Pointer to the start of the input stream data.
	unsigned long					fInStreamSize;		// Size of the input data.
	DWORD								fStrFileAttr;		// File attributes of the file stream.
	DWORD								fStrFileDate;		// File date/time to set for the streamed file.
	BOOL								fHowToMove;			
	unsigned short					fWantedCodePage;	
	unsigned short					fNotUsed0;
	long								fNotUsed[ 4 ];
	int								fSeven;				// End of structure (eg. 7)
};
#pragma option -a.

typedef ZipParms *PZipParms;
//typedef int __stdcall (*GetZipExecAddress)(PZipParms);
//typedef int __stdcall (*GetZipVersionAddress1)(void) ;
//typedef int __stdcall (*GetZipVersionAddress2)(void) ;

//-- var, const, procedure ---------------------------------------------------

//extern GetZipExecAddress		ZipDllExec;
//extern GetZipVersionAddress1	GetZipDllVersion;
//extern GetZipVersionAddress2	GetZipDllPrivVersion;
//extern HINSTANCE					ZipDllHandle;

// 1.73 (2 August 2003 RA) added minver parameter in DoExec
class TZipDll : public TZipLibs::TZipLib
{
  public:
    TZipDll(TObject *owner) :TZipLib(owner, true){};
    int Exec(PZipParms info, int minver){return DoExec(info, minver);}
};


}	/* namespace ZipDLL */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
	using namespace ZipDLL;
#endif
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -