Archive: Sharing violation


Hi

I am new to NSIS ,

when trying to register a dll I get "Error opening file for writing" , the file is not open at that time by any application.

I went to check it using sysinternals filemon , and saw that while NSIS tried to copy the file , the file system reported a "Sharing violation" .

I made another installation using the InstallWizard system , and run it while watching at FileMon , no sharing violation happend . I immediatly run NSIS based installation and got the problem again.

this is my code snippet , please tell me how to make NSIS get over the sharing violation (and any other comments you have regarding my use of NSIS)

thanks

Section "Test1"
; Set output path to the installation directory.
SetOutPath $SYSDIR
ClearErrors
IfErrors 0 GoError
CompareDLLVersions /STOREFROM "c:\winnt\system32\l3codecx.ax" "$SYSDIR\l3codecx.ax" docopy none

DetailPrint "Files are the same"
goto none

docopy:
; Put file there
File "c:\winnt\system32\l3codecx.ax"
REGDLL "$SYSDIR\l3codecx.ax"
DetailPrint "Installing.."
goto end
GoError:
DetailPrint "Error.."
none:
DetailPrint "Skip.."
end:
SectionEnd ; end the sectionSectionEnd


can anyone comment ?

can anyone tell me why NSIS have a sharing violation problem while other installers don't , how to get over it ?

thanks


Windows tends to keep files open. I had an application which showed which files are used by Windows, and these Multimedia conversion codecs are opened most of the time by Windows.
Maybe this is something worth checking out.


you are right

even after mediaplayer shutdown , explorer is still keeping these codecs open.

the wierd thing is that all other installation software can bypass this problem, NSIS can't.

who can check it ?


Extract the file to a temporary directory, and use
Rename /REBOOTOK $TEMP\myFile.ax $SYSDIR\whatever.ax

That way the file will be updated on reboot (likely the way that other installers do it)..

Also, at leaast on win2k, you may be able to do:

Rename $SYSDIR\whatever.ax $SYSDIR\whatever.old.ax

and then extract your file over it...

-Justin


well..
Hi Justin,

thanks for your help

I tried that trick on win2k and strangly it worked, why is that ? and why would it work on other windows versions.

I tried NSIS &InstallWizard , I tracked them both using sysinternals filemon,

the flow was the same until NSIS got kicked by the OS for sharing violation and installwizard did not , there was no rebook neccecary.

maybe we are missing something here ?