WiseScript Call msi.dll GetProductInfo
Created: 18 Sep 2012 | 8 comments
While working on a previous clients site I created a wisescript that I had a Call to the MSI.dll to check for a product code. I dont remember how to setup the call, because I did not create that part but found it on a different application and copied it to mine. From what I remember, this is what I had.
set variable ACROPRO - {product guid for acrobat pro}
set variable ACROSTD - {product guid for acrobat std}
Call msi.dll Function GetProductInfo
If ACROPRO = Installed then
set variable APPINSTALLED = PRO
ElseIF ACROSTD = Installed then
set variable APPINSTALLED = STD
end
If APPINSTALLED = PRO then
blah
blah
end
If APPINSTALLED = STD then
blah
blah
end
Discussion Filed Under:
Comments 8 Comments • Jump to latest comment
Was there a question relating to your statement above?
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
I guess my question was a tab burried in all of that...
my question is, how do you use Call DLL Function to check the pc for an installed ProductCode?
Is it, msi.dll function GetProductInfo
I found this, but I could not figure out what info I needed to put in the Call DLL Function Window.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724358(v=vs.85).aspx
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Ahe, thanks for that... I did not consider that WiseScript would have issues with 64bit OS.
Ok, I don't work a whole lot with VBScript, but if I was running your example above inside of WiseScript, how would I pass a product guid to the Script, and what results am I looking for on the way out?
I see that you have (ProductCode) and if I ran this as a custom action via MSI it would grab that from Property Table correct? However, if running it from WiseScript, could I replace (ProductCode) with %PRODCODE% - "my variable"?
Thanks for the help BTW.. :-)
Since MSI files can handle VBScript directly, there is no need to use Wisescript as an intermediary, but for the record, Wisescript has commands which can read and write properties from/to the calling MSI when Wisescript is used as a custom action.
When using vbscript, you can read a property value in a variable "x" like this:
x=session.property("ProductCode")
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Currently, the company I work for uses a Wisescript Wrapper to install all products, what I was trying to do was check for current application about to be installed, and also look for the older version.
If the current one exist, then exit the install. (which I know would happen normally if the Current App was an MSI)
If the previous app existed, then check for that apps main running process. If running then notify user that a newer version will be installed, and Kill the process when they click OK.
I dont know how to put all of that logic inside of the MSI.
On a side note, for those interested... one of my ex-coworkers sent me the WSE that I was thinking of and here is how it worked.. Just open up a blank WSE and save it. Then edit it with Notepad, and Paste Lines below at the END of your Blank.wse and save it. Then you can open it up normally and you will see all items..
I was wrong on the DLL Function name, it was MsiQueryProductStateA... That would explain why all of my search on the net found nothing.. hehe!
...Cut & Paste below...
item: Set Variable
Variable=PRODUCTCODESTD
Value={AC76BA86-1033-F400-BA7E-000000000003}
end
item: Set Variable
Variable=PRODUCTCODEPRO
Value={AC76BA86-1033-F400-7760-000000000003}
end
item: Remark
Text=......................Check if Acrobat 8 Standard is installed................
end
item: Call DLL Function
Pathname=%SYS32%\msi.dll
Function Name=MsiQueryProductStateA
Argument List=40PRODUCTCODESTD
Return Variable=0INSTALL_STATE
Flags=00100000
end
item: Set Variable
Variable=STANDARDAPPINSTALLED
Value=DontKnowYet
end
item: If/While Statement
Value=INSTALL_STATE = "5 Or 2"
Flags=00001101
end
item: Set Variable
Variable=STANDARDAPPINSTALLED
Value=YES
end
item: End Block
end
item: Remark
Text=......................Check if Acrobat 8 Pro is installed................
end
item: Call DLL Function
Pathname=%SYS32%\msi.dll
Function Name=MsiQueryProductStateA
Argument List=40PRODUCTCODEPRO
Return Variable=0INSTALL_STATE
Flags=00100000
end
item: Set Variable
Variable=PROAPPINSTALLED
Value=DontKnowYet
end
item: If/While Statement
Value=INSTALL_STATE = "5 Or 2"
Flags=00001101
end
item: Set Variable
Variable=PROAPPINSTALLED
Value=YES
end
item: End Block
end
Did some more searching and I found a list of InstallStates that get Returned from DLL...
Microsoft Site that explains the different states...
http://msdn.microsoft.com/en-us/library/windows/desktop/aa370363(v=vs.85).aspx
Installshield site that displays the Return Values...
http://helpnet.installshield.com/isxhelp17/CheckingIfProductInstalled.htm
Randy
Would you like to reply?
Login or Register to post your comment.