[delphizip] Re: I got another two Errors, code 10123 and 3082

  • From: "R.Peters" <russellpeters@xxxxxxxxxxx>
  • To: delphizip@xxxxxxxxxxxxx
  • Date: Mon, 27 Nov 2006 15:32:22 +1100

You should not be able to get error code 10 (temporary file failure) 
unless it had to create a temporary file and it should not need to use a 
temporary file except :-
1. the file already exists
2. the file is to built on a removable or network drive (had not been 
considering that possibility).

- Russell Peters

Mind Visualizer--Productive Mind Mapping Software wrote, On 27/11/2006 
3:24 PM:
> Really appreciated for your help, I will try the new dll from now on.
>
> and you said converting a widestring to ansiString will cause the path be 
> changed? 
>
> and for error code 10123 and 3082, I forgot if the file already exist or not, 
> but for error code 10, the file didn't exist before calling AddStreamToFile.
>
>
>
>
> Edwin
> Best Regards,
> Mind Visualizer--Productive Mind Mapping Software
> 2006-11-27
>
>
>
> Sender£º R.Peters
> Sent£º 2006-11-27 11:54:00
> Recipient£º delphizip@xxxxxxxxxxxxx
> CC£º 
> Subject£º [delphizip] Re: I got another two Errors, code 10123 and 3082
>
> I prepared another version of DelZip179.dll that handles 'moving' the 
> resulting file differently (probably safer)
> It is http://www.delphizip.org/files/dz061127.zip
> I noticed that you assign a WideString as the filename - this will be 
> converted to a 'normal' string and that may be changing the path for 
> ZipFileName.
> Note that your error can only happen if the file already exists before 
> doing AddStreamToFile otherwise it creates the file using the given 
> ZipFileName.
>
> If the problem is consistent try setting zip.Trace := true and check the 
> messages (in OnZipMasterMessage)or have the dll produce a log file - 
> either will allow you to verify paths/filenames.
>
> - Russell Peters
>
> Mind Visualizer--Productive Mind Mapping Software wrote, On 27/11/2006 
> 1:45 PM:
>   
>> Dear Russell Peters,
>>
>> I use kapersky, but you can forgot about the anti-virus software, recently I 
>> found that the same errors and error 10 occured in my another PC that don't 
>> have anti-virus installed. and according to JclDebug stack trace, it seems 
>> all erros were raise up when calling TZipMaster.AddStreamToFile?
>>
>> and the the following code produced the erros:
>> var
>>   zip: TZipMaster;
>>   tmpFileName: WideString;
>> begin
>>   zip := TZipMaster.Create(nil);
>>   zip.AddOptions := [AddDirNames, AddEncrypt];
>>   zip.AddCompLevel := 5;
>>   zip.CodePage := cpNone;
>>   zip.Trace := False;
>>   zip.Unattended := True;
>>   zip.Verbose := False;
>>
>>   zip.OnMessage := OnZipMasterMessage;
>>
>>   tmpFileName := 
>> WideIncludeTrailingPathDelimiter(WideExtractFilePath(aFileName));//aFileName 
>> is a param. of the function
>>   tmpFileName := tmpFileName + mtHelper.GenGUID;
>>   zip.ZipFileName := tmpFileName;
>>
>>   try
>>     aZip.ZipStream.Clear;
>>     bmp.SaveToStream(aZip.ZipStream);
>>     aZip.AddStreamToFile('images\ + guid, 0, 0)  < > 0 then//guid is a GUID 
>> string like BC2C88AA-B5ED-4463-A7EE-44CB5F379F60
>>     aZip.ZipStream.Clear;
>>
>>   finally
>>     zip.Free;
>>   end;
>>
>>   try
>>     if WideFileExists(aFileName) then
>>     begin
>>       if not SysUtils.deleteFile(aFileName) then
>>         raise Exception.Create('Failed removing original file');
>>     end;
>>
>>      if not mtHelper.RenameFile(tmpFileName, aFileName) then
>>       raise Exception.Create('Failed renaming temporary file');
>>
>>     Result := True;
>>   except
>>     if WideFileExists(tmpFileName) then
>>       deleteFile(tmpFileName);
>>     raise;
>>   end;
>>
>> --------------
>> Edwin
>> Best Regards,
>> Mind Visualizer--Productive Mind Mapping Software
>>
>>
>>
>> Best Regards,
>> Mind Visualizer--Productive Mind Mapping Software
>> 2006-11-27
>>
>>
>>
>> Sender£º R.Peters
>> Sent£º 2006-11-26 14:05:52
>> Recipient£º delphizip@xxxxxxxxxxxxx
>> CC£º 
>> Subject£º [delphizip] Re: I got another two Errors, code 10123 and 3082
>>
>> I have been doing some digging and similar problems have affected other 
>> code (see http://blogs.msdn.com/junfeng/archive/2004/10/09/240355.aspx)
>> Evidently what can happen is that Index service or AntiVirus (or Shadow 
>> copying) can be accessing the temporary file when MoveFile is called and 
>> MoveFile cannot work because it requires exclusive access to both files.
>> If you are still having problems I will try a change in the dll to do 
>> things slightly differently and hopefully get around this problem.
>>
>> Out of curiosity - what Anti-Virus do you use (not that it probably 
>> makes that much difference because what one does others are likely to do).
>> I use eset Nod32 and recently it complained about, and kept removing, a 
>> map file made by Delphi so you never know when they will hit a false 
>> positive.
>> - Russell Peters
>>
>> Mind Visualizer--Productive Mind Mapping Software wrote, On 25/11/2006 
>> 9:45 PM:
>>   
>>     
>>> Thanks very much Russell Peters,
>>>
>>> The program was adding a new zip archive when the error was occured, i.e. 
>>> TZipMaster.ZipFileName was assigned a filename that has not been exists, 
>>> and I login as administrator thus the program had the access permission to  
>>> the folder where the .zip archive was creating in. hower, I use a 
>>> anti-virus with realtime protection enabled:(
>>>
>>> Any further hints? Thanks.
>>>
>>>
>>>
>>>
>>> Best Regards,
>>> Mind Visualizer--Productive Mind Mapping Software
>>> 2006-11-25
>>>
>>>
>>>
>>> Sender£º R.Peters
>>> Sent£º 2006-11-25 13:59:18
>>> Recipient£º delphizip@xxxxxxxxxxxxx
>>> CC£º 
>>> Subject£º [delphizip] Re: I got another two Errors, code 10123 and 3082
>>>
>>> It is normally a problem with the target file not the temporary file
>>> ie. adding files to somefile.zip
>>>    open somefile.zip for reading
>>>    create temporary.zip
>>>    the files already in somefile.zip are copied to temporary.zip.
>>>    close somefile.zip
>>>    the new files are added to temporary.zip
>>>    the new central directory is written to temporary.zip
>>>    temporary.zip is closed
>>>    temporary.zip is 'moved' (copied) to somefile.zip  (***)
>>>    temporary.zip is deleted
>>> It is the move (marked (***)) that is causing your problem and the 
>>> commonest reasons are because some other process is still using it or it 
>>> is Read-Only (somefile.zip).
>>> In your case it is reporting error 5, ERROR_ACCESS_DENIED which is 
>>> access denied.
>>>
>>> There is the possibility that your anti-virus (or similar) is blocking 
>>> the operation of replacing the destination file.
>>> - Russell Peters
>>>
>>> Mind Visualizer--Productive Mind Mapping Software wrote, On 25/11/2006 
>>> 4:30 PM:
>>>   
>>>     
>>>       
>>>> I see now, so it's a bug of the DLL or my something is wrong in my code? I 
>>>> login as administrator thus has the rigth access to the temp folder, and 
>>>> it's supposed that the temporary file the DLL writes to should be used by 
>>>> the DLL itself only, what program else would be likely to use it?  
>>>>
>>>> Could you advise how to avoid this kind of problem? Do you think I should 
>>>> use another temp folder for TZipMaster by setting another value to the 
>>>> TempDir property?
>>>>
>>>>
>>>>
>>>>
>>>> Best Regards,
>>>> Mind Visualizer--Productive Mind Mapping Software
>>>> 2006-11-25
>>>>
>>>>
>>>>
>>>> Sender£º R.Peters
>>>> Sent£º 2006-11-25 13:02:05
>>>> Recipient£º delphizip@xxxxxxxxxxxxx
>>>> CC£º 
>>>> Subject£º [delphizip] Re: I got another two Errors, code 10123 and 3082
>>>>
>>>> When the dll is modifying a zip file it writes to a temporary file and 
>>>> when finished this file is 'moved' to it's destination.
>>>> Mostly by 'moved' it is actually copied over the original file which 
>>>> cannot happen it that file is in use or Read-Only (or if the user is not 
>>>> authorised to modify it).
>>>> Depending upon the circumstances 'move' may also be delete original, 
>>>> then rename or transfer the directory entry to it's new directory.
>>>> This is done by a Win32 function MoveFile hence I generally refer to it 
>>>> as move.
>>>> - Russell Peters
>>>> Mind Visualizer--Productive Mind Mapping Software wrote, On 25/11/2006 
>>>> 3:24 PM:
>>>>   
>>>>     
>>>>       
>>>>         
>>>>> Dear Russell Peters,
>>>>>
>>>>> Thanks very much for your prompt response.
>>>>> Yes, The first error, I raised an exception in the OnMessage handler, I 
>>>>> think I should replace it with a MessageBox.
>>>>>
>>>>> and the  second error, when you say "the temporary file", do you refer to 
>>>>> the .zip file that is being compressing? when you say "moving", do you 
>>>>> refer to an internal operation within TZipMaster, the  DLL or my code? I 
>>>>> used a temporary .zip filename, and after all files are added, I rename 
>>>>> it to a proper name.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Best Regards,
>>>>> Mind Visualizer--Productive Mind Mapping Software
>>>>> 2006-11-25
>>>>>
>>>>>
>>>>>
>>>>> Sender£º R.Peters
>>>>> Sent£º 2006-11-24 12:02:41
>>>>> Recipient£º delphizip@xxxxxxxxxxxxx
>>>>> CC£º 
>>>>> Subject£º [delphizip] Re: I got another two Errors, code 10123 and 3082
>>>>>
>>>>> The first error
>>>>>
>>>>> Error Code: 10123, Error Msg: DLL Error - Exception in handler  #4 
>>>>>
>>>>> is most likely (it can sometimes be fooled into reporting wrong) that
>>>>> your OnMessage handler is raising an exception.
>>>>>
>>>>> The second error (the one that caused the message that raised the
>>>>> exception) is because 'moving' the temporary file to it's proper
>>>>> destination failed.
>>>>> This is normally because the file is either Read-Only or in use by some
>>>>> other process.
>>>>> - Russell Peters
>>>>>
>>>>> Mind Visualizer--Productive Mind Mapping Software wrote, On 24/11/2006
>>>>> 2:37 PM:
>>>>>   
>>>>>     
>>>>>       
>>>>>         
>>>>>           
>>>>>> Dear all,
>>>>>>
>>>>>> Please help, I got other two run time errors when compressing a zip 
>>>>>> file, they occured and the same time:
>>>>>> ----------------------------------------------------------------------------------
>>>>>> Error Code: 10123, Error Msg: DLL Error - Exception in handler  #4 
>>>>>> Error Code: 3082, Error Msg:  replace: Move failed [5]".
>>>>>> ----------------------------------------------------------------------------------
>>>>>> ***the code that produced the errors are
>>>>>> ----------------------------------------------------------------------------------
>>>>>> aZip.ZipStream.Clear;
>>>>>> bmp.SaveToStream(aZip.ZipStream);
>>>>>> aZip.AddStreamToFile('images\ + guid, 0, 0)      <     > 0 then//guid is 
>>>>>> a GUID string like BC2C88AA-B5ED-4463-A7EE-44CB5F379F60
>>>>>> aZip.ZipStream.Clear;
>>>>>> ----------------------------------------------------------------------------------
>>>>>> ***And the Stack list generated by jclDebug:
>>>>>> [0065D817] mmXmlStorerU.TmmXmlStorer.OnZipMasterMessage (Line 1152, 
>>>>>> "Model\mmXmlStorerU.pas" + 3) + $28
>>>>>> [0064AB21] ZMCore.TZMCore.ShowExceptionError (Line 676, "ZMCore.pas" + 
>>>>>> 9) + $17
>>>>>> [0064EB76] ZMWrkr.TZMWorker.ExtAdd (Line 2315, "ZMWrkr.pas" + 210) + $5
>>>>>> [0064B25F] ZMDBind.TZMDynamicBind.CheckExec (Line 144, "ZMDBind.pas" + 
>>>>>> 17) + $10
>>>>>> [006CC044] JclHookExcept.DoExceptNotify (Line 231, "JclHookExcept.pas" + 
>>>>>> 24) + $5
>>>>>> [006CC05E] JclHookExcept.DoExceptNotify (Line 234, "JclHookExcept.pas" + 
>>>>>> 27) + $0
>>>>>> [006CC0BD] JclHookExcept.HookedRaiseException (Line 252, 
>>>>>> "JclHookExcept.pas" + 4) + $7
>>>>>> [0064B25F] ZMDBind.TZMDynamicBind.CheckExec (Line 144, "ZMDBind.pas" + 
>>>>>> 17) + $10
>>>>>> [0064B41A] ZMDBind.TZMDynamicBind.DoZipExec (Line 201, "ZMDBind.pas" + 
>>>>>> 12) + $6
>>>>>> [0064EAA1] ZMWrkr.TZMWorker.ExtAdd (Line 2299, "ZMWrkr.pas" + 194) + $6
>>>>>> [0064C696] ZMWrkr.TZMWorker.AddStreamToFile (Line 549, "ZMWrkr.pas" + 
>>>>>> 19) + $F
>>>>>> [00656F62] ZipMstr.TCustomZipMaster.AddStreamToFile (Line 840, 
>>>>>> "ZipMstr.pas" + 4) + $12
>>>>>> ----------------------------------------------------------------------------------
>>>>>> ***Enviroment:
>>>>>> System   : Windows XP Professional, Version: 5.1, Build: A28, "Service 
>>>>>> Pack 2"
>>>>>> Processor: Intel, Celeron, 666 MHz MMX
>>>>>> Display  : 800x600 pixels, 16 bpp
>>>>>> ------------------------------------------------------------------------------
>>>>>>
>>>>>>   
>>>>>> --------------
>>>>>> Best Regards,
>>>>>> Mind Visualizer--Productive Mind Mapping Software
>>>>>> http://www.mindmapware.com
>>>>>> 2006-11-24
>>>>>>             
>   
-----------
To unsubscribe from this list, send an empty e-mail 
message to:
  delphizip-request@xxxxxxxxxxxxx 
and put the word unsubscribe in the subject.

Other related posts: