E D R , A S I H C RSS

NSIS

1. NSIS

1.1. Opening Statement

†ต ”„กœ๊ทธžจ„ ๊ฐœฐœ•˜๊ณ  ‚˜„œ 'งŒ“ค—ˆ‹ค' กœ ‚˜Š” ๊ฒฝšฐ๊ฐ€ งŽ‹ค. •˜€งŒ,  •ž‘ ฐฐฌ•Œ—Š” • ผ งŽ‹ค. Šนžˆ  œ–Œ ”„กœ๊ทธžจ “ฑก/‚ญ œ — “ฑก˜Š” ฐฉ‹ผ˜€,  ˆ€ŠคŠธฆฌฅผ ๊ฑ“œฆฐ‹ค˜€, Program Files ”— ณต‚ฌ•œ‹ค˜€.  ๊ฒฝšฐ—Š” †ต  „šฉ Installer ”„กœ๊ทธžจ„ “ฐ๊ฒŒ ˜€งŒ, •„ง  œŒ€กœ จณธ   —†—ˆ˜ ๊ฒƒ ๊ฐ™‹ค.

ฒˆ—Š” 'ฐฐฌ' ผŠ” …€„— Œ€• › „ งžถฐ๊ณ ž, ธŠค†จŸฌค‘ •˜‚˜ธ NSIS — Œ€• ๊ฐ„‹จžˆ  •ฆฌ•˜๊ณ ž •œ‹ค. (ž..  œ ผ€ ‚„œ งŒ“  ”„กœ๊ทธžจ —ฌฃผž. ^^; ๊ฒŒ ๊ฐ€žฅ ฐ  . --;)

nsis Š” free software ฉฐ, †ŒŠค๊ฐ€ ๊ณต๊ฐœ˜–žˆ‹ค. ๊€‹ฌžˆŠ” ‚ฌžŒ“ค€ ถ„„•‹œ๊ธธ.

1.2. ฐธกฐ งฌ

1.3.  „ ๊ณผ •

NSIS˜ ›ฆฌŠ” ๊ฐ„‹จ•˜‹ค. nsi ผŠ” ŠคฌฆฝŠธ ™”ผ„ •„•„œ •‹น งžŠ” ”„กœ๊ทธžจ“ค„ •˜‚˜˜ ™”ผกœ •••‹œ‚ค๊ณ  ‹ค–‰”„กœ๊ทธžจœผกœ งŒ“œŠ” ๊ฒƒ‹ค. (งˆน˜ ฐฐน˜™”ผ„ ž‘„ฑ•œ‹ค๊ณ  ƒ๊ฐ• ˆ˜„ žˆ๊ฒ ‹ค.)

  1. ”„กœ๊ทธžจ„ ๊ฐœฐœ•œ‹ค.
  2. NSI Script ฅผ ž‘„ฑ•œ‹ค.
  3. makensis กœ Script ฅผ ŒŒผ•œ‹ค. ๊ทธŸฌ makensis Š” ŠคฌฆฝŠธฅผ ถ„„•˜„œ ฌ••••  ™”ผ“ค„ •˜‚˜กœ ฌถ–€‹ค. ๊ทธฆฌ๊ณ  zip˜ ˜•‹œผกœ ••••€‹ค. (‚€ œผกœ zip2exe ๊ฐ€ šฉœ‹ค. ๊ฑ zlib ‚ฌšฉจ.)
  4. •˜‚˜˜ Install ™”ผ ƒ„ฑ. ™„ฃŒ. (ฟŒฆฌž~ -_-v)

1.4. MakeNSIS usage

NSIS installer“ค€ 'MakeNSIS' ”„กœ๊ทธžจ— ˜•„œ NSI script (.NSI) ฅผ ŒŒผ•œผกœ„œ งŒ“ค–ง„‹ค.
makensis ˜ ‹ค–‰ ฌธ•€ Œ€๊ฐ• ‹คŒ๊ณผ ๊ฐ™‹ค.

