brainsucker
21st September 2002 03:11 UTC
System plugin
General purpose of this plugin is to allow you to call any DLL functions (for ex. kernel32.dll->GetDiskFreeSpaceExA) from within NSIS script. Some additional functionality... Coming, at least... :)
Read LastComments.txt and System.txt. MSVC++7.0 required to compile (or project conversion). Compiled dll and example script included...
Sunjammer
21st September 2002 09:06 UTC
Word of warning, this will only work with a certain number of parameters because the NSIS code only allows a fixed number. I *believe* someone just increased this limit slightly but it's still a low number (it used to be somewhere around 5 or 6). Also, invisibly behind the scenes NSIS is entitled to use some of these slots itself, off the top of my head I can't remember if the current implementation of plugin calls uses any or not but I think it's likely that it does and so you have even less args that you can pass to a called function via this plugin.
brainsucker
21st September 2002 13:06 UTC
Arguments???
... :-( ) ...
Certain number of parameters???? 5-6? What parameters do you mean?
Calls to external dll's thru System Plugin uses the stack to pass the parameters (at least control ones, other are specified by format). And I thought NSIS have un-sized stack, am I right? Yes, I just looked at source code, it creates and disposes elements at runtime using GlobalAlloc and GlobalFree. To plugin stack passed by pointer too, so there mustn't be any problems with CallInstDll. The dll::proc just pushes params to stack, so no problems here too. Surely, you meant something other?
By the way: in the worst case this is not a problem too, user can pass allowed number of arguments thru stack and place others to $/$R variables, he just need to specify this by ParamID.
For example, the MessageBox: the case of passing all args thru stack (takes all args from stack, and places result to $R0):
System::FullCall 33 "Example 1" "Just something" 0 "ssss?annnn" "user32.dll?MessageBoxA?iissi"
And the case of passing args thru variables:
StrCpy $R1 "Just something"
StrCpy $R2 "Example1"
StrCpy $R3 33
System::FullCall "nbcd?annnn" "user32.dll?MessageBoxA?iissi"
Sunjammer
21st September 2002 14:44 UTC
Yeah it uses the stack to pass variables, but in the code I think the variables to a command keyword are packed into an opcode structure which is stored in the installer exe and then acted upon at install time. This opcode structure stacks up the args it knows about then calls the plugin. So if the opcode structure doesn't have enough space for all of your args they won't get stacked... that is unless someone changed the code recently.
-- Sunjammer
brainsucker
21st September 2002 16:15 UTC
dll:proc
Checked the NSIS code once again: argument pushes are separate entrys (EW_PUSHPOP), just like EW_REGISTERDLL which calls proc itself.
P.S. Thanx for you care!
Sunjammer
21st September 2002 17:19 UTC
Hmm I'm sure I replied to earlier saying that the code has indeed changed and I was/am wrong :).. However my system or the board ate my post it seems :P
I also said that after thinking about it for a while I think you're right about the order of the arguments, especially in the case where you are dealing with a printf like function (or anything else that uses the first arg as a means of saying how many more args there will be).
brainsucker
21st September 2002 19:52 UTC
huh
1. :) You've posted that message to another thread ("Feature request')...
2. Cool... Now I have an ally! :)