Archive: Callback from a Plugin back into NSIS?


Callback from a Plugin back into NSIS?
Is it possible with NSIS, to make callback which is callable from a plugin, while the plugin is doing a very long task.

So effectively the pseudo code would look something like:


Function ProgressCallback
Pop $0
${Log} "$0"
FunctionEnd

AddressOf $1 ProgressCallback

Plugin::DoLongTask $1


The intention here, is that there is a very long process taking place, and that I want to callback into the NSIS install script to have it send the progress reports to our install manager.
Obviously the DoLongTask of the plugin would then use address $1 to make the callback somehow. The "AddressOf" command above is just my own pseudo code, and obviously not real as well.

in the nsis code, you use GetFunctionAddress to get the address, in the plugin code, you call ExecuteCodeSegment (part of the extra parameter struct passed to plugin exports) (you also subtract 1 from the address you get from GetFunctionAddress IIRC)


Thanks very much!


Hmm okay, this works fine when I pass data into the NSIS script. However it appears, that using popstack, and getuservariable, I am unable to get any data back from the NSIS script.

Is this correct? Or am I doing something wrong?


no, could get data back, save "result" from the nsis function in a specific register or push it to the stack, then read it back in the plugin when the nsis function call returns


Hmm that's what I am doing the callback does that exactly. Now I realize actually that in the callback functions, I am unable to get data off the stack either, or from the registers.
What appears to happen from my perspective, is that NSIS engine, and my plugin appear to have two seperate copies of the stack and registers set.


You'll have to add some code examples to that statement to get a solution.