PasXip.pas issue.
Hi Team, I recently started to play in 64 bit. Normally I was 32 bit exclusive. I ran up against an issue with paszip.pas, used in a couple of places in various 3rd Party libraries. I kept geting an error at line 4341 or thereabouts: file_ := INVALID_HANDLE_VALUE; Tracing, I found variable file_ was defined at line around 3963 as a DWORD: file_: dword; This is fine in 32bit but problematic in 64bit. The solution was to change the declaration to: file_: THandle; Now paszip.pas builds without issue in both 32 & 64 bit. HTH in some way..
Regards, Ian
Please try with the above commit, and close if it is OK for you.
I tried to fix all wrong occurrences of DWORD in this unit.
Builds & runs OK. Thank you. Ian
I was still experiencing issues with 64bit. Examining INVALID_HANDLE_VALUE at the error line I found it to be a rediculous value: 1811674407373709551615. Doing some research I found that INVALID_HANDLE_VALUE seems to be generally assigned a value of -1. I made this change in PasZip:
{$WARNINGS OFF} {$Q-,R-} // Turn range checking and overflow checking off
{ $D-,L-}
{$I Synopse.inc}
interface
uses {$IFDEF MSWINDOWS} Windows, {$ELSE} Types, {$ENDIF MSWINDOWS} SysUtils;
////////////////////////////////////////////////////////////////////// const // This const add on 09/12/2024. INVALID_HANDLE_VALUE = THandle(-1); // Add the constant here /////////////////////////////////////////////////////////////////////
type {$IFDEF HASCODEPAGE} RawByteZip = RawByteString; TZipName = type AnsiString(437); {$ELSE} RawByteZip = AnsiString; TZipName = AnsiString; {$ENDIF HASCODEPAGE}
I will advise if I have any more issues.
Please try with the above commit.
Using a function like in mORMot 2 seems a cleaner way.
No problem. Either way seems to work.
I will let you know after some more testing.
These variables must also be THandle types:
file_, map: dword;here https://github.com/synopse/mORMot/blob/master/PasZip.pas#L249Handle: integer;here https://github.com/synopse/mORMot/blob/master/PasZip.pas#L298
P.S. Also, there may be errors related to the fact that the variables used to store the size/offset have a Cardinal type (for files >2GB).
About the use of cardinal, this would need to support the Zip64 format, which is clearly out of scope of this small unit (it is a bit complex to implement).
We have mormot.core.zip.pas for full zip support, including the Zip64 format.
No reaction.
Closing.
Apologies. I lost track of this. All good.
Apologies. I lost track of this. All good.