-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathexample.nsi
90 lines (68 loc) · 2 KB
/
example.nsi
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
Name "EnVar Example"
OutFile "EnVarExample.exe"
RequestExecutionLevel User
ShowInstDetails Show
Page InstFiles
Unicode True
Section
; Check for write access
EnVar::Check "NULL" "NULL"
Pop $0
DetailPrint "EnVar::Check write access HKCU returned=|$0|"
; Set to HKLM
EnVar::SetHKLM
; Check for write access
EnVar::Check "NULL" "NULL"
Pop $0
DetailPrint "EnVar::Check write access HKLM returned=|$0|"
; Set back to HKCU
EnVar::SetHKCU
DetailPrint "EnVar::SetHKCU"
; Check for a 'temp' variable
EnVar::Check "temp" "NULL"
Pop $0
DetailPrint "EnVar::Check returned=|$0|"
; Add a value
EnVar::AddValue "ZTestVariable" "C:\Test"
Pop $0
DetailPrint "EnVar::AddValue returned=|$0|"
EnVar::AddValue "ZTestVariable" "C:\TestJas"
Pop $0
DetailPrint "EnVar::AddValue returned=|$0|"
; Add an expanded value
EnVar::AddValue "ZTestVariable1" "C:\Test"
Pop $0
DetailPrint "EnVar::AddValue returned=|$0|"
EnVar::AddValueEx "ZTestVariable1" "C:\Test"
Pop $0
DetailPrint "EnVar::AddValue returned=|$0|"
EnVar::AddValueEx "ZTestVariable1" "C:\TestVariable"
Pop $0
DetailPrint "EnVar::AddValue returned=|$0|"
; Update the installer environment so that new
; paths are available to the installer
EnVar::Update "HKCU" "ZTestVariable"
Pop $0
DetailPrint "EnVar::Update returned=|$0|"
EnVar::Update "" "ZTestVariable1"
Pop $0
DetailPrint "EnVar::Update returned=|$0|"
; Delete a value from a variable
EnVar::DeleteValue "ZTestVariable1" "C:\Test"
Pop $0
DetailPrint "EnVar::DeleteValue returned=|$0|"
EnVar::DeleteValue "ZTestVariable1" "C:\Test"
Pop $0
DetailPrint "EnVar::DeleteValue returned=|$0|"
EnVar::DeleteValue "ZTestVariable1" "C:\TestJason"
Pop $0
DetailPrint "EnVar::DeleteValue returned=|$0|"
; Delete a variable
EnVar::Delete "ZTestVariable"
Pop $0
DetailPrint "EnVar::Delete returned=|$0|"
; Try deleting "path", this should give an error
EnVar::Delete "path"
Pop $0
DetailPrint "EnVar::Delete returned=|$0|"
SectionEnd