blayde
25th October 2003 20:24 UTC
noob vs System.dll
i'm hoping someone can point out what i'm missing here, i'm trying to use system.dll.
i've spent a good two hours trying this way and that to get a single call to a dll working. i've read the faq, forum archives etc and can't find the solution.
in my dll is the function
int __stdcall GetDriveFSType( LPCTSTR pDriveRoot, char* outFSType )
the first argument is a string : a drive letter essentially.
the second argument gets set as the result.
the return indicates any errors.
i've followed this example by bjc but with no luck. the second argument is always 1024 after the call ( i strpy it 1024, see the link to see why ). yet the return value comes back fine.
could someone please tell me the right line of code to use to call this function.
TIA
Joost Verburg
25th October 2003 20:37 UTC
There are examples in available in the archive that explain how to get the drive type
http://nsis.sf.net/archive
deguix
25th October 2003 21:09 UTC
... maybe putting a direct link to System Plugin examples:
System Plugin Examples
(please any Archive admin, move my Create Font API to System Plugin Examples folder)
brainsucker
26th October 2003 00:30 UTC
System::Call 'mydll::GetDriveFSType(t r0, t .r1) i .r2'
blayde
26th October 2003 05:50 UTC
brainsucker :
well bugger me it worked. it's always the one thing i didn't think of : no '.' for the first argument. thanks a lot.
only, now i'm really confused. this code, to my mind, goes against the example code. it says
placing a period/dot ('.') in front of a System.dll variable means 'makes no change to source' and it appears to be used everywhere except where a pointer is returned.
but you used it on variables that changed, and didn't on variables that stayed the same.
everyone else :
thanks for the suggestions. to make my question clearer i should have added that my dll had other functions i need as well, so i have to use it. but thanks all the same.
brainsucker
26th October 2003 23:58 UTC
I've asked NSIS developers to change this example and documentation tens of times...
Everything is simple: param defenition looks like "TYPE INPUT OUTPUT".
Before proc run it parses INPUT for value (with required type), and after proc run it outputs value to the OUTPUT. In case when the input doesn't matter, but you want to specify output, you could use dot ('.'), to skip it. For example "i r1 r2", will read input from $1, and after run put it to $2. "i r1" will only read from $1 and never put output to somewhere. "i .r2" will take no input, but will place output value to r2.
kichik
27th October 2003 18:29 UTC
Didn't we say I was just going to rewrite the readme?
Well, it's taking too long anyway... I'd better update that page.
kichik
3rd November 2003 10:41 UTC
Updated.