cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tom_dinh
Level 3

Delete Registry value

I am trying to delete a value from the registry when installing or patching so that the registry count remains at 1.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs

Does anyone has done this before and or can show me some Installshield code to do it? I am trying to go away with using vbscript. There are some limitation and vbscript engine is not always installed causing the Custom Action to error out. Thank you in advance.
Labels (1)
0 Kudos
(8) Replies
MSIYER
Level 8

Try using:
RegDBSetKeyValueEx Installscript function.

But it would be better if you could give some more info about the background of the problem so that a better solution, if any, can be found.
0 Kudos
manomatt
Level 8

use the following instal scipt functions

RegDBDeleteKey - it will deletes a specific key and its associated value from the registry.

RegDBDeleteValue - it will deletes a value from a specific key in the registry

InstallShiled Help File will give you the sample code
0 Kudos
MSIYER
Level 8

mano.n.s75,
I am trying to delete a value from the registry when installing or patching so that the registry count remains at 1.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs

The requirement is not clear at all...
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs
should not be deleted, and should only be modified if the outcome is known and certain. That is why I asked for further details and gave the poster a function that updates rather than deletes...
0 Kudos
manomatt
Level 8

MSIYER,

Yes you are right, I totally agree with you.
0 Kudos
MGarrett
Level 6

Be careful - there be dragons here.
You really shouldn't be modifying the SharedDlls unless you know exactly what you are doing. The OS keeps a refcount of all files marked as Shared. On uninstall, InstallShield/Windows Installer will automatically decrement the refcount until it reaches 0, at which point the file is removed.
In general, this all happens automatically so you shouldn't need to manually edit the SharedDLLs registry location.

If you aren't careful, changing values here could result in needed files getting removed and applications breaking. Be ESPECIALLY careful if these SharedDLLs are components that might be used by other applications, such as redistributables or GAC files.

If you do decide to modify SharedDLLs, InstallScript is much easier than VBScript, as noted by the previous posters. Be aware that on 64bit Vista and Win7, there are two locations where the SharedDLLs could be saved, depending on whether you have a 32-bit or a 64-bit installer. You can use REGDB_OPTION_WOW64_64KEY to enable the 64-bit usage with the registry functions.
0 Kudos
tom_dinh
Level 3

So sorry, I never a get an email notifying that the thread has some new posts. I accidentally went back today found all this replies. Anyway, I am doing this on purpose. The original count is at 1 but after applying the patch, the dll gets incremented to 2 even the patch only uses the binary difference not the whole file so when I uninstall the product, the dll remains behind. Thanks again.
0 Kudos
MGarrett
Level 6

Tom, Does your patch have the same Upgrade Code as the original installer? I highly recommend not changing your upgrade code.

Community, am I correct in assuming that an upgrade/patch with the same upgrade could should not change the SharedDLLs refcount, regardless of whether the file changed or not?
0 Kudos
tom_dinh
Level 3

MGarret,
I think when I build the patch, Installshield automatically change the upgrade code. I will double check and get back to you. Thanks for replying.
0 Kudos