cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
scottd72
Level 7

UseDLL() not working in Basic MSI

Hello,

I'm new to Basic MSI installs and I'm having problems getting UseDLL(..) to work. It works just fine in my Installscript MSI install, but it never works in a Basic MSI. I took a look into the documentation and there's nothing in there that says it is not compatable with Basic MSI's, so does anything know how to get it to work?

Here's my code:


szDLL = SUPPORTDIR ^ "MyDLL.dll";

ChangeDirectory (SUPPORTDIR);
if (UseDLL (szDLL) != 0) then
MessageBox ("UseDLL failed.", INFORMATION);
abort;
endif;
Labels (1)
0 Kudos
(7) Replies
RobertDickau
Flexera Alumni

Assuming converting it to "MSI DLL" format, etc., and calling directly as a custom action aren't in the cards, perhaps try getting the value of the SUPPORTDIR property, rather than the variable (see "Placing Files in the .msi Database and Extracting Them During Run Time" and "SUPPORTDIR"), or place in the Binary table and use StreamFileFromBinary?
0 Kudos
scottd72
Level 7

Thanks for the reply.

It wasn't a pathing issue. I wasn't sure how to convert my DLL to MSI DLL format, so I tried putting it into the binary table and calling StreamFileFromBinary and this worked.

Thanks again.
0 Kudos
ametisse
Level 5

Hello Scottd72,

I have the same problem. Can you explain me how to do to use StreamFileFromBinary please?

thanks.
0 Kudos
scottd72
Level 7

I can tell you how I used StreamFileFromBinary(), but I'm not sure it is the correct way. Maybe someone could chime in if I am wrong. Also, a warning, as a result of doing this I had corrupted my project file - so I'm guessing my approach is not correct or else this is a bug in IS.

Fortunately, there is a simple workaround for this file corruption issue which can be found here: http://community.flexerasoftware.com/showthread.php?t=190268

Anyway, to answer your question. I put my DLL file into supportfiles. Then, I went to Direct Editor -> Binary and added my DLL there, with the name MY_DLL and the ISBuildSourcePath as \support files\MyDLL.dll. Then in the custom action script I put this:

nLength = MAX_PATH + 1;
MsiGetProperty(hwnd, "SUPPORTDIR", szSupportDir, nLength);

szFileName = szSupportDir ^ "MyDLL.dll";

nResult = StreamFileFromBinary (hwnd, "MY_DLL", szFileName);

if (UseDLL (szFileName) != 0) then
MessageBox ("UseDLL failed.", INFORMATION);
abort;
endif;


Hope this helps.
0 Kudos
ametisse
Level 5

Thank you very much. 😮
I will try that on monday, because I must go now.
I hope this will work for me too.
0 Kudos
ametisse
Level 5

Hi,

Now I'm not so tired, I know that your problem isn't the same as mine. (mine is explain here : http://community.flexerasoftware.com/showthread.php?p=456292&posted=1#post456292)

I manage to use my dll using the custom actions (new standard dll > stored in binary table)
(you can found my project in the topic which is linked, if this can help you...)

But my problem is only to use strings in functions of the DLL.

Thank you very much for your help.
Have a good day.
0 Kudos
MattQVI
Level 8

What happens if the DLL I want to use resides on the PC in a directory from a different install? Will UseDLL still work? Will I have to change BACK to the install dir (where I am running setup.exe from) after UseDLL is successful?
0 Kudos