|
1 |
|
2 DetailPrint "Checking if wintap is installed..." |
|
3 |
|
4 !ifndef ClassGUID |
|
5 !define ClassGUID "{4d36e972-e325-11ce-bfc1-08002be10318}" |
|
6 !endif |
|
7 |
|
8 push $0 |
|
9 push $1 |
|
10 push $2 |
|
11 push $4 |
|
12 |
|
13 ${GetParameters} $1 |
|
14 |
|
15 ${If} $1 =~ "/NOWINTAP" |
|
16 DetailPrint "Wintap installation overridden - skipping installation..." |
|
17 GoTo end |
|
18 ${EndIf} |
|
19 |
|
20 ;checking if wintap is installed |
|
21 #IntOp $0 $0 & 0 |
|
22 ClearErrors |
|
23 /*next: |
|
24 IntFmt $1 "%04d" $0 |
|
25 ReadRegStr $2 HKLM "SYSTEM\CurrentControlSet\Control\Class\${ClassGUID}\$1" "NetCfgInstanceId" |
|
26 ReadRegStr $4 HKLM "SYSTEM\CurrentControlSet\Control\Class\${ClassGUID}\$1" "DriverDesc" |
|
27 StrCmp "TAP-Win32 Adapter V8" $4 found |
|
28 IntOp $0 $0 + 1 |
|
29 */ |
|
30 |
|
31 StrCpy $0 0 |
|
32 StrCpy $7 0 |
|
33 /*loop: |
|
34 |
|
35 StrCmp $1 "" notfound |
|
36 ReadRegStr $2 HKLM "SYSTEM\CurrentControlSet\Control\Class\${ClassGUID}\$1" "NetCfgInstanceId" |
|
37 ReadRegStr $4 HKLM "SYSTEM\CurrentControlSet\Control\Class\${ClassGUID}\$1" "DriverDesc" |
|
38 StrCmp "TAP-Win32 Adapter V8" $4 found |
|
39 StrCpy $6 $1 |
|
40 IntOp $6 $6 + 1 |
|
41 IntOp $0 $0 + 1 |
|
42 GoTo loop |
|
43 done:*/ |
|
44 |
|
45 EnumRegKey $1 HKLM "SYSTEM\CurrentControlSet\Control\Class\${ClassGUID}" $0 |
|
46 IntOp $6 $1 + 1 |
|
47 ${While} $1 != "" |
|
48 ReadRegStr $2 HKLM "SYSTEM\CurrentControlSet\Control\Class\${ClassGUID}\$1" "NetCfgInstanceId" |
|
49 ReadRegStr $4 HKLM "SYSTEM\CurrentControlSet\Control\Class\${ClassGUID}\$1" "DriverDesc" |
|
50 StrCmp "TAP-Win32 Adapter V8" $4 found |
|
51 IntOp $0 $0 + 1 |
|
52 EnumRegKey $1 HKLM "SYSTEM\CurrentControlSet\Control\Class\${ClassGUID}" $0 |
|
53 IntFmt $7 "%04d" $6 |
|
54 ${If} "$7" == "$1" |
|
55 IntOp $6 $6 + 1 |
|
56 ${EndIf} |
|
57 ${EndWhile} |
|
58 GoTo notfound |
|
59 ;an error means that we trie to browse through not existing keys |
|
60 ;- search was finished, wintap is not there |
|
61 #IfErrors notfound next |
|
62 |
|
63 ;if found skipping installation |
|
64 found: |
|
65 DetailPrint "Wintap found - skipping installation..." |
|
66 GoTo end |
|
67 |
|
68 ;if not found we install it |
|
69 notfound: |
|
70 DetailPrint "Wintap not found - starting installation. Please wait." |
|
71 |
|
72 ;a variable to contain the next entry that will be created by the driver installer |
|
73 #IntOp $0 $6 |
|
74 IntFmt $0 "%04d" $6 |
|
75 |
|
76 ;launch the tapinstall (devcon) or do something to install the driver |
|
77 SetOutPath "$INSTDIR\driver" ;working directory must be tap installer directory |
|
78 nsExec::ExecToLog "$INSTDIR\driver\tapinstaller" |
|
79 |
|
80 ;rename network connection to TAP-Win32 |
|
81 ReadRegStr $3 HKLM "SYSTEM\CurrentControlSet\Control\Class\${ClassGUID}\$0" "NetCfgInstanceId" |
|
82 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\Network\${ClassGUID}\$3\Connection" "Name" "TAP-Win32" |
|
83 |
|
84 ;message to wait, as the following step takes a stupid amount of time |
|
85 ;and it seems that the PC is doing nothing |
|
86 DetailPrint "Configuring TAP-Win32 Adapter..." |
|
87 DetailPrint "The process will take a while, please wait..." |
|
88 |
|
89 ;set TAP-Win32 ip's using netsh |
|
90 nsExec::ExecToLog "netsh interface ip set address TAP-Win32 static 192.168.0.1 255.255.255.0" |
|
91 |
|
92 DetailPrint "Wintap installation completed..." |
|
93 |
|
94 end: |
|
95 pop $4 |
|
96 pop $2 |
|
97 pop $1 |
|
98 pop $0 |
|
99 DetailPrint "=========================================" |