U E D R , A S I H C RSS

NSIS/예제2

각 화면 vs 관련 코드


~cpp 
; 인스톨러 프로그램 이름
Name "Example2"

; 인스톨러 화일 이름
OutFile "example2.exe"

; 기본 인스톨 디렉토리
InstallDir $PROGRAMFILES\Example2
; 디렉토리 체크를 위한 레지스트리 
; (만일 인스톨을 다시 할경우  
; 예전의 레지스트리를 자동으로 overwrite 할 것임)
InstallDirRegKey HKLM SOFTWARE\NSIS_Example2 "Install_Dir"

; 인스톨화면시 문구들
ComponentText "This will install the less simple example2 on your computer. Select which optional things you want installed."
; The text to prompt the user to enter a directory
DirText "Choose a directory to install in to:"

; 인스톨 할 Section 들 관련
Section "Example2 (required)"
  ; Set output path to the installation directory.
  SetOutPath $INSTDIR
  ; 인스톨 할 화일
  File "C:\winnt\notepad.exe"
  ; 인스톨된 path를 레지스트리에 저장
  WriteRegStr HKLM SOFTWARE\NSIS_Example2 "Install_Dir" "$INSTDIR"
  ; 윈도우를 위한 Uninstall key를 레지스트리에 저장
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "DisplayName" "NSIS Example2 (remove only)"
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "UninstallString" '"$INSTDIR\uninstall.exe"'
  WriteUninstaller "uninstall.exe"
SectionEnd

; optional section
Section "Start Menu Shortcuts"
  CreateDirectory "$SMPROGRAMS\Example2"
  CreateShortCut "$SMPROGRAMS\Example2\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
  CreateShortCut "$SMPROGRAMS\Example2\Example2 (notepad).lnk" "$INSTDIR\notepad.exe" "" "$INSTDIR\notepad.exe" 0
SectionEnd


~cpp 
; 인스톨러 프로그램 이름
Name "Example2"
; 기본 인스톨 디렉토리
InstallDir $PROGRAMFILES\Example2
; The text to prompt the user to enter a directory
DirText "Choose a directory to install in to:"

~cpp 
  ; 인스톨된 path를 레지스트리에 저장
  WriteRegStr HKLM SOFTWARE\NSIS_Example2 "Install_Dir" "$INSTDIR"
  ; 윈도우를 위한 Uninstall key를 레지스트리에 저장
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "DisplayName" "NSIS Example2 (remove only)"
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "UninstallString" '"$INSTDIR\uninstall.exe"'
  WriteUninstaller "uninstall.exe"

~cpp 
; 언인스톨 관련 처리
UninstallText "This will uninstall example2. Hit next to continue."

~cpp 
; 언인스톨 Section
Section "Uninstall"
  ; 레지스트리 키 제거
  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2"
  DeleteRegKey HKLM SOFTWARE\NSIS_Example2
  ; 화일들 제거
  Delete $INSTDIR\notepad.exe
  ; 반드시! unstaller 도 제거할 것.
  Delete $INSTDIR\uninstall.exe
  ; shortcut 이 있으면 제거할것.
  Delete "$SMPROGRAMS\Example2\*.*"
  ; 사용했던 디렉토리들 제거.
  RMDir "$SMPROGRAMS\Example2"
  RMDir "$INSTDIR"
SectionEnd

전체 소스

~cpp 
; example2.nsi
;
; adds uninstall support
; and (optionally) start menu shortcuts.
;
; It will install notepad.exe into a directory that the user selects,
;

; 인스톨러 프로그램 이름
Name "Example2"

; 인스톨러 화일 이름
OutFile "example2.exe"

; 기본 인스톨 디렉토리
InstallDir $PROGRAMFILES\Example2
; 디렉토리 체크를 위한 레지스트리 
; (만일 인스톨을 다시 할경우  
; 예전의 레지스트리를 자동으로 overwrite 할 것임)
InstallDirRegKey HKLM SOFTWARE\NSIS_Example2 "Install_Dir"

; 인스톨 문구
ComponentText "This will install the less simple example2 on your computer. Select which optional things you want installed."
; The text to prompt the user to enter a directory
DirText "Choose a directory to install in to:"

