home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 25 / nopv25.iso / 040A / DELZIP10.ZIP / VCL.ZIP / ZIPDLL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-04-07  |  5.4 KB  |  154 lines

  1. { ZIPDLL.PAS   - Delphi v2 translation of file "wizzip.h" by Eric W. Engler }
  2. { Import Unit for ZIPDLL - put this into the "uses" clause of any
  3.   other unit that wants to access the DLL. }
  4.  
  5. { Note: Don't use VC++ 4.2 to generate DLLs.  It's DLLEXPORT has a bug
  6.   that causes them to be cdecl instead of stdcall. Also, OCXs generated
  7.   with 4.2 can't fire Delphi events. }
  8.  
  9. unit ZIPDLL;
  10.  
  11. interface
  12.  
  13. uses Windows, ZCallBck;
  14.  
  15.  
  16. { This record is very critical.  Any changes in the order of items, the
  17.   size of items, or modifying the number of items, may have disasterous
  18.   results.  You have been warned! }
  19. Type ZipParms = packed record
  20.          Handle: THandle;
  21.          Caller: Pointer;    { "self" referance of the Delphi form }
  22.                      { This is passed back to us in the callback function
  23.                      so we can direct the info to the proper form instance
  24.                      - thanks to Dennis Passmore for this idea. }
  25.          Version: LongInt;   { version of DLL we expect to see }
  26.          ZCallbackFunc: ZFunctionPtrType;
  27.          fTraceEnabled: LongBool;
  28.  
  29.          {============== Begin Zip Flag section ============== }
  30.          fEncryptVerify: LongBool; { not used yet }
  31.          fSuffix: LongBool;   { not used yet }
  32.          fEncrypt: LongBool;  { not supported yet }
  33.  
  34.          { include system and hidden files }
  35.          fSystem: LongBool;
  36.  
  37.          { Include volume label }
  38.          fVolume: LongBool;
  39.  
  40.          { Include extra file attributes (read-only, unix timestamps, etc) }
  41.          fExtra: LongBool;
  42.  
  43.          { Do not add directory names to .ZIP archive }
  44.          { see also: fJunkDir }
  45.          fNoDirEntries: LongBool;
  46.  
  47.          { Only add files newer a specified date }
  48.          { See the "Date" array below if you set this to TRUE }
  49.          fDate: LongBool;
  50.  
  51.          { Give a little more information to the user via message boxes }
  52.          fVerboseEnabled: LongBool;
  53.  
  54.          { Quiet operation - the DLL won't issue any messages at all. }
  55.          { Delphi program MUST handle ALL errors via it's callback function. }
  56.          fQuiet: LongBool;
  57.  
  58.          { Compression level (0 - 9; 9=max, 0=none) }
  59.          { All of these levels are variations of deflate. }
  60.          { I strongly recommend you use one of 3 values here:
  61.               0 = no compression, just store file
  62.               3 = "fast" compression
  63.               9 = "best" compression }
  64.          fLevel: longint;
  65.  
  66.          { Try to compress files that appear to be already compressed
  67.            based on their extension: .zip, .arc, .gif, ... }
  68.          fComprSpecial: LongBool;
  69.  
  70.          { translate text file end-of-lines }
  71.          fCRLF_LF: LongBool;
  72.  
  73.          { junk the directory names }
  74.          { If true, this says not to save dirnames as separate entries, 
  75.            in addition to being save with filenames. }
  76.          { see also: fNoDirEntries }
  77.          fJunkDir: LongBool;
  78.  
  79.          { Recurse into subdirectories }
  80.          fRecurse: LongBool;
  81.  
  82.          { Allow appending to a zip file }
  83.          fGrow: LongBool;
  84.  
  85.          { Convert filenames to DOS 8x3 names - for compatibility
  86.            with PKUNZIP v2.04g, which doesn't understand long filenames }
  87.          fForce: LongBool;
  88.  
  89.          { Delete orig files that were added or updated in zip file }
  90.          { This is a variation of Add }
  91.          fMove: LongBool;
  92.  
  93.          { Delete specified files from zip file }
  94.          fDeleteEntries: LongBool;
  95.  
  96.          { Update zip -- if true, rezip changed, and add new files in fspec }
  97.          { This is a variation of Add }
  98.          fUpdate: LongBool;
  99.  
  100.          { Freshen zip -- if true, rezip all changed files in fspec }
  101.          { This is a variation of Add }
  102.          fFreshen: LongBool;
  103.  
  104.          { junk the SFX prefix on the self-extracing .EXE archives }
  105.          fJunkSFX: LongBool;
  106.  
  107.          { Set zip file time to time of newest file in it }
  108.          fLatestTime: LongBool;
  109.          {============== End Zip Flag section ============== }
  110.  
  111.          { Cutoff Date for Add-by-date; add files newer than this day }
  112.          { This is only used if the "fDate" option is TRUE }
  113.          { format = MMDDYY plus a trailing null }
  114.          Date: Array[0..7] of Char;
  115.  
  116.          { Count of files to add or delete - don't forget to set this! }
  117.          argc: LongInt;
  118.  
  119.          { ptr to name of zip file }
  120.          PZipFN: PChar;
  121.  
  122.          seven: LongInt; { pass a 7 here to validate struct size }
  123.  
  124.          { Array of filenames contained in the ZIP archive }
  125.          PFileNames: array[0..FilesMax] of PChar;
  126.       end;
  127.  
  128.  type
  129.    PZipParms = ^ZipParms;
  130.    PWord    = ^Word;
  131.    ZipOpt = (Add, Delete);
  132.    { NOTE: Freshen, Update, and Move are only variations of Add }
  133.    { The LIST function is being handled by the TZREADER Delphi VCL }
  134.  
  135. { The LIST function is being handled by the TZREADER Delphi VCL }
  136.  
  137. { Main call to execute a ZIP add or Delete.  This call returns the
  138.   number of files that were sucessfully operated on. }
  139. function DllZipUpFiles(ZipRec: PZipParms): DWORD; stdcall;
  140.  
  141. procedure GetDllVersion(VersionHi: PWord;
  142.                         VersionLo: PWord);
  143.                         stdcall;
  144. implementation
  145.  
  146. function DllZipUpFiles(ZipRec: PZipParms): DWORD;
  147.                        external 'ZIPDLL.DLL' index 2;
  148.  
  149. procedure GetDllVersion(VersionHi: PWord;
  150.                         VersionLo: PWord);
  151.                         external 'ZIPDLL.DLL' index 3;
  152.  
  153. end.
  154.