cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
DWillis
Level 5

Registry Magic. Anyone have any magic dust?

Throughout the course of my installation, I have to add and manipulate registry keys.

Then, when I uninstall, I have to delete keys as well as modify keys to place them back into their pre-installed state.

My problem is this:
- How do I edit a registry key at install time?
I need to append a registry key string during install here, so how can I edit and add to the string?

- How do I edit a registry key at uninstall time?
The key which I appended with my information needs to be reverted back to its pre-installed state.

The problem I have now is that I only know how to add/delete entire keys, not just edit the data in a key. This is causing the dreaded blue screen of death, so it's important to find a solution to this problem.

I am using an Installscript MSI project, so it is possible to use Installscript if needed. However, this is my first time ever building an installer as well as using Installshield, so I am at the bottom of the learning curve with regards to IS and installscript and how to properly time all of this...

Any suggestions to assist me in getting on the right path is greatly appreciated.

Thanks in advance,
D
Labels (1)
0 Kudos
(11) Replies
DWillis
Level 5

Anyone want to touch this one? Any ideas? Suggestions?
0 Kudos
Jeff2008
Level 6

To edit a registry key at install time without installscript:
- Add a system search to search for the value of the key and put the result in a property (for example, SEARCH_RESULT)
- Write "[SEARCH_RESULT]appended datas" in the registry key

To edit at uninstall
- This will require a custom action, you could write the [SEARCH_RESULT] to a backup key value when installing (this can be done without InstallScript), and use it at uninstall to revert back with a simple InstallScript function.
0 Kudos
DWillis
Level 5

Jeff2008 wrote:
To edit a registry key at install time without installscript:
- Add a system search to search for the value of the key and put the result in a property (for example, SEARCH_RESULT)
- Write "[SEARCH_RESULT]appended datas" in the registry key

To edit at uninstall
- This will require a custom action, you could write the [SEARCH_RESULT] to a backup key value when installing (this can be done without InstallScript), and use it at uninstall to revert back with a simple InstallScript function.


Thanks for the suggestion, however this still doesn't seem to meet my needs. I'm going to simply create a function that gets called on install (and another for uninstall) that will use the RegDBSetKeyValueEx, grab the current value, append it and rewrite it.

On uninstall, I'll do the opposite - grab the key, remove my specific entry, and rewrite it.

does anyone know whether or not the registry stuff removed the entire Key you have entered or just the value of that key?
0 Kudos
samwalker04
Level 3

I'm in the same boat as the OP, pretty much.

Upon install, I need to let the user type in their username and password, then make some sort of HTTP request to validate that and return a GUID, which will then be written to a new key in the registry. I tried to do this with Visual Studio and Orca--I wrote a C++ DLL which contained the function to make the request and write into the registry, then tried to import that DLL into the MSI file Visual Studio created via Orca, but I kept running into problems and got frustrated.

Do MSI files that use external, customized functions during install REQUIRE C++? Or can they be in any language? I'm basically reworking a system that a previous programmer created with C++ (ugh).

Hopefully there is an easier way to do this with InstallShield. Our company has a license for IS but I haven't installed it yet. Just wondering if any experts could confirm that this is doable...
0 Kudos
DWillis
Level 5

samwalker04 wrote:
I'm in the same boat as the OP, pretty much.

Upon install, I need to let the user type in their username and password, then make some sort of HTTP request to validate that and return a GUID, which will then be written to a new key in the registry. I tried to do this with Visual Studio and Orca--I wrote a C++ DLL which contained the function to make the request and write into the registry, then tried to import that DLL into the MSI file Visual Studio created via Orca, but I kept running into problems and got frustrated.

Do MSI files that use external, customized functions during install REQUIRE C++? Or can they be in any language? I'm basically reworking a system that a previous programmer created with C++ (ugh).

Hopefully there is an easier way to do this with InstallShield. Our company has a license for IS but I haven't installed it yet. Just wondering if any experts could confirm that this is doable...


sending out an http request is outside the scope of this question, and I have no idea how to go about that. I know that MSI has lots of communication tools, but you might need to extend the installscript a bit in order to access some of those API's...
0 Kudos
samwalker04
Level 3

DWillis wrote:
sending out an http request is outside the scope of this question, and I have no idea how to go about that. I know that MSI has lots of communication tools, but you might need to extend the installscript a bit in order to access some of those API's...


Thanks for the response. I know what I described is a convoluted process but I'm basically cleaning up a previous programmer's mess and I'm in a hurry to get it finished for the client. Is the built-in help/tutorial section the best resource for InstallShield/InstallScript developers? I haven't found much of anything on the web so far.
0 Kudos
DWillis
Level 5

samwalker04 wrote:
Thanks for the response. I know what I described is a convoluted process but I'm basically cleaning up a previous programmer's mess and I'm in a hurry to get it finished for the client. Is the built-in help/tutorial section the best resource for InstallShield/InstallScript developers? I haven't found much of anything on the web so far.


Unfortunately, I'm not sure. I would certainly start there, though. It might give you a more pointed question to ask or a direction to go in.

I found this in the IS help under user authentication:


If your One-Click Install installation requires authentication after it is started, you can authenticate the user on the fly using InstallScript. When authentication is required, the Web server returns HTTP error code 401 to your installation, which generates an InternetError event. Respond to that event by prompting the user for a user name and password in the OnInternetError event handler.

The easiest way to do so is to use the InternetErrorDlg API in WinInet.dll and return the value IDRETRY from OnInternetError. This causes the installation to issue the HTTP request for the file again. If users enter incorrect information, they will be prompted to enter it again.



Not sure if that helps, but it might point you in a direction to research. Good luck.
0 Kudos
samwalker04
Level 3

DWillis wrote:
Unfortunately, I'm not sure. I would certainly start there, though. It might give you a more pointed question to ask or a direction to go in.

I found this in the IS help under user authentication:

If your One-Click Install installation requires authentication after it is started, you can authenticate the user on the fly using InstallScript. When authentication is required, the Web server returns HTTP error code 401 to your installation, which generates an InternetError event. Respond to that event by prompting the user for a user name and password in the OnInternetError event handler.

The easiest way to do so is to use the InternetErrorDlg API in WinInet.dll and return the value IDRETRY from OnInternetError. This causes the installation to issue the HTTP request for the file again. If users enter incorrect information, they will be prompted to enter it again.

Not sure if that helps, but it might point you in a direction to research. Good luck.


That is helpful. Thank you. And sorry for hijacking your thread! 😄
0 Kudos
DWillis
Level 5

samwalker04 wrote:
That is helpful. Thank you. And sorry for hijacking your thread! 😄


A little further information. As I was modifying my release build settings, I came across an entire section dedicated to signing, and that included user/https authentication. I don't know any more than that because I do not require it at this time, but that might be meaningful to you.
0 Kudos
samwalker04
Level 3

DWillis wrote:
A little further information. As I was modifying my release build settings, I came across an entire section dedicated to signing, and that included user/https authentication. I don't know any more than that because I do not require it at this time, but that might be meaningful to you.


Interesting. Where did you browse to in the Help file to find that section?
0 Kudos
DWillis
Level 5

Do a search on release view. You'll find that view in the media->releases-[release type] section in the editor.
0 Kudos