Thanks to James Muchmore for this suggestion and the attached code:
The install check currently only looks at REG_DWORD and REG_SZ data types, but I needed to be able to check for a specific substring within a REG_MULTI_SZ type.
I needed to be able to check to see if specific instances of MSDE (the redistributable version of Microsoft SQL Server) were installed on my system. The names of all the instances of MSDE are stored in the registry key SOFTWARE\Microsoft\Microsoft SQL Server\InstalledInstances.
When I tried to use the existing code I found that the RegQueryValueEx command returned a set of null terminated strings. When the memory block was copied to a CString, only the characters preceding the first null value were copied, all the rest was discarded. This obviously caused problems if the substring I was searching for was in the discarded data.
To get around this, I first created new enumerations for the Comparison and FieldType fields in the InstalledCheck screen in the Installer Editor. The Comparison now has a ‘contains’ option, and the FieldType has a REG_MULTI_SZ option.
In the dotNetInstaller, I added some code that looks for a substring within the registry value if the Comparison option is set to ‘contains’.
I also added another section to handle the REG_MULTI_SZ return values. In this case, any null values within the returned data block are replaced by spaces, after which the resulting string can be searched for either exact matches or for matching substrings.
See attached file
Log in to post a comment.