windll.txt 6.4 KB

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