Dynamic-Link Libraries
Dynamic-Link Libraries

A custom action can call a function defined in a dynamic-link library (DLL) written in C or C++. The DLL can exist as a file installed during the current installation or as a temporary binary stream originating from the Binary table of the installation database.

Note that any called functions, including custom actions in DLLs, must specify the __stdcall calling convention. For example, to call CustomAction use the following.

#include <windows.h>
#include <msi.h>
#include <Msiquery.h>
#pragma comment(lib, "msi.lib")

UINT __stdcall CustomAction(MSIHANDLE hInstall)

For more information see, Accessing the Current Installer Session from Inside a Custom Action

The following types of custom actions call a dynamic-link library.

Custom action typeDescription
Custom Action Type 1DLL file stored in a Binary table stream.
Custom Action Type 17DLL file installed with a product.

 

Note  To use COM you need to call CoInitializeEx in the custom action. Do not quit if you find that the thread has already been initialized. For example, the thread is initialized in a per-machine installation but not in a per-user installation.

See Summary List of All Custom Action Types for a summary of all types of custom actions and how they are encoded into the CustomAction table.

Send comments about this topic to Microsoft

Build date: 11/12/2009

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View