~cpp 
Makensis [/Vx] [/Olog] [/LICENSE] [/PAUSE] [/NOCONFIG] [/CMDHELP [command]] [/HDRINFO] [/CD] [/Ddefine[=value] ...]
         ["/XCommand parameter" ...] [Script.nsi | - [...]]
  • /LICENSE - license pageฅผ —ฌ€‹ค.
  • /Vx (xŠ” 0~4) - output ˜ ‘œ‹œ  •„ฅผ กฐ ˆ•œ‹ค.
    0 : no output
    1 : errors only
    2 : warnings and errors
    3 : info, warnings, and errors
    4 : all output
  • /Olog (log Š” filename) - compile ค‘ screen ƒ— •‹น ™”ผ— Œ€•œ logฅผ ‘œ‹œ•˜Š” Œ€‹  ™”ผกœ „ค ••œ‹ค.
  • /PAUSE - Makensis ๊ฐ€ ข…ฃŒ˜๊ธฐ  „ ค‘๊ฐ„— ผ‹œ •€•€‹ค. Š” Windows —„œ ง ‘ ‹ค–‰•  •Œ œ šฉ•˜‹ค.
  • /NOCONFIG - nsisconfi.nsi „ ฌ••˜€ •ŠŠ”‹ค.  ŒŒผฉ”„ฐ๊ฐ€ —†Š” ๊ฒฝšฐ, ธŠค†จŸฌŠ” ๊ธฐณธ œผกœ nsisconf.nsi กœ€„ฐ ๊ธฐณธ„ค • „ธŒ…œ‹ค. (NSIS Configuration File ฐธกฐ)
  • /CMDHELP - command — Œ€•œ ๊ธฐณธ ธ ‚ฌšฉ •ฅผ ถœ ฅ•€‹ค.

•˜€งŒ ๊ฑฐ˜ ๊ธฐณธ ˜ต…˜ƒ ž˜ •ˆ“ฐ๊ฒŒ   ๊ฒƒ‹ค. ^^;

1.5. šจœจ ธ ๊ฐœฐœž‘—…™˜๊ฒฝ

NSIS Š” ธŠค†จ•˜๊ณ  ‚œ ’ค—Š” ˜คฅธฒ„Šผ shell-extension — •‹น ™•žฅž ŒŒผ “ฑกœ‹ค. •˜€งŒ command กœ ˆ˜™œผกœ ˜ต…˜„ „ค ••˜„œ ž… ฅ•ฃผŠ” ๊ฒƒ ” Žธ•˜‹ค.

˜Š” Editplus ˜ ‚ฌšฉž„๊ตฌ๊ทธฃน— makensis „ “ฑก‹œผœ„œ ‚ฌšฉ•˜Š” ฐฉ•„ žˆ๊ฒ ‹ค. (nsis ฅผ œ„•œ ๊ฐ„‹จ•œ ide งŒ“ค–„œ จจน–Š”ค‘.. ˜€€งŒ. —‰—‰.. ๊ทธž˜„ editplus ๊ฐ€ ›จ Žธ•˜๊ธ •˜‹ค. --;)

1.6. .NSI script ๊ธฐณธ ฌธ•

NSIS Script File (.nsi) Š” command “ค˜ ฌถŒธ batch-file™€„ ๊ฐ™•„Š” text file‹ค.
  • ; ‚˜ # œผกœ ‹œž‘˜Š” –‰“ค€  „€ comment ‹ค.
  • ;, # ’ค— ‚˜˜คŠ” ๊ฒƒ ˜•œ comment กœ ทจ๊ธ‰œ‹ค.
  • ฃผ„ •„‹Œ –‰“ค€ 'command parameter' ˜ ˜•ƒœฅผ ค‹ค.
  • parameter ˜ ˆซž“ค€ 10ง„ˆ˜, 16ง„ˆ˜, 8ง„ˆ˜“ค„ šฉ•  ˆ˜ žˆ‹ค. (ผฐ˜ ˆซž, 0x__, 0124 ‹œผกœ..)
  • ‘œ˜„•˜๊ณ ž•˜Š” string — ๊ณตฐฑ žˆœผ ”ฐ˜‘œฅผ šฉ•œ‹ค.
    ex)

