This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Help with Understanding MsiGetProperty()
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 04, 2008
02:45 PM
Help with Understanding MsiGetProperty()
Alright, I am completely open to new ideas other then using the function but here is what I am trying to do.
-Take the port number from the user input on my dialog box which is set into property IDDATAPORT (global variable all capitals right?)
-Set the port as open in the firewall. (This part is working flawlessly)
My problem comes trying to use MsiGetProperty. I have used a messagebox to verifiy that even when I set the default value of IDDATAPORT to 25000 it still returns nothing as in blank. So if anybody could tell me what I am doing wrong I would certainly appriciate it. My code is below message boxes just used for debugging:
Thanks in advance
-Take the port number from the user input on my dialog box which is set into property IDDATAPORT (global variable all capitals right?)
-Set the port as open in the firewall. (This part is working flawlessly)
My problem comes trying to use MsiGetProperty. I have used a messagebox to verifiy that even when I set the default value of IDDATAPORT to 25000 it still returns nothing as in blank. So if anybody could tell me what I am doing wrong I would certainly appriciate it. My code is below message boxes just used for debugging:
export prototype configFirewall(HWND);
function configFirewall(hMSI)
string szMsg, svText, formattedText;
string strNetsh;
string strCommandLine, strCommandLine2;
string svValue;
number nvSize, nvType;
number nbSize;
begin
//CtrlGetText("ServerInfo", 27445 ,svText);
MsiGetProperty(ISMSI_HANDLE, "IDDATAPORT", svText, nbSize);
strNetsh = WINSYSDIR^"netsh.exe";
strCommandLine = "firewall add portopening tcp " + svText + " portname enable All";
strCommandLine2= "firewall set opmode enable enable";
MessageBox(strCommandLine, INFORMATION);
LaunchAppAndWait( strNetsh, strCommandLine, LAAW_OPTION_WAIT||LAAW_OPTION_HIDDEN);
LaunchAppAndWait( strNetsh, strCommandLine2, LAAW_OPTION_WAIT||LAAW_OPTION_HIDDEN);
//set registry entry
RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
RegDBGetKeyValueEx ("Software\\key name private." , "PortNumber" , nvType , svValue , nvSize );
svValue = svText;
RegDBSetKeyValueEx ("Software\\key name private" , "PortNumber" , REGDB_STRING , svValue , -1 );
end;
Thanks in advance
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 04, 2008
05:49 PM
A couple of things: before calling MsiGetProperty, you'll want to set the buffer-size argument (nbSize, in your case) to a large enough value to contain the maximum property value.
The first argument to MsiGetProperty probably wants to be the same argument passed to the entry-point function (hMSI, in your case).
That little section would then be:
Having said that, what kind of project is this? If Basic MSI, you might be able to use launch-an-EXE custom actions that use [IDDATAPORT] as an argument, and avoid scripting entirely...
The first argument to MsiGetProperty probably wants to be the same argument passed to the entry-point function (hMSI, in your case).
That little section would then be:
nbSize = 10; // whatever's right
MsiGetProperty(hMSI, "IDDATAPORT", svText, nbSize);
Having said that, what kind of project is this? If Basic MSI, you might be able to use launch-an-EXE custom actions that use [IDDATAPORT] as an argument, and avoid scripting entirely...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 05, 2008
01:54 PM
It was my lack of buffersize that did it. Thank you I knew it was something small and stupid I was doing. I definatly appriciate the help.
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)