MsiAdvertiseProductEx Function

Windows Installer

MsiAdvertiseProductEx Function

The MsiAdvertiseProductEx function generates an advertise script or advertises a product to the computer. This function enables Windows Installer to write to a script the registry and shortcut information used to assign or publish a product. The script can be written to be consistent with a specified platform by using MsiAdvertiseProductEx. The MsiAdvertiseProductEx function provides the same functionality as MsiAdvertiseProduct.

Syntax

C++UINT MsiAdvertiseProductEx(
  __in  LPCTSTR szPackagePath,
  __in  LPCTSTR szScriptfilePath,
  __in  LPCTSTR szTransforms,
  __in  LANGID lgidLanguage,
  __in  DWORD dwPlatform,
  __in  DWORD dwOptions
);

Parameters

szPackagePath [in]

The full path to the package of the product being advertised.

szScriptfilePath [in]

The full path to the script file to be created with the advertised information. To advertise the product locally to the computer, set ADVERTISEFLAGS_MACHINEASSIGN or ADVERTISEFLAGS_USERASSIGN.

Flag Meaning
ADVERTISEFLAGS_MACHINEASSIGN
0

Set to advertise a per-computer installation of the product available to all users.

ADVERTISEFLAGS_USERASSIGN
1

Set to advertise a per-user installation of the product available to a particular user.

 

szTransforms [in]

A semicolon–delimited list of transforms to be applied. The list of transforms can be prefixed with the @ or | character to specify the secure caching of transforms. The @ prefix specifies secure-at-source transforms and the | prefix indicates secure full path–transforms. For more information, see Secured Transforms. This parameter may be null.

lgidLanguage [in]

The language to use if the source supports multiple languages.

dwPlatform [in]

Bit flags that control for which platform the installer should create the script. This parameter is ignored if szScriptfilePath is null. If dwPlatform is zero (0), then the script is created based on the current platform. This is the same functionality as MsiAdvertiseProduct. If dwPlatform is 1 or 2, the installer creates script for the specified platform.

Flag Meaning
none
0

Creates a script for the current platform.

MSIARCHITECTUREFLAGS_X86
1

Creates a script for the x86 platform.

MSIARCHITECTUREFLAGS_IA64
2

Creates a script for the Intel Itanium Processor Family (IPF).

MSIARCHITECTUREFLAGS_AMD64
4

Creates a script for the x64 platform.

 

dwOptions [in]

Bit flags that specify extra advertisement options. Nonzero value is only available in Windows Installer versions shipped with Windows Server 2003 and Windows XP with SP1 and later.

Flag Meaning
MSIADVERTISEOPTIONS_INSTANCE
1

Multiple instances through product code changing transform support flag. Advertises a new instance of the product. Requires that the szTransforms parameter includes the instance transform that changes the product code. For more information, see Installing Multiple Instances of Products and Patches.

 

Return Value

Value Meaning
ERROR_SUCCESS

The function completes successfully.

An error that relates to an action

For more information, see Error Codes.

Initialization Error

An initialization error has occurred.

ERROR_CALL_NOT_IMPLEMENTED

This error is returned if an attempt is made to generate an advertise script on any platform other than Windows 2000 or Windows XP. Advertisement to the local computer is supported on all platforms.

 

Remarks

Multiple instances through product code–changing transforms is only available for Windows Installer versions shipping with Windows Server 2003 and Windows XP with SP1 and later.

Requirements

VersionWindows Installer 5.0 on Windows Server 2008 R2 or Windows 7. Windows Installer 4.0 or Windows Installer 4.5 on Windows Server 2008 or Windows Vista. Windows Installer on Windows Server 2003, Windows XP, and Windows 2000. See the Windows Installer Run-Time Requirements for information about the minimum Windows service pack that is required by a Windows Installer version.
HeaderMsi.h
LibraryMsi.lib
DLLMsi.dll
Unicode and ANSI namesMsiAdvertiseProductExW (Unicode) and MsiAdvertiseProductExA (ANSI)

See Also

Multiple-Package Installations

Send comments about this topic to Microsoft

Build date: 8/13/2009

© 2009 Microsoft Corporation. All rights reserved.