Top Description Fields Methods
com.sun.jna.platform.win32

public Interface Msi

extends StdCallLibrary
Imports
com.sun.jna.Native, com.sun.jna.ptr.IntByReference, com.sun.jna.win32.StdCallLibrary, .W32APIOptions

Provides access to the w32 MSI installer library.

Field Summary

Modifier and TypeField and Description
public static final int
INSTALLSTATE_ABSENT

The feature was uninstalled.

public static final int
INSTALLSTATE_ADVERTISED

The advertised feature.

public static final int
INSTALLSTATE_BADCONFIG

The configuration data is corrupt.

public static final int
INSTALLSTATE_BROKEN

The feature is broken.

public static final int
INSTALLSTATE_DEFAULT

The feature is installed in the default location: local or source.

public static final int
INSTALLSTATE_INCOMPLETE

The installation is suspended or in progress.

public static final int
INSTALLSTATE_INVALIDARG

An invalid parameter was passed to the function.

public static final int
INSTALLSTATE_LOCAL

The feature was installed on the local drive.

public static final int
INSTALLSTATE_MOREDATA

The return buffer is full.

public static final int
INSTALLSTATE_NOTUSED

The component being requested is disabled on the computer.

public static final int
INSTALLSTATE_REMOVED

The component is being removed.

public static final int
INSTALLSTATE_SOURCE

The feature must run from the source, CD-ROM, or network.

public static final int
INSTALLSTATE_SOURCEABSENT

The feature must run from the source, and the source is unavailable.

public static final int
INSTALLSTATE_UNKNOWN

An unrecognized product or feature was specified.

public static final Msi
Inherited from com.sun.jna.win32.StdCallLibrary:
FUNCTION_MAPPERSTDCALL_CONVENTION

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

ERROR_BAD_CONFIGURATION - The configuration data is corrupt. ERROR_INVALID_PARAMETER - An invalid parameter was passed to the function. ERROR_NO_MORE_ITEMS - There are no components to return. ERROR_NOT_ENOUGH_MEMORY - The system does not have enough memory to complete the operation. Available with Windows Server 2003. ERROR_SUCCESS - A value was enumerated.
MsiEnumComponents
(WinDef.DWORD
Specifies the index of the component to retrieve. This parameter should be zero for the first call to the MsiEnumComponents function and then incremented for subsequent calls. Because components are not ordered, any new component has an arbitrary index. This means that the function can return components in any order.
iComponentIndex
,
char[]
Pointer to a buffer that receives the component code. This buffer must be 39 characters long. The first 38 characters are for the GUID, and the last character is for the terminating null character.
lpComponentBuf
)

The MsiEnumComponents function enumerates the installed components for all products.

public int

Returns:

The MsiGetComponentPath function returns the following values. INSTALLSTATE_NOTUSED - The component being requested is disabled on the computer. INSTALLSTATE_ABSENT - The component is not installed. INSTALLSTATE_INVALIDARG - One of the function parameters is invalid. INSTALLSTATE_LOCAL - The component is installed locally. INSTALLSTATE_SOURCE - The component is installed to run from source. INSTALLSTATE_SOURCEABSENT - The component source is inaccessible. INSTALLSTATE_UNKNOWN - The product code or component ID is unknown.
MsiGetComponentPath
(String
Specifies the product code for the client product.
szProduct
,
String
Specifies the component ID of the component to be located.
szComponent
,
char[]
Pointer to a variable that receives the path to the component. This parameter can be null. If the component is a registry key, the registry roots are represented numerically. If this is a registry subkey path, there is a backslash at the end of the Key Path. If this is a registry value key path, there is no backslash at the end. For example, a registry path on a 32-bit operating system of HKEY_CURRENT_USER\SOFTWARE\Microsoft is returned as "01:\SOFTWARE\Microsoft\".
lpPathBuf
,
IntByReference
Pointer to a variable that specifies the size, in characters, of the buffer pointed to by the lpPathBuf parameter. On input, this is the full size of the buffer, including a space for a terminating null character. If the buffer passed in is too small, the count returned does not include the terminating null character. If lpPathBuf is null, pcchBuf can be null.
pcchBuf
)

The MsiGetComponentPath function returns the full path to an installed component.

public int

Returns:

ERROR_BAD_CONFIGURATION - The configuration data is corrupt. ERROR_INSTALL_FAILURE - The product code could not be determined. ERROR_INVALID_PARAMETER - An invalid parameter was passed to the function. ERROR_SUCCESS - The function completed successfully. ERROR_UNKNOWN_COMPONENT - The specified component is unknown.
MsiGetProductCode
(String
This parameter specifies the component code of a component that has been installed by the application. This will be typically the component code of the component containing the executable file of the application.
szComponent
,
char[]
Pointer to a buffer that receives the product code. This buffer must be 39 characters long. The first 38 characters are for the GUID, and the last character is for the terminating null character.
lpProductBuf
)

