Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Shared DLLs usage count (http://forums.winamp.com/showthread.php?t=182069)

brettg 3rd June 2004 01:01

Shared DLLs usage count
 
I would to know if there is a way to automatically handle usage counting for shared DLLs. As you must know, Windows has a mechanism to keep count of shared DLLs, so that setup programs can know when to unregister and delete the shared DLL. I can't find any info on it.

thanks for any help

Vytautas 3rd June 2004 02:32

Check out the VB Runtime Install script for details as it uses this counter.

Vytautas

brettg 3rd June 2004 04:29

I can't find this script in the Examples folder...can you give me the exact name of the .nsi file?

Vytautas 3rd June 2004 04:38

I think that it's available in the NSIS Archive on the net. However you can also read the two articles in the NSIS Help file. Appendixes B9 and B10

Vytautas

[Ant]DiMension 4th June 2004 15:45

I'm using this script with some succes. Only, Microsoft recommends increasing Shared DLL count to 1 if the file is already present on the system, so that programs that didn't correctly increase DLL count still work after the user uninstalls your application.

I've tried implementing this in the UpgradeDLL macro in the following way: (last four lines are by me)
code:
;------------------------
;Check file and version

IfFileExists $R4 0 upgradedll.copy_${UPGRADEDLL_UNIQUE}

ReadRegDword $1 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R4
StrCmp $1 "" 0 +3
Push $R4
Call AddSharedDLL


Only this one seems to have some flaws. Can anyone spot what is going wrong?

Joost Verburg 4th June 2004 19:58

UpgradeDLL does not handle the shared DLL user count. You should update the AddSharedDLL function.

[Ant]DiMension 6th June 2004 10:08

code:
Function AddSharedDLL
Exch $R1
Push $R0
ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
StrCmp $R0 "" increment
IntOp $R0 $R0 + 1
WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0
Goto noincrement
increment:
IfFileExists $R1 0 noincrement
WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 2
noincrement:
Pop $R0
Pop $R1
FunctionEnd


This seems to work perfectly. Thanks!


All times are GMT. The time now is 18:09.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.