PDA

View Full Version : retrieve/set information in the Registry Table with ISWIAuto11



Cygnusx1
02-13-2006, 10:55 AM
Does anyone know of a way to retrieve/set Registry Table information using Automation Interface?

So far I can retrieve and set lots of other tables but not the registry table.

Any ideas?

RobertDickau
02-13-2006, 06:13 PM
For importing registry data, anyway, there are the ImportRegFile method and RegFileToMergeAtBuild property.

For other things---assuming your .ism file is in Binary format---you can use MSI Automation to query and modify the tables. (Here's a DevLetter tip with the general idea: http://www.installshield.com/news/newsletter/0203-articles/msi-automation.asp.) If it's in XML format, others here have apparently had success using XSL transforms or just direct text replacement...

Cygnusx1
02-14-2006, 08:07 AM
Thank you. I did not make the connection between ism & msi.

Cygnusx1
02-16-2006, 09:32 AM
Upon looking into this further, I have found that I can not use some of the SQL commands successfully. I know this is not an Installshield question but rather a Windows Installer one. At any rate, if you readily know the solution...

Background: I need to delete all references to a company's registry key; but can not seem to this based on the Key:
HKLM\Software\COMPANY\

Const sRegname = "SOFTWARE\COMPANYNAME\PACKAGES\[PRODUCTNAME]"
Set database = oInstaller.OpenDatabase(.ISM or .MSI,1)
Set View = database.OpenView("DELETE FROM Registry WHERE `Key` = '" & sRegname & "'")
view.Execute
View.Close
database.Commit

But if I search for the registry Name AND Value it is successful...
Dim aRegName,aRegValue
aRegName = Array("ProductVersion","Release","Build","Installed Date","Transforms","Installed Time",_
"ProductCode","UpgradeCode","ApplicationID","ProductName")
aRegValue = Array("[ProductVersion]","[RELEASE]","[BUILD]","[Date]","[TRANSFORMS]","[Time]","[ProductCode]",_
"[UpgradeCode]","[AppID]","[ProductName]")
For x=0 to 9
Set View = database.OpenView("DELETE FROM Registry WHERE Name = '" & aRegName(x) &_
"' AND Value = '" & aRegValue(x) & "'")
view.Execute
View.Close
Next

By the way I can use this statement on the `Key`...
Set View = database.OpenView("INSERT INTO Registry (Registry,Root,`Key`,Name,Value,Component_) VALUES('Registry.0','2','Software\COMPANYNAME\Packages\[ProductCode]','DisplayVersion','[ProductVersion]','_MyComponent')")

Doing the latter is workable but I just need to know if the first DELETE FROM will work. (Basing the delete on the Component_ also works.

Any thoughts? Can the `Key` not be used for it is a primary key column?

Thanks!