Xceed Zip Compression Library Documentation
64-bit values
Xceed Zip control reference > 64-bit values

As of version 5.0, Xceed Zip supports the Zip64 zip file format which means that 64-bit values need to be handled and displayed properly. In order to keep Xceed Zip backwards compatible with previous versions, some the events that provide byte/size information, as well as the GetZipFileInformation method were given a 64-bit counterpart. These counterparts have the same names as the regular events except that they have "64" added to the name (e.g., GlobalStatus64)

Each of these counterparts has 2 parameters related to byte/size rather than one. For example, if the 32-bit version of an event had a parameter named lSize, in the 64-bit version of the event, this parameter would be split in two: lSizeLow and lSizeHigh. lSize low represents the 32 low-order bits and lSizeHigh represents the 32 high-order bits. These values can then be combined to retrieve the complete 64-bit value.

To split zip files into parts that are larger than 4 gigs, the SplitSize property must be used in conjunction with the SplitSizeHigh property, or the SplitSize64 property, which is the 64-bit counterpart of the SplitSize and SplitSizeHigh properties, can be used. 

For example, if we were to take the hexadecimal value 0xFFFFFFFE and separate it into its low-order and high-order bits, the low-order bits would be FFFE and the high-order bits would be FFFF.

These values can then be combined in order to retrieve the 64-bit value as demonstrated in the following Visual Basic example:

Visual Basic Copy Code

Private Function GetDoubleFromTwoLongs( ByVal lHigh As Long, ByVal lLow As Long ) As Double

   Dim returnValue As Double 

   ' Since VB's longs are signed, we need to bring them back
   ' to a positive value before combining them, if applicable 

   returnValue = IIf( lHigh < 0, 4294967296# + lHigh, lHigh )
   returnValue = returnValue * 4294967296#
   returnValue = returnValue + IIf( lLow < 0, 4294967296 + lLow, lLow ) 

   GetDoubleFromTwoLongs = returnValue
End Function 

' In order to combine this values in C, the following code can be used:

' ULONGLONG ullValue = ( ( ( ULONGLONG )lSizeHigh ) << 32 ) + ( ( ULONGLONG )lSizeLow );

In Delphi, these values can be combined in the following manner:

Delphi Copy Code

var

  lSizeLow  : LongInt; 
  lSizeHigh : LongInt; 
  llSize    : Int64;

begin

  { Value examples } 
  lSizeLow  := -1; 
  lSizeHigh := 1;  

  { How to convert two signed 32-bit values to an Int64 } 
  llSize := ( Int64( Longword( lSizeHigh ) ) shl 32 ) + ( Int64( Longword( lSizeLow ) ) );

The following example demonstrates how to get two long values from a 64-bit integer. The values retrieved can then be assigned to the SplitSize and SplitSizeHigh values when creating split zip files.
Visual Basic Copy Code

Private Sub GetTwoLongsFromInt64(ByVal cInt64 As Currency, ByRef lHigh As Long, ByRef lLow As Long)

  Dim cRemainder As Currency

  ' Compute what multiple of &H7FFFFFFF the supplied 64-bit value
  lHigh = CLng(Fix(cInt64 / 4294967296#))

  ' In an ideal world, the Mod operator would be used to compute the remainder.
  ' Unfortunately, in VB6 it casts its operand to Long so most attempts will overflow
  ' We will therefore find the remainder by substracting the high part from the 64-bit value
  cRemainder = cInt64 - (lHigh * 4294967296#)

  ' If the remaining value is smaller or equal than a signed 32 bit value (&H7FFFFFFF)
  If (cRemainder <= 2147483647#) Then
    ' Use the remaining value as the low part
    lLow = CLng(cRemainder)
  Else
    ' Wrap the remaining value around so it expresses as a signed 32 bit value
    cRemainder = cRemainder - 4294967296#
 
    ' Use the transformed remaining value as the low part
    lLow = (CLng(cRemainder))
  End If
End Sub