~cpp 
	MessageBox MB_OK "I'll be happy" ; this one puts a ' inside a string
	MessageBox MB_OK 'And he said to me "Hi there!"' ; this one puts a " inside a string
	MessageBox MB_OK `And he said to me "I'll be fucked!"` ; this one puts both ' and "s inside a string:
  • •˜‚˜˜ command ๊ฐ€ —ฌŸฌค„„ šฉ•˜Š” ๊ฒฝšฐ '' ฅผ ‚ฌšฉ•œ‹ค.

~cpp 
    CreateShortCut "$SMPROGRAMS\NSIS\ZIP2EXE project workspace.lnk" \
                   "$INSTDIR\source\zip2exe\zip2exe.dsw"
    MessageBox MB_YESNO|MB_ICONQUESTION \
               "Remove all files in your NSIS directory? (If you have anything \
you created that you want to keep, click No)" \
                IDNO NoRemoveLabel


1.7. NSI Script Study

NSIS Š” ŠคฌฆฝŠธ ๊ธฐฐ˜œผกœ ผข…˜ ฐฐน˜™”ผ๊ณผ ๊ฐ™œผ€กœ, ˜ˆ œœ„ฃผ˜  ‘๊ทผ„ •˜ ‰ฝ๊ฒŒ šฉ•  ˆ˜ žˆ‹ค. NSIS/˜ˆ œ1, NSIS/˜ˆ œ2, NSIS/˜ˆ œ3 “ฑ„ ถ„„•˜๊ณ  †ŒŠคฅผ กฐ๊ธˆ”ฉ šฉ„— งž๊ฒŒ ˆ˜ ••˜—ฌ ž‘„ฑ•˜ ‰ฝ๊ฒŒ  ‘๊ทผ•  ˆ˜ žˆ„ ๊ฒƒ‹ค. ˜ฌธ ƒ๊ธฐŠ” … น–‚˜ †„ฑ(attribute)— Œ€•„œŠ” NSIS/Reference ฅผ ฐธกฐ•˜๊ธฐ ฐ”ž€‹ค.

1.8. CHM Document

NSIS ˜ windows installer ฒ„ „„ „คน˜•˜ NSIS.CHM ™”ผ ๊ฐ™ žˆ‹ค.

1.9. NSIS —„œ ธŠค†จ ค‘ Explorer ฐฝ  „€ ‹ซ๊ธฐ

1.10. •‹น dll “ค system32 ˜ ”” ‰† ฆฌ— ณต‚ฌ•ฃผ๊ธฐ

~cpp 
;copy files
File /r `.\tmp\*.*`
;system32 — ณต‚ฌ•ค„ dll “ค„ ผ‹จ ณต‚ฌ•€‹ค.
File /r `.\AdditionalDLL\*.dll` 

;move system addtinoal dlls to system folder
Rename "$INSTDIR\MSVCP60.dll" "$SYSDIR\MSVCP60.dll"


1.11. windows ๊น”ฆฐ œ„น˜ ฐพ•„˜ค๊ธฐ

šฉ ˜ˆ : windows ˜ system32 ”” ‰† ฆฌ— dll “ค„ ณต‚ฌ•ค„ •Œ.

~cpp 
Section "ThisNameIsIgnoredSoWhyBother?" 
  .
  .
  MessageBox MB_OK "$WINDIR"
  MessageBox MB_OK "$SYSDIR"
  ; ณต‚ฌ•  ™”ผ„ ถ”๊ฐ€•˜๊ธฐ. 
SectionEnd ; section ™„ฃŒ 


1.12. ExecWait

exec กœ •‹น ”„กœ„ธŠคฅผ ‹ค–‰•  •Œ •‹น ”„กœ„ธŠค๊ฐ€ ฃฝ„ •Œ ๊นŒ€ wait.
regsvr32.exe กœ dll „ unregister •œ ‹คŒ—  „ ”ฅผ ‚ญ œ•  •Œ, regsvr32.exe Š” Exec ๊ฐ€ •„‹Œ ExecWait กœ ‹ค–‰•ฃผ–••œ‹ค. (๊ทธ ‡€ •Šœผ •‹น dll  unregister ˜๊ธฐ  „— dll ™”ผ delete ˜–  •ƒ ธ uninstall  ˜€ •Š„ ˆ˜„ žˆ‹ค.)

