Log in

No account? Create an account
Previous Entry Share Next Entry
MSI Custom Action DLL Written in D
I'm tasked with testing software. I've implemented some ActiveX controls to make sure we integrate into software we don't have access to. That was a pretty exciting accomplishment but I've been haunted by the installers. Our installers include a DLL we have little insight on and calls a couple functions as a Custom Action, so I haven't been able to verify our installs work until we hand it over.

Well today I had some time to look at mocking something up for this and my success has come through utilizing a DLL written in D. To make this happen I used some help from "MSI Custom Action DLL" which provided the signature for the Custom Action function and what the primary header file was.

pragma(lib, "msi.lib");
UINT MsiSetPropertyW(MSIHANDLE hInstall,
	LPCWSTR   szName,       // property identifier, case-sensitive
	LPCWSTR   szValue);     // property value, null to undefine property

alias MSIHANDLE = uint;

export uint CustomActionFunction(MSIHANDLE hModule) { return ... }

Compilation was done from a Developer Command Prompt for AMD64 build. The generated DLL was then used to replace the black box DLL, and things were great.

dmd -m64 -shared -ofmain.dll main.d