MsiAdvertiseScript function

The MsiAdvertiseScript function copies an advertised script file into the specified locations.

Syntax


UINT MsiAdvertiseScript(
  _In_ LPCTSTR szScriptFile,
  _In_ DWORD   dwFlags,
  _In_ PHKEY   phRegData,
  _In_ BOOL    fRemoveItems
);

Parameters

szScriptFile [in]

The full path to a script file generated by MsiAdvertiseProduct or MsiAdvertiseProductEx.

dwFlags [in]

The following bit flags from SCRIPTFLAGS control advertisement. The value of dwFlags can be a combination of the following values.

FlagMeaning
SCRIPTFLAGS_CACHEINFO
0x001

Include this flag if the icons need to be created or removed.

SCRIPTFLAGS_SHORTCUTS
0x004

Include this flag if the shortcuts need to be created or removed.

SCRIPTFLAGS_MACHINEASSIGN
0x008

Include this flag if the product to be assigned to a computer.

SCRIPTFLAGS_REGDATA_CNFGINFO
0x020

Include this flag if the configuration and management information in the registry data needs to be written or removed.

SCRIPTFLAGS_VALIDATE_TRANSFORMS_LIST
0x040

Include this flag to force validation of the transforms listed in the script against previously registered transforms for this product. Note that transform conflicts are detected using a string comparison that is case insensitive and are evaluated between per-user and per-machine installations across all contexts. If the list of transforms in the script does not match the transforms registered for the product, the function returns ERROR_INSTALL_TRANSFORM_FAILURE.

SCRIPTFLAGS_REGDATA_CLASSINFO
0x080

Include this flag if advertisement information in the registry related to COM classes needs to be written or removed.

SCRIPTFLAGS_REGDATA_EXTENSIONINFO
0x100

Include this flag if advertisement information in the registry related to an extension needs to be written or removed.

SCRIPTFLAGS_REGDATA_APPINFO
0x180

Include this flag if the advertisement information in the registry needs to be written or removed.

SCRIPTFLAGS_REGDATA
0x1A0

Include this flag if the advertisement information in the registry needs to be written or removed.

 

phRegData [in]

A registry key under which temporary information about registry data is to be written. If this parameter is null, the registry data is placed under the appropriate key, based on whether the advertisement is per-user or per-machine. If this parameter is non-null, the script will write the registry data under the specified registry key rather than the normal location. In this case, the application will not get advertised to the user.

Note that this registry key cannot be used when generating an advertisement of a product for a user or a computer because the provider of the registry key generally deletes the key. The registry key is located outside of the normal registry locations for shell, class, and .msi configuration information and it is not under HKEY_CLASSES_ROOT. This registry key is only intended for getting temporary information about registry data in a script.

fRemoveItems [in]

TRUE if specified items are to be removed instead of being created.

Return value

ValueMeaning
ERROR_SUCCESS

The function completed successfully.

ERROR_ACCESS_DENIED

The calling process was not running under the LocalSystem account.

An error relating to an action

See Error Codes.

Initialization Error

An error relating to initialization occurred.

ERROR_CALL_NOT_IMPLEMENTED

This function is only available on Windows 2000 and Windows XP.

 

 

Remarks

The process calling this function must be running under the LocalSystem account. To advertise an application for per-user installation to a targeted user, the thread that calls this function must impersonate the targeted user. If the thread calling this function is not impersonating a targeted user, the application is advertised to all users for installation with elevated privileges.

Requirements

Version

Windows Installer 5.0 on Windows Server 2012, Windows 8, 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 or Windows XP. See the Windows Installer Run-Time Requirements for information about the minimum Windows service pack that is required by a Windows Installer version.

Header

Msi.h

Library

Msi.lib

DLL

Msi.dll

Unicode and ANSI names

MsiAdvertiseScriptW (Unicode) and MsiAdvertiseScriptA (ANSI)

See also

Installation Context

 

 

Show: