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

Basic MSI reading registry

Hi,

I am new to using Installshield 2011. I have been tasked to create an install project that verifies a serial key based on mac address of the computer. Since I am not too good at scripting I chose to use Basic MSI project. Since I had a C# application that checks for mac address and verifies a key, I chose to try to use this inside of the install project. So upon a "next" button in a dialog I am opening my C# exe. With this I can now verify the key based on mac of the computer and it wiorks fine. The last problem I now have is that how do I get the installshield bsic MSI project to realize if my external exe was successful in verifying the key or not? Right now it just continues with the next screen weather it fails or not. So I read somewhere I should "pass" the message to the next dialog through the registry. I have no problems writing the registry from my C# program, but HOW DO I READ THAT REGISRTY VALUE TO MAKE MY NEXT DIALOG TO NOT OPEN IF THE KEY VERIFICATION FAILED? This is my question.

Thanks!
Catheryne
Labels (1)
0 Kudos
(5) Replies
enanrum
Level 9

You would have to create another CustomAction, perhaps InstallScript, to read the value you would write in from your C# program which would be called after your C# CA withing the Next button.

Try looking at: RegDBGetKeyValueEx
0 Kudos
cwilliamsson
Level 3

I was hoping there would be another solution that would stick with basic MSI only since I am not comfortable with the scripting. I can probably figure out the actual reading of register value though by reading the RegDBGetKeyValueEx examples as you suggest.

The hard part for me may be to actually get to that point in my installsheild project. Can you give me some basic step by step how I would be able to add this custom installscript action into my basic msi and how it would be called after my external c# program finishes? I have figured out how to call the C# funtion with "doaction" on the next button, but I am opening the next screen following the C# program at the same time as the C# function. I don't know how to get this new customaction to start after the C# exe and break out or fail to open if the registry value is unsuccessful. Hope I am making sence.
0 Kudos
TsungH
Level 12

If possible, use DLL custom action instead of EXE custom action. Your C# DLL custom action can communicate with the running installer by setting a property, which can then be used to control Next button's ControlEvent. You may find this thread useful.
0 Kudos
cwilliamsson
Level 3

OK, maybe I should try that. So I will call a function in the dll from the dialog? How do I do that?
0 Kudos
TsungH
Level 12

Similar to what you did to call EXE custom action, use DoAction ControlEvent to invoke your DLL custom action.
0 Kudos