nsismonk
7th July 2005 00:19 UTC
variable functionname in Getfunctionaddress
Hello,
I need to pass function name as a variable to getfunctionaddress,
e.g. if I have a function named myFunction:
StrCpy $1 myFunction
GetFunctionAddress $0 $1
but this does not work, is this too difficult to implement in NSIS?
Afrow UK
7th July 2005 15:05 UTC
The second paramater for GetFunctionAddress has to be a compile-time value. $1 is a run-time variable and so you'll be telling it your function is called "$1" not "myFunction".
You could get around this though by checking the value of $1 and get the right function address from there.
E.g.
StrCmp $1 "myFunction" 0 +2
GetFunctionAddress $0 "myFunction"
-Stu
ParallaxTZ
7th July 2005 20:29 UTC
if you can use that inside a macro you could try something similar to:
(note _FUNC and '${_FUNC}' )
Function RegSearch
!define RegSearch `!insertmacro RegSearchCall`
!macro RegSearchCall _PATH _OPTIONS _FUNC
Push $0
Push `${_PATH}`
Push `${_OPTIONS}`
GetFunctionAddress $0 `${_FUNC}`
Push `$0`
Call RegSearch
Pop $0
!macroend
.
.
.
from
http://nsis.sourceforge.net/wiki/RegSearch