Nsis why system pass "0" and not integer

1

I'm trying to pass the 32 bit integer returned by func1 pointer *ir1 to func2. But it seems that only the pointer or null is passed in func2?.

System::Call 'mydll.dll::func1(*ir1, i 0x00000000)v'  
System::Call 'mydll.dll::func2(ir1)'
nsis
asked on Stack Overflow Jan 28, 2019 by John M • edited Jan 28, 2019 by Sven Harris

1 Answer

0

System::Call function parameters consists of 3 pieces; type, input and output, and you are not using the output. *i is a pointer type but it still has separate input and outputs.

If your C code looks like:

void __stdcall func1(int*output, int something) { *output = 1337; }
void __stdcall func2(int input) {}

then the NSIS code should look like:

System::Call 'mydll.dll::func1(*i.r1, i 0x00000000)' ; '.' means no input, the value of the integer the parameter points to is undefined (but probably 0) 
System::Call 'mydll.dll::func2(ir1)'

or if you also need to provide input to func1:

System::Call 'mydll.dll::func1(*i 666 r1, i 0x00000000)'
System::Call 'mydll.dll::func2(ir1)'

If your C functions are __cdecl instead of __stdcall then you must tell the System plug-in:

System::Call 'mydll.dll::func1(*i.r1, i 0x00000000)?c'
System::Call 'mydll.dll::func2(ir1)?c'
answered on Stack Overflow Jan 28, 2019 by Anders

User contributions licensed under CC BY-SA 3.0