| 1 |
The code set out below is not intended to be compiled, but is only intended as |
| 2 |
a very simplistic pointer to how to load and call the dll. You will have to |
| 3 |
look in the files referenced below for actual, working code. |
| 4 |
|
| 5 |
There is one entry point that uses the structure shown below: |
| 6 |
|
| 7 |
typedef struct { |
| 8 |
LPSTR Date; /* Date to include after */ |
| 9 |
LPSTR szRootDir; /* Directory to use as base for zipping */ |
| 10 |
LPSTR szTempDir; /* Temporary directory used during zipping */ |
| 11 |
BOOL fTemp; /* Use temporary directory '-b' during zipping */ |
| 12 |
BOOL fSuffix; /* include suffixes (not implemented in WiZ) */ |
| 13 |
BOOL fEncrypt; /* encrypt files */ |
| 14 |
BOOL fSystem; /* include system and hidden files */ |
| 15 |
BOOL fVolume; /* Include volume label */ |
| 16 |
BOOL fExtra; /* Exclude extra attributes */ |
| 17 |
BOOL fNoDirEntries; /* Do not add directory entries */ |
| 18 |
BOOL fExcludeDate; /* Exclude files earlier than specified date */ |
| 19 |
BOOL fIncludeDate; /* Include only files earlier than specified date */ |
| 20 |
BOOL fVerbose; /* Mention oddities in zip file structure */ |
| 21 |
BOOL fQuiet; /* Quiet operation */ |
| 22 |
BOOL fCRLF_LF; /* Translate CR/LF to LF */ |
| 23 |
BOOL fLF_CRLF; /* Translate LF to CR/LF */ |
| 24 |
BOOL fJunkDir; /* Junk directory names */ |
| 25 |
BOOL fGrow; /* Allow appending to a zip file */ |
| 26 |
BOOL fForce; /* Make entries using DOS names (k for Katz) */ |
| 27 |
BOOL fMove; /* Delete files added or updated in zip file */ |
| 28 |
BOOL fDeleteEntries; /* Delete files from zip file */ |
| 29 |
BOOL fUpdate; /* Update zip file--overwrite only if newer */ |
| 30 |
BOOL fFreshen; /* Freshen zip file--overwrite only */ |
| 31 |
BOOL fJunkSFX; /* Junk SFX prefix */ |
| 32 |
BOOL fLatestTime; /* Set zip file time to time of latest file in it */ |
| 33 |
BOOL fComment; /* Put comment in zip file */ |
| 34 |
BOOL fOffsets; /* Update archive offsets for SFX files */ |
| 35 |
BOOL fPrivilege; /* Use privileges (WIN32 only) */ |
| 36 |
BOOL fEncryption; /* TRUE if encryption supported, else FALSE. |
| 37 |
this is a read-only flag */ |
| 38 |
LPSTR szSplitSize; /* This string contains the size that you want to |
| 39 |
split the archive into. i.e. 100 for 100 bytes, |
| 40 |
2K for 2 k bytes, where K is 1024, m for meg |
| 41 |
and g for gig. If this string is not NULL it |
| 42 |
will automatically be assumed that you wish to |
| 43 |
split an archive. */ |
| 44 |
LPSTR szIncludeList; /* Pointer to include file list string (for VB) */ |
| 45 |
long IncludeListCount; /* Count of file names in the include list array */ |
| 46 |
char **IncludeList; /* Pointer to include file list array. Note that the last |
| 47 |
entry in the array must be NULL */ |
| 48 |
LPSTR szExcludeList; /* Pointer to exclude file list (for VB) */ |
| 49 |
long ExcludeListCount; /* Count of file names in the include list array */ |
| 50 |
char **ExcludeList; /* Pointer to exclude file list array. Note that the last |
| 51 |
entry in the array must be NULL */ |
| 52 |
int fRecurse; /* Recurse into subdirectories. 1 => -r, 2 => -R */ |
| 53 |
int fRepair; /* Repair archive. 1 => -F, 2 => -FF */ |
| 54 |
char fLevel; /* Compression level (0 - 9) */ |
| 55 |
} ZPOPT, _far *LPZPOPT; |
| 56 |
|
| 57 |
The main entry point is ZpArchive(ZCL, *Opts) where the structure shown below |
| 58 |
is passed to the DLL when it is called. |
| 59 |
|
| 60 |
typedef struct { |
| 61 |
int argc; = Count of files to zip |
| 62 |
LPSTR lpszZipFN; = Archive file name |
| 63 |
char **FNV; = file names to zip up. Think of this an argv |
| 64 |
LPSTR lpszAltFNL; /* pointer to a string containing a list of file names to zip up, |
| 65 |
separated by whitespace. Intended for use only by VB users, all |
| 66 |
others should set this to NULL. */ |
| 67 |
} ZCL, _far *LPZCL; |
| 68 |
|
| 69 |
|
| 70 |
For examples of how the actual calls to the dll were set up in WiZ, look in |
| 71 |
the file makezip.c in the WiZ source directory. |
| 72 |
|
| 73 |
For examples of how the actual loading and unloading of the dll's themselves |
| 74 |
was done, look in wizmain.c in the WiZ source directory. Note that WiZ looks |
| 75 |
specifically for a particular version number of the dll, and also expects to |
| 76 |
find the company name to be Info-ZIP. This is to protect from getting different |
| 77 |
versions of the dll loaded, with resulting unknown behavior. |
| 78 |
|
| 79 |
There is a very simplistic example of how to load and call into the dll in |
| 80 |
example.c and example.h. Note that this example does not implement any |
| 81 |
command line switches at all, and is merely intended as a guide for those |
| 82 |
brave enough to enter a new world. |
| 83 |
|
| 84 |
There are three additional (at the moment) entry points: |
| 85 |
|
| 86 |
ZpInit, defined as |
| 87 |
|
| 88 |
int WINAPI ZpInit(ZIPUSERFUNCTIONS far * lpZipUserFunc); |
| 89 |
|
| 90 |
where ZIPUSERFUNCTIONS is defined as below. |
| 91 |
|
| 92 |
ZpVersion, defined as |
| 93 |
|
| 94 |
ZpVer * ZpVersion(void); |
| 95 |
|
| 96 |
where ZpVer is defined as: |
| 97 |
|
| 98 |
typedef struct _ZpVer { |
| 99 |
ulg structlen; /* length of the struct being passed */ |
| 100 |
ulg flag; /* bit 0: is_beta bit 1: uses_zlib */ |
| 101 |
char *betalevel; /* e.g., "g BETA" or "" */ |
| 102 |
char *date; /* e.g., "4 Sep 95" (beta) or "4 September 1995" */ |
| 103 |
char *zlib_version; /* e.g., "0.95" or NULL */ |
| 104 |
BOOL fEncryption; /* TRUE if encryption enabled, FALSE otherwise */ |
| 105 |
_zip_version_type zip; |
| 106 |
_zip_version_type os2dll; |
| 107 |
_zip_version_type windll; |
| 108 |
} ZpVer; |
| 109 |
|
| 110 |
See api.c for exactly what ZpVersion does, but the short version of |
| 111 |
what it does is return the zip and dll versions in the ZpVer structure. |
| 112 |
The structure typedef's are in api.h. It will also tell you if encryption |
| 113 |
is enabled. |
| 114 |
|
| 115 |
The typedef's for the function pointers in the structure ZIPUSERFUNCTIONS |
| 116 |
are shown immediately below. |
| 117 |
|
| 118 |
typedef int (WINAPI DLLPRNT) (LPSTR, unsigned long); |
| 119 |
typedef int (WINAPI DLLPASSWORD) (LPSTR, int, LPCSTR, LPCSTR); |
| 120 |
typedef int (WINAPI DLLSPLIT) (LPSTR); |
| 121 |
#ifdef ZIP64_SUPPORT |
| 122 |
typedef int (WINAPI DLLSERVICE) (LPCSTR, __int64); |
| 123 |
typedef int (WINAPI DLLSERVICE_NO_INT64) (LPCSTR, unsigned long, unsigned long); |
| 124 |
#else |
| 125 |
typedef int (WINAPI DLLSERVICE) (LPCSTR, unsigned long); |
| 126 |
#endif |
| 127 |
#endif |
| 128 |
typedef int (WINAPI DLLCOMMENT)(LPSTR); |
| 129 |
|
| 130 |
|
| 131 |
typedef struct { |
| 132 |
DLLPRNT *print; |
| 133 |
DLLCOMMENT *comment; |
| 134 |
DLLPASSWORD *password; |
| 135 |
DLLSPLIT *split; /* This MUST be set to NULL unless you want to be queried |
| 136 |
for a destination for each split archive. */ |
| 137 |
#ifdef ZIP64_SUPPORT |
| 138 |
DLLSERVICE *ServiceApplication64; |
| 139 |
DLLSERVICE_NO_INT64 *ServiceApplication64_No_Int64; |
| 140 |
#else |
| 141 |
DLLSERVICE *ServiceApplication; |
| 142 |
#endif |
| 143 |
} ZIPUSERFUNCTIONS, far * LPZIPUSERFUNCTIONS; |
| 144 |
|
| 145 |
Last revised April 26, 2004. |
| 146 |
|
| 147 |
Mike White |