1.13. NSIS —„œ Šน • Process ๊ฐ€ ‚•„žˆŠ”€ —ฌ€ ™•ธ

FindProc Plugin „ „คน˜•œ‹ค.


‚ฌšฉ ˜ˆ : exec กœ regsvr32.exe ˜ธถœ‹œ น„™๊ธฐ ˜ธถœ ˜– ’ค˜ delete ฌธ ‹ค–‰œ‹ค. ฅผ ฐฉ€•˜๊ธฐ œ„•œ ฐฉ•œผกœ ‹คŒ๊ณผ ๊ฐ™ •œ‹ค.

~cpp 
  Exec 'regsvr32.exe /u /s "$INSTDIR\COMDLL.dll"'
  waitloop:
    FindProcDLL::FindProc "regsvr32.exe"
    IntCmp $R0 0 waitdone
    Sleep 500
    Goto waitloop
  waitdone:

  Delete "$INSTDIR\*.*"
  RMDir /r "$INSTDIR"


1.14. NSIS —„œ ActiveX Component “ฑก•˜๊ธฐ

http://nsis.sourceforge.net/archive/viewpage.php?pageid=435
~cpp 
;Inside the -Post section
Exec 'regsvr32.exe /s "$INSTDIR\${NAME_OF_MY_DLL}"'

;And Inside the Uninstall Section 
Exec 'regsvr32.exe /s /u "$INSTDIR\${NAME_OF_MY_DLL}"'


1.15. NSIS —„œ uninstall.exe งŒ“ค๊ธฐ


•  ผ : 1. 'Uninstall' Section „ งŒ“ ‹ค. 2. WriteInstaller ฅผ šฉ•€‹ค.

~cpp 
;--------------------------------    
;Uninstaller Section  
Section "Uninstall"
   
;Delete Files 
  RMDir /r "$INSTDIR\*.*"    
 
;Remove the installation directory
  RMDir "$INSTDIR"
  
;Delete Start Menu Shortcuts
  Delete "$DESKTOP\${MUI_PRODUCT}.lnk"
  Delete "$SMPROGRAMS\${MUI_PRODUCT}\*.*"
  RmDir  "$SMPROGRAMS\${MUI_PRODUCT}"
  
;Delete Uninstaller And Unistall Registry Entries
  DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${MUI_PRODUCT}"
  DeleteRegKey HKEY_LOCAL_MACHINE
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"  
  
SectionEnd

Section ""
.
.
.

; ˆ€ŠคŠธฆฌ— uninstall ”„กœ๊ทธžจ …‹Œ…•ฃผŠ” €ถ„
;write uninstall information to the registry
  WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"
"DisplayName" "${MUI_PRODUCT} (remove only)"
  WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"
"UninstallString" "$INSTDIR\Uninstall.exe"

; Uninstaller ฅผ งŒ“œŠ” €ถ„ 
WriteUninstaller "$INSTDIR\Uninstall.exe"

SectionEnd


2. Thread

--fnwinter ˜• ๊ณ งˆ›Œ—ฌ~ NSIS “ฐŠ”๊ฑฐ  •ฆฌ •  •„š”๊ฐ€ žˆ—ˆŠ” ฐ , PS ๊ฑฐ ง๊ณ „ INNO SETUP ผŠ” ”„กœ๊ทธžจ žˆ๊ฑฐ“ š”. ๊ทธ๊ฒƒ„ ๊œฐฎ€ฐ, •œฒˆ จ„ธš”~
‡‡ œ ‹ธฆฌ‹ฐ ธŠค†จŸฌ—„œ InnoSetup “ฐŠ”๊ฑฐ ข…ข… ˜€—ˆŠ”ฐ, ๊ฒƒ„ ๊ณตงœ˜€๊ตฐ..~ ๊ทธ‚˜ €‚˜, http://isfd.kaju74.de/index.php?screenshots . „ˆ €Œ€‚˜Š”๊ฑฐ •„ƒ?;; --1002
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:50
Processing time 0.0267 sec