View Full Version : Trying to use win32 dll in custom action - Cannot find entry point of function

11-07-2005, 03:12 PM
I've been trying to call into a win32 dll for a couple of days and have yet to get it working. Everytime I try it I get an error from the custom action "Can not find the entry point of function 'readInstallRegKeys', make sure it is exported"

I created a c++ dll, and a .def file for it, and I created a new custom action - i've done a lot of searching on the forums and in the installshield documentation.
One aspect of it that I am thinking may be the root of the problem is in the custom action wizard
- when i define the parameters of the function call I am not sure what install property represents the MSIHANDLE that should be passed into the function.
- I am currently defining the custom action to 'Call a function in a standard dynamic link library' with Location set to 'Stored in a binary table' and referred to the dll in a scripts folder i have on the installshield machine.

Either way as it stands the install cannot see the function

Any help is appreciated...

for reference the dll is written in c++ and does some simple registry reading
I've defined the dll as follows:
#include "stdafx.h"
#include <string>
#include "msiquery.h"
#include "msi.h"

BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
return TRUE;

UINT _stdcall readInstallRegKeys(MSIHANDLE hInstall)
//read the values of the installation registry keys
HKEY hkey;

std::string keyValue;

MessageBox(NULL,"trying registry key read", "test" ,MB_OK);

RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\ShipConstructor2006"), 0, NULL,&hkey);

MessageBox(NULL, "trying registry key read", "test" ,MB_OK);

return 1;

the def file is as follows:
LIBRARY "installUtilDLL"
readInstallRegKeys @1

Christopher Painter
11-07-2005, 03:19 PM
Don't use new standard DLL ( that's an InstallShield specific thunking DLL ). Use new MSI dll. ( MSI Custom Action Type 1 ) This is the CA type that is native to MSI. When you use it you don't specify function arguments because there is only 1 standard entry point for a MSI DLL Function.