Solved

Run VB Code In WISE 6.2

Posted on 2009-07-09
15
778 Views
Last Modified: 2013-11-13
I am trying to create a Wise Installation routine using "Wise for Windows Installer 6.2". What I would like to do, is if the user selected a certain option for install, to display a screen asking for a Procudt ID, this part is fairly simple.  The next thing I would like to do, is "validate" the Product ID entered before allowing the user to continue.  In order to do this, I have to run VB Code using a custom class I created, but I have no clue how to run VB.Net Code inside the Wise Installation & return a "Pass/Fail" flag...

Can anyone help point me in the right direction?
0
Comment
Question by:Ben Santiardo
  • 7
  • 6
15 Comments
 
LVL 40

Expert Comment

by:Vadim Rapp
Comment Utility
Did you read the article "Guidelines for Calling .DLLs " in WfWI Help?
0
 

Author Comment

by:Ben Santiardo
Comment Utility
Thanks for responding, but that section (which was a pain to find BTW), doesn't really explain much.  It's extremely confusing and has no samples to look at to help explain what it's describing.
I am looking for a more detailed "How To"...
0
 
LVL 40

Expert Comment

by:Vadim Rapp
Comment Utility
DLL must be C++-type one, that's where there are "functions" inside it, which you specify in the custom action. I don't think you can do it with VB.net.

I think it would be much easier to call executable instead of DLL. Or you can call vbscript that in turn will create an instance of your class, run it, and return the result.

See http://msdn.microsoft.com/en-us/library/aa368085(VS.85).aspx about what to specify. You can pass the the entered product key as parameter using Target column. The executable should return 0 if validation passed, non-zero if not.

I personally would use vbscript if possible. If you make the executable in .net, then you are opening a big can of worms with installed framework, its version, plus ton of various security issues, guaranteed.
0
 

Author Comment

by:Ben Santiardo
Comment Utility
This question stayed open because no truly useful and/or valid answer has come up.  This problem is still active.  I suppose since no one else has offered suggestions to this thread, it can be closed since apparently no one has an answer.  But accepting vadimrapp1's comment is not valid, since his comment was not an actual useful answer for my problem.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
Comment Utility
> no truly useful and/or valid answer has come up
> his comment was not an actual useful answer for my problem.

the question was:
"I have no clue how to run VB.Net Code inside the Wise Installation & return a "Pass/Fail" flag..."

I explained why DLL made by VB wouldn't work;
and then I suggested what will work instead.

Please clarify why this is not valid, and what you expected.
0
 

Author Comment

by:Ben Santiardo
Comment Utility
My apologies, no offence was intended.  
I need to know exactly how to incorporate this type of idea into the WFWI project.  I understand that a DLL could help, or an EXE.  I do not write in C++ so that type of DLL idea doesn't help my situation.  And although I could write another VB executable to recieve and return data, I still don't know how to incorporate it into WFWI.  Like I stated in my 2nd posting "I am looking for a more detailed "How To"... "
I need examples, it's makes it easier to understand and grasp.  I am new to using WFWI, I come from using Wise Installation System 9.0 where we had a great amount of control over the scripting directly within the installation routine.  WFWI is very....limited or rather locked down, in what you can access.  Or so it seems compared to what I am used to.  
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 40

Expert Comment

by:Vadim Rapp
Comment Utility
hold on, let me create a sample for you.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
Comment Utility
here's the sample. Look at the button "next" on the dialog "user information" - it runs custom action "MyValidateProductId" - which is embedded vbscript. That vbscript extracts the property associated with the product id box on the dialog, analyzes it, and depending on the result sets another property MyValidationSuccess to 1 or 0. Following that, button "next" invokes the next dialog only when MyValidationSuccess =  1; there's also textbox "invalid key" that shows up or hides depending on the value of MyValidationSuccess.

This is simple implementation; in fact, the user can bypass UI alltogether by running the installation from command line with /qn , so you have to ensure that validation occurs in the immediate phase as well.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
Comment Utility
the sample can be downloaded from here:
http://rdpvr.polyscience.com/crm/testmsi.msi
0
 

Author Comment

by:Ben Santiardo
Comment Utility
Ok, thank you for the sample file.  Now where exactly is this Embedded VBScript?
0
 

Author Comment

by:Ben Santiardo
Comment Utility
Ok, I was able to trrack down the embedded code.  Sorry I found it a few minutes after I posted the previous comment.  
But one remaining question I do have, is it possible to use my own previously created class that will verify the ProductID?  If so, how can I add the class to the project to be able to instantiate it in the VBScript and use?
0
 
LVL 40

Accepted Solution

by:
Vadim Rapp earned 500 total points
Comment Utility
I don't think it's possible. The binaries for custom actions are stored in the installation in the table Binaries, and are extracted just for running custom action, and then deleted. They are extracted with temporary name. In case of your class, the dll would have to be not only extracted, but also registered in the system as COM object, prior to running the vbscript. Which Installer obviously won't do. That's why it allows C++ dll's, because their entry points can be addressed directly by name without any registration in the system.

The only way I can imagine would be by vbscript reaching inside the installation, extracting the binary dll, storing it on the hard drive, running regsvr32, then calling, then unregistering and removing - but as you can see, it's closer to sci-fi than to reality.

Instead of vbscript, you can call an executable - "execute program from installation". Note however the last paragraph from my prior comment 24825868 .
0
 

Author Comment

by:Ben Santiardo
Comment Utility
Ok, now I see and understand the situation better.  I think you are correct that a simply created EXE that takes parameters and returns a flag would be the best solution...  
Thank you very much for your help, I am going to try that senario now and post my progress.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Among others, I monitor the Windows Installer zone and Installer zone. I find that many of the questions could be answered much more quickly if a Windows Installer verbose log were submitted with the question.   However, I do not always have t…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now