PDA

View Full Version : Can not create zip files in 6.0.21


Nick
17-Sep-2009, 01:44 PM
Hi Eurekalog team,

First off congrats on releasing 6.0.21. It's great to be able to get Eurekalog going in Delphi 2010 :)

As you may know, I am running a slightly customised version of Eureklog that has some changes Paul Healey made for FogBugz as well as my own for compatibility with FogBugz v7. Because of this I was a bit hesitant in sending this through, but I have checked and double check the customized code and I'm fairly certain it is not the cause of the problem.

The problem appears to be with EZlib2.pas in the function CreateZipFile. I'm not sure why, but the call to zipOpen(ZipFile, 0) returns 0. I have tested 6.0.20 in Delphi 2007 and zipOpen returns a handle. I have tested 6.0.21 in both Delphi 2007 and Delphi 2010 and in both cases it returns 0. My OS is Windows 7, but I have run a test app on Windows XP and it does not create a Zip file either.

Hope I've been clear enough for you to be able replicate.

Cheers,

Nick Barrett

Nick
18-Sep-2009, 05:39 AM
Hello again,

I have done some more testing. I found that if I replaced the EZlib2.pas with the file from version 6.0.20, the zipOpen returned a handle and subsequently the zip file was created and sent to FogBugz.

In the file EZlib2.pas from version 6.0.21 I have found that it is the function _fopen that is causing the problem. In order for it to work I have had to change the code to read as follows:


const
szMSVCRT = 'MSVCRT.DLL'; //<== Changed from MSVCRT20.DLL

var
hLib: THandle;

function _fopen(filename: PAnsiChar; mode: PAnsiChar): Pointer; cdecl;
var
func: function(filename: PAnsiChar; mode: PAnsiChar): Pointer; cdecl;
begin
Result := nil;

hLib := GetModuleHandle(szMSVCRT); //<== Added else hLib always = 0
if (hLib = 0) then Exit;

@func := GetProcAddress(hLib, 'fopen');
if (not Assigned(func)) then Exit;

Result := func(filename, mode);
end;


I found that hLib always came up as 0 so added the GetModuleHandle line. Also in the "Modules" window in the IDE I found that I had msvcrt.dll loaded not msvcrt20.dll so I changed this too.

I have tested this code and found that it runs in both Windows 7 and Windows XP SP3.

Hope this helps :)

Cheers,

Nick Barrett

Alex
18-Sep-2009, 11:41 AM
Hi, Nick.

Many thanks for this info!

This was forgotten test code, which slipped into release :(
We've re-released 6.0.21. Sorry for any inconvenience and thank you for your attention and feedback!