Archive: Calling External Dll Text Parameters


Calling External Dll Text Parameters
I'm new to the NSIS Installer but so far it's worked great.
I'm doing a Palm Application Install based on the example external system dll code. I'm using the Palm File Installer DLL Instaide.dll.
Most calls are working fine.

However I am having trouble with the call to PltInstallFile() which takes 2 text parameters as input. Here's the code snippit I am trying.
;;;;;;;;;;;;;;;;;;;;;;;;
StrCpy $R0 "0" ; assign memory to $0
System::Alloc 1024 ; allocate space for username
Pop $1

;Get User is working
System::Call 'Instaide::PltGetUser(i $R0, t, *i) i(.r0, .r1, r2).r3'
DetailPrint 'User: "$1"'
DetailPrint "Path length: $2"
DetailPrint "Return value: $3"

DetailPrint 'User Num: "$R0"'
DetailPrint 'User Name: "$1"'

System::Alloc 1024 ; allocate space for filename
Pop $2

; yes this file is there
StrCpy $2 "$INSTDIR\PalmOS\MathLib.prc"
DetailPrint 'Install File: "$2"'

System::Call 'Instaide::PltInstallFile(t, t) i(.r1, .r2).r3'
DetailPrint "Return value: $3"
;;;;;;;;;;;;;;;

The return value I get is alweays -554 or ERR_PILOT_BAD_FILENAME
Is there a syntax error or somthing missing here?
Thanks.


1. You don't need to allocate space for text variables (system does it).
2. In plt install file you used .r1 and .r2, indicating to system you want this variables to receive values after function call, but in fact you need to pass the boss values TO function (not FROM).

StrCpy $R0 "0"
StrCpy $2 "${NSIS_MAX_STRLEN}"

System::Call 'Instaide::PltGetUser(i $R0, t .r1, *i r2 r2) i.r3'

StrCpy $2 "$INSTDIR\PalmOS\MathLib.prc"
System::Call 'Instaide::PltInstallFile(t r1, t r2) i.r3'


Hope this will help...


Works now,
Thanks!
(BTW. The docs are very confusing)


What's so confusing in the docs? Any suggestions for improvement?


System DLL readme -> HTML.

-Stu :)


yes please :)


Section C.5 of the documentation is already a good tutorial, but brainsucker could indeed improve the System DLL reference.