Archive: How to Change $PLUGINSDIR (Nsis Unicode)

How to Change $PLUGINSDIR (Nsis Unicode)

Is there a way to change the $PLUGINSDIR Variable?
I tried the chngvrbl.dll but it doesnt seem to work (not even the example that comes with the dll), i think this is because i use NSIS Unicode :/

so is there another way to change this Directory?

Why do you think you want to change the $PLUGINSDIR variable?

If you're looking for a temporary directory, simply use $TEMP (in conjunction with GetTempFileName for added safety).

the problem is that some of our customers are not allowed to execute somthing (like a dll) in the temp directory by their admins, they only have the permission for the temp directory of our application (which is a specific direcotry in %TEMP%), but when we use plugins in nsis they are executed from the $PLUGINSDIR not the $TEMPDIR directory so they can't update (we use nsis as an updater)

long story short:
The problem is that the Admins can't give the user the privileges for the Plugins folder because its doesn't have a static name

couldn't you extract the plugin dlls to your preferred directory and call them with CallInstDLL?

(isn't it the purpose of admins to install the software in the first place?)

i could use CallInstDLL but i was wondering if there was an easier solution :/

Seems like a perfectly simple solution to me. What more do you want? If you want less code lines in your nsi script, just make a macro to wrap the pushes etc.

it would be even easier if i could change $PLUGINSDIR :D
but this solution works fine for me...i was just wondering if there was a way...

thank you for your help

You should tell your admins to change their policy, the user should have full access to %temp%!

The next version of NSIS has UnsafeStrcpy, until then you are left with hacks.

Ugly system.dll hack:

!define EXEGVARSOFFSET 4386816 ; NSIS 2.46 zlib ANSI official, change this for different exehead
!define /math PDOFFSET 52 * ${NSIS_MAX_STRLEN}
!define /math PDOFFSET 26 * ${NSIS_MAX_STRLEN}
StrCpy $0 "$Temp\MyNewPluginsDir"
CreateDirectory $0
File /oname=$0\system.dll "${NSISDIR}\Plugins\system.dll"
Push 'kernel32::lstrcpy(i ${PDPTR},tr0)'
CallInstDLL "$0\system.dll" Call
DetailPrint $PluginsDir
System::Call 'user32::MessageBox(i$hwndparent,t "Hello World",t "w00t",i0)'
Find the offset with:
System::Call kernel32::GetModuleHandle(i0)i.r1
;Save some time? StrCpy $1 4316816
System::Call 'kernel32::lstrcmp(ir1,tr0)i.r2'
StrCmp $2 0 done
IntOp $1 $1 + 1
goto loop
DetailPrint $1