Skip to content
⌘ NSIS Forum Archive

Calling an ANSI string DLL from Unicode NSIS

7 posts

will49#

Calling an ANSI string DLL from Unicode NSIS

I have a legacy custom DLL that I need to call from my installer that uses ANSI character strings for parameters. Now I want to move to using the Unicode version of NSIS v3, but I can't easily recompile the DLL to support wide characters.

I've been searching for a way to pass single byte strings to and from the DLL and then convert to Unicode for use within NSIS, but I haven't found a clear answer.

Is "CallAnsiPlugin" any use for what I need? The sample code is pretty unclear to me.

Any pointers are much appreciated.
Afrow UK#
The CallAnsiPlugin plug-in is what you need to use. What is not clear from the example?

Stu
will49#
Maybe it's best to show what I had been using before with my DLL:

   StrCpy $0 ${NSIS_MAX_STRLEN}          ; assign memory to $0
System::Call '$TEMP\${TMP_SUB_DIR}\MYCUSTOMDLL::GetString(t) i(.r0) .r1'
MessageBox MB_OK|MB_ICONEXCLAMATION $0
How would I accomplish the same thing with CallAnsiPlugin? Maybe something like this?

CallAnsiPlugin::Call "$TEMP\${TMP_SUB_DIR}\MYCUSTOMDLL" GetString 1 $0
will49#
I should point out that my dll is not an NSIS plugin DLL. It's just a plain Win32 DLL that copies a string into the parameter.
Anders#
CallAnsiPlugin only works for NSIS plugins.

The System plugin will work, you just have to use the correct string type and in your case just change (t) to (m).

m = char*
w = wchar_t*
t = TCHAR* / LPTSTR
taichismith#
ANSI to Unicode

Try ANSI to Unicode Migration Tool solution to import ANSI file to Unicode Cloud environment. With an easy and secure connection to Exchange Online in presence of the Internet, it effortlessly uploads ANSI data to Unicode Platform. Supports all versions of Windows OS and Outlook data files. Embedded with high-tech features to provide accurate ANSI to Unicode.

Visit at : https://www.osttopstapp.com/ansi-to-unicode-pst.html