vfw installer nsis script.
[x264/x264-sandbox.git] / vfw / installer / x264-conf.nsi
1 ; !packhdr "x264.dat" "upx.exe --best x264.dat"
2 ; ---------------------------------------------------------------------------
3 ; ---------------------------------------------------------------------------
4
5 !define NAME "x264 H.264/AVC Video Codec"
6 !define OUTFILE "x264vfw.exe"
7 !define INPUT_PATH ""
8 !define VFW_FILE1 "x264vfw.dll"
9 !define VFW_FILE2 "x264vfw.ico"
10 !define UNINST_NAME "x264-uninstall.exe"
11 !define MUI_WELCOMEFINISHPAGE_BITMAP win.bmp
12 !define MUI_UNWELCOMEFINISHPAGE_BITMAP win.bmp
13 !define MUI_COMPONENTSPAGE_SMALLDESC
14 !include "MUI.nsh"
15 !include "Sections.nsh"
16 !include "LogicLib.nsh"
17
18 ; ---------------------------------------------------------------------------
19 ; NOTE: this .NSI script is designed for NSIS v1.8+
20 ; ---------------------------------------------------------------------------
21
22 Name "${NAME}"
23 OutFile "${OUTFILE}"
24 SetCompressor lzma
25
26 SetOverwrite ifnewer
27 SetDatablockOptimize on ; (can be off)
28 CRCCheck on ; (can be off)
29 AutoCloseWindow false ; (can be true for the window go away automatically at end)
30 ShowInstDetails hide ; (can be show to have them shown, or nevershow to disable)
31 SetDateSave off ; (can be on to have files restored to their orginal date)
32
33 !insertmacro MUI_PAGE_WELCOME
34 !insertmacro MUI_PAGE_INSTFILES
35
36 !insertmacro MUI_UNPAGE_CONFIRM
37 !insertmacro MUI_UNPAGE_INSTFILES
38 !insertmacro MUI_UNPAGE_FINISH
39 !insertmacro MUI_LANGUAGE "English"
40
41 ; ---------------------------------------------------------------------------
42
43 ;Section ""
44 ;  MessageBox MB_YESNO "This will install ${NAME}. Do you wish to continue?" IDYES gogogo
45 ;    Abort
46 ;  gogogo:
47 ;SectionEnd
48
49 Section "-hidden section"
50 ;Section "" ; (default section)
51         SetOutPath "$SYSDIR"
52         ; add files / whatever that need to be installed here.
53         File "${INPUT_PATH}${VFW_FILE1}"
54         File "${INPUT_PATH}${VFW_FILE2}"
55
56         CreateDirectory $SMPROGRAMS\x264
57         CreateShortcut "$SMPROGRAMS\x264\x264 configuration.lnk" $SYSDIR\rundll32.exe x264vfw.dll,Configure x264vfw.ico
58         CreateShortcut "$SMPROGRAMS\x264\x264 Uninstall.lnk" $SYSDIR\x264-uninstall.exe
59
60         ; write out uninstaller
61         WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "DisplayName" "${NAME} (remove only)"
62         WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "UninstallString" '"$SYSDIR\${UNINST_NAME}"'
63         WriteUninstaller "$SYSDIR\${UNINST_NAME}"
64
65         DeleteRegKey HKCU "Software\GNU\x264"
66
67         WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows NT\CurrentVersion\Drivers32" "vidc.X264" "x264vfw.dll"
68         WriteINIStr system.ini drivers32 "vidc.X264" "x264vfw.dll"
69         WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.X264" "Description" "x264 H.264 Video Codec"
70         WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.X264" "Driver" "x264vfw.dll"
71         WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.X264" "FriendlyName" "x264"
72
73
74
75 SectionEnd ; end of default section
76
77   
78
79 ; ---------------------------------------------------------------------------
80
81 ; begin uninstall settings/section
82 UninstallText "This will uninstall ${NAME} from your system"
83
84 Section Uninstall
85         
86         ; add delete commands to delete whatever files/registry keys/etc you installed here.
87         Delete /REBOOTOK "$SYSDIR\${VFW_FILE1}"
88         Delete /REBOOTOK "$SYSDIR\${VFW_FILE2}"
89         Delete "$SYSDIR\${UNINST_NAME}"
90    
91         DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}"
92         DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows NT\CurrentVersion\Drivers32\vidc.X264"
93         DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Drivers32\vidc.X264"
94         DeleteRegKey HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.X264"
95         DeleteINIStr system.ini drivers32 "vidc.X264"
96         Delete "$SMPROGRAMS\x264\x264 configuration.lnk"
97         Delete "$SMPROGRAMS\x264\x264 Uninstall.lnk"
98         RMDir  "$SMPROGRAMS\x264"
99
100
101 SectionEnd ; end of uninstall section
102
103 ; ---------------------------------------------------------------------------
104
105 Function un.onUninstSuccess
106         IfRebootFlag 0 NoReboot
107                 MessageBox MB_OK \ 
108                         "A file couldn't be deleted. It will be deleted at next reboot."
109         NoReboot:
110 FunctionEnd
111
112 ; ---------------------------------------------------------------------------
113 ; eof
114 ; ---------------------------------------------------------------------------