The MsiGetProductCode function returns the product code of an application by using the component code of an installed or advertised component of the application.

public int

Returns:

The MsiGetComponentPath function returns the following values. INSTALLSTATE_NOTUSED - The component being requested is disabled on the computer. INSTALLSTATE_ABSENT - The component is not installed. INSTALLSTATE_INVALIDARG - One of the function parameters is invalid. INSTALLSTATE_LOCAL - The component is installed locally. INSTALLSTATE_MOREDATA - The buffer provided was too small. INSTALLSTATE_SOURCE - The component is installed to run from source. INSTALLSTATE_SOURCEABSENT - The component source is inaccessible. INSTALLSTATE_UNKNOWN - The product code or component ID is unknown.
MsiLocateComponent
(String
Specifies the component ID of the component to be located.
szComponent
,
char[]
Pointer to a variable that receives the path to the component. The variable includes the terminating null character.
lpPathBuf
,
IntByReference
Pointer to a variable that specifies the size, in characters, of the buffer pointed to by the lpPathBuf parameter. On input, this is the full size of the buffer, including a space for a terminating null character. Upon success of the MsiLocateComponent function, the variable pointed to by pcchBuf contains the count of characters not including the terminating null character. If the size of the buffer passed in is too small, the function returns INSTALLSTATE_MOREDATA. If lpPathBuf is null, pcchBuf can be null.
pcchBuf
)

The MsiLocateComponent function returns the full path to an installed component without a product code.

Field Detail

INSTALLSTATE_ABSENTback to summary
public static final int INSTALLSTATE_ABSENT

The feature was uninstalled.

INSTALLSTATE_ADVERTISEDback to summary
public static final int INSTALLSTATE_ADVERTISED

The advertised feature.

INSTALLSTATE_BADCONFIGback to summary
public static final int INSTALLSTATE_BADCONFIG

The configuration data is corrupt.

INSTALLSTATE_BROKENback to summary
public static final int INSTALLSTATE_BROKEN

The feature is broken.

INSTALLSTATE_DEFAULTback to summary
public static final int INSTALLSTATE_DEFAULT

The feature is installed in the default location: local or source.

INSTALLSTATE_INCOMPLETEback to summary
public static final int INSTALLSTATE_INCOMPLETE

The installation is suspended or in progress.

INSTALLSTATE_INVALIDARGback to summary
public static final int INSTALLSTATE_INVALIDARG

An invalid parameter was passed to the function.

INSTALLSTATE_LOCALback to summary
public static final int INSTALLSTATE_LOCAL

The feature was installed on the local drive.

INSTALLSTATE_MOREDATAback to summary
public static final int INSTALLSTATE_MOREDATA

The return buffer is full.

INSTALLSTATE_NOTUSEDback to summary
public static final int INSTALLSTATE_NOTUSED

The component being requested is disabled on the computer.

INSTALLSTATE_REMOVEDback to summary
public static final int INSTALLSTATE_REMOVED

The component is being removed.

INSTALLSTATE_SOURCEback to summary
public static final int INSTALLSTATE_SOURCE

The feature must run from the source, CD-ROM, or network.

INSTALLSTATE_SOURCEABSENTback to summary
public static final int INSTALLSTATE_SOURCEABSENT

The feature must run from the source, and the source is unavailable.

INSTALLSTATE_UNKNOWNback to summary
public static final int INSTALLSTATE_UNKNOWN

An unrecognized product or feature was specified.

INSTANCEback to summary
public static final Msi INSTANCE

Method Detail

MsiEnumComponentsback to summary
public int MsiEnumComponents(WinDef.DWORD iComponentIndex, char[] lpComponentBuf)

The MsiEnumComponents function enumerates the installed components for all products. This function retrieves one component code each time it is called.

Parameters
iComponentIndex:WinDef.DWORD

Specifies the index of the component to retrieve. This parameter should be zero for the first call to the MsiEnumComponents function and then incremented for subsequent calls. Because components are not ordered, any new component has an arbitrary index. This means that the function can return components in any order.

lpComponentBuf:char[]

Pointer to a buffer that receives the component code. This buffer must be 39 characters long. The first 38 characters are for the GUID, and the last character is for the terminating null character.

Returns:int

