home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / zip22.zip / windll / windll.txt < prev    next >
Text File  |  1997-10-15  |  6KB  |  152 lines

  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. This code, as I understand it, is not callable from Visual Basic. This is due
  6. to a limitation on Visual Basic's part in that it cannot deal with pointers to
  7. functions, nor can it deal with pointers to structures very well. I know almost
  8. nothing about Visual Basic, and at this point, have little or no interest in
  9. learning much about it.
  10.  
  11. There are two entry points that use the structure shown below:
  12.  
  13. BOOL WINAPI ZpSetOptions(ZPOPT) and
  14. ZPOPT WINAPI ZpGetOptions(void)
  15.  
  16. typedef struct {
  17. BOOL fSuffix            = Currently not used by WiZ
  18. BOOL fEncrypt;          = encrypt file
  19. BOOL fSystem;           = include system and hidden files
  20. BOOL fVolume;           = Include volume label
  21. BOOL fExtra;            = Exclude extra attributes
  22. BOOL fNoDirEntries;     = Do not add directory entries
  23. BOOL fDate;             = Exclude files earlier than specified date
  24. BOOL fVerbose;          = Mention oddities in zip file structure
  25. BOOL fQuiet;            = Quiet operation
  26. BOOL fCRLF_LF;          = Translate CR/LF to LF
  27. BOOL fLF_CRLF;          = Translate LF to CR/LF
  28. BOOL fJunkDir;          = Junk directory names
  29. BOOL fRecurse;          = Recurse into subdirectories
  30. BOOL fGrow;             = Allow appending to a zip file
  31. BOOL fForce;            = Make entries using DOS names (k for Katz)
  32. BOOL fMove;             = Delete files added or updated in zip file
  33. BOOL fDeleteEntries;    = Delete files from zip file
  34. BOOL fUpdate;           = Update zip file--overwrite only if newer
  35. BOOL fFreshen;          = Freshen zip file--overwrite only
  36. BOOL fJunkSFX;          = Junk SFX prefix
  37. BOOL fLatestTime;       = Set zip file time to time of latest file in it
  38. BOOL fComment;          = Put comment in zip file
  39. BOOL fOffsets;          = Update archive offsets for SFX files
  40. BOOL fPrivilege;        = Save privileges
  41. BOOL fEncryption        = read only option, true if encryption supported,
  42.                           false otherwise.
  43. int fRepair;            = 1 => fix archive, 2 => try harder to fix
  44. char fLevel;            = Compression level (0 - 9)
  45. char Date[7];           = Date to include files after
  46. char szRootDir[256];    = Directory to use as base for zipping
  47. } ZPOPT, _far *LPZPOPT
  48.  
  49. BOOL WINAPI ZpSetOptions(ZPOPT)
  50.  
  51. This call will simply set the options in the zip dll until such time as
  52. another call to this function is made. This must be made before the initial
  53. call to make or update an archive.
  54.  
  55. ZPOPT WINAPI ZpGetOptions(void)
  56.  
  57. The call will return the above structure from the dll, with the fEncryption
  58. flag set to the appropriate value based on whether encryption is supported
  59. in this dll or not. It is currently used in WiZ only to determine if
  60. encryption is actually supported.
  61.  
  62. The main entry point is ZpArchive(ZCL C) where the structure shown below
  63. is passed to the DLL when it is called.
  64.  
  65. typedef struct {
  66. int  argc;              = Count of files to zip
  67. LPSTR lpszZipFN;        = Archive file name
  68. char **FNV;             = file names to zip up. Think of this an argv
  69. } ZCL, _far *LPZCL;
  70.  
  71.  
  72. For examples of how the actual calls to the dll were set up in WiZ, look in
  73. the file makezip.c in the WiZ source directory.
  74.  
  75. For examples of how the actual loading and unloading of the dll's themselves
  76. was done, look in wizmain.c in the WiZ source directory. Note that WiZ looks
  77. specifically for a particular version number of the dll, and also expects to
  78. find the company name to be Info-ZIP. This is to protect from getting different
  79. versions of the dll loaded, with resulting unknown behavior.
  80.  
  81. There is a very simplistic example of how to load and call into the dll in
  82. example.c and example.h. Note that this example does not implement any
  83. command line switches at all, and is merely intended as a guide for those
  84. brave enough to enter a new world.
  85.  
  86. There are four additional (at the moment) entry points:
  87.  
  88. ZpInit, defined as
  89.  
  90. int WINAPI ZpInit(ZIPUSERFUNCTIONS far * lpZipUserFunc);
  91.  
  92. where ZIPUSERFUNCTIONS is defined as below.
  93.  
  94. ZpInitVB, defined as
  95. int WINAPI ZpInitVB(ZIPUSERFUNCTIONS_VB)
  96.  
  97. where ZIPUSERFUNCTIONS_VB is defined as:
  98.  
  99. typedef struct {
  100. HINSTANCE hInstance;
  101. char print[80];
  102. char comment[80];
  103. char password[80];
  104. } ZIPUSERFUNCTIONS_VB, far *LPZIPUSERFUNCTIONS_VB;
  105.  
  106. ZpInitVB is designed to be used only by Visual Basic users, as it is my
  107. understanding that VB doesn't talk pointers to functions. Hence what is
  108. required here is to pass in the exact name of the functions for printing,
  109. passwords and handling comments. These functions must also be exported by
  110. the VB application. NOTE that this function has been tested under 'C', but
  111. has not with VB. I have no idea if this will truly work.
  112.  
  113. ZpVersion, defined as
  114.  
  115. ZpVer * ZpVersion(void);
  116.  
  117. where ZpVer is defined as:
  118.  
  119. typedef struct _ZpVer {
  120.     ulg structlen;          /* length of the struct being passed */
  121.     ulg flag;               /* bit 0: is_beta   bit 1: uses_zlib */
  122.     char *betalevel;        /* e.g., "g BETA" or "" */
  123.     char *date;             /* e.g., "4 Sep 95" (beta) or "4 September 1995" */
  124.     char *zlib_version;     /* e.g., "0.95" or NULL */
  125.     _zip_version_type zip;
  126.     _zip_version_type os2dll;
  127.     _zip_version_type windll;
  128. } ZpVer;
  129.  
  130. See api.c for exactly what ZpVersion does, but the short version of
  131. what it does is return the unzip and dll versions in the ZpVer structure.
  132. The structure typedef's are in api.h
  133.  
  134. The typedef's for the function pointers in the structure ZIPUSERFUNCTIONS
  135. are shown immediately below.
  136.  
  137. typedef int (far *DLLPRNT) (FILE *, unsigned int, char *);
  138. typedef int (WINAPI DLLPASSWORD) (char *, char *, int, char *);
  139. typedef char far * (far *DLLCOMMENT) (LPSTR);
  140.  
  141. typedef struct {
  142. DLLPRNT *print;          = pointer to application's print function.
  143. DLLPASSWORD *password;   = pointer to application's function for processing
  144.                            passwords. Called from ttyio.c
  145. DLLCOMMENT *comment;     = pointer to application's function for processing
  146.                            comments.
  147. } ZIPUSERFUNCTIONS, far * LPZIPUSERFUNCTIONS;
  148.  
  149. Last revised June 3, 1997.
  150.  
  151. Mike White
  152.