PDA

View Full Version : DLL function calls from script...



eposty
02-14-2002, 02:50 PM
I am using ISWI 2.03...

I have a DLL that was given to me by development. It has 2 functions in it only...

int LoadLicenseFile(char* fileName);
char* GetValue(char* szSectionName, char* szEntryName);

Development also mentioned in the email...

It is built using C++ and 2 APIs are exported. you can see them using Dependency Walker.

And no more need to call CoInitialize/CoUninitialize. No more to register.
You can just directly call those 2 APIs.

The name of the file is HWLIC.DLL. I put it in the binary table and I prototype it as...

prototype NUMBER HWLIC.LoadLicenseFile( STRING );
prototype STRING HWLIC.GetValue( STRING, STRING );

And then later on when I try to get ready to call it (before CostFinalize so I can set some other information), I do...

szBinaryKey = "LICENSE_FILE";
szDLLFile = SUPPORTDIR ^ "HWLIC.Dll";
szLicenseFile = "C:\\Temp\\license.lic";

// load the DLL from the binary section...
StreamFileFromBinary( hInstall, szBinaryKey, szDLLFile );

nResult = UseDLL( szDLLFile );

nResult = HWLIC.LoadLicenseFile( szLicenseFile );
szStatus = HWLIC.GetValue( "Server", "EDMS_DOCDOMAIN" ); // TRUE
szStatus = HWLIC.GetValue( "Server", "MSPROJECT" ); // FALSE
szStatus = HWLIC.GetValue( "Server", "BIZCOVE" ); // TRUE

nResult = UnUseDLL( szDLLFile );

However, when I make the LoadLicenseFile call, the install just jumps to the finished dialog and that is it. I don't get an error or anything.

Any ideas?

Thanks.

Crnjan
02-18-2002, 12:28 PM
maybe you should try with:

int __stdcall LoadLicenseFile(char* fileName);
char* __stdcall GetValue(char* szSectionName, char* szEntryName);

can you see these functions within the Dependencie walker with these names (for example: "LoadLicenseFile" and not with "_LoadLicenseFile@4" or something that? If so, than you should try with exporting these functions with .def file)?