ERROR_BAD_CONFIGURATION - The configuration data is corrupt. ERROR_INVALID_PARAMETER - An invalid parameter was passed to the function. ERROR_NO_MORE_ITEMS - There are no components to return. ERROR_NOT_ENOUGH_MEMORY - The system does not have enough memory to complete the operation. Available with Windows Server 2003. ERROR_SUCCESS - A value was enumerated.

MsiGetComponentPathback to summary
public int MsiGetComponentPath(String szProduct, String szComponent, char[] lpPathBuf, IntByReference pcchBuf)

The MsiGetComponentPath function returns the full path to an installed component. If the key path for the component is a registry key then the registry key is returned.

Parameters
szProduct:String

Specifies the product code for the client product.

szComponent:String

Specifies the component ID of the component to be located.

lpPathBuf:char[]

Pointer to a variable that receives the path to the component. This parameter can be null. If the component is a registry key, the registry roots are represented numerically. If this is a registry subkey path, there is a backslash at the end of the Key Path. If this is a registry value key path, there is no backslash at the end. For example, a registry path on a 32-bit operating system of HKEY_CURRENT_USER\SOFTWARE\Microsoft is returned as "01:\SOFTWARE\Microsoft\".

pcchBuf:IntByReference

Pointer to a variable that specifies the size, in characters, of the buffer pointed to by the lpPathBuf parameter. On input, this is the full size of the buffer, including a space for a terminating null character. If the buffer passed in is too small, the count returned does not include the terminating null character. If lpPathBuf is null, pcchBuf can be null.

Returns:int

The MsiGetComponentPath function returns the following values. INSTALLSTATE_NOTUSED - The component being requested is disabled on the computer. INSTALLSTATE_ABSENT - The component is not installed. INSTALLSTATE_INVALIDARG - One of the function parameters is invalid. INSTALLSTATE_LOCAL - The component is installed locally. INSTALLSTATE_SOURCE - The component is installed to run from source. INSTALLSTATE_SOURCEABSENT - The component source is inaccessible. INSTALLSTATE_UNKNOWN - The product code or component ID is unknown.

MsiGetProductCodeback to summary
public int MsiGetProductCode(String szComponent, char[] lpProductBuf)

The MsiGetProductCode function returns the product code of an application by using the component code of an installed or advertised component of the application. During initialization, an application must determine under which product code it has been installed or advertised.

Parameters
szComponent:String

This parameter specifies the component code of a component that has been installed by the application. This will be typically the component code of the component containing the executable file of the application.

lpProductBuf:char[]

Pointer to a buffer that receives the product code. This buffer must be 39 characters long. The first 38 characters are for the GUID, and the last character is for the terminating null character.

Returns:int

ERROR_BAD_CONFIGURATION - The configuration data is corrupt. ERROR_INSTALL_FAILURE - The product code could not be determined. ERROR_INVALID_PARAMETER - An invalid parameter was passed to the function. ERROR_SUCCESS - The function completed successfully. ERROR_UNKNOWN_COMPONENT - The specified component is unknown.

MsiLocateComponentback to summary
public int MsiLocateComponent(String szComponent, char[] lpPathBuf, IntByReference pcchBuf)

The MsiLocateComponent function returns the full path to an installed component without a product code. This function attempts to determine the product using MsiGetProductCode, but is not guaranteed to find the correct product for the caller. MsiGetComponentPath should always be called when possible.

Parameters
szComponent:String

Specifies the component ID of the component to be located.

lpPathBuf:char[]

Pointer to a variable that receives the path to the component. The variable includes the terminating null character.

pcchBuf:IntByReference

Pointer to a variable that specifies the size, in characters, of the buffer pointed to by the lpPathBuf parameter. On input, this is the full size of the buffer, including a space for a terminating null character. Upon success of the MsiLocateComponent function, the variable pointed to by pcchBuf contains the count of characters not including the terminating null character. If the size of the buffer passed in is too small, the function returns INSTALLSTATE_MOREDATA. If lpPathBuf is null, pcchBuf can be null.

Returns:int

The MsiGetComponentPath function returns the following values. INSTALLSTATE_NOTUSED - The component being requested is disabled on the computer. INSTALLSTATE_ABSENT - The component is not installed. INSTALLSTATE_INVALIDARG - One of the function parameters is invalid. INSTALLSTATE_LOCAL - The component is installed locally. INSTALLSTATE_MOREDATA - The buffer provided was too small. INSTALLSTATE_SOURCE - The component is installed to run from source. INSTALLSTATE_SOURCEABSENT - The component source is inaccessible. INSTALLSTATE_UNKNOWN - The product code or component ID is unknown.