diff options
author | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-07-20 19:30:57 +0100 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-07-20 19:30:57 +0100 |
commit | 04664087ad66f5614f82a2cfba3ae4eda15e792b (patch) | |
tree | 332090b15fd2db1b93abf40dccf06211d9aba297 /windll | |
download | zip-04664087ad66f5614f82a2cfba3ae4eda15e792b.tar.gz |
Tarball conversion
Diffstat (limited to 'windll')
-rw-r--r-- | windll/VBz64/VBZIP.VBP | 33 | ||||
-rw-r--r-- | windll/VBz64/VBZIP.vbw | 2 | ||||
-rw-r--r-- | windll/VBz64/VBZipBas.bas | 737 | ||||
-rw-r--r-- | windll/VBz64/Vbzipfrm.frm | 183 | ||||
-rw-r--r-- | windll/VBz64/readVB64.txt | 25 | ||||
-rw-r--r-- | windll/Vb/VBZIP.vbw | 2 | ||||
-rw-r--r-- | windll/Vb/VBZipBas.bas | 458 | ||||
-rw-r--r-- | windll/Vb/Vbzip.vbp | 34 | ||||
-rw-r--r-- | windll/Vb/Vbzipfrm.frm | 130 | ||||
-rw-r--r-- | windll/Vb/readmeVB.txt | 34 | ||||
-rw-r--r-- | windll/contents | 42 | ||||
-rw-r--r-- | windll/example.c | 375 | ||||
-rw-r--r-- | windll/example.h | 54 | ||||
-rw-r--r-- | windll/structs.h | 30 | ||||
-rw-r--r-- | windll/visualc/dll/zip32z64.dsp | 168 | ||||
-rw-r--r-- | windll/visualc/dll/zip32z64.dsw | 29 | ||||
-rw-r--r-- | windll/visualc/lib/zip32z64.dsp | 158 | ||||
-rw-r--r-- | windll/visualc/lib/zip32z64.dsw | 29 | ||||
-rw-r--r-- | windll/windll.aps | bin | 0 -> 1652 bytes | |||
-rw-r--r-- | windll/windll.c | 176 | ||||
-rw-r--r-- | windll/windll.h | 63 | ||||
-rw-r--r-- | windll/windll.rc | 57 | ||||
-rw-r--r-- | windll/windll.txt | 147 | ||||
-rw-r--r-- | windll/windll16.def | 15 | ||||
-rw-r--r-- | windll/windll32.def | 14 | ||||
-rw-r--r-- | windll/ziplib.def | 15 |
26 files changed, 3010 insertions, 0 deletions
diff --git a/windll/VBz64/VBZIP.VBP b/windll/VBz64/VBZIP.VBP new file mode 100644 index 0000000..4161be5 --- /dev/null +++ b/windll/VBz64/VBZIP.VBP @@ -0,0 +1,33 @@ +Type=Exe
+Form=Vbzipfrm.frm
+Module=VBZipBas; VBZipBas.bas
+IconForm="Form1"
+Startup="Form1"
+HelpFile=""
+Title="VBZIP"
+ExeName32="VBZIP.exe"
+Command32=""
+Name="Project1"
+HelpContextID="0"
+CompatibleMode="0"
+MajorVer=1
+MinorVer=0
+RevisionVer=0
+AutoIncrementVer=0
+ServerSupportFiles=0
+VersionCompanyName="Mike"
+CompilationType=-1
+OptimizationType=0
+FavorPentiumPro(tm)=0
+CodeViewDebugInfo=0
+NoAliasing=0
+BoundsCheck=0
+OverflowCheck=0
+FlPointCheck=0
+FDIVCheck=0
+UnroundedFP=0
+StartMode=0
+Unattended=0
+Retained=0
+ThreadPerObject=0
+MaxNumberOfThreads=1
diff --git a/windll/VBz64/VBZIP.vbw b/windll/VBz64/VBZIP.vbw new file mode 100644 index 0000000..7b4e7f5 --- /dev/null +++ b/windll/VBz64/VBZIP.vbw @@ -0,0 +1,2 @@ +Form1 = 7, 9, 712, 539, , 22, 22, 660, 466, C
+VBZipBas = 26, -4, 716, 492,
diff --git a/windll/VBz64/VBZipBas.bas b/windll/VBz64/VBZipBas.bas new file mode 100644 index 0000000..99547a0 --- /dev/null +++ b/windll/VBz64/VBZipBas.bas @@ -0,0 +1,737 @@ +Attribute VB_Name = "VBZipBas" + +Option Explicit + +'--------------------------------------------------------------- +'-- Please Do Not Remove These Comments!!! +'--------------------------------------------------------------- +'-- Sample VB 6 code to drive zip32z64.dll +'-- Based on the code contributed to the Info-ZIP project +'-- by Mike Le Voi +'-- +'-- See the original VB example in a separate directory for +'-- more information +'-- +'-- Use this code at your own risk. Nothing implied or warranted +'-- to work on your machine :-) +'--------------------------------------------------------------- +'-- +'-- The Source Code Is Freely Available From Info-ZIP At: +'-- ftp://ftp.info-zip.org/pub/infozip/infozip.html +'-- +'-- A Very Special Thanks To Mr. Mike Le Voi +'-- And Mr. Mike White Of The Info-ZIP +'-- For Letting Me Use And Modify His Orginal +'-- Visual Basic 5.0 Code! Thank You Mike Le Voi. +'--------------------------------------------------------------- + +'--------------------------------------------------------------- +' This example is redesigned to work with Zip32z64.dll compiled from +' Zip 3.0 with Zip64 enabled. This allows for archives with more +' and larger files than allowed in previous versions. +' +' Modified 4/24/2004, 12/4/2007 by Ed Gordon +'--------------------------------------------------------------- + +'--------------------------------------------------------------- +' Usage notes: +' +' This code uses Zip32z64.dll. You DO NOT need to register the +' DLL to use it. You also DO NOT need to reference it in your +' VB project. You DO have to copy the DLL to your SYSTEM +' directory, your VB project directory, or place it in a directory +' on your command PATH. +' +' Note that Zip32z64 is probably not thread safe so you should avoid +' using the dll in multiple threads at the same time without first +' testing for interaction. +' +' All code provided under the Info-Zip license. If you have +' any questions please contact Info-Zip. +' +' April 24 2004 EG +' +'--------------------------------------------------------------- + +'-- C Style argv +'-- Holds The Zip Archive Filenames +' +' Max for zFiles just over 8000 as each pointer takes up 4 bytes and +' VB only allows 32 kB of local variables and that includes function +' parameters. - 3/19/2004 EG +' +' Can put names in strZipFileNames instead of using this array, +' which avoids this limit. File names are separated by spaces. +' Enclose names in quotes if include spaces. +Public Type ZIPnames + zFiles(1 To 100) As String +End Type + +'-- Call Back "String" +Public Type ZipCBChar + ch(4096) As Byte +End Type + +'-- Version Structure +Public Type VerType + Major As Byte + Minor As Byte + PatchLevel As Byte + NotUsed As Byte +End Type +Public Type ZipVerType + structlen As Long ' Length Of The Structure Being Passed + flag As Long ' Bit 0: is_beta bit 1: uses_zlib + Beta As String * 10 ' e.g., "g BETA" or "" + date As String * 20 ' e.g., "4 Sep 95" (beta) or "4 September 1995" + ZLIB As String * 10 ' e.g., "1.0.5" or NULL + encryption As Long ' 0 if encryption not available + ZipVersion As VerType + os2dllVersion As VerType + windllVersion As VerType +End Type + +'-- ZPOPT Is Used To Set The Options In The ZIP32z64.DLL +Public Type ZpOpt + date As String ' Date in either US 12/31/98 or 1998-12-31 format + szRootDir As String ' Root Directory Pathname (Up To 256 Bytes Long) + szTempDir As String ' Temp Directory Pathname (Up To 256 Bytes Long) + fTemp As Long ' 1 If Temp dir Wanted, Else 0 + fSuffix As Long ' Include Suffixes (Not Yet Implemented!) + fEncrypt As Long ' 1 If Encryption Wanted, Else 0 + fSystem As Long ' 1 To Include System/Hidden Files, Else 0 + fVolume As Long ' 1 If Storing Volume Label, Else 0 + fExtra As Long ' 1 If Excluding Extra Attributes, Else 0 + fNoDirEntries As Long ' 1 If Ignoring Directory Entries (end with /), Else 0 + fExcludeDate As Long ' 1 If Excluding Files After Specified Date, Else 0 + fIncludeDate As Long ' 1 If Including Files After Specified Date, Else 0 + fVerbose As Long ' 1 If Full Messages Wanted, Else 0 + fQuiet As Long ' 1 If Minimum Messages Wanted, Else 0 + fCRLF_LF As Long ' 1 If Translate CR/LF To LF, Else 0 + fLF_CRLF As Long ' 1 If Translate LF To CR/LF, Else 0 + fJunkDir As Long ' 1 If Junking Directory Names on entries, Else 0 + fGrow As Long ' 1 If Allow Appending To Zip File, Else 0 + fForce As Long ' 1 If Making Entries Using DOS File Names, Else 0 + fMove As Long ' 1 If Deleting Files Added Or Updated, Else 0 + fDeleteEntries As Long ' 1 If Files Passed Have To Be Deleted, Else 0 + fUpdate As Long ' 1 If Updating Zip File-Overwrite Only If Newer, Else 0 + fFreshen As Long ' 1 If Freshing Zip File-Overwrite Only, Else 0 + fJunkSFX As Long ' 1 If Junking SFX Prefix, Else 0 + fLatestTime As Long ' 1 If Setting Zip File Time To Time Of Latest File In Archive, Else 0 + fComment As Long ' 1 If Putting Comment In Zip File, Else 0 + fOffsets As Long ' 1 If Updating Archive Offsets For SFX Files, Else 0 + fPrivilege As Long ' 1 If Not Saving Privileges, Else 0 + fEncryption As Long ' Read Only Property!!! + szSplitSize As String ' Size of split if splitting, Else NULL (empty string) + ' This string contains the size that you want to + ' split the archive into. i.e. 100 for 100 bytes, + ' 2K for 2 k bytes, where K is 1024, m for meg + ' and g for gig. + szIncludeList As String ' If used, space separated list of Include filename + ' patterns where match includes file - put quotes + ' around each filename pattern. + IncludeListCount As Long ' place filler (not for VB) - (inits to 0) DO NOT USE + IncludeList As Long ' place filler (not for VB) - (inits to 0) DO NOT USE + szExcludeList As String ' If used, space separated list of Exclude filename + ' patterns where match excludes file - put quotes + ' around each filename pattern. + ExcludeListCount As Long ' place filler (not for VB) - (inits to 0) DO NOT USE + ExcludeList As Long ' place filler (not for VB) - (inits to 0) DO NOT USE + fRecurse As Long ' 1 (-r), 2 (-R) If Recursing Into Sub-Directories, Else 0 + fRepair As Long ' 1 = Fix Archive, 2 = Try Harder To Fix, Else 0 + flevel As Byte ' Compression Level - 0 = Stored 6 = Default 9 = Max +End Type + + +' Used by SetZipOptions +Public Enum ZipModeType + Add = 0 + Delete = 1 + Update = 2 + Freshen = 3 +End Enum +Public Enum CompressionLevelType + c0_NoCompression = 0 + c1_Fast = 1 + c2_Fast = 2 + c3_Fast = 3 + c4_Med = 4 + c5_Med = 5 + c6_Default = 6 + c7_Extra = 7 + c8_Extra = 8 + c9_Max = 9 +End Enum +Public Enum Translate_LF_Type + No_Line_End_Trans = 0 + LF_To_CRLF = 1 + CRLF_To_LF = 2 +End Enum +Public Enum RepairType + NoRepair = 0 + TryFix = 1 + TryFixHarder = 2 +End Enum +Public Enum VerbosenessType + Quiet = 0 + Normal = 1 + Verbose = 2 +End Enum +Public Enum RecurseType + NoRecurse = 0 + r_RecurseIntoSubdirectories = 1 + R_RecurseUsingPatterns = 2 +End Enum + + +'-- This Structure Is Used For The ZIP32z64.DLL Function Callbacks +' Assumes Zip32z64.dll with Zip64 enabled +Public Type ZIPUSERFUNCTIONS + ZDLLPrnt As Long ' Callback ZIP32z64.DLL Print Function + ZDLLCOMMENT As Long ' Callback ZIP32z64.DLL Comment Function + ZDLLPASSWORD As Long ' Callback ZIP32z64.DLL Password Function + ZDLLSPLIT As Long ' Callback ZIP32z64.DLL Split Select Function + ' There are 2 versions of SERVICE, we use one does not need 64-bit data type + ZDLLSERVICE As Long ' Callback ZIP32z64.DLL Service Function + ZDLLSERVICE_NO_INT64 As Long ' Callback ZIP32z64.DLL Service Function +End Type + +'-- Default encryption password (used in callback if not empty string) +Public EncryptionPassword As String + +'-- For setting the archive comment +Public ArchiveCommentText + +'-- version info +Public ZipVersion As ZipVerType + +'-- Local Declarations +Public ZOPT As ZpOpt +Public ZUSER As ZIPUSERFUNCTIONS + +'-- This Assumes ZIP32z64.DLL Is In Your \windows\system directory +'-- or a copy is in the program directory or in some other directory +'-- listed in PATH +Private Declare Function ZpInit Lib "zip32z64.dll" _ + (ByRef Zipfun As ZIPUSERFUNCTIONS) As Long '-- Set Zip Callbacks + +Private Declare Function ZpArchive Lib "zip32z64.dll" _ + (ByVal argc As Long, ByVal funame As String, _ + ByRef argv As ZIPnames, ByVal strNames As String, ByRef Opts As ZpOpt) As Long '-- Real Zipping Action + +Private Declare Sub ZpVersion Lib "zip32z64.dll" _ + (ByRef ZipVersion As ZipVerType) '-- Version of DLL + + +'------------------------------------------------------- +'-- Public Variables For Setting The ZPOPT Structure... +'-- (WARNING!!!) You Must Set The Options That You +'-- Want The ZIP32.DLL To Do! +'-- Before Calling VBZip32! +'-- +'-- NOTE: See The Above ZPOPT Structure Or The VBZip32 +'-- Function, For The Meaning Of These Variables +'-- And How To Use And Set Them!!! +'-- These Parameters Must Be Set Before The Actual Call +'-- To The VBZip32 Function! +'------------------------------------------------------- + +'-- Public Program Variables +Public zArgc As Integer ' Number Of Files To Zip Up +Public zZipArchiveName As String ' The Zip File Name ie: Myzip.zip +Public zZipFileNames As ZIPnames ' File Names To Zip Up +Public strZipFileNames As String ' String of names to Zip Up +Public zZipInfo As String ' Holds The Zip File Information + +'-- Public Constants +'-- For Zip & UnZip Error Codes! +Public Const ZE_OK = 0 ' Success (No Error) +Public Const ZE_EOF = 2 ' Unexpected End Of Zip File Error +Public Const ZE_FORM = 3 ' Zip File Structure Error +Public Const ZE_MEM = 4 ' Out Of Memory Error +Public Const ZE_LOGIC = 5 ' Internal Logic Error +Public Const ZE_BIG = 6 ' Entry Too Large To Split Error +Public Const ZE_NOTE = 7 ' Invalid Comment Format Error +Public Const ZE_TEST = 8 ' Zip Test (-T) Failed Or Out Of Memory Error +Public Const ZE_ABORT = 9 ' User Interrupted Or Termination Error +Public Const ZE_TEMP = 10 ' Error Using A Temp File +Public Const ZE_READ = 11 ' Read Or Seek Error +Public Const ZE_NONE = 12 ' Nothing To Do Error +Public Const ZE_NAME = 13 ' Missing Or Empty Zip File Error +Public Const ZE_WRITE = 14 ' Error Writing To A File +Public Const ZE_CREAT = 15 ' Could't Open To Write Error +Public Const ZE_PARMS = 16 ' Bad Command Line Argument Error +Public Const ZE_OPEN = 18 ' Could Not Open A Specified File To Read Error + +'-- These Functions Are For The ZIP32z64.DLL +'-- +'-- Puts A Function Pointer In A Structure +'-- For Use With Callbacks... +Public Function FnPtr(ByVal lp As Long) As Long + + FnPtr = lp + +End Function + +'-- Callback For ZIP32z64.DLL - DLL Print Function +Public Function ZDLLPrnt(ByRef fname As ZipCBChar, ByVal x As Long) As Long + + Dim s0 As String + Dim xx As Long + + '-- Always Put This In Callback Routines! + On Error Resume Next + + s0 = "" + + '-- Get Zip32.DLL Message For processing + For xx = 0 To x + If fname.ch(xx) = 0 Then + Exit For + Else + s0 = s0 + Chr(fname.ch(xx)) + End If + Next + + '---------------------------------------------- + '-- This Is Where The DLL Passes Back Messages + '-- To You! You Can Change The Message Printing + '-- Below Here! + '---------------------------------------------- + + '-- Display Zip File Information + '-- zZipInfo = zZipInfo & s0 + Form1.Print s0; + + DoEvents + + ZDLLPrnt = 0 + +End Function + +'-- Callback For ZIP32z64.DLL - DLL Service Function +Public Function ZDLLServ(ByRef mname As ZipCBChar, _ + ByVal LowSize As Long, _ + ByVal HighSize As Long) As Long + + Dim s0 As String + Dim xx As Long + Dim FS As Currency ' for large file sizes + + '-- Always Put This In Callback Routines! + On Error Resume Next + + FS = (HighSize * &H10000 * &H10000) + LowSize + ' Form1.Print "ZDLLServ returned File Size High " & HighSize & _ + ' " Low " & LowSize & " = " & FS & " bytes" + + s0 = "" + '-- Get Zip32.DLL Message For processing + For xx = 0 To 4096 ' x + If mname.ch(xx) = 0 Then + Exit For + Else + s0 = s0 + Chr(mname.ch(xx)) + End If + Next + ' At this point, s0 contains the message passed from the DLL + ' It is up to the developer to code something useful here :) + ZDLLServ = 0 ' Setting this to 1 will abort the zip! + +End Function + +'-- Callback For ZIP32z64.DLL - DLL Password Function +Public Function ZDLLPass(ByRef p As ZipCBChar, _ + ByVal n As Long, ByRef m As ZipCBChar, _ + ByRef Name As ZipCBChar) As Integer + + Dim filename As String + Dim prompt As String + Dim xx As Integer + Dim szpassword As String + + '-- Always Put This In Callback Routines! + On Error Resume Next + + ZDLLPass = 1 + + '-- User Entered A Password So Proccess It + + '-- Enter or Verify + For xx = 0 To 255 + If m.ch(xx) = 0 Then + Exit For + Else + prompt = prompt & Chr(m.ch(xx)) + End If + Next + + '-- If There Is A Password Have The User Enter It! + '-- This Can Be Changed + + '-- Now skip asking if default password set + If EncryptionPassword <> "" Then + szpassword = EncryptionPassword + Else + szpassword = InputBox("Please Enter The Password!", prompt) + End If + + '-- The User Did Not Enter A Password So Exit The Function + If szpassword = "" Then Exit Function + + For xx = 0 To n - 1 + p.ch(xx) = 0 + Next + + For xx = 0 To Len(szpassword) - 1 + p.ch(xx) = Asc(Mid(szpassword, xx + 1, 1)) + Next + + p.ch(xx) = Chr(0) ' Put Null Terminator For C + + ZDLLPass = 0 + +End Function + +'-- Callback For ZIP32z64.DLL - DLL Comment Function +Public Function ZDLLComm(ByRef s1 As ZipCBChar) As Integer + + Dim comment As String + Dim xx%, szcomment$ + + '-- Always Put This In Callback Routines! + On Error Resume Next + + ZDLLComm = 1 + If Not IsEmpty(ArchiveCommentText) Then + ' use text given to SetZipOptions + szcomment = ArchiveCommentText + Else + For xx = 0 To 4095 + szcomment = szcomment & Chr(s1.ch(xx)) + If s1.ch(xx) = 0 Then + Exit For + End If + Next + comment = InputBox("Enter or edit the comment", Default:=szcomment) + If comment = "" Then + ' either empty comment or Cancel button + If MsgBox("Remove comment?" & Chr(13) & "Hit No to keep existing comment", vbYesNo) = vbYes Then + szcomment = comment + Else + Exit Function + End If + End If + szcomment = comment + End If + 'If szcomment = "" Then Exit Function + For xx = 0 To Len(szcomment) - 1 + s1.ch(xx) = Asc(Mid$(szcomment, xx + 1, 1)) + Next xx + s1.ch(xx) = 0 ' Put null terminator for C + +End Function + +' This function can be used to set options in VB +Public Function SetZipOptions(ByRef ZipOpts As ZpOpt, _ + Optional ByVal ZipMode As ZipModeType = Add, _ + Optional ByVal RootDirToZipFrom As String = "", _ + Optional ByVal CompressionLevel As CompressionLevelType = c6_Default, _ + Optional ByVal RecurseSubdirectories As RecurseType = NoRecurse, _ + Optional ByVal Verboseness As VerbosenessType = Normal, _ + Optional ByVal i_IncludeFiles As String = "", _ + Optional ByVal x_ExcludeFiles As String = "", _ + Optional ByVal UpdateSFXOffsets As Boolean = False, Optional ByVal JunkDirNames As Boolean = False, _ + Optional ByVal Encrypt As Boolean = False, Optional ByVal Password As String = "", _ + Optional ByVal Repair As RepairType = NoRepair, Optional ByVal NoDirEntries As Boolean = False, _ + Optional ByVal GrowExistingArchive As Boolean = False, _ + Optional ByVal JunkSFXPrefix As Boolean = False, Optional ByVal ForceUseOfDOSNames As Boolean = False, _ + Optional ByVal Translate_LF As Translate_LF_Type = No_Line_End_Trans, _ + Optional ByVal Move_DeleteAfterAddedOrUpdated As Boolean = False, _ + Optional ByVal SetZipTimeToLatestTime As Boolean = False, _ + Optional ByVal IncludeSystemAndHiddenFiles As Boolean = False, _ + Optional ByVal ExcludeEarlierThanDate As String = "", _ + Optional ByVal IncludeEarlierThanDate As String = "", _ + Optional ByVal IncludeVolumeLabel As Boolean = False, _ + Optional ByVal ArchiveComment As Boolean = False, _ + Optional ByVal ArchiveCommentTextString = Empty, _ + Optional ByVal UsePrivileges As Boolean = False, _ + Optional ByVal ExcludeExtraAttributes As Boolean = False, Optional ByVal SplitSize As String = "", _ + Optional ByVal TempDirPath As String = "") As Boolean + + Dim SplitNum As Long + Dim SplitMultS As String + Dim SplitMult As Long + + ' set some defaults + ZipOpts.date = vbNullString + ZipOpts.szRootDir = vbNullString + ZipOpts.szTempDir = vbNullString + ZipOpts.fTemp = 0 + ZipOpts.fSuffix = 0 + ZipOpts.fEncrypt = 0 + ZipOpts.fSystem = 0 + ZipOpts.fVolume = 0 + ZipOpts.fExtra = 0 + ZipOpts.fNoDirEntries = 0 + ZipOpts.fExcludeDate = 0 + ZipOpts.fIncludeDate = 0 + ZipOpts.fVerbose = 0 + ZipOpts.fQuiet = 0 + ZipOpts.fCRLF_LF = 0 + ZipOpts.fLF_CRLF = 0 + ZipOpts.fJunkDir = 0 + ZipOpts.fGrow = 0 + ZipOpts.fForce = 0 + ZipOpts.fMove = 0 + ZipOpts.fDeleteEntries = 0 + ZipOpts.fUpdate = 0 + ZipOpts.fFreshen = 0 + ZipOpts.fJunkSFX = 0 + ZipOpts.fLatestTime = 0 + ZipOpts.fComment = 0 + ZipOpts.fOffsets = 0 + ZipOpts.fPrivilege = 0 + ZipOpts.szSplitSize = vbNullString + ZipOpts.IncludeListCount = 0 + ZipOpts.szIncludeList = vbNullString + ZipOpts.ExcludeListCount = 0 + ZipOpts.szExcludeList = vbNullString + ZipOpts.fRecurse = 0 + ZipOpts.fRepair = 0 + ZipOpts.flevel = 0 + + If RootDirToZipFrom <> "" Then + ZipOpts.szRootDir = RootDirToZipFrom + End If + ZipOpts.flevel = Asc(CompressionLevel) + If UpdateSFXOffsets Then ZipOpts.fOffsets = 1 + + If i_IncludeFiles <> "" Then + ZipOpts.szIncludeList = i_IncludeFiles + End If + If x_ExcludeFiles <> "" Then + ZipOpts.szExcludeList = x_ExcludeFiles + End If + + If ZipMode = Add Then + ' default + ElseIf ZipMode = Delete Then + ZipOpts.fDeleteEntries = 1 + ElseIf ZipMode = Update Then + ZipOpts.fUpdate = 1 + Else + ZipOpts.fFreshen = 1 + End If + ZipOpts.fRepair = Repair + If GrowExistingArchive Then ZipOpts.fGrow = 1 + If Move_DeleteAfterAddedOrUpdated Then ZipOpts.fMove = 1 + + If Verboseness = Quiet Then + ZipOpts.fQuiet = 1 + ElseIf Verboseness = Verbose Then + ZipOpts.fVerbose = 1 + End If + + If ArchiveComment = False And Not IsEmpty(ArchiveCommentTextString) Then + MsgBox "Must set ArchiveComment = True to set ArchiveCommentTextString" + Exit Function + End If + If IsEmpty(ArchiveCommentTextString) Then + ArchiveCommentText = Empty + Else + ArchiveCommentText = ArchiveCommentTextString + End If + If ArchiveComment Then ZipOpts.fComment = 1 + + If NoDirEntries Then ZipOpts.fNoDirEntries = 1 + If JunkDirNames Then ZipOpts.fJunkDir = 1 + If Encrypt Then ZipOpts.fEncrypt = 1 + EncryptionPassword = Password + If JunkSFXPrefix Then ZipOpts.fJunkSFX = 1 + If ForceUseOfDOSNames Then ZipOpts.fForce = 1 + If Translate_LF = LF_To_CRLF Then ZipOpts.fLF_CRLF = 1 + If Translate_LF = CRLF_To_LF Then ZipOpts.fCRLF_LF = 1 + ZipOpts.fRecurse = RecurseSubdirectories + If IncludeSystemAndHiddenFiles Then ZipOpts.fSystem = 1 + + If SetZipTimeToLatestTime Then ZipOpts.fLatestTime = 1 + If ExcludeEarlierThanDate <> "" And IncludeEarlierThanDate <> "" Then + MsgBox "Both ExcludeEarlierThanDate and IncludeEarlierThanDate not " & Chr(10) & _ + "supported at same time" + Exit Function + End If + If ExcludeEarlierThanDate <> "" Then + ZipOpts.fIncludeDate = 1 + ZipOpts.date = ExcludeEarlierThanDate + End If + If IncludeEarlierThanDate <> "" Then + ZipOpts.fExcludeDate = 1 + ZipOpts.date = IncludeEarlierThanDate + End If + + If TempDirPath <> "" Then + ZipOpts.szTempDir = TempDirPath + ZipOpts.fTemp = 1 + End If + + If SplitSize <> "" Then + SplitSize = Trim(SplitSize) + SplitMultS = Right(SplitSize, 1) + SplitMultS = UCase(SplitMultS) + If (SplitMultS = "K") Then + SplitMult = 1024 + SplitNum = Val(Left(SplitSize, Len(SplitSize) - 1)) + ElseIf SplitMultS = "M" Then + SplitMult = 1024 * 1024& + SplitNum = Val(Left(SplitSize, Len(SplitSize) - 1)) + ElseIf SplitMultS = "G" Then + SplitMult = 1024 * 1024 * 1024& + SplitNum = Val(Left(SplitSize, Len(SplitSize) - 1)) + Else + SplitMult = 1024 * 1024& + SplitNum = Val(SplitSize) + End If + SplitNum = SplitNum * SplitMult + If SplitNum = 0 Then + MsgBox "SplitSize of 0 not supported" + Exit Function + ElseIf SplitNum < 64 * 1024& Then + MsgBox "SplitSize must be at least 64k" + Exit Function + End If + ZipOpts.szSplitSize = SplitSize + End If + + If IncludeVolumeLabel Then ZipOpts.fVolume = 1 + If UsePrivileges Then ZipOpts.fPrivilege = 1 + If ExcludeExtraAttributes Then ZipOpts.fExtra = 1 + + SetZipOptions = True + +End Function + +Function ChopNulls(ByVal Str) As String + Dim A As Integer + Dim C As String + + For A = 1 To Len(Str) + If Mid(Str, A, 1) = Chr(0) Then + ChopNulls = Left(Str, A - 1) + Exit Function + End If + Next + ChopNulls = Str + +End Function +Sub DisplayVersion() + + ' display version of DLL + Dim Beta As Boolean + Dim ZLIB As Boolean + Dim Zip64 As Boolean + Dim Flags As String + Dim A As Integer + + ZipVersion.structlen = Len(ZipVersion) + ZpVersion ZipVersion + ' Check flag + If ZipVersion.flag And 1 Then + Flags = Flags & " Beta," + Beta = True + Else + Flags = Flags & " No Beta," + End If + If ZipVersion.flag And 2 Then + Flags = Flags & " ZLIB," + ZLIB = True + Else + Flags = Flags & " No ZLIB," + End If + If ZipVersion.flag And 4 Then + Flags = Flags & " Zip64, " + Zip64 = True + Else + Flags = Flags & " No Zip64, " + End If + If ZipVersion.encryption Then + Flags = Flags & "Encryption" + Else + Flags = Flags & " No encryption" + End If + + Form1.Caption = "Using Zip32z64.DLL Version " & _ + ZipVersion.ZipVersion.Major & "." & ZipVersion.ZipVersion.Minor & " " & _ + ChopNulls(ZipVersion.Beta) & " [" & ChopNulls(ZipVersion.date) & "]" & _ + " - FLAGS: " & Flags + + If Not Zip64 Then + A = MsgBox("Zip32z64.dll not compiled with Zip64 enabled - continue?", _ + vbOKCancel, _ + "Wrong dll") + If A = vbCancel Then + End + End If + End If + +End Sub + +'-- Main ZIP32.DLL Subroutine. +'-- This Is Where It All Happens!!! +'-- +'-- (WARNING!) Do Not Change This Function!!! +'-- +Public Function VBZip32() As Long + + Dim retcode As Long + Dim FileNotFound As Boolean + + ' On Error Resume Next '-- Nothing Will Go Wrong :-) + On Error GoTo ZipError + + retcode = 0 + + '-- Set Address Of ZIP32.DLL Callback Functions + '-- (WARNING!) Do Not Change!!! (except as noted below) + ZUSER.ZDLLPrnt = FnPtr(AddressOf ZDLLPrnt) + ZUSER.ZDLLPASSWORD = FnPtr(AddressOf ZDLLPass) + ZUSER.ZDLLCOMMENT = FnPtr(AddressOf ZDLLComm) + ZUSER.ZDLLSERVICE_NO_INT64 = FnPtr(AddressOf ZDLLServ) + + ' If you need to set destination of each split set this + 'ZUSER.ZDLLSPLIT = FnPtr(AddressOf ZDLLSplitSelect) + + '-- Set ZIP32.DLL Callbacks - return 1 if DLL loaded 0 if not + retcode = ZpInit(ZUSER) + If retcode = 0 And FileNotFound Then + MsgBox "Probably could not find Zip32z64.DLL - have you copied" & Chr(10) & _ + "it to the System directory, your program directory, " & Chr(10) & _ + "or a directory on your command PATH?" + VBZip32 = retcode + Exit Function + End If + + DisplayVersion + + If strZipFileNames = "" Then + ' not using string of names to zip (so using array of names) + strZipFileNames = vbNullString + End If + + '-- Go Zip It Them Up! + retcode = ZpArchive(zArgc, zZipArchiveName, zZipFileNames, strZipFileNames, ZOPT) + + '-- Return The Function Code + VBZip32 = retcode + + Exit Function + +ZipError: + MsgBox "Error: " & Err.Description + If Err = 48 Then + FileNotFound = True + End If + Resume Next + +End Function + diff --git a/windll/VBz64/Vbzipfrm.frm b/windll/VBz64/Vbzipfrm.frm new file mode 100644 index 0000000..57c4df4 --- /dev/null +++ b/windll/VBz64/Vbzipfrm.frm @@ -0,0 +1,183 @@ +VERSION 5.00
+Begin VB.Form Form1
+ AutoRedraw = -1 'True
+ Caption = "Form1"
+ ClientHeight = 3150
+ ClientLeft = 60
+ ClientTop = 345
+ ClientWidth = 6570
+ BeginProperty Font
+ Name = "MS Sans Serif"
+ Size = 9.75
+ Charset = 0
+ Weight = 700
+ Underline = 0 'False
+ Italic = 0 'False
+ Strikethrough = 0 'False
+ EndProperty
+ LinkTopic = "Form1"
+ ScaleHeight = 3150
+ ScaleWidth = 6570
+ StartUpPosition = 1 'CenterOwner
+End
+Attribute VB_Name = "Form1"
+Attribute VB_GlobalNameSpace = False
+Attribute VB_Creatable = False
+Attribute VB_PredeclaredId = True
+Attribute VB_Exposed = False
+
+Option Explicit
+
+'---------------------------------------------------------------
+'-- Sample VB 6 code to drive zip32z64.dll
+'--
+'-- Based on code contributed to the Info-ZIP project by Mike Le Voi
+'--
+'-- See the Original VB example in a separate directory for
+'-- more information
+'--
+'-- Use this code at your own risk. Nothing implied or warranted
+'-- to work on your machine :-)
+'---------------------------------------------------------------
+'--
+'-- The Source Code Is Freely Available From Info-ZIP At:
+'-- ftp://ftp.info-zip.org/pub/infozip/infozip.html
+'-- and
+'-- http://sourceforge.net/projects/infozip/
+'--
+'-- A Very Special Thanks To Mr. Mike Le Voi
+'-- And Mr. Mike White Of The Info-ZIP project
+'-- For Letting Me Use And Modify His Orginal
+'-- Visual Basic 5.0 Code! Thank You Mike Le Voi.
+'---------------------------------------------------------------
+'--
+'-- Contributed To The Info-ZIP Project By Raymond L. King
+'-- Modified June 21, 1998
+'-- By Raymond L. King
+'-- Custom Software Designers
+'--
+'-- Contact Me At: king@ntplx.net
+'-- ICQ 434355
+'-- Or Visit Our Home Page At: http://www.ntplx.net/~king
+'--
+'---------------------------------------------------------------
+
+'---------------------------------------------------------------
+' Zip32z64.dll is the new Zip32.dll based on Zip 3.0 and compiled
+' with Zip64 support enabled. See windll.txt in the windll directory
+' for more on Zip32z64 and the comments in VBZipBas.bas.
+'
+' Contact Info-Zip if problems. This code is
+' provided under the Info-Zip license.
+'
+' 4/24/2004, 12/4/2007 EG
+'---------------------------------------------------------------
+
+Private Sub Form_Click()
+
+ Dim retcode As Integer ' For Return Code From ZIP32.DLL
+ Dim iFiles As String
+ Dim FilesToZip() As String
+ Dim i As Long
+
+ Cls
+
+ '-- Set Options - Only The Common Ones Are Shown Here
+ '-- These Must Be Set Before Calling The VBZip32 Function
+
+ ' In VB 6 you can see the list of possible options and the defaults
+ ' by adding a space between any parameters which should make the tip box
+ ' appear. Delete a := and retype to see a list of choices.
+
+ ' Be warned: There are bugs in the previous dll. See the Original VB
+ ' example in the VB directory for details.
+
+ If Not SetZipOptions(ZOPT, _
+ ZipMode:=Add, _
+ CompressionLevel:=c6_Default) Then
+ ' Some additional options ...
+ ' RootDirToZipFrom:="", _
+ ' strip paths and just store names:
+ ' JunkDirNames:=False, _
+ ' do not store entries for the directories themselves:
+ ' NoDirEntries:=True _
+ ' include files only if match one of these patterns:
+ ' i_IncludeFiles:="*.vbp *.frm", _
+ ' exclude files that match these patterns:
+ ' x_ExcludeFiles:="*.bas", _
+ ' Verboseness:=Verbose, _
+ ' IncludeEarlierThanDate:="2004-4-1", _
+ ' RecurseSubdirectories:=r_RecurseIntoSubdirectories, _
+ ' Encrypt:=False, _
+ ' ArchiveComment:=False
+ ' date example (format mmddyyyy or yyyy-mm-dd):
+ ' ExcludeEarlierThanDate:="2002-12-10", _
+ ' split example (can only create, can't update split archives in VB):
+ ' SplitSize:="110k", _
+' Delete
+ ' If Not SetZipOptions(ZOPT, _
+ ' ZipMode:=Delete) Then
+
+ ' a problem if get here - error message already displayed so just exit
+ Exit Sub
+ End If
+
+
+ '-- Select Some Files - Wildcards Are Supported
+ '-- Change The Paths Here To Your Directory
+ '-- And Files!!!
+
+ ' default to current (VB project) directory and zip up project files
+ zZipArchiveName = "MyFirst.zip"
+
+
+ ' Files to zip - use one of below
+
+ '---------------
+ ' Example using file name array
+
+ ' Store the file paths
+ ' Change Dim of zFiles at top of VBZipBas.bas if more than 100 files
+ ' See note at top of VBZipBas.bas for limit on number of files
+
+' zArgc = 2 ' Number Of file paths below
+' zZipFileNames.zFiles(1) = "*.bas"
+' zZipFileNames.zFiles(2) = "*.frm"
+
+ '---------------
+ ' Example using file list string
+
+ ' List of files to zip as string of names with space between
+ ' Set zArgc = 0 as not using array
+ ' Using string for file list avoids above array limit
+
+ zArgc = 0
+' ReDim FilesToZip(1) ' dim to number of files below
+' FilesToZip(1) = "x:*.*"
+ ReDim FilesToZip(2) ' dim to number of files below
+ FilesToZip(1) = "*.bas"
+ FilesToZip(2) = "*.frm"
+
+ ' Build string of file names
+ ' Best to put double quotes around each in case of spaces
+ strZipFileNames = ""
+ For i = 1 To UBound(FilesToZip)
+ strZipFileNames = strZipFileNames & """" & FilesToZip(i) & """ "
+ Next
+ '---------------
+
+ '-- Go Zip Them Up!
+ retcode = VBZip32()
+
+ '-- Display The Returned Code Or Error!
+ Print "Return code:" & Str(retcode)
+
+End Sub
+
+Private Sub Form_Load()
+
+ Me.Show
+
+ Print "Click me!"
+
+End Sub
diff --git a/windll/VBz64/readVB64.txt b/windll/VBz64/readVB64.txt new file mode 100644 index 0000000..2876b44 --- /dev/null +++ b/windll/VBz64/readVB64.txt @@ -0,0 +1,25 @@ +On Windows open this file in WordPad. + +Contents of the "windll/vbz64" sub-archive + +This directory contains a Visual Basic project example for using the +zip32z64.dll library (Zip 3.0 with Zip64 enabled). See the comments in +the form and project files for details. + +This new project and the new zip32z64.dll library are not compatible +with previous VB examples using the zip32.dll interface as this new +interface supports more files and handles file sizes larger than 2 GB. +It should be simple to convert a VB program using zip32.dll to +zip32z64.dll but the program may need some changes. For a compatible +replacement use the dll compiled from Zip 2.32 (released separately) +and see the zip32.dll example in the VB directory of this source tree. + +Note that the files may be saved in unix format with carriage returns +stripped. These must be restored before the project can be successfully +used. This can be done by using the -a option to unzip. Another way to +do this is to open each file in WordPad, select and cut a line, paste +the line back, and save the file. This will force WordPad to change the +line ends in the entire file. Newer versions of WordPad may not do this. + +Ed Gordon +4/26/2008 diff --git a/windll/Vb/VBZIP.vbw b/windll/Vb/VBZIP.vbw new file mode 100644 index 0000000..2f8339a --- /dev/null +++ b/windll/Vb/VBZIP.vbw @@ -0,0 +1,2 @@ +Form1 = 0, 0, 0, 0, C, 22, 22, 563, 389, C
+VBZipBas = 44, 44, 659, 489,
diff --git a/windll/Vb/VBZipBas.bas b/windll/Vb/VBZipBas.bas new file mode 100644 index 0000000..2b766e9 --- /dev/null +++ b/windll/Vb/VBZipBas.bas @@ -0,0 +1,458 @@ +Attribute VB_Name = "VBZipBas"
+
+Option Explicit
+
+'---------------------------------------------------------------
+'-- Please Do Not Remove These Comments!!!
+'---------------------------------------------------------------
+'-- Sample VB 5 code to drive zip32.dll
+'-- Contributed to the Info-ZIP project by Mike Le Voi
+'--
+'-- Contact me at: mlevoi@modemss.brisnet.org.au
+'--
+'-- Visit my home page at: http://modemss.brisnet.org.au/~mlevoi
+'--
+'-- Use this code at your own risk. Nothing implied or warranted
+'-- to work on your machine :-)
+'---------------------------------------------------------------
+'--
+'-- The Source Code Is Freely Available From Info-ZIP At:
+'-- http://www.cdrom.com/pub/infozip/infozip.html
+'--
+'-- A Very Special Thanks To Mr. Mike Le Voi
+'-- And Mr. Mike White Of The Info-ZIP
+'-- For Letting Me Use And Modify His Orginal
+'-- Visual Basic 5.0 Code! Thank You Mike Le Voi.
+'---------------------------------------------------------------
+'--
+'-- Contributed To The Info-ZIP Project By Raymond L. King
+'-- Modified June 21, 1998
+'-- By Raymond L. King
+'-- Custom Software Designers
+'--
+'-- Contact Me At: king@ntplx.net
+'-- ICQ 434355
+'-- Or Visit Our Home Page At: http://www.ntplx.net/~king
+'--
+'---------------------------------------------------------------
+'
+' This is the original example with some small changes. Only
+' use with the original Zip32.dll (compiled from Zip 2.31 or
+' later). Do not use this VB example with Zip32z64.dll
+' (compiled from Zip 3.0). To check the version of a dll,
+' right click on the file and check properties.
+'
+' 6/24/2008 Ed Gordon
+
+'---------------------------------------------------------------
+' Usage notes:
+'
+' This code uses Zip32.dll. You DO NOT need to register the
+' DLL to use it. You also DO NOT need to reference it in your
+' VB project. You DO have to copy the DLL to your SYSTEM
+' directory, your VB project directory, or place it in a directory
+' on your command PATH.
+'
+' A bug has been found in the Zip32.dll when called from VB. If
+' you try to pass any values other than NULL in the ZPOPT strings
+' Date, szRootDir, or szTempDir they get converted from the
+' VB internal wide character format to temporary byte strings by
+' the calling interface as they are supposed to. However when
+' ZpSetOptions returns the passed strings are deallocated unless the
+' VB debugger prevents it by a break between ZpSetOptions and
+' ZpArchive. When Zip32.dll uses these pointers later it
+' can result in unpredictable behavior. A kluge is available
+' for Zip32.dll, just replacing api.c in Zip 2.3, but better to just
+' use the new Zip32z64.dll where these bugs are fixed. However,
+' the kluge has been added to Zip 2.31 and later and these are
+' now stable. To determine the version of the dll you have
+' right click on it, select the Version tab, and verify the
+' Product Version is at least 2.31.
+'
+' Another bug is where -R is used with some other options and can
+' crash the dll. This is a bug in how zip processes the command
+' line and should be mostly fixed in Zip 2.31. If you run into
+' problems try using -r instead for recursion. The bug is fixed
+' in Zip 3.0 but note that Zip 3.0 creates dll zip32z64.dll and
+' it is not compatible with older VB including this example. See
+' the new VB example code included with Zip 3.0 for calling
+' interface changes.
+'
+' Note that Zip32 is probably not thread safe. It may be made
+' thread safe in a later version, but for now only one thread in
+' one program should use the DLL at a time. Unlike Zip, UnZip is
+' probably thread safe, but an exception to this has been
+' found. See the UnZip documentation for the latest on this.
+'
+' All code in this VB project is provided under the Info-Zip license.
+'
+' If you have any questions please contact Info-Zip at
+' http://www.info-zip.org.
+'
+' 4/29/2004 EG (Updated 3/1/2005, 6/24/2008 EG)
+'
+'---------------------------------------------------------------
+
+
+'-- C Style argv
+'-- Holds The Zip Archive Filenames
+' Max for this just over 8000 as each pointer takes up 4 bytes and
+' VB only allows 32 kB of local variables and that includes function
+' parameters. - 3/19/2004 EG
+'
+Public Type ZIPnames
+ zFiles(0 To 99) As String
+End Type
+
+'-- Call Back "String"
+Public Type ZipCBChar
+ ch(4096) As Byte
+End Type
+
+'-- ZPOPT Is Used To Set The Options In The ZIP32.DLL
+Public Type ZPOPT
+ Date As String ' US Date (8 Bytes Long) "12/31/98"?
+ szRootDir As String ' Root Directory Pathname (Up To 256 Bytes Long)
+ szTempDir As String ' Temp Directory Pathname (Up To 256 Bytes Long)
+ fTemp As Long ' 1 If Temp dir Wanted, Else 0
+ fSuffix As Long ' Include Suffixes (Not Yet Implemented!)
+ fEncrypt As Long ' 1 If Encryption Wanted, Else 0
+ fSystem As Long ' 1 To Include System/Hidden Files, Else 0
+ fVolume As Long ' 1 If Storing Volume Label, Else 0
+ fExtra As Long ' 1 If Excluding Extra Attributes, Else 0
+ fNoDirEntries As Long ' 1 If Ignoring Directory Entries, Else 0
+ fExcludeDate As Long ' 1 If Excluding Files Earlier Than Specified Date, Else 0
+ fIncludeDate As Long ' 1 If Including Files Earlier Than Specified Date, Else 0
+ fVerbose As Long ' 1 If Full Messages Wanted, Else 0
+ fQuiet As Long ' 1 If Minimum Messages Wanted, Else 0
+ fCRLF_LF As Long ' 1 If Translate CR/LF To LF, Else 0
+ fLF_CRLF As Long ' 1 If Translate LF To CR/LF, Else 0
+ fJunkDir As Long ' 1 If Junking Directory Names, Else 0
+ fGrow As Long ' 1 If Allow Appending To Zip File, Else 0
+ fForce As Long ' 1 If Making Entries Using DOS File Names, Else 0
+ fMove As Long ' 1 If Deleting Files Added Or Updated, Else 0
+ fDeleteEntries As Long ' 1 If Files Passed Have To Be Deleted, Else 0
+ fUpdate As Long ' 1 If Updating Zip File-Overwrite Only If Newer, Else 0
+ fFreshen As Long ' 1 If Freshing Zip File-Overwrite Only, Else 0
+ fJunkSFX As Long ' 1 If Junking SFX Prefix, Else 0
+ fLatestTime As Long ' 1 If Setting Zip File Time To Time Of Latest File In Archive, Else 0
+ fComment As Long ' 1 If Putting Comment In Zip File, Else 0
+ fOffsets As Long ' 1 If Updating Archive Offsets For SFX Files, Else 0
+ fPrivilege As Long ' 1 If Not Saving Privileges, Else 0
+ fEncryption As Long ' Read Only Property!!!
+ fRecurse As Long ' 1 (-r), 2 (-R) If Recursing Into Sub-Directories, Else 0
+ fRepair As Long ' 1 = Fix Archive, 2 = Try Harder To Fix, Else 0
+ flevel As Byte ' Compression Level - 0 = Stored 6 = Default 9 = Max
+End Type
+
+'-- This Structure Is Used For The ZIP32.DLL Function Callbacks
+Public Type ZIPUSERFUNCTIONS
+ ZDLLPrnt As Long ' Callback ZIP32.DLL Print Function
+ ZDLLCOMMENT As Long ' Callback ZIP32.DLL Comment Function
+ ZDLLPASSWORD As Long ' Callback ZIP32.DLL Password Function
+ ZDLLSERVICE As Long ' Callback ZIP32.DLL Service Function
+End Type
+
+'-- Local Declarations
+Public ZOPT As ZPOPT
+Public ZUSER As ZIPUSERFUNCTIONS
+
+'-- This Assumes ZIP32.DLL Is In Your \Windows\System Directory!
+'-- (alternatively, a copy of ZIP32.DLL needs to be located in the program
+'-- directory or in some other directory listed in PATH.)
+Private Declare Function ZpInit Lib "zip32.dll" _
+ (ByRef Zipfun As ZIPUSERFUNCTIONS) As Long '-- Set Zip Callbacks
+
+Private Declare Function ZpSetOptions Lib "zip32.dll" _
+ (ByRef Opts As ZPOPT) As Long '-- Set Zip Options
+
+Private Declare Function ZpGetOptions Lib "zip32.dll" _
+ () As ZPOPT '-- Used To Check Encryption Flag Only
+
+Private Declare Function ZpArchive Lib "zip32.dll" _
+ (ByVal argc As Long, ByVal funame As String, _
+ ByRef argv As ZIPnames) As Long '-- Real Zipping Action
+
+'-------------------------------------------------------
+'-- Public Variables For Setting The ZPOPT Structure...
+'-- (WARNING!!!) You Must Set The Options That You
+'-- Want The ZIP32.DLL To Do!
+'-- Before Calling VBZip32!
+'--
+'-- NOTE: See The Above ZPOPT Structure Or The VBZip32
+'-- Function, For The Meaning Of These Variables
+'-- And How To Use And Set Them!!!
+'-- These Parameters Must Be Set Before The Actual Call
+'-- To The VBZip32 Function!
+'-------------------------------------------------------
+Public zDate As String
+Public zRootDir As String
+Public zTempDir As String
+Public zSuffix As Integer
+Public zEncrypt As Integer
+Public zSystem As Integer
+Public zVolume As Integer
+Public zExtra As Integer
+Public zNoDirEntries As Integer
+Public zExcludeDate As Integer
+Public zIncludeDate As Integer
+Public zVerbose As Integer
+Public zQuiet As Integer
+Public zCRLF_LF As Integer
+Public zLF_CRLF As Integer
+Public zJunkDir As Integer
+Public zRecurse As Integer
+Public zGrow As Integer
+Public zForce As Integer
+Public zMove As Integer
+Public zDelEntries As Integer
+Public zUpdate As Integer
+Public zFreshen As Integer
+Public zJunkSFX As Integer
+Public zLatestTime As Integer
+Public zComment As Integer
+Public zOffsets As Integer
+Public zPrivilege As Integer
+Public zEncryption As Integer
+Public zRepair As Integer
+Public zLevel As Integer
+
+'-- Public Program Variables
+Public zArgc As Integer ' Number Of Files To Zip Up
+Public zZipFileName As String ' The Zip File Name ie: Myzip.zip
+Public zZipFileNames As ZIPnames ' File Names To Zip Up
+Public zZipInfo As String ' Holds The Zip File Information
+
+'-- Public Constants
+'-- For Zip & UnZip Error Codes!
+Public Const ZE_OK = 0 ' Success (No Error)
+Public Const ZE_EOF = 2 ' Unexpected End Of Zip File Error
+Public Const ZE_FORM = 3 ' Zip File Structure Error
+Public Const ZE_MEM = 4 ' Out Of Memory Error
+Public Const ZE_LOGIC = 5 ' Internal Logic Error
+Public Const ZE_BIG = 6 ' Entry Too Large To Split Error
+Public Const ZE_NOTE = 7 ' Invalid Comment Format Error
+Public Const ZE_TEST = 8 ' Zip Test (-T) Failed Or Out Of Memory Error
+Public Const ZE_ABORT = 9 ' User Interrupted Or Termination Error
+Public Const ZE_TEMP = 10 ' Error Using A Temp File
+Public Const ZE_READ = 11 ' Read Or Seek Error
+Public Const ZE_NONE = 12 ' Nothing To Do Error
+Public Const ZE_NAME = 13 ' Missing Or Empty Zip File Error
+Public Const ZE_WRITE = 14 ' Error Writing To A File
+Public Const ZE_CREAT = 15 ' Could't Open To Write Error
+Public Const ZE_PARMS = 16 ' Bad Command Line Argument Error
+Public Const ZE_OPEN = 18 ' Could Not Open A Specified File To Read Error
+
+'-- These Functions Are For The ZIP32.DLL
+'--
+'-- Puts A Function Pointer In A Structure
+'-- For Use With Callbacks...
+Public Function FnPtr(ByVal lp As Long) As Long
+
+ FnPtr = lp
+
+End Function
+
+'-- Callback For ZIP32.DLL - DLL Print Function
+Public Function ZDLLPrnt(ByRef fname As ZipCBChar, ByVal x As Long) As Long
+
+ Dim s0 As String
+ Dim xx As Long
+
+ '-- Always Put This In Callback Routines!
+ On Error Resume Next
+
+ s0 = ""
+
+ '-- Get Zip32.DLL Message For processing
+ For xx = 0 To x
+ If fname.ch(xx) = 0 Then
+ Exit For
+ Else
+ s0 = s0 + Chr(fname.ch(xx))
+ End If
+ Next
+
+ '----------------------------------------------
+ '-- This Is Where The DLL Passes Back Messages
+ '-- To You! You Can Change The Message Printing
+ '-- Below Here!
+ '----------------------------------------------
+
+ '-- Display Zip File Information
+ '-- zZipInfo = zZipInfo & s0
+ Form1.Print s0;
+
+ DoEvents
+
+ ZDLLPrnt = 0
+
+End Function
+
+'-- Callback For ZIP32.DLL - DLL Service Function
+Public Function ZDLLServ(ByRef mname As ZipCBChar, ByVal x As Long) As Long
+
+ ' x is the size of the file
+
+ Dim s0 As String
+ Dim xx As Long
+
+ '-- Always Put This In Callback Routines!
+ On Error Resume Next
+
+ s0 = ""
+ '-- Get Zip32.DLL Message For processing
+ For xx = 0 To 4096
+ If mname.ch(xx) = 0 Then
+ Exit For
+ Else
+ s0 = s0 + Chr(mname.ch(xx))
+ End If
+ Next
+ ' Form1.Print "-- " & s0 & " - " & x & " bytes"
+
+ ' This is called for each zip entry.
+ ' mname is usually the null terminated file name and x the file size.
+ ' s0 has trimmed file name as VB string.
+
+ ' At this point, s0 contains the message passed from the DLL
+ ' It is up to the developer to code something useful here :)
+ ZDLLServ = 0 ' Setting this to 1 will abort the zip!
+
+End Function
+
+'-- Callback For ZIP32.DLL - DLL Password Function
+Public Function ZDLLPass(ByRef p As ZipCBChar, _
+ ByVal n As Long, ByRef m As ZipCBChar, _
+ ByRef Name As ZipCBChar) As Integer
+
+ Dim prompt As String
+ Dim xx As Integer
+ Dim szpassword As String
+
+ '-- Always Put This In Callback Routines!
+ On Error Resume Next
+
+ ZDLLPass = 1
+
+ '-- If There Is A Password Have The User Enter It!
+ '-- This Can Be Changed
+ szpassword = InputBox("Please Enter The Password!")
+
+ '-- The User Did Not Enter A Password So Exit The Function
+ If szpassword = "" Then Exit Function
+
+ '-- User Entered A Password So Proccess It
+ For xx = 0 To 255
+ If m.ch(xx) = 0 Then
+ Exit For
+ Else
+ prompt = prompt & Chr(m.ch(xx))
+ End If
+ Next
+
+ For xx = 0 To n - 1
+ p.ch(xx) = 0
+ Next
+
+ For xx = 0 To Len(szpassword) - 1
+ p.ch(xx) = Asc(Mid(szpassword, xx + 1, 1))
+ Next
+
+ p.ch(xx) = Chr(0) ' Put Null Terminator For C
+
+ ZDLLPass = 0
+
+End Function
+
+'-- Callback For ZIP32.DLL - DLL Comment Function
+Public Function ZDLLComm(ByRef s1 As ZipCBChar) As Integer
+
+ Dim xx%, szcomment$
+
+ '-- Always Put This In Callback Routines!
+ On Error Resume Next
+
+ ZDLLComm = 1
+ szcomment = InputBox("Enter the comment")
+ If szcomment = "" Then Exit Function
+ For xx = 0 To Len(szcomment) - 1
+ s1.ch(xx) = Asc(Mid$(szcomment, xx + 1, 1))
+ Next xx
+ s1.ch(xx) = Chr(0) ' Put null terminator for C
+
+End Function
+
+'-- Main ZIP32.DLL Subroutine.
+'-- This Is Where It All Happens!!!
+'--
+'-- (WARNING!) Do Not Change This Function!!!
+'--
+Public Function VBZip32() As Long
+
+ Dim retcode As Long
+
+ On Error Resume Next '-- Nothing Will Go Wrong :-)
+
+ retcode = 0
+
+ '-- Set Address Of ZIP32.DLL Callback Functions
+ '-- (WARNING!) Do Not Change!!!
+ ZUSER.ZDLLPrnt = FnPtr(AddressOf ZDLLPrnt)
+ ZUSER.ZDLLPASSWORD = FnPtr(AddressOf ZDLLPass)
+ ZUSER.ZDLLCOMMENT = FnPtr(AddressOf ZDLLComm)
+ ZUSER.ZDLLSERVICE = FnPtr(AddressOf ZDLLServ)
+
+ '-- Set ZIP32.DLL Callbacks
+ retcode = ZpInit(ZUSER)
+ If retcode = 0 Then
+ MsgBox "Zip32.dll did not initialize. Is it in the current directory " & _
+ "or on the command path?", vbOKOnly, "VB Zip"
+ Exit Function
+ End If
+
+ '-- Setup ZIP32 Options
+ '-- (WARNING!) Do Not Change!
+ ZOPT.Date = zDate ' "12/31/79"? US Date?
+ ZOPT.szRootDir = zRootDir ' Root Directory Pathname
+ ZOPT.szTempDir = zTempDir ' Temp Directory Pathname
+ ZOPT.fSuffix = zSuffix ' Include Suffixes (Not Yet Implemented)
+ ZOPT.fEncrypt = zEncrypt ' 1 If Encryption Wanted
+ ZOPT.fSystem = zSystem ' 1 To Include System/Hidden Files
+ ZOPT.fVolume = zVolume ' 1 If Storing Volume Label
+ ZOPT.fExtra = zExtra ' 1 If Including Extra Attributes
+ ZOPT.fNoDirEntries = zNoDirEntries ' 1 If Ignoring Directory Entries
+ ZOPT.fExcludeDate = zExcludeDate ' 1 If Excluding Files Earlier Than A Specified Date
+ ZOPT.fIncludeDate = zIncludeDate ' 1 If Including Files Earlier Than A Specified Date
+ ZOPT.fVerbose = zVerbose ' 1 If Full Messages Wanted
+ ZOPT.fQuiet = zQuiet ' 1 If Minimum Messages Wanted
+ ZOPT.fCRLF_LF = zCRLF_LF ' 1 If Translate CR/LF To LF
+ ZOPT.fLF_CRLF = zLF_CRLF ' 1 If Translate LF To CR/LF
+ ZOPT.fJunkDir = zJunkDir ' 1 If Junking Directory Names
+ ZOPT.fGrow = zGrow ' 1 If Allow Appending To Zip File
+ ZOPT.fForce = zForce ' 1 If Making Entries Using DOS Names
+ ZOPT.fMove = zMove ' 1 If Deleting Files Added Or Updated
+ ZOPT.fDeleteEntries = zDelEntries ' 1 If Files Passed Have To Be Deleted
+ ZOPT.fUpdate = zUpdate ' 1 If Updating Zip File-Overwrite Only If Newer
+ ZOPT.fFreshen = zFreshen ' 1 If Freshening Zip File-Overwrite Only
+ ZOPT.fJunkSFX = zJunkSFX ' 1 If Junking SFX Prefix
+ ZOPT.fLatestTime = zLatestTime ' 1 If Setting Zip File Time To Time Of Latest File In Archive
+ ZOPT.fComment = zComment ' 1 If Putting Comment In Zip File
+ ZOPT.fOffsets = zOffsets ' 1 If Updating Archive Offsets For SFX Files
+ ZOPT.fPrivilege = zPrivilege ' 1 If Not Saving Privelages
+ ZOPT.fEncryption = zEncryption ' Read Only Property!
+ ZOPT.fRecurse = zRecurse ' 1 or 2 If Recursing Into Subdirectories
+ ZOPT.fRepair = zRepair ' 1 = Fix Archive, 2 = Try Harder To Fix
+ ZOPT.flevel = zLevel ' Compression Level - (0 To 9) Should Be 0!!!
+
+ '-- Set ZIP32.DLL Options
+ retcode = ZpSetOptions(ZOPT)
+
+ '-- Go Zip It Them Up!
+ retcode = ZpArchive(zArgc, zZipFileName, zZipFileNames)
+
+ '-- Return The Function Code
+ VBZip32 = retcode
+
+End Function
+
diff --git a/windll/Vb/Vbzip.vbp b/windll/Vb/Vbzip.vbp new file mode 100644 index 0000000..b5e5827 --- /dev/null +++ b/windll/Vb/Vbzip.vbp @@ -0,0 +1,34 @@ +Type=Exe
+Form=Vbzipfrm.frm
+Module=VBZipBas; VBZipBas.bas
+IconForm="Form1"
+Startup="Form1"
+HelpFile=""
+Title="VBZIP"
+ExeName32="VBZIP.exe"
+Path32="..\..\.."
+Command32=""
+Name="Project1"
+HelpContextID="0"
+CompatibleMode="0"
+MajorVer=1
+MinorVer=0
+RevisionVer=0
+AutoIncrementVer=0
+ServerSupportFiles=0
+VersionCompanyName="Mike"
+CompilationType=-1
+OptimizationType=0
+FavorPentiumPro(tm)=0
+CodeViewDebugInfo=0
+NoAliasing=0
+BoundsCheck=0
+OverflowCheck=0
+FlPointCheck=0
+FDIVCheck=0
+UnroundedFP=0
+StartMode=0
+Unattended=0
+Retained=0
+ThreadPerObject=0
+MaxNumberOfThreads=1
diff --git a/windll/Vb/Vbzipfrm.frm b/windll/Vb/Vbzipfrm.frm new file mode 100644 index 0000000..de323cd --- /dev/null +++ b/windll/Vb/Vbzipfrm.frm @@ -0,0 +1,130 @@ +VERSION 5.00
+Begin VB.Form Form1
+ AutoRedraw = -1 'True
+ Caption = "Form1"
+ ClientHeight = 3150
+ ClientLeft = 60
+ ClientTop = 345
+ ClientWidth = 6570
+ BeginProperty Font
+ Name = "MS Sans Serif"
+ Size = 9.75
+ Charset = 0
+ Weight = 700
+ Underline = 0 'False
+ Italic = 0 'False
+ Strikethrough = 0 'False
+ EndProperty
+ LinkTopic = "Form1"
+ ScaleHeight = 3150
+ ScaleWidth = 6570
+ StartUpPosition = 1 'CenterOwner
+End
+Attribute VB_Name = "Form1"
+Attribute VB_GlobalNameSpace = False
+Attribute VB_Creatable = False
+Attribute VB_PredeclaredId = True
+Attribute VB_Exposed = False
+
+Option Explicit
+
+'---------------------------------------------------------------
+'-- Please Do Not Remove These Comments!!!
+'---------------------------------------------------------------
+'-- Sample VB 5 code to drive zip32.dll
+'-- Contributed to the Info-ZIP project by Mike Le Voi
+'--
+'-- Contact me at: mlevoi@modemss.brisnet.org.au
+'--
+'-- Visit my home page at: http://modemss.brisnet.org.au/~mlevoi
+'--
+'-- Use this code at your own risk. Nothing implied or warranted
+'-- to work on your machine :-)
+'---------------------------------------------------------------
+'--
+'-- The Source Code Is Freely Available From Info-ZIP At:
+'-- http://www.cdrom.com/pub/infozip/infozip.html
+'--
+'-- A Very Special Thanks To Mr. Mike Le Voi
+'-- And Mr. Mike White Of The Info-ZIP project
+'-- For Letting Me Use And Modify His Orginal
+'-- Visual Basic 5.0 Code! Thank You Mike Le Voi.
+'---------------------------------------------------------------
+'--
+'-- Contributed To The Info-ZIP Project By Raymond L. King
+'-- Modified June 21, 1998
+'-- By Raymond L. King
+'-- Custom Software Designers
+'--
+'-- Contact Me At: king@ntplx.net
+'-- ICQ 434355
+'-- Or Visit Our Home Page At: http://www.ntplx.net/~king
+'--
+'---------------------------------------------------------------
+' This is the original VB example (with some changes) for use
+' with Zip32.dll (Zip 2.31) but not Zip32z64.dll (Zip 3.0).
+'
+' Minor changes to use current directory and VB project files
+' for the example and to turn off encryption.
+'
+' The VB example provided with Zip 3.0 is more extensive. Even
+' if you plan to use the updated zip32.dll instead of the new
+' zip32z64.dll (Zip 3.0), there may be some things you might find
+' useful in the VB example there.
+'
+' 2/27/2005 Ed Gordon
+'---------------------------------------------------------------
+
+Private Sub Form_Click()
+
+ Dim retcode As Integer ' For Return Code From ZIP32.DLL
+
+ Cls
+
+ '-- Set Options - Only The Common Ones Are Shown Here
+ '-- These Must Be Set Before Calling The VBZip32 Function
+ zDate = vbNullString
+ 'zDate = "2005-1-31"
+ 'zExcludeDate = 1
+ 'zIncludeDate = 0
+ zJunkDir = 0 ' 1 = Throw Away Path Names
+ zRecurse = 0 ' 1 = Recurse -r 2 = Recurse -R 2 = Most Useful :)
+ zUpdate = 0 ' 1 = Update Only If Newer
+ zFreshen = 0 ' 1 = Freshen - Overwrite Only
+ zLevel = Asc(9) ' Compression Level (0 - 9)
+ zEncrypt = 0 ' Encryption = 1 For Password Else 0
+ zComment = 0 ' Comment = 1 if required
+
+ '-- Select Some Files - Wildcards Are Supported
+ '-- Change The Paths Here To Your Directory
+ '-- And Files!!!
+ ' Change ZIPnames in VBZipBas.bas if need more than 100 files
+ zArgc = 2 ' Number Of Elements Of mynames Array
+ zZipFileName = "MyFirst.zip"
+ zZipFileNames.zFiles(0) = "vbzipfrm.frm"
+ zZipFileNames.zFiles(1) = "vbzip.vbp"
+ zRootDir = "" ' This Affects The Stored Path Name
+
+ ' Older versions of Zip32.dll do not handle setting
+ ' zRootDir to anything other than "". If you need to
+ ' change root directory an alternative is to just change
+ ' directory. This requires Zip32.dll to be on the command
+ ' path. This should be fixed in Zip 2.31. 1/31/2005 EG
+
+ ' ChDir "a"
+
+ '-- Go Zip Them Up!
+ retcode = VBZip32
+
+ '-- Display The Returned Code Or Error!
+ Print "Return code:" & Str(retcode)
+
+End Sub
+
+Private Sub Form_Load()
+
+ Me.Show
+
+ Print "Click me!"
+
+End Sub
diff --git a/windll/Vb/readmeVB.txt b/windll/Vb/readmeVB.txt new file mode 100644 index 0000000..1c36949 --- /dev/null +++ b/windll/Vb/readmeVB.txt @@ -0,0 +1,34 @@ +On Windows open this file in WordPad. + +Contents of the "windll/vb" sub-archive + +This directory contains a Visual Basic project example for +using the zip32.dll library. This project updates the Zip 2.3 VB +project example and includes some bug fixes and many additional notes +but is still compatible with zip32.dll. See the comments in the form +and project files for details. It has been tested on VB 5 and VB 6. + +Zip 2.31 itself had bug fixes as well, including some related to the +dll, and you should now use a version of zip32.dll from that or later. +This dll includes a fix for the VB dll bug where Date, szRootDir, and +szTempDir were not passed in correctly and setting these to anything +but NULL could impact the dll and maybe crash it. You can tell which +version you have by right clicking on zip32.dll in a file listing, +looking at properties, selecting the Version tab, and verifying the +Product Version is at least 2.31. + +A new dll is available as part of this Zip 3.0 release and a +new VB project is included in the VBz64 directory. This dll and +project supports Zip64 and large files but is not backward compatible +with Zip32.dll. You will need the new zip32z64.dll to use this project, +which can be compiled from Zip 3.0. See windll/VBz64 for details. + +Note that the files may saved in unix format with carriage returns +stripped. These must be restored before the project can be successfully +used. This can be done by using the -a option to unzip. Another way to +do this is to open each file in WordPad, select and cut a line, paste +the line back, and save the file. This will force WordPad to format +the entire file. + +Ed Gordon +2/2/2007 diff --git a/windll/contents b/windll/contents new file mode 100644 index 0000000..36da176 --- /dev/null +++ b/windll/contents @@ -0,0 +1,42 @@ +Contents of the "windll" sub-archive for Zip 2.2 and later: + + contents this file + windll16.def definition file for 16-bit Zip DLL + windll32.def definition file for 32-bit Zip DLL + windll.c Contains the entry point for the DLL, "fake" printing, + and password functions. + windll.h header file for both 16 and 32-bit DLLs. + zipver.h versioning information for resource file, and also + used by WiZ application itself. + windll.rc resource file for both 16 and 32-bit DLLs + windll.txt simplistic explanation of how to use DLL. + structs.h header file used by both the dll and by WiZ which defines + several structures passed to the dll. + example.c a very simplistic example of how to load the dll, and make + a call into it. + example.h header file for example.c + + borland\dll <dir> contains 16 and 32 bit make files for the zip dlls. + borland\lib <dir> contains 32 bit make files for the zip32 static library + visualc\dll <dir> contains Visual C++ 5.0 project and make files for + zip32 dll. + visualc\lib <dir> contains Visual C++ 5.0 project and make files for + zip32 static library. + +The Microsoft C port has not been tested as completely as the Borland port. +Note that Borland C++ 5.0 is full of bugs version 4.5 is recommended instead. +If you must use Borland C++ 5.0, using the Intel optimizing compiler is +required to avoid crashes (possibly due to a bug in the stat() function +in the normal Borland compiler.) This does have the advantage of giving you +a smaller code size than the 4.52 compiler. + +Borland C++ 5.01 has resolved many of the problems seen with 5.0, and +can now reliably be used. + +Note that I have been singularly unsuccessful in getting this to compile +and run under MSVC 1.52c. + +Last updated October 13, 1997 + +Mike White + diff --git a/windll/example.c b/windll/example.c new file mode 100644 index 0000000..f1a1936 --- /dev/null +++ b/windll/example.c @@ -0,0 +1,375 @@ +/* + Copyright (c) 1990-1999 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 1999-Oct-05 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, both of these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html +*/ +/* + A very simplistic example of how to load the zip dll and make a call into it. + Note that none of the command line options are implemented in this example. + + */ + +#ifndef WIN32 +# define WIN32 +#endif +#define API + +#include <sys/types.h> +#include <sys/stat.h> +#include <time.h> +#include <string.h> +#ifdef __BORLANDC__ +#include <dir.h> +#else +#include <direct.h> +#endif +#include "example.h" +#include "zipver.h" + +#ifdef WIN32 +#include <commctrl.h> +#include <winver.h> +#else +#include <ver.h> +#endif + +#ifdef WIN32 +#define ZIP_DLL_NAME "ZIP32.DLL\0" +#else +#define ZIP_DLL_NAME "ZIP16.DLL\0" +#endif + +#define DLL_WARNING "Cannot find %s."\ + " The Dll must be in the application directory, the path, "\ + "the Windows directory or the Windows System directory." +#define DLL_VERSION_WARNING "%s has the wrong version number."\ + " Insure that you have the correct dll's installed, and that "\ + "an older dll is not in your path or Windows System directory." + +int hFile; /* file handle */ + +ZCL ZpZCL; +LPZIPUSERFUNCTIONS lpZipUserFunctions; +HANDLE hZUF = (HANDLE)NULL; +HINSTANCE hUnzipDll; +HANDLE hFileList; +ZPOPT ZpOpt; +#ifdef WIN32 +DWORD dwPlatformId = 0xFFFFFFFF; +#endif +HINSTANCE hZipDll; + + +/* Forward References */ +_DLL_ZIP ZipArchive; +_ZIP_USER_FUNCTIONS ZipInit; +ZIPSETOPTIONS ZipSetOptions; + +void FreeUpMemory(void); +int WINAPI DummyPassword(LPSTR, int, LPCSTR, LPCSTR); +int WINAPI DummyPrint(char far *, unsigned long); +int WINAPI WINAPI DummyComment(char far *); + +#ifdef WIN32 +BOOL IsNT(VOID); +#endif + +/**************************************************************************** + + FUNCTION: Main(int argc, char **argv) + +****************************************************************************/ +#ifdef __BORLANDC__ +# ifdef WIN32 +#pragma argsused +# endif +#endif +int main(int argc, char **argv) +{ +LPSTR szFileList; +char **index, *sz; +int retcode, i, cc; +DWORD dwVerInfoSize; +DWORD dwVerHnd; +char szFullPath[PATH_MAX]; +#ifdef WIN32 +char *ptr; +#else +HFILE hfile; +OFSTRUCT ofs; +#endif +HANDLE hMem; /* handle to mem alloc'ed */ + +if (argc < 3) + return 0; /* Exits if not proper number of arguments */ + +hZUF = GlobalAlloc( GPTR, (DWORD)sizeof(ZIPUSERFUNCTIONS)); +if (!hZUF) + { + return 0; + } +lpZipUserFunctions = (LPZIPUSERFUNCTIONS)GlobalLock(hZUF); + +if (!lpZipUserFunctions) + { + GlobalFree(hZUF); + return 0; + } + +lpZipUserFunctions->print = DummyPrint; +lpZipUserFunctions->password = DummyPassword; +lpZipUserFunctions->comment = DummyComment; + +/* Let's go find the dll */ +#ifdef WIN32 +if (SearchPath( + NULL, /* address of search path */ + ZIP_DLL_NAME, /* address of filename */ + NULL, /* address of extension */ + PATH_MAX, /* size, in characters, of buffer */ + szFullPath, /* address of buffer for found filename */ + &ptr /* address of pointer to file component */ + ) == 0) +#else +hfile = OpenFile(ZIP_DLL_NAME, &ofs, OF_SEARCH); +if (hfile == HFILE_ERROR) +#endif + { + char str[256]; + wsprintf (str, DLL_WARNING, ZIP_DLL_NAME); + printf("%s\n", str); + FreeUpMemory(); + return 0; + } +#ifndef WIN32 +else + lstrcpy(szFullPath, ofs.szPathName); +_lclose(hfile); +#endif + +/* Now we'll check the zip dll version information */ +dwVerInfoSize = + GetFileVersionInfoSize(szFullPath, &dwVerHnd); + +if (dwVerInfoSize) + { + BOOL fRet, fRetName; + char str[256]; + LPSTR lpstrVffInfo; /* Pointer to block to hold info */ + LPSTR lszVer = NULL; + LPSTR lszVerName = NULL; + UINT cchVer = 0; + + /* Get a block big enough to hold the version information */ + hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize); + lpstrVffInfo = GlobalLock(hMem); + + /* Get the version information */ + GetFileVersionInfo(szFullPath, 0L, dwVerInfoSize, lpstrVffInfo); + fRet = VerQueryValue(lpstrVffInfo, + TEXT("\\StringFileInfo\\040904E4\\FileVersion"), + (LPVOID)&lszVer, + &cchVer); + fRetName = VerQueryValue(lpstrVffInfo, + TEXT("\\StringFileInfo\\040904E4\\CompanyName"), + (LPVOID)&lszVerName, + &cchVer); + if (!fRet || !fRetName || + (lstrcmpi(lszVer, ZIP_DLL_VERSION) != 0) || + (lstrcmpi(lszVerName, COMPANY_NAME) != 0)) + { + wsprintf (str, DLL_VERSION_WARNING, ZIP_DLL_NAME); + printf("%s\n", str); + FreeUpMemory(); + return 0; + } + /* free memory */ + GlobalUnlock(hMem); + GlobalFree(hMem); + } +else + { + char str[256]; + wsprintf (str, DLL_VERSION_WARNING, ZIP_DLL_NAME); + printf("%s\n", str); + FreeUpMemory(); + return 0; + } +/* Okay, now we know that the dll exists, and has the proper version + * information in it. We can go ahead and load it. + */ +hZipDll = LoadLibrary(ZIP_DLL_NAME); +#ifndef WIN32 +if (hZipDll > HINSTANCE_ERROR) +#else +if (hZipDll != NULL) +#endif + { + (_DLL_ZIP)ZipArchive = (_DLL_ZIP)GetProcAddress(hZipDll, "ZpArchive"); + (ZIPSETOPTIONS)ZipSetOptions = (ZIPSETOPTIONS)GetProcAddress(hZipDll, "ZpSetOptions"); + if (!ZipArchive || !ZipSetOptions) + { + char str[256]; + wsprintf (str, "Could not get entry point to %s", ZIP_DLL_NAME); + MessageBox((HWND)NULL, str, "Info-ZIP Example", MB_ICONSTOP | MB_OK); + FreeUpMemory(); + return 0; + } + } +else + { + char str[256]; + wsprintf (str, "Could not load %s", ZIP_DLL_NAME); + printf("%s\n", str); + FreeUpMemory(); + return 0; + } + +(_ZIP_USER_FUNCTIONS)ZipInit = (_ZIP_USER_FUNCTIONS)GetProcAddress(hZipDll, "ZpInit"); +if (!ZipInit) + { + printf("Cannot get address of ZpInit in Zip dll. Terminating..."); + FreeLibrary(hZipDll); + FreeUpMemory(); + return 0; + } +if (!(*ZipInit)(lpZipUserFunctions)) + { + printf("Application functions not set up properly. Terminating..."); + FreeLibrary(hZipDll); + FreeUpMemory(); + return 0; + } + +/* Here is where the action starts */ +ZpOpt.fSuffix = FALSE; /* include suffixes (not yet implemented) */ +ZpOpt.fEncrypt = FALSE; /* true if encryption wanted */ +ZpOpt.fSystem = FALSE; /* true to include system/hidden files */ +ZpOpt.fVolume = FALSE; /* true if storing volume label */ +ZpOpt.fExtra = FALSE; /* true if including extra attributes */ +ZpOpt.fNoDirEntries = FALSE; /* true if ignoring directory entries */ +ZpOpt.fVerbose = FALSE; /* true if full messages wanted */ +ZpOpt.fQuiet = FALSE; /* true if minimum messages wanted */ +ZpOpt.fCRLF_LF = FALSE; /* true if translate CR/LF to LF */ +ZpOpt.fLF_CRLF = FALSE; /* true if translate LF to CR/LF */ +ZpOpt.fJunkDir = FALSE; /* true if junking directory names */ +ZpOpt.fGrow = FALSE; /* true if allow appending to zip file */ +ZpOpt.fForce = FALSE; /* true if making entries using DOS names */ +ZpOpt.fMove = FALSE; /* true if deleting files added or updated */ +ZpOpt.fUpdate = FALSE; /* true if updating zip file--overwrite only + if newer */ +ZpOpt.fFreshen = FALSE; /* true if freshening zip file--overwrite only */ +ZpOpt.fJunkSFX = FALSE; /* true if junking sfx prefix*/ +ZpOpt.fLatestTime = FALSE; /* true if setting zip file time to time of + latest file in archive */ +ZpOpt.fComment = FALSE; /* true if putting comment in zip file */ +ZpOpt.fOffsets = FALSE; /* true if updating archive offsets for sfx + files */ +ZpOpt.fDeleteEntries = FALSE; /* true if deleting files from archive */ +ZpOpt.fRecurse = 0; /* subdir recursing mode: 1 = "-r", 2 = "-R" */ +ZpOpt.fRepair = 0; /* archive repair mode: 1 = "-F", 2 = "-FF" */ +ZpOpt.Date = NULL; /* Not using, set to NULL pointer */ +getcwd(szFullPath, PATH_MAX); /* Set directory to current directory */ +ZpOpt.szRootDir = szFullPath; + +ZpZCL.argc = argc - 2; /* number of files to archive - adjust for the + actual number of file names to be added */ +ZpZCL.lpszZipFN = argv[1]; /* archive to be created/updated */ + +/* Copy over the appropriate portions of argv, basically stripping out argv[0] + (name of the executable) and argv[1] (name of the archive file) + */ +hFileList = GlobalAlloc( GPTR, 0x10000L); +if ( hFileList ) + { + szFileList = (char far *)GlobalLock(hFileList); + } +index = (char **)szFileList; +cc = (sizeof(char *) * ZpZCL.argc); +sz = szFileList + cc; + +for (i = 0; i < ZpZCL.argc; i++) + { + cc = lstrlen(argv[i+2]); + lstrcpy(sz, argv[i+2]); + index[i] = sz; + sz += (cc + 1); + } +ZpZCL.FNV = (char **)szFileList; /* list of files to archive */ + +/* Set the options */ +ZipSetOptions(&ZpOpt); + +/* Go zip 'em up */ +retcode = ZipArchive(ZpZCL); +if (retcode != 0) + printf("Error in archiving\n"); + +GlobalUnlock(hFileList); +GlobalFree(hFileList); +FreeUpMemory(); +FreeLibrary(hZipDll); +return 1; +} + +void FreeUpMemory(void) +{ +if (hZUF) + { + GlobalUnlock(hZUF); + GlobalFree(hZUF); + } +} + +#ifdef WIN32 +/* This simply determines if we are running on NT */ +BOOL IsNT(VOID) +{ +if(dwPlatformId != 0xFFFFFFFF) + return dwPlatformId; +else +/* note: GetVersionEx() doesn't exist on WinNT 3.1 */ + { + if(GetVersion() < 0x80000000) + { + (BOOL)dwPlatformId = TRUE; + } + else + { + (BOOL)dwPlatformId = FALSE; + } + } +return dwPlatformId; +} +#endif + +/* Password entry routine - see password.c in the wiz directory for how + this is actually implemented in Wiz. If you have an encrypted file, + this will probably give you great pain. Note that none of the + parameters are being used here, and this will give you warnings. + */ +int WINAPI DummyPassword(LPSTR p, int n, LPCSTR m, LPCSTR name) +{ +return 1; +} + +/* Dummy "print" routine that simply outputs what is sent from the dll */ +int WINAPI DummyPrint(char far *buf, unsigned long size) +{ +printf("%s", buf); +return (unsigned int) size; +} + + +/* Dummy "comment" routine. See comment.c in the wiz directory for how + this is actually implemented in Wiz. This will probably cause you + great pain if you ever actually make a call into it. + */ +int WINAPI DummyComment(char far *szBuf) +{ +szBuf[0] = '\0'; +return TRUE; +} diff --git a/windll/example.h b/windll/example.h new file mode 100644 index 0000000..da52598 --- /dev/null +++ b/windll/example.h @@ -0,0 +1,54 @@ +/* + Copyright (c) 1990-1999 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 1999-Oct-05 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, both of these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html +*/ +/* + Example header file +*/ +#ifndef _EXAMPLE_H +#define _EXAMPLE_H + +#include <windows.h> +#include <assert.h> /* required for all Windows applications */ +#include <stdlib.h> +#include <stdio.h> +#include <commdlg.h> +#include <dlgs.h> +#include <windowsx.h> + +#ifndef EXPENTRY +#define EXPENTRY WINAPI +#endif + +#include "structs.h" + +/* Defines */ +#ifndef MSWIN +#define MSWIN +#endif + +typedef int (WINAPI * _DLL_ZIP)(ZCL); +typedef int (WINAPI * _ZIP_USER_FUNCTIONS)(LPZIPUSERFUNCTIONS); +typedef BOOL (WINAPI * ZIPSETOPTIONS)(LPZPOPT); + +/* Global variables */ + +extern LPZIPUSERFUNCTIONS lpZipUserFunctions; + +extern HINSTANCE hZipDll; + +extern int hFile; /* file handle */ + +/* Global functions */ + +int WINAPI DisplayBuf(char far *, unsigned long int); +extern _DLL_ZIP ZipArchive; +extern _ZIP_USER_FUNCTIONS ZipInit; +extern ZIPSETOPTIONS ZipSetOptions; + +#endif /* _EXAMPLE_H */ + diff --git a/windll/structs.h b/windll/structs.h new file mode 100644 index 0000000..0f36df6 --- /dev/null +++ b/windll/structs.h @@ -0,0 +1,30 @@ +/* + windll/structs.h - Zip 3 + + Copyright (c) 1990-2003 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2003-May-08 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, all these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html +*/ +#ifndef _ZIP_STRUCTS_H +#define _ZIP_STRUCTS_H + +#ifndef Far +# define Far far +#endif + +/* Porting definations between Win 3.1x and Win32 */ +#ifdef WIN32 +# define far +# define _far +# define __far +# define near +# define _near +# define __near +#endif + +#include "../api.h" + +#endif /* _ZIP_STRUCTS_H */ diff --git a/windll/visualc/dll/zip32z64.dsp b/windll/visualc/dll/zip32z64.dsp new file mode 100644 index 0000000..46bea99 --- /dev/null +++ b/windll/visualc/dll/zip32z64.dsp @@ -0,0 +1,168 @@ +# Microsoft Developer Studio Project File - Name="zip32z64" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=zip32z64 - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "zip32z64.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "zip32z64.mak" CFG="zip32z64 - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "zip32z64 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "zip32z64 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "zip32z64 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release\app"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "WIN32" /YX /FD /c
+# ADD CPP /nologo /Zp4 /MT /W3 /GX /O2 /I "..\..\.." /I "..\..\..\WINDLL" /I "..\..\..\WIN32" /D "NDEBUG" /D "_WINDOWS" /D "WIN32" /D "NO_ASM" /D "WINDLL" /D "MSDOS" /D "USE_ZIPMAIN" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG" /d "WIN32"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386
+
+!ELSEIF "$(CFG)" == "zip32z64 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\Debug\app"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "WIN32" /YX /FD /c
+# ADD CPP /nologo /Zp4 /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\ZIP" /I "..\..\..\WINDLL" /I "..\..\..\WIN32" /D "_DEBUG" /D "_WINDOWS" /D "WIN32" /D "NO_ASM" /D "WINDLL" /D "MSDOS" /D "USE_ZIPMAIN" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG" /d "WIN32"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"..\Debug\app/zip32z64.dll" /pdbtype:sept
+# SUBTRACT LINK32 /map
+
+!ENDIF
+
+# Begin Target
+
+# Name "zip32z64 - Win32 Release"
+# Name "zip32z64 - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\..\api.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\crc32.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\crypt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\deflate.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\fileio.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\globals.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\win32\nt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\trees.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\ttyio.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\util.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\win32\win32.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\win32\win32i64.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\win32\win32zip.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\windll\windll.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\windll\windll.rc
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\windll\windll32.def
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\zip.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\zipfile.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\zipup.c
+# End Source File
+# End Target
+# End Project
diff --git a/windll/visualc/dll/zip32z64.dsw b/windll/visualc/dll/zip32z64.dsw new file mode 100644 index 0000000..4643105 --- /dev/null +++ b/windll/visualc/dll/zip32z64.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "zip32z64"=.\zip32z64.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/windll/visualc/lib/zip32z64.dsp b/windll/visualc/lib/zip32z64.dsp new file mode 100644 index 0000000..a610912 --- /dev/null +++ b/windll/visualc/lib/zip32z64.dsp @@ -0,0 +1,158 @@ +# Microsoft Developer Studio Project File - Name="zip32z64" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=zip32z64 - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "zip32z64.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "zip32z64.mak" CFG="zip32z64 - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "zip32z64 - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "zip32z64 - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "zip32z64 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\Release\libs"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "_WINDOWS" /D "WIN32" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\.." /I "..\..\..\win32" /I "..\..\..\windll" /D "NDEBUG" /D "_WINDOWS" /D "WIN32" /D "NO_ASM" /D "WINDLL" /D "MSDOS" /D "USE_ZIPMAIN" /D "ZIPLIB" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF "$(CFG)" == "zip32z64 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\Debug\libs"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "_DEBUG" /D "_WINDOWS" /D "WIN32" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\.." /I "..\..\..\win32" /I "..\..\..\windll" /D "_DEBUG" /D "_WINDOWS" /D "WIN32" /D "NO_ASM" /D "WINDLL" /D "MSDOS" /D "USE_ZIPMAIN" /D "ZIPLIB" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ENDIF
+
+# Begin Target
+
+# Name "zip32z64 - Win32 Release"
+# Name "zip32z64 - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\..\api.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\crc32.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\crypt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\deflate.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\fileio.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\globals.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\win32\nt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\trees.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\ttyio.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\util.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\win32\win32.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\win32\win32zip.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\windll\windll.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\windll\windll.rc
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\zip.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\zipfile.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\windll\ziplib.def
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\zipup.c
+# End Source File
+# End Target
+# End Project
diff --git a/windll/visualc/lib/zip32z64.dsw b/windll/visualc/lib/zip32z64.dsw new file mode 100644 index 0000000..4643105 --- /dev/null +++ b/windll/visualc/lib/zip32z64.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "zip32z64"=.\zip32z64.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/windll/windll.aps b/windll/windll.aps Binary files differnew file mode 100644 index 0000000..73e3468 --- /dev/null +++ b/windll/windll.aps diff --git a/windll/windll.c b/windll/windll.c new file mode 100644 index 0000000..f825108 --- /dev/null +++ b/windll/windll.c @@ -0,0 +1,176 @@ +/* + windll/windll.c - Zip 3 + + Copyright (c) 1990-2004 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2003-May-08 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, all these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html +*/ +/* + * windll.c by Mike White loosly based on Mark Adler's zip.c + */ +#include <windows.h> +#include <process.h> +#include <signal.h> +#include <stdarg.h> +#include <ctype.h> +#include "../zip.h" +#include "windll.h" + +HINSTANCE hCurrentInst; +#ifdef ZIPLIB +/* DLL Entry Point */ +#ifdef __BORLANDC__ +#pragma argsused +/* Borland seems to want DllEntryPoint instead of DllMain like MSVC */ +#define DllMain DllEntryPoint +#endif +#ifdef WIN32 +BOOL WINAPI DllMain( HINSTANCE hInstance, + DWORD dwReason, + LPVOID plvReserved) +#else +int WINAPI LibMain( HINSTANCE hInstance, + WORD wDataSegment, + WORD wHeapSize, + LPSTR lpszCmdLine ) +#endif +{ +#ifndef WIN32 +/* The startup code for the DLL initializes the local heap(if there is one) + with a call to LocalInit which locks the data segment. */ + +if ( wHeapSize != 0 ) + { + UnlockData( 0 ); + } +hCurrentInst = hInstance; +return 1; /* Indicate that the DLL was initialized successfully. */ +#else +BOOL rc = TRUE; +switch( dwReason ) + { + case DLL_PROCESS_ATTACH: + // DLL is loaded. Do your initialization here. + // If cannot init, set rc to FALSE. + hCurrentInst = hInstance; + break; + + case DLL_PROCESS_DETACH: + // DLL is unloaded. Do your cleanup here. + break; + default: + break; + } +return rc; +#endif +} + +#ifdef __BORLANDC__ +#pragma argsused +#endif +int FAR PASCAL WEP ( int bSystemExit ) +{ +return 1; +} +#endif /* ZIPLIB */ + +LPSTR szCommentBuf; +HANDLE hStr; + +void comment(unsigned int comlen) +{ +unsigned int i; +if (comlen > 65534L) + comlen = (unsigned int) 65534L; +hStr = GlobalAlloc( GPTR, (DWORD)65535L); +if ( !hStr ) + { + hStr = GlobalAlloc( GPTR, (DWORD) 2); + szCommentBuf = GlobalLock(hStr); + szCommentBuf[0] = '\0'; + return; + } + +szCommentBuf = GlobalLock(hStr); +if (comlen) + { + for (i = 0; i < comlen; i++) + szCommentBuf[i] = zcomment[i]; + szCommentBuf[comlen] = '\0'; + } +else + szCommentBuf[0] = '\0'; +free(zcomment); +zcomment = malloc(1); +*zcomment = 0; +lpZipUserFunctions->comment(szCommentBuf); +return; +} + +#define STDIO_BUF_SIZE 16384 + +int __far __cdecl printf(const char *format, ...) +{ +va_list argptr; +HANDLE hMemory; +LPSTR pszBuffer; +int len; + +va_start(argptr, format); +hMemory = GlobalAlloc(GMEM_MOVEABLE, STDIO_BUF_SIZE); +WinAssert(hMemory); +if (!hMemory) + { + return 0; + } +pszBuffer = (LPSTR)GlobalLock(hMemory); +WinAssert(pszBuffer); +len = wvsprintf(pszBuffer, format, argptr); +va_end(argptr); +WinAssert(strlen(pszBuffer) < STDIO_BUF_SIZE); +len = lpZipUserFunctions->print(pszBuffer, len); +GlobalUnlock(hMemory); +GlobalFree(hMemory); +return len; +} + +/* fprintf clone for code in zip.c, etc. */ +int __far __cdecl fprintf(FILE *file, const char *format, ...) +{ +va_list argptr; +HANDLE hMemory; +LPSTR pszBuffer; +int len; + +va_start(argptr, format); +hMemory = GlobalAlloc(GMEM_MOVEABLE, STDIO_BUF_SIZE); +WinAssert(hMemory); +if (!hMemory) + { + return 0; + } +pszBuffer = GlobalLock(hMemory); +WinAssert(pszBuffer); +len = wvsprintf(pszBuffer, format, argptr); +va_end(argptr); +WinAssert(strlen(pszBuffer) < STDIO_BUF_SIZE); +if ((file == stderr) || (file == stdout)) + { + len = lpZipUserFunctions->print(pszBuffer, len); + } +else + len = write(fileno(file),(char far *)(pszBuffer), len); +GlobalUnlock(hMemory); +GlobalFree(hMemory); +return len; +} + +void __far __cdecl perror(const char *parm1) +{ +printf("%s", parm1); +} + + diff --git a/windll/windll.h b/windll/windll.h new file mode 100644 index 0000000..0a45fc1 --- /dev/null +++ b/windll/windll.h @@ -0,0 +1,63 @@ +/* + windll/windll.h - Zip 3 + + Copyright (c) 1990-2004 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2003-May-08 or later + (the contents of which are also included in zip.h) for terms of use. + If, for some reason, all these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html +*/ +/* + WiZ 1.0 header file for zip dll +*/ +#ifndef _WINDLL_H +#define _WINDLL_H + +#include "structs.h" + +#ifndef MSWIN +#define MSWIN +#endif + +#ifndef USE_ZIPMAIN +# define USE_ZIPMAIN +#endif + +#ifndef NDEBUG +# define WinAssert(exp) \ + {\ + if (!(exp))\ + {\ + char szBuffer[40];\ + sprintf(szBuffer, "File %s, Line %d",\ + __FILE__, __LINE__) ;\ + if (IDABORT == MessageBox((HWND)NULL, szBuffer,\ + "Assertion Error",\ + MB_ABORTRETRYIGNORE|MB_ICONSTOP))\ + FatalExit(-1);\ + }\ + } + +#else +# define WinAssert(exp) +#endif + +#define cchFilesMax 4096 + +extern int WINAPI ZpArchive(ZCL C, LPZPOPT Opts); +extern HWND hGetFilesDlg; +extern char szFilesToAdd[80]; +extern char rgszFiles[cchFilesMax]; +BOOL WINAPI CommentBoxProc(HWND hwndDlg, WORD wMessage, WPARAM wParam, LPARAM lParam); +BOOL PasswordProc(HWND, WORD, WPARAM, LPARAM); +void CenterDialog(HWND hwndParent, HWND hwndDlg); +void comment(unsigned int); + +extern LPSTR szCommentBuf; +extern HANDLE hStr; +extern HWND hWndMain; +void __far __cdecl perror(const char *); + +#endif /* _WINDLL_H */ + diff --git a/windll/windll.rc b/windll/windll.rc new file mode 100644 index 0000000..4fab86a --- /dev/null +++ b/windll/windll.rc @@ -0,0 +1,57 @@ +#define APSTUDIO_READONLY_SYMBOLS
+#define APSTUDIO_HIDDEN_SYMBOLS
+#include <windows.h>
+#if (defined(WIN32) && !defined(__EMX__) && !defined(__MINGW32__))
+#include <winver.h>
+#endif
+#undef APSTUDIO_HIDDEN_SYMBOLS
+#include "../revision.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION Z_MAJORVER,Z_MINORVER,Z_PATCHLEVEL,0
+ PRODUCTVERSION Z_MAJORVER,Z_MINORVER,Z_PATCHLEVEL,0
+ FILEFLAGSMASK 0x3L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_DLL
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+#ifdef _UNICODE
+ BLOCK "040904B0"
+#else
+ BLOCK "040904E4"
+#endif
+ BEGIN
+ VALUE "CompanyName", IZ_COMPANY_NAME "\0"
+ VALUE "FileDescription", "Info-ZIP's Zip dll\0"
+ VALUE "FileVersion", VERSION "\0"
+ VALUE "InternalName", "Zip32z64\0"
+ VALUE "LegalCopyright", "Info-ZIP 1997 - 2008\0"
+ VALUE "OriginalFilename", "ZIP32Z64.DLL\0"
+ VALUE "ProductName", "Info-ZIP's WiZ\0"
+ VALUE "ProductVersion", VERSION "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+#ifdef _UNICODE
+ VALUE "Translation", 0x409, 1200
+#else
+ VALUE "Translation", 0x409, 1252
+#endif
+ END
+END
diff --git a/windll/windll.txt b/windll/windll.txt new file mode 100644 index 0000000..8df4bae --- /dev/null +++ b/windll/windll.txt @@ -0,0 +1,147 @@ +The code set out below is not intended to be compiled, but is only intended as +a very simplistic pointer to how to load and call the dll. You will have to +look in the files referenced below for actual, working code. + +There is one entry point that uses the structure shown below: + +typedef struct { +LPSTR Date; /* Date to include after */ +LPSTR szRootDir; /* Directory to use as base for zipping */ +LPSTR szTempDir; /* Temporary directory used during zipping */ +BOOL fTemp; /* Use temporary directory '-b' during zipping */ +BOOL fSuffix; /* include suffixes (not implemented in WiZ) */ +BOOL fEncrypt; /* encrypt files */ +BOOL fSystem; /* include system and hidden files */ +BOOL fVolume; /* Include volume label */ +BOOL fExtra; /* Exclude extra attributes */ +BOOL fNoDirEntries; /* Do not add directory entries */ +BOOL fExcludeDate; /* Exclude files earlier than specified date */ +BOOL fIncludeDate; /* Include only files earlier than specified date */ +BOOL fVerbose; /* Mention oddities in zip file structure */ +BOOL fQuiet; /* Quiet operation */ +BOOL fCRLF_LF; /* Translate CR/LF to LF */ +BOOL fLF_CRLF; /* Translate LF to CR/LF */ +BOOL fJunkDir; /* Junk directory names */ +BOOL fGrow; /* Allow appending to a zip file */ +BOOL fForce; /* Make entries using DOS names (k for Katz) */ +BOOL fMove; /* Delete files added or updated in zip file */ +BOOL fDeleteEntries; /* Delete files from zip file */ +BOOL fUpdate; /* Update zip file--overwrite only if newer */ +BOOL fFreshen; /* Freshen zip file--overwrite only */ +BOOL fJunkSFX; /* Junk SFX prefix */ +BOOL fLatestTime; /* Set zip file time to time of latest file in it */ +BOOL fComment; /* Put comment in zip file */ +BOOL fOffsets; /* Update archive offsets for SFX files */ +BOOL fPrivilege; /* Use privileges (WIN32 only) */ +BOOL fEncryption; /* TRUE if encryption supported, else FALSE. + this is a read-only flag */ +LPSTR szSplitSize; /* This string contains the size that you want to + split the archive into. i.e. 100 for 100 bytes, + 2K for 2 k bytes, where K is 1024, m for meg + and g for gig. If this string is not NULL it + will automatically be assumed that you wish to + split an archive. */ +LPSTR szIncludeList; /* Pointer to include file list string (for VB) */ +long IncludeListCount; /* Count of file names in the include list array */ +char **IncludeList; /* Pointer to include file list array. Note that the last + entry in the array must be NULL */ +LPSTR szExcludeList; /* Pointer to exclude file list (for VB) */ +long ExcludeListCount; /* Count of file names in the include list array */ +char **ExcludeList; /* Pointer to exclude file list array. Note that the last + entry in the array must be NULL */ +int fRecurse; /* Recurse into subdirectories. 1 => -r, 2 => -R */ +int fRepair; /* Repair archive. 1 => -F, 2 => -FF */ +char fLevel; /* Compression level (0 - 9) */ +} ZPOPT, _far *LPZPOPT; + +The main entry point is ZpArchive(ZCL, *Opts) where the structure shown below +is passed to the DLL when it is called. + +typedef struct { +int argc; = Count of files to zip +LPSTR lpszZipFN; = Archive file name +char **FNV; = file names to zip up. Think of this an argv +LPSTR lpszAltFNL; /* pointer to a string containing a list of file names to zip up, + separated by whitespace. Intended for use only by VB users, all + others should set this to NULL. */ +} ZCL, _far *LPZCL; + + +For examples of how the actual calls to the dll were set up in WiZ, look in +the file makezip.c in the WiZ source directory. + +For examples of how the actual loading and unloading of the dll's themselves +was done, look in wizmain.c in the WiZ source directory. Note that WiZ looks +specifically for a particular version number of the dll, and also expects to +find the company name to be Info-ZIP. This is to protect from getting different +versions of the dll loaded, with resulting unknown behavior. + +There is a very simplistic example of how to load and call into the dll in +example.c and example.h. Note that this example does not implement any +command line switches at all, and is merely intended as a guide for those +brave enough to enter a new world. + +There are three additional (at the moment) entry points: + +ZpInit, defined as + +int WINAPI ZpInit(ZIPUSERFUNCTIONS far * lpZipUserFunc); + +where ZIPUSERFUNCTIONS is defined as below. + +ZpVersion, defined as + +ZpVer * ZpVersion(void); + +where ZpVer is defined as: + +typedef struct _ZpVer { + ulg structlen; /* length of the struct being passed */ + ulg flag; /* bit 0: is_beta bit 1: uses_zlib */ + char *betalevel; /* e.g., "g BETA" or "" */ + char *date; /* e.g., "4 Sep 95" (beta) or "4 September 1995" */ + char *zlib_version; /* e.g., "0.95" or NULL */ + BOOL fEncryption; /* TRUE if encryption enabled, FALSE otherwise */ + _zip_version_type zip; + _zip_version_type os2dll; + _zip_version_type windll; +} ZpVer; + +See api.c for exactly what ZpVersion does, but the short version of +what it does is return the zip and dll versions in the ZpVer structure. +The structure typedef's are in api.h. It will also tell you if encryption +is enabled. + +The typedef's for the function pointers in the structure ZIPUSERFUNCTIONS +are shown immediately below. + +typedef int (WINAPI DLLPRNT) (LPSTR, unsigned long); +typedef int (WINAPI DLLPASSWORD) (LPSTR, int, LPCSTR, LPCSTR); +typedef int (WINAPI DLLSPLIT) (LPSTR); +#ifdef ZIP64_SUPPORT +typedef int (WINAPI DLLSERVICE) (LPCSTR, __int64); +typedef int (WINAPI DLLSERVICE_NO_INT64) (LPCSTR, unsigned long, unsigned long); +#else +typedef int (WINAPI DLLSERVICE) (LPCSTR, unsigned long); +#endif +#endif +typedef int (WINAPI DLLCOMMENT)(LPSTR); + + +typedef struct { +DLLPRNT *print; +DLLCOMMENT *comment; +DLLPASSWORD *password; +DLLSPLIT *split; /* This MUST be set to NULL unless you want to be queried + for a destination for each split archive. */ +#ifdef ZIP64_SUPPORT +DLLSERVICE *ServiceApplication64; +DLLSERVICE_NO_INT64 *ServiceApplication64_No_Int64; +#else +DLLSERVICE *ServiceApplication; +#endif +} ZIPUSERFUNCTIONS, far * LPZIPUSERFUNCTIONS; + +Last revised April 26, 2004. + +Mike White diff --git a/windll/windll16.def b/windll/windll16.def new file mode 100644 index 0000000..1173b5f --- /dev/null +++ b/windll/windll16.def @@ -0,0 +1,15 @@ +;module-definition file for Windows Zip DLL -- used by link.exe +LIBRARY ZIP16 ; Library module name +DESCRIPTION 'Windows Info-ZIP Zip DLL 1.01 by Info-ZIP, Mike White 1996' + +CODE PRELOAD FIXED + +DATA PRELOAD MOVEABLE + +EXPORTS + ZpArchive + ZpVersion + ZpInit + ZpSetOptions + ZpGetOptions + diff --git a/windll/windll32.def b/windll/windll32.def new file mode 100644 index 0000000..f1426ee --- /dev/null +++ b/windll/windll32.def @@ -0,0 +1,14 @@ +;module-definition file for Windows Zip DLL -- used by link.exe + +LIBRARY ZIP32Z64 ; Library module name +DESCRIPTION 'Windows Info-ZIP Zip DLL 3.0 by Info-ZIP, Mike White 2004' + +;CODE PRELOAD FIXED + +;DATA PRELOAD MOVEABLE + +EXPORTS + ZpArchive + ZpVersion + ZpInit + diff --git a/windll/ziplib.def b/windll/ziplib.def new file mode 100644 index 0000000..a768740 --- /dev/null +++ b/windll/ziplib.def @@ -0,0 +1,15 @@ +;module-definition file for Windows Zip static library -- used by link.exe +LIBRARY ZIP64 ; Library module name +DESCRIPTION 'Windows Info-ZIP Zip Library 1.02 by Info-ZIP, Mike White 1997' + +CODE PRELOAD FIXED + +DATA PRELOAD MOVEABLE + +EXPORTS + ZpArchive + ZpVersion + ZpInit + ZpSetOptions + ZpGetOptions + |