; The stuff to install
Section "Example2 (required)"
  ; Set output path to the installation directory.
  SetOutPath $INSTDIR
  ; 인스톨 할 화일
  File "C:\winnt\notepad.exe"
  ; 인스톨된 path를 레지스트리에 저장
  WriteRegStr HKLM SOFTWARE\NSIS_Example2 "Install_Dir" "$INSTDIR"
  ; 윈도우를 위한 Uninstall key를 레지스트리에 저장
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "DisplayName" "NSIS Example2 (remove only)"
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "UninstallString" '"$INSTDIR\uninstall.exe"'
  WriteUninstaller "uninstall.exe"
SectionEnd

; optional section
Section "Start Menu Shortcuts"
  CreateDirectory "$SMPROGRAMS\Example2"
  CreateShortCut "$SMPROGRAMS\Example2\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
  CreateShortCut "$SMPROGRAMS\Example2\Example2 (notepad).lnk" "$INSTDIR\notepad.exe" "" "$INSTDIR\notepad.exe" 0
SectionEnd

; 언인스톨 관련 처리
UninstallText "This will uninstall example2. Hit next to continue."

; 언인스톨 Section
Section "Uninstall"
  ; 레지스트리 키 제거
  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2"
  DeleteRegKey HKLM SOFTWARE\NSIS_Example2
  ; 화일들 제거
  Delete $INSTDIR\notepad.exe
  ; 반드시! unstaller 도 제거할 것.
  Delete $INSTDIR\uninstall.exe
  ; shortcut 이 있으면 제거할것.
  Delete "$SMPROGRAMS\Example2\*.*"
  ; 사용했던 디렉토리들 제거.
  RMDir "$SMPROGRAMS\Example2"
  RMDir "$INSTDIR"
SectionEnd

; eof

컴파일 과정

~cpp 
---------- makensis ----------
MakeNSIS v1.95 - Copyright 1999-2001 Nullsoft, Inc.

Portions Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler (zlib).
Contributors: nnop@newmail.ru, Ryan Geiss, Andras Varga, Drew Davidson, Peter Windridge, Dave Laundon, Robert Rainwater, Yaroslav Faybishenko, et al.



Processing config: 


Processing script file: "example2.nsi"
Name: "Example2"
OutFile: "example2.exe"
InstallDir: "$PROGRAMFILES\Example2"
InstallRegKey: "HKLM\SOFTWARE\NSIS_Example2\Install_Dir"
ComponentText: "This will install the less simple example2 on your computer. Select which optional things you want installed." "" ""
DirText: "Choose a directory to install in to:" "" ""
Section: "Example2 (required)"
SetOutPath: "$INSTDIR"
File: "NOTEPAD.EXE" [compress] 21719/50960 bytes
WriteRegStr: HKLM\SOFTWARE\NSIS_Example2\Install_Dir=$INSTDIR
WriteRegStr: HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2\DisplayName=NSIS Example2 (remove only)
WriteRegStr: HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2\UninstallString="$INSTDIR\uninstall.exe"
WriteUninstaller: "uninstall.exe"
SectionEnd
Section: "Start Menu Shortcuts"
CreateDirectory: "$SMPROGRAMS\Example2"
CreateShortCut: "$SMPROGRAMS\Example2\Uninstall.lnk"->"$INSTDIR\uninstall.exe"   icon:$INSTDIR\uninstall.exe,0, showmode=0x0, hotkey=0x0
CreateShortCut: "$SMPROGRAMS\Example2\Example2 (notepad).lnk"->"$INSTDIR\notepad.exe"   icon:$INSTDIR\notepad.exe,0, showmode=0x0, hotkey=0x0
SectionEnd
UninstallText: "This will uninstall example2. Hit next to continue." ""
Section: "Uninstall"
DeleteRegKey: HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2
DeleteRegKey: HKLM\SOFTWARE\NSIS_Example2
Delete: "$INSTDIR\notepad.exe"
Delete: "$INSTDIR\uninstall.exe"
Delete: "$SMPROGRAMS\Example2\*.*"
RMDir: "$SMPROGRAMS\Example2"
RMDir: "$INSTDIR"
SectionEnd

Processed 1 file, writing output:

Output: "F:\NSIS\example2.exe"
Install: 2 sections (1 required).
Install: 11 instructions (264 bytes), 941 byte string table.
Uninstall: 8 instructions (192 bytes), 345 byte string table.

EXE header size:               35328 / 35328 bytes
Install code+strings:            769 / 1513 bytes
Install data:                  21723 / 50974 bytes
Uninstall code+data+strings:     624 / 1106 bytes
CRC (0x7C511ED3):                  4 / 4 bytes

Total size:                    58448 / 88925 bytes (65.7%)
Normal Termination
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:50
Processing time 0.0154 sec