gridman
Pilgrim

Re: Serial number validation dll

I didn't know that klacounte. Thanks.
0 Kudos
Chikura
Pilgrim

copy the DLL to system32

Hi,

Previously i was having problems when i tried to load a DLL from the SUPPORTDIR directly. IS was unable to load the DLL.

We solved it by copying that DLL first to the system32 directory and then loading the dll from there.
Ur Customaction should do following:
1) Check for existence of DLL in system32.
2) If it exists delete that DLL.
3) Copy that DLL from SUPPORTDIR to system32.
4) Load DLL
5) Do whatever u want,,,,,,,
.
.
)Unload DLL
)Delete the DLL from system32.

Hope it helps,
Santhosh
0 Kudos
Nicolasb
Pilgrim

Re: Serial number validation dll

Thank you guy for these information! I'll try them today and give you news right here!
0 Kudos
klacounte
Pilgrim

Re: Serial number validation dll

Chikura wrote:
We solved it by copying that DLL first to the system32 directory and then loading the dll from there.

You can load a dll from any location as long as you specify the full path to the dll. Following this link for more info LoadLibrary Function. Copying the dll to the System32 directory works because that is in the dll search path but I would not recommend it. See this link for dll search order Dynamic-Link Library Search Order.

If your dll loads other dll's from that same directory then you'll need to call SetDllDirectory on XP SP1 or higher or SetCurrentDirectory on any other OS.
0 Kudos
Nicolasb
Pilgrim

Re: Serial number validation dll

I tried your suggestion and well, I think I missed something somewhere.. I'm sorry, but I got more questions.

I put my file in the supportdir and I loaded the DLL using UseDLL in an Installscript CA. The UseDll function worked fine, but I couldn't call my function... I think an exception occurs when I call the function. Do you have an example code on how to call a function in an external dll. The example along with the UseDll example isn't enough for me. Here is my function definition : extern "C" __declspec(dllexport) int __stdcall TestDll( int pOut )

Also, I explored the idea of putting my dll in the binary table. But here, I don't see where to put it in the project. I did not find the folder.

Thanks guys!
0 Kudos
esiemiat
Occasional contributor

Re: Serial number validation dll

Did you prototype the DLL function before calling it. The prototype should look something like:

prototype MyDLL.MyFunction( INT, INT, INT ); 
0 Kudos
Nicolasb
Pilgrim

Re: Serial number validation dll

You mean that the prototype for function
extern "C" __declspec(dllexport) int __stdcall TestDll( int pOut )
in gaga.dll should be
prototype gaga.TestDll( INT, INT, INT ); 

(??) What is the argument pOut and what is the return value of the function ? And why the third int ? I would have declared my function that way :
prototype INT cdkc.TestDll( INT );
0 Kudos
esiemiat
Occasional contributor

Re: Serial number validation dll

That was a sample from the help. The point was that you had to prototype your DLL function in InstallScript prior to calling it. Substitute you DLL name for MyDll, you function name for MyFunction, and list whatever your paramters are in the parameter list.
0 Kudos