Functions
TcpIpImpl.cpp File Reference
#include "stdAfx.h"
#include "FlagMaps.h"

Functions

CA_API UINT __stdcall TcpIp_BindSocket (MSIHANDLE hInstall)
 Attempts to bind a socket. More...
 
CA_API UINT __stdcall TcpIp_Connect (MSIHANDLE hInstall)
 Attempts to connect to a remote server. More...
 
CA_API UINT __stdcall TcpIp_ListAddresses (MSIHANDLE hInstall)
 Lists IP address assigned to this host. More...
 

Function Documentation

CA_API UINT __stdcall TcpIp_BindSocket ( MSIHANDLE  hInstall)

Attempts to bind a socket.

Attempts to bind a socket, useful for checking whether the socket can or cannot be bound to.

Parameters
TCP_IPADDRESSlocal TCP/IP address to bind to
TCP_PORTlocal TCP port to bind to
Returns
TCPIP_BIND_SUCCEEDED. Set to 1 if bind succeeded.
check CA_ERROR on function failure
CA_API UINT __stdcall TcpIp_Connect ( MSIHANDLE  hInstall)

Attempts to connect to a remote server.

Attempts to connect to a remote server, useful for checking whether there's a listening server. See http://msdn.microsoft.com/en-us/library/ms742212(VS.85).aspx for parameter details.

Parameters
TCP_IPADDRESSremote TCP/IP address to connect to
TCP_PORTremote TCP port to connect to
TCP_SOCKET_TYPEsocket type, one of SOCK_STREAM, SOCK_DGRAM or SOCK_RAW
TCP_PROTOCOL,oneof IPPROTO_TCP or IPPROTO_UDP
Returns
TCPIP_CONNECTION_ESTABLISHED. Set to 1 if connection was successfully established.
check CA_ERROR on function failure
CA_API UINT __stdcall TcpIp_ListAddresses ( MSIHANDLE  hInstall)

Lists IP address assigned to this host.

Parameters
IP_LIST_TYPEList type to populate with data.
IP_LIST_PROPERTYThe property associated with the list.
IP_LIST_INDEXOptional index to start adding items at, default is 2 (assumes one item in the list already).
Returns
check CA_ERROR on function failure

This function populates an MSI list attached to a property IP_LIST_PROPERTY and of type IP_LIST_TYPE, beginning with index IP_LIST_INDEX (default is 2, assuming there's one item). It executes SELECT * FROM [IP_LIST_TYPE] WHERE Property=[IP_LIST_PROPERTY] to locate the target.

This custom action can be used in combination with a combo box. Call the CA in the InstallUISequence.

<CustomAction Id="SetIpIndex" Property="IP_LIST_INDEX" Value="2" Execute="immediate" />
<CustomAction Id="SetIpProperty" Property="IP_LIST_PROPERTY" Value="BIND_ADDRESS" Execute="immediate" />
<CustomAction Id="SetIpType" Property="IP_LIST_TYPE" Value="ComboBox" Execute="immediate" />
<InstallUISequence>
<Custom Action="SetIpListProperty" After="CostInitialize" />
<Custom Action="SetIpListType" After="SetIpListProperty" />
<Custom Action="SetIpListIndex" After="SetIpListType" />
<Custom Action="TcpIp_ListAddresses" After="SetIpListIndex">NOT Installed</Custom>
</InstallUISequence>

Use a ComboBox control in the UI.

<Control Id="Server" Type="ComboBox" X="30" Y="65" Width="200" Height="18" Property="BIND_ADDRESS">
<ComboBox Property="BIND_ADDRESS">
<ListItem Text="0.0.0.0" Value="0.0.0.0" />
</ComboBox>
</Control>


© Application Security Inc. - All Rights Reserved http://msiext.codeplex.com