Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 14th September 2003, 11:07   #1
ACEMCP
Junior Member
 
Join Date: Aug 2003
Posts: 39
Copy file - Register dll - Shared counter

I tried to rewrite sunjammers code about "Upgrade a DLL" (http://nsis.sourceforge.net/archive/...instances=0,11)... His prg snippet is an macro, but I want to write Function if possible because I have to install lot of dll... I added more functionality, shared files counter handler from Add a shared DLL (http://nsis.sourceforge.net/archive/...instances=0,11)

First, I Push the parameters from the macro, then I pop the parameters, and do what I need from the function.

I am using this include file for this functionality:

[edited by kichik]attach large scripts. attached below [/edit]

If I try to compile i got a next error message:
GetDLLVersionLocal: error reading version info from "$LOCALFILE"
!include: error in script: "Include\Installer.nsi" on line 52
Error in script "E:\Fejlesztes\ACE Mega CoDecS Pack\ACE Mega CoDecS Pack.nsi" on line 6 -- aborting creation process

I think error caused by $LOCALFILE variable, because If I remmark this line, the compiler stops next where $LOCALFILE appear...
What I did wrong?
Please help me!

Best regards,
ACEMCP
ACEMCP is offline   Reply With Quote
Old 14th September 2003, 11:15   #2
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
I wrote that macro.

You are mising up run-time and compile time. GetDLLVersionLocal gets the version of a DLL on the compiler system (the DLL that will be included), so you can never use a run-time variable.

Always increasing the shared item count is also not a good idea. For example, it should not be increased when reinstalling.
Joost Verburg is offline   Reply With Quote
Old 14th September 2003, 11:21   #3
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
Quote:
Do not copy and paste large scripts, attach them. This helps the forum stay clean and easy to read. The forum provides a vast database of questions and answers regarding NSIS, so it's important it stays clean and easy to read so users may easily find the answer they are looking for.
Attached Files
File Type: nsi reg.nsi (3.0 KB, 109 views)

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 14th September 2003, 11:48   #4
ACEMCP
Junior Member
 
Join Date: Aug 2003
Posts: 39
Sorry kichik!

Dear Joost!
Are there any way to solve this problem? I want to use this intelligent update feature for about 200 dlls. I think macro method makes the installer lot bigger.
How can I determine users run as installer or reinstaller? Enough to watch HKLM\Software\${PRODUCT} exist or there are another better sollution?
ACEMCP is offline   Reply With Quote
Old 14th September 2003, 12:01   #5
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Indeed, checking files or registry keys is a good solution.

You should use compile-time defines for GetDLLVersionLocal.
Joost Verburg is offline   Reply With Quote
Old 14th September 2003, 12:03   #6
blayde
Junior Member
 
Join Date: Sep 2003
Posts: 18
Yeah, you could store it in the reg' and remove the entry at uninstall. you chould also check if the file(s) your installing already exist and need replacing.

eg
http://nsis.sourceforge.net/Docs/AppendixC.html#C.4
blayde is offline   Reply With Quote
Old 14th September 2003, 12:20   #7
ACEMCP
Junior Member
 
Join Date: Aug 2003
Posts: 39
So I have to build dll table with define command like this:
!define aaadll aaa.dll
!define baadll baa.dll
etc
to add all the filename information to the script? Then I can use it compile time?Is it a right sollution? Or macro the whole Upgrade a DLL - at about 200 times?
ACEMCP is offline   Reply With Quote
Old 20th September 2003, 14:02   #8
ACEMCP
Junior Member
 
Join Date: Aug 2003
Posts: 39
Dear Joost!
I switched back to macro, because using function this are is an stupid move )

I tried to add more functionality: Register dll, Shared counter

Register dll already implemented, but I may help for shared file counter:
there are a variable:
var INSTALLCOUNT

in the begening of installation:

ReadRegDWORD $INSTALLCOUNT HKLM "Software\${PRODUCT}" "Installer Counter" ; increase for every installation
; decreased every uninstallation
IntOp $INSTALLCOUNT $INSTALLCOUNT + 1
WriteRegDWORD HKLM "Software\${PRODUCT}" "Installer Counter" $INSTALLCOUNT

I increase every time,

(of course deinstallation remove at all)

When I installing files, I use this method
If file non exist shared dll counter be 1
If file exist but my program first installed (Installer Counter==1) shared dll counter Increased by 1
If file exist but my program already installed (Installer Counter>1) No increment.
If file exist and no (or 0) value of shared dll counter, the shared dll counter be 2.
Uninstall:
Uninstallation always decrease counter, and file and counter removed if reached 0...

This is the right sollution? Or you have better one?

ACEMCP
ACEMCP is offline   Reply With Quote
Old 20th September 2003, 14:08   #9
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
For the shared DLL count, a separate function is available. You should also call it on a new installion (check whether installion files or registry keys exist).
Joost Verburg is offline   Reply With Quote
Old 20th September 2003, 14:18   #10
ACEMCP
Junior Member
 
Join Date: Aug 2003
Posts: 39
But what is the matter if files exist but the file's sharedDLLs counter is 0 or non exist?
ACEMCP is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump