summaryrefslogtreecommitdiffstats
path: root/windows/Neo2.0_installer.nsi
blob: 93afc2b4932361af420d777d73eb6b0adb61ea14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
;NSIS-Installer f�r alle Windowstreiber
;Geschrieben von Florian Jan�en
;
; Offene Punkte:
; - Rechteverwaltung bei Vista und 7
; - Uninstaller
; - Keine Ordnerabfrage bei Installation ohne AHK
; - Startmenu
;- Autostart (Abfrage)
; 
; Status:
; - Installiert bislang nur kbdneo (mit und ohne Zustatzskript)
; - Ben�tigt Admin-Rechte
; - Erkennt 32- und 64bit Systeme und w�hlt entsprechenden Treiber aus.
; - Kann auf die 64bit Registry und 64bit-Systemordner von Vista und 7 zugreifen


;--------------------------------
;MUI Oberfl�che
;Nur eine Section ausw�hlbar
;64bit Zauberei

  !include "MUI2.nsh"
  !include "Sections.nsh"
  !include "x64.nsh"

;--------------------------------
;Allgemeines

;Name und Name der Datei
  Name "Neo 2.0 - Das ergonomische Tastaturlayout"
  OutFile "Neo2.0_installer.exe"

;Standardordner (f�r AHK)
  InstallDir "$PROGRAMFILES\Neo2"

;Mal sehen ob Neo schon mal da war
  InstallDirRegKey HKCU "Software\Neo 2.0" ""

;Rechte anfordern
  RequestExecutionLevel admin

;Warnung bei Abbruch
  !define MUI_ABORTWARNING

;--------------------------------
;Seiten des Installers
!define WELCOME_TITLE 'Willkommen zum Installations-  Assistenten f�r Neo 2.0'
!define UNWELCOME_TITLE 'Willkommen zum Deinstallations-  Assistenten f�r Neo 2.0'
!define FINISH_TITLE 'Die Installation von Neo 2.0 wurde erfolgreich beendet.'
!define UNFINISH_TITLE 'Die Deinstallation von Neo 2.0 wurde erfolgreich beendet.'
!define MUI_COMPONENTSPAGE_SMALLDESC 

  !define MUI_WELCOMEPAGE_TITLE '${WELCOME_TITLE}'
  !define MUI_WELCOMEPAGE_TITLE_3LINES
  !insertmacro MUI_PAGE_WELCOME
  !insertmacro MUI_PAGE_LICENSE "lizenz.txt"
  !insertmacro MUI_PAGE_COMPONENTS
;  !insertmacro MUI_PAGE_DIRECTORY
  !insertmacro MUI_PAGE_INSTFILES
  !define MUI_FINISHPAGE_TITLE '${FINISH_TITLE}'
  !define MUI_FINISHPAGE_TITLE_3LINES
  !insertmacro MUI_PAGE_FINISH

  !define MUI_WELCOMEPAGE_TITLE '${UNWELCOME_TITLE}'
  !define MUI_WELCOMEPAGE_TITLE_3LINES
  !insertmacro MUI_UNPAGE_WELCOME
  !insertmacro MUI_UNPAGE_CONFIRM
  !insertmacro MUI_UNPAGE_INSTFILES
  !define MUI_FINISHPAGE_TITLE '${UNFINISH_TITLE}'
  !define MUI_FINISHPAGE_TITLE_3LINES
  !insertmacro MUI_UNPAGE_FINISH

;--------------------------------
;Deutsche Oberfl�chen

  !insertmacro MUI_LANGUAGE "German"

;--------------------------------
;Installer Sections

;Verschiedene Installationstypen
InstType  "Vollst�ndig" 
InstType  "Nur Teiber kein Skript"
;InstType  "Nur neo20.exe"
;InstType /NOCUSTOM


Section /o "Neo-2.0-Treiber" installiereKbdneoOhneAHK
SectionIn  2

  SetOutPath "$SYSDIR"
  ${If} ${RunningX64}
	SetRegView 64
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Text" "Deutsch (Neo 2.0 ergonomisch)"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout File" "kbdneo2.dll"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Id" "00c0"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1000"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Name" "German (Germany)"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1100"
	SetRegView 32
	${DisableX64FSRedirection}
	file kbdneo2\Treiber\64bit_Windows\kbdneo2.dll
  ${Else}
	SetRegView 32 
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Text" "Deutsch (Neo 2.0 ergonomisch)"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout File" "kbdneo2.dll"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Id" "00c0"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1000"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Name" "German (Germany)"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1100"
	${EnableX64FSRedirection}
	file kbdneo2\Treiber\32bit_Windows\kbdneo2.dll
  ${EndIf}

;Keyboardlayout wird aktiviert
  System::Call "user32::LoadKeyboardLayout (b0000407,KLF_ACTIVATE)"

;UnInstaller erstellen
  WriteUninstaller "$INSTDIR\Uninstall.exe"

SectionEnd

Section "Neo-2.0-Treiber und AHK-Erweiterung" installiereKbdneoPlusAHK
SectionIn 1 
  SetOutPath "$INSTDIR"
;Zustatz Skript kopieren (immer als 32bit)
  file kbdneo2\Treiber\AHK_f�r_kbdneo2\kbdneo_ahk.exe

;Installationspfad speichern (immer 32bit)
  WriteRegStr HKCU "Software\Neo 2.0" "" $INSTDIR

  SetOutPath "$SYSDIR"
  ${If} ${RunningX64}
	SetRegView 64
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Text" "Deutsch (Neo 2.0 ergonomisch)"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout File" "kbdneo2.dll"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Id" "00c0"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1000"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Name" "German (Germany)"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1100"
	SetRegView 32
	${DisableX64FSRedirection}
	file kbdneo2\Treiber\64bit_Windows\kbdneo2.dll
  ${Else}
	SetRegView 32 
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Text" "Deutsch (Neo 2.0 ergonomisch)"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout File" "kbdneo2.dll"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Id" "00c0"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1000"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Name" "German (Germany)"
	WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1100"
	${EnableX64FSRedirection}
	file kbdneo2\Treiber\32bit_Windows\kbdneo2.dll
  ${EndIf}

;Keyboardlayout wird aktiviert
  System::Call "user32::LoadKeyboardLayout (b0000407,KLF_ACTIVATE)"

;UnInstaller erstellen
  WriteUninstaller "$INSTDIR\Uninstall.exe"

SectionEnd

; Section /o "Eigenst�ndiges Neo2.0-AHK-Skript (neo-vars)" installiereAHK
; SectionIn 3
  ; SetOutPath "$INSTDIR"
  ; file neo-vars\out\neo20.exe


  ; WriteRegStr HKCU "Software\Neo 2.0" "" $INSTDIR


  ; WriteUninstaller "$INSTDIR\Uninstall.exe"

; SectionEnd

;--------------------------------
;Functions

Function .onInit
 
  StrCpy $1 ${installiereKbdneoPlusAHK}
 
FunctionEnd
 
Function .onSelChange
;  !insertmacro SectionRadioButtons "${installiereKbdneoPlusAHK}" "${installiereKbdneoPlusAHK},${installiereKbdneoOhneAHK},${installiereAHK}"

  !insertmacro StartRadioButtons $1
  !insertmacro RadioButton ${installiereKbdneoPlusAHK}
  !insertmacro RadioButton ${installiereKbdneoOhneAHK}
  ; !insertmacro RadioButton ${installiereAHK}
  !insertmacro EndRadioButtons
 
FunctionEnd



;--------------------------------
;Beschreibung der Installationstypen

  ;LangsStrings (nur Deutsch)
  LangString DESC_installiereKbdneoPlusAHK ${LANG_GERMAN} "Installiert den nativen Neo2.0-Treiber (kbdneo2.dll) und die AHK-Erweiterung (kbdneo.ahk) - Administratorrechte erforderlich!"
  LangString DESC_installiereKbdneoOhneAHK ${LANG_GERMAN} "Installiert nur den nativen Neo2.0-Treiber (kbdneo2.dll) - Administratorrechte erforderlich!"
  LangString DESC_installiereAHK ${LANG_GERMAN} "Installiert den Neo2.0-AHK-Standalone-Treiber Neo-Vars (keine Adminrechte n�tig)"
  
  ;LangsStrings den Sections zuordnen
  !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
    !insertmacro MUI_DESCRIPTION_TEXT ${installiereKbdneoPlusAHK} $(DESC_installiereKbdneoPlusAHK)
	!insertmacro MUI_DESCRIPTION_TEXT ${installiereKbdneoOhneAHK} $(DESC_installiereKbdneoOhneAHK)
	; !insertmacro MUI_DESCRIPTION_TEXT ${installiereAHK} $(DESC_installiereAHK)	
  !insertmacro MUI_FUNCTION_DESCRIPTION_END

;--------------------------------
;Uninstaller Section (Nicht fertig)

Section "Uninstall"

  

  Delete "$INSTDIR\Uninstall.exe"

  RMDir "$INSTDIR"

  DeleteRegKey /ifempty HKCU "Software\Neo 2.0"

SectionEnd