Skip to content
⌘ NSIS Forum Archive

plugin parameters

7 posts

coreduo32#

plugin parameters

hi,

when writing plugins, there is a "int string_size" parameter used in the functions.
What value does it get when the function is called?

Thanks.
MSG#
Well, I'm no programmer, but I would guess that that should contain ${NSIS_MAX_STRLEN}, because that value differs between different NSIS builds.
coreduo32#
say we have this function


extern "C" void __declspec(dllexport) FileReadBytes(HWND hwndParent, int string_size,
TCHAR *variables, stack_t **stacktop)


if we call the function with this : "nsisFile::FileReadBytes <file handle> <length>"
will the "string_size" parameter have the value obtained by "sizeof(filehandle)+sizeof(length)" ?
Afrow UK#
No it's the capacity (in characters) of NSIS strings, as MSG has said. It will always be 1024 unless you use the 8192 NSIS special build. You use string_size to allocate buffers that receive plug-in arguments (use LocalAlloc/GlobalAlloc) via popstring (arguments are passed via the run-time stack).

Stu
coreduo32#
Thank you for your explanations.

Stu, as far as I see, when we call plugin functions, we dont pass hwndparent,string_size,etc. parameters to them, as you can see in my previous post. Where do our own parameters go?
Anders#
And it should be noted that nsis strings (on the stack) can only be modified with the Global* memory functions. You should take a look at the exdll example plugin in SVN ( http://nsis.svn.sourceforge.net/view...Contrib/ExDLL/ )