Datei #zsgsyk30-3488 - NSIS - Quellcode
Hochgeladen von lotiez - 27/07/2010 11:59 - 60 Zugriffe
Quellcode
; LZMA;--------------------------------;!include "MUI.nsh"
; AutoCloseWindow true
; ShowInstDetails show;--------------------------------;;;;!define _TEST_
;--------------------------------;; version;!ifdef _TEST_!define VERSION "0.01a"
!define VERSION_STR "0001a"
!define SRC_DIR "NT_TEST_0001a"
!else ;_TEST_
!define VERSION "NT_1.91E"
!define VERSION_STR "NT191E"
!define SRC_DIR "Trickster"
!endif ;_TEST_
;--------------------------------;; window version infomation;; GetWindowsVersion;; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
; Updated by Joost Verburg;; Returns on top of stack;; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003, Vista); or; '' (Unknown Windows Version)
;; Usage:; Call GetWindowsVersion; Pop $R0; ; at this point $R0 is "NT 4.0" or whatnotFunction GetWindowsVersionPush $R0Push $R1ClearErrorsReadRegStr $R0 HKLM \"SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersionIfErrors 0 lbl_winnt; we are not NTReadRegStr $R0 HKLM \"SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumberStrCpy $R1 $R0 1StrCmp $R1 '4' 0 lbl_error
StrCpy $R1 $R0 3StrCmp $R1 '4.0' lbl_win32_95
StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
lbl_win32_95:StrCpy $R0 '95'
Goto lbl_donelbl_win32_98:StrCpy $R0 '98'
Goto lbl_donelbl_win32_ME:StrCpy $R0 'ME'
Goto lbl_donelbl_winnt:StrCpy $R1 $R0 1StrCmp $R1 '3' lbl_winnt_x
StrCmp $R1 '4' lbl_winnt_x
StrCpy $R1 $R0 3StrCmp $R1 '5.0' lbl_winnt_2000
StrCmp $R1 '5.1' lbl_winnt_XP
StrCmp $R1 '5.2' lbl_winnt_2003
StrCmp $R1 '6.0' lbl_winnt_vista lbl_error
lbl_winnt_x:StrCpy $R0 "NT $R0" 6Goto lbl_donelbl_winnt_2000:Strcpy $R0 '2000'
Goto lbl_donelbl_winnt_XP:Strcpy $R0 'XP'
Goto lbl_donelbl_winnt_2003:Strcpy $R0 '2003'
Goto lbl_donelbl_winnt_vista:Strcpy $R0 'Vista'
Goto lbl_donelbl_error:Strcpy $R0 ''
lbl_done:Pop $R1Exch $R0FunctionEnd;--------------------------------;; window version infomation end;;--------------------------------;; WordFind;Function WordFind!define WordFind `!insertmacro WordFindCall`!macro WordFindCall _STRING _DELIMITER _OPTION _RESULTPush `${_STRING}`Push `${_DELIMITER}`Push `${_OPTION}`Call WordFindPop ${_RESULT}!macroendExch $1ExchExch $0ExchExch 2Exch $R0Exch 2Push $2Push $3Push $4Push $5Push $6Push $7Push $8Push $9Push $R1ClearErrorsStrCpy $9 ''
StrCpy $2 $1 1StrCpy $1 $1 '' 1
StrCmp $2 'E' 0 +3
StrCpy $9 Egoto -4StrCpy $3 ''
StrCmp $2 '+' +6
StrCmp $2 '-' +5
StrCmp $2 '/' restart
StrCmp $2 '#' restart
StrCmp $2 '*' restart
goto error3
StrCpy $4 $1 1 -1
StrCmp $4 '*' +4
StrCmp $4 '}' +3
StrCmp $4 '{' +2
goto +4
StrCpy $1 $1 -1
StrCpy $3 '$4$3'
goto -7
StrCmp $3 '*' error3
StrCmp $3 '**' error3
StrCmp $3 '}{' error3
IntOp $1 $1 + 0
StrCmp $1 0 error2
restart:StrCmp $R0 '' error1
StrCpy $4 0
StrCpy $5 0
StrCpy $6 0
StrLen $7 $0
goto loop
preloop:IntOp $6 $6 + 1
loop:StrCpy $8 $R0 $7 $6
StrCmp $8$5 0 error1
StrCmp $8 '' +2
StrCmp $8 $0 +5 preloop
StrCmp $3 '{' minus
StrCmp $3 '}' minus
StrCmp $2 '*' minus
StrCmp $5 $6 minus +5
StrCmp $3 '{' +4
StrCmp $3 '}' +3
StrCmp $2 '*' +2
StrCmp $5 $6 nextword
IntOp $4 $4 + 1
StrCmp $2$4 +$1 plus
StrCmp $2 '/' 0 nextword
IntOp $8 $6 - $5
StrCpy $8 $R0 $8 $5
StrCmp $1 $8 0 nextword
StrCpy $R1 $4
goto endnextword:IntOp $6 $6 + $7
StrCpy $5 $6
goto loop
minus:StrCmp $2 '-' 0 sum
StrCpy $2 '+'
IntOp $1 $4 - $1
IntOp $1 $1 + 1
IntCmp $1 0 error2 error2 restart
sum:StrCmp $2 '#' 0 sumdelim
StrCpy $R1 $4
goto endsumdelim:StrCmp $2 '*' 0 error2
StrCpy $R1 $4
goto endplus:StrCmp $3 '' 0 +4
IntOp $6 $6 - $5
StrCpy $R1 $R0 $6 $5
goto endStrCmp $3 '{' 0 +3
StrCpy $R1 $R0 $6
goto endStrCmp $3 '}' 0 +4
IntOp $6 $6 + $7
StrCpy $R1 $R0 '' $6
goto endStrCmp $3 '{*' +2
StrCmp $3 '*{' 0 +3
StrCpy $R1 $R0 $6
goto endStrCmp $3 '*}' +2
StrCmp $3 '}*' 0 +3
StrCpy $R1 $R0 '' $5
goto endStrCmp $3 '}}' 0 +3
StrCpy $R1 $R0 '' $6
goto endStrCmp $3 '{{' 0 +3
StrCpy $R1 $R0 $5
goto endStrCmp $3 '{}' 0 error3
StrLen $3 $R0
StrCmp $3 $6 0 +3
StrCpy $0 ''
goto +2
IntOp $6 $6 + $7
StrCpy $8 $R0 '' $6
StrCmp $4$8 1 +6
StrCmp $4 1 +2 +7
IntOp $6 $6 + $7
StrCpy $3 $R0 $7 $6
StrCmp $3 '' +2
StrCmp $3 $0 -3 +3
StrCpy $R1 ''
goto endStrCmp $5 0 0 +3
StrCpy $0 ''
goto +2
IntOp $5 $5 - $7
StrCpy $3 $R0 $5
StrCpy $R1 '$3$0$8'
goto enderror3:StrCpy $R1 3
goto error
error2:StrCpy $R1 2
goto error
error1:StrCpy $R1 1
error:StrCmp $9 'E' 0 +3
SetErrors
end:
StrCpy $R0 $R1
Pop $R1Pop $9Pop $8Pop $7Pop $6Pop $5Pop $4Pop $3Pop $2Pop $1Pop $0Exch $R0FunctionEnd
;--------------------------------;; WordFind End
;;--------------------------------;; 설치 관련 디렉토리/레지스트리 정보
;!define DEFAULT_SRC_DIR "\NTREEV"
!define DESKTOP_ICON_NAME "트릭스터"
!ifdef _TEST_!define DESKTOP_SETUP_ICON_NAME "트릭스터 테스트버전 환경설정"
!else ;_TEST_
!define DESKTOP_SETUP_ICON_NAME "트릭스터 환경설정"
!endif ;_TEST_
!define COMPANY_NAME "Ntreev"
!ifdef _TEST_!define APP_NAME "TricksterTest"
!else ;_TEST_
!define APP_NAME "Trickster"
!endif ;_TEST_
!define RUN_FILE_NAME "Splash.exe"
Name "${APP_NAME}"OutFile "${APP_NAME}_${VERSION_STR}.exe"InstallDir "C:\NtreevSoft\Game\${APP_NAME}";--------------------------------;; MUI setting;!define MUI_ABORTWARNING
!define MUI_HEADERIMAGE
!insertmacro MUI_DEFAULT MUI_HEADERIMAGE_BITMAP "header.bmp"
!insertmacro MUI_DEFAULT MUI_ICON "install.ico"
!insertmacro MUI_DEFAULT MUI_UNICON "uninstall.ico"
;--------------------------------;; pages;; !insertmacro MUI_PAGE_LICENSE "License_KOR.txt"
; !insertmacro MUI_PAGE_COMPONENTS ; 설치 항목 선택 페이지
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE "FindVista"
!insertmacro MUI_PAGE_DIRECTORY!insertmacro MUI_PAGE_INSTFILES!insertmacro MUI_UNPAGE_CONFIRM!insertmacro MUI_UNPAGE_INSTFILES;--------------------------------;; languages;!insertmacro MUI_LANGUAGE "Korean"
;--------------------------------;;Reserve Files;;These files should be inserted before other files in the data block;Keep these lines before any File command
;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
!insertmacro MUI_RESERVEFILE_LANGDLLFunction FindVista; ReadRegStr $0 HKLM "Software\Netmarble" "DefaultPath"
; MessageBox MB_OK "Netmarble DefaultPath at: $0"
; StrLen $1 "$0" # = 6
; MessageBox MB_OK "Netmarble DefaultPath Len : $1"
; StrCmp $1 "0" 0 dircopy
; MessageBox MB_YESNO "넷마블 게임을 설치할 기본 폴더를 설정하지 않았습니다.\n\n넷마블 웹 사이트(http://www.netmarble.net)에 방문하여 \n게임을 설치하실 것을 권장합니다.\n\n그래도 계속 진행하시겠습니까?" IDYES continue IDNO cancel
; continue:
; Goto Start; cancel:
; Abort; dircopy:
; StrCpy InstallDir $0
;Start:
Call GetWindowsVersion
Pop $R0StrCmp $R0 "Vista" 0 +2
Goto Vista
Goto Skip
Vista:; MessageBox MB_OK "Vista"
${WordFind} "$INSTDIR" "Program Files" "E+1{" $R0
IfErrors notfound found
found:MessageBox MB_OK "관리자 권한이 없을 때 문제가 발생할 수 있습니다."Goto Skip
notfound:; MessageBox MB_OK "Call Skip"
Goto Skip
Skip:; MessageBox MB_OK "Skip"
FunctionEnd
;--------------------------------;; Install section; 파일 설치 / 레지스트리 정보 작성
;Section "Trickster" SecTricksterSectionIn RO
CreateDirectory "${COMPANY_NAME}"SetOutPath "${COMPANY_NAME}"SetOutPath "$INSTDIR" ; 기본 설치 폴더 지정
File /r "${SRC_DIR}\*.*" ; 파일 복사
CreateDirectory "$INSTDIR\capture"WriteRegStr HKLM "SOFTWARE\${COMPANY_NAME}\${APP_NAME}" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\${COMPANY_NAME}\${APP_NAME}" "Patcher" "${RUN_FILE_NAME}"
WriteRegStr HKLM "SOFTWARE\${COMPANY_NAME}\${APP_NAME}" "UpdateVersion" "${VERSION}"
; Uninstaller settingWriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" "DisplayIcon" "$INSTDIR\${RUN_FILE_NAME},0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" "DisplayName" "${APP_NAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" "NoRepair" 1
WriteUninstaller "uninstall.exe"; WriteRegStr HKLM "SOFTWARE\${COMPANY_NAME}\${APP_NAME}" "Language" "${TRICKSTER_LANGUAGE}"
; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANY_NAME}" "Install_Dir_Trickster" "$INSTDIR" ; [설치 폴더] 예비용으로 중복 저장
SectionEnd
;--------------------------------;; optional section; 바로가기 설치
; CreateShortCut shortcut_name.lnk targetfile_name parameters("") iconfile_name icon_index_number - start_options(SW_SHOWNORMAL)
;Section "Start Menu Shortcuts" SecMenuSectionIn RO
CreateShortCut "$DESKTOP\${DESKTOP_ICON_NAME}.lnk" "http://www.trickster.co.kr" "" "$INSTDIR\TricksterR.ico" 0
CreateShortCut "$DESKTOP\${DESKTOP_SETUP_ICON_NAME}.lnk" "$INSTDIR\Setup.exe" "" "$INSTDIR\Setup.exe" 0
SectionEnd
;--------------------------------;; Install section Descriptions;/*!ifdef _KOR_!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN!insertmacro MUI_DESCRIPTION_TEXT ${SecTrickster} "트릭스터를 설치합니다."!insertmacro MUI_DESCRIPTION_TEXT ${SecMenu} "시작 메뉴에 트릭스터를 등록합니다."!insertmacro MUI_FUNCTION_DESCRIPTION_END!endif ; _KOR_*/;--------------------------------;; Uninstaller Section;Section "Uninstall"; RegistryDeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"DeleteRegKey HKLM "SOFTWARE\${COMPANY_NAME}\${APP_NAME}"!ifdef _TEST_DeleteRegKey HKCU "Software\Ntreev\Trickster_NT_Test"!else ;_TEST_
DeleteRegKey HKCU "Software\Ntreev\Trickster_NT"!endif ;_TEST_
; file
RMDir /r "$INSTDIR\"
; shortcutDelete "$DESKTOP\${DESKTOP_ICON_NAME}.lnk"
Delete "$DESKTOP\${DESKTOP_SETUP_ICON_NAME}.lnk"
SectionEnd
