View Full Version : Question Function of NSIS ?
dong
15th February 2009, 13:39
In NSIS, I begins and opens a new function, Can this function pass parmeter for variable as languge pascal, C++... ?
Comperio
15th February 2009, 15:19
For functions, you usually use the stack to pass information. Or, if you use macros, the values can be passed as parameters.
There are several examples of these methods throughout the samples included with NSIS.
Or try using the search option in this forum. Here's one such article that might help:
http://forums.winamp.com/showthread.php?s=&threadid=300144
Animaether
15th February 2009, 15:45
and, of course, the wiki...
http://nsis.sourceforge.net/Macro_vs_Function
LoRd_MuldeR
15th February 2009, 15:56
You may of course write your own custom C or Pascal code, compile it as a NSIS Plugin DLL and then call the plugin functions from your NSIS code. There are NSIS Plugin API's available for C as well as for Delphi/Pascal...
dong
18th February 2009, 12:29
I read documents about function to pass information or to pass parameter for function what you sent me but i don't understand and I don't write source code, i want you help me write source code. I have 2 question want to question, distribute 2 case. This my example simple about delete key.
case:
1. I want to write function all delete fonts Tahoma.ttf and Tahomabd.ttf as DeleteRegValue but i can't delete them, can you help me ? My soure code or you see attach file AllDeleteFont.nsi, If i want to debug (or see) variable environment, i can see content variable environment, can i ? as $Pathkey, $fontkey, $0, $1,... ? what do i do ?
Var PathKey
Var FontKey
Function AllDeleteRegValue
#All delete fonts Tahoma.ttf and Tahomabd.ttf into registry
StrCpy $0 0
loop: #All delete Tahoma.ttf and Tahomabd.ttf
ClearErrors
EnumRegValue $1 HKLM PathKey $0
IfErrors done
IntOp $0 $0 + 1
# Copy font names: Tahoma.ttf (or Tahomabd.ttf) into $2 and compare $2 if equal Tahoma.ttf is delete them
StrCpy $2 $1 "" -StrLen(FontKey) #
StrCmp $2 FontKey 0 +3
DeleteRegValue HKLM PathKey $1
StrCpy $0 0
goto +2
; # Copy font names: Tahoma.ttf (or Tahomabd.ttf) into $2 and compare $2 if equal Tahoma.ttf is delete them
; StrCpy $3 $1 "" -12 #
; StrCmp $2 "Tahomabd.ttf" 0 +3
; DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\SharedDlls" $1
; StrCpy $0 0
; goto +1
goto loop
done:
#All delete fonts Tahoma.ttf and Tahomabd.ttf into registry
FunctionEnd
Section
StrCpy $FontKey "Tahoma.ttf"
StrCpy $PathKey "Software\Microsoft\Windows\CurrentVersion\SharedDlls"
Call AllDeleteRegValue
StrCpy $FontKey "Tahomabd.ttf"
Call AllDeleteRegValue
SectionEnd
+++++++++++++++++++++++
Case 2:
2. If i want to write function AllDeleteRegValue as DeleteRegValue to pass parameter.
AllDeleteRegValue HKLM "Software\My Company\My Software" "Tahoma.ttf"
In Section i write, can i write them ? can you help me ?
Function AllDeleteRegValue (PathKey, FontKey)
... Command
FunctionEnd
Section
AllDeleteRegValue HKLM "Software\My Company\My Software" "Tahoma.ttf"
AllDeleteRegValue HKLM "Software\My Company\My Software" "Tahomabd.ttf"
SectionEnd
I can't send attach file because i don't see button attach file, I will copy content file, the name file AllDeleteFont.nsi
# All delete fonts
Name "All Delete Fonts"
Caption "All Delete Fonts"
OutFile "AllDeleteFonts.exe"
Var PathKey
Var FontKey
Function AllDeleteRegValue
#All delete fonts Tahoma.ttf and Tahomabd.ttf into registry
StrCpy $0 0
loop: #All delete Tahoma.ttf and Tahomabd.ttf
ClearErrors
EnumRegValue $1 HKLM PathKey $0
IfErrors done
IntOp $0 $0 + 1
# Copy font names: Tahoma.ttf (or Tahomabd.ttf) into $2 and compare $2 if equal Tahoma.ttf is delete them
StrCpy $2 $1 "" -StrLen(FontKey) #
StrCmp $2 FontKey 0 +3
DeleteRegValue HKLM PathKey $1
StrCpy $0 0
goto +2
; # Copy font names: Tahoma.ttf (or Tahomabd.ttf) into $2 and compare $2 if equal Tahoma.ttf is delete them
; StrCpy $3 $1 "" -12 #
; StrCmp $2 "Tahomabd.ttf" 0 +3
; DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\SharedDlls" $1
; StrCpy $0 0
; goto +1
goto loop
done:
#All delete fonts Tahoma.ttf and Tahomabd.ttf into registry
FunctionEnd
Section
StrCpy $FontKey "Tahoma.ttf"
StrCpy $PathKey "Software\Microsoft\Windows\CurrentVersion\SharedDlls"
Call AllDeleteRegValue
StrCpy $FontKey "Tahomabd.ttf"
Call AllDeleteRegValue
SectionEnd
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.