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 type||Description|
|Custom Action Type 1||DLL file stored in a Binary table stream.|
|Custom Action Type 17||DLL file installed with a product.|
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.