Archive: Capturing input from EXE or DLL


Capturing input from EXE or DLL
I need to make a custom page that prompts for a directory needed during install. I'd like to have a default value in the DirRequest field that comes from executing an EXE or DLL plug-in call that I will write.

The NSIS docs don't elaborate on what kind of I/O can happen with plug-in calls, or even how data types work in the scripting language when DLL functions are called.

So could someone explain how I could obtain data this way? I would then expect to do a MUI_INSTALLOPTIONS_WRITE to set the value in the custom page.


MUI_INSTALLOPTIONS_WRITE is the way to write to INI files that were extracted using MUI_INSTALLOPTIONS_EXTRACT. What's the problem with it?

NSIS doesn't use any other data type but string. Any command or plug-in may interpret the string as any other data type, but the variables always contain strings.


Ok, say you need to prompt the user for a file path. You want the installer to 'guess' the filepath for the user, incase the user doesn't know. I can write an EXE or DLL that can generate this 'guessed' answer.

Let's say I make a plug-in DLL for this. I do something like mydll:guessthepath... but how do I script it to receive data from the plug-in call? If I had it in a register/variable, I could use MUI_INSTALLOPTIONS_WRITE to set the value that I generated.


MUI_INSTALLOPTIONS_WRITE writes into INI files. It works with InstallOptions because that plug-in uses INI files to describe the dialog to be created.

The parameters that are passed after mydll::guessthepath are passed on the stack. See Contrib\ExDLL\ExDLL.c or any other plug-in for an example of stack usage in plug-ins.


ExDLL.c explains how to retrieve data, but how about returning data to the script?


pushstring() is the most common method of returning values.