Andrew812
Posts: 3
Joined: Tue Nov 15, 2022 8:48 am

Get string from standard dll

Tue Nov 15, 2022 9:05 am

Calling functions from dll supports string output type
Image

But, unfortunately it is not documented how to implement such function inside C DLL
https://www.advancedinstaller.com/user- ... ll-std-dll

How to make the function that will return string value from standard DLL in C language.
Usually client provides a buffer to DLL, and DLL fills it with data. A memory allocated for string inside DLL should be released inside DLL otherwise if function give this buffer to advanced installer this cause memory leak.

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: Get string from standard dll

Tue Nov 15, 2022 4:50 pm

Hello Andrew and welcome to our forums,
How to make the function that will return string value from standard DLL in C language.
I am not quite sure I understand this question. Could you please give me some more details about what you'd like to achieve here?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Andrew812
Posts: 3
Joined: Tue Nov 15, 2022 8:48 am

Re: Get string from standard dll

Wed Nov 16, 2022 3:58 am

I'm asking how to write a function in my DLL written in C language that will return string, so advanced installer could read this string.
See my screenshot, supported output types Unicode/Multibyte strings.

The situation is that in normal DLL design, a client (advanced installer) have to provide its buffer to DLL function and DLL fill this buffer with string data.
If DLL return string buffer allocated inside DLL to the client then it cause memory leak, because memory allocated inside DLL should be released inside DLL.

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: Get string from standard dll

Thu Nov 17, 2022 5:00 pm

Hello Andrew,

I'm afraid that is rather a C question rather than an Advanced Installer question.

As I am no expert myself in C, I'm afraid I can not help - however I am pretty sure you can find this on the internet.

If there's something I can help with regarding Advanced Installer, please let me know and I will gladly assist.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Andrew812
Posts: 3
Joined: Tue Nov 15, 2022 8:48 am

Re: Get string from standard dll

Fri Nov 18, 2022 8:31 am

Workarounded that using Msi API, it possible to read/write installer properties by MsiGetProperty / MsiSetProperty functions.

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: Get string from standard dll

Fri Nov 18, 2022 9:56 am

Hello Andrew,

Thank you for your followup on this and for sharing your solution with us!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”