@@ -67,11 +67,11 @@ func setupLogger(dll *lazyDLL) {
67
67
} else if runtime .GOARCH == "amd64" || runtime .GOARCH == "arm64" {
68
68
callback = windows .NewCallback (logMessage )
69
69
}
70
- syscall .Syscall (dll .NewProc ("WireGuardSetLogger" ).Addr (), 1 , callback , 0 , 0 )
70
+ syscall .SyscallN (dll .NewProc ("WireGuardSetLogger" ).Addr (), callback )
71
71
}
72
72
73
73
func closeAdapter (wireguard * Adapter ) {
74
- syscall .Syscall (procWireGuardCloseAdapter .Addr (), 1 , wireguard .handle , 0 , 0 )
74
+ syscall .SyscallN (procWireGuardCloseAdapter .Addr (), wireguard .handle )
75
75
}
76
76
77
77
// CreateAdapter creates a WireGuard adapter. name is the cosmetic name of the adapter.
@@ -90,7 +90,7 @@ func CreateAdapter(name, tunnelType string, requestedGUID *windows.GUID) (wiregu
90
90
if err != nil {
91
91
return
92
92
}
93
- r0 , _ , e1 := syscall .Syscall (procWireGuardCreateAdapter .Addr (), 3 , uintptr (unsafe .Pointer (name16 )), uintptr (unsafe .Pointer (tunnelType16 )), uintptr (unsafe .Pointer (requestedGUID )))
93
+ r0 , _ , e1 := syscall .SyscallN (procWireGuardCreateAdapter .Addr (), uintptr (unsafe .Pointer (name16 )), uintptr (unsafe .Pointer (tunnelType16 )), uintptr (unsafe .Pointer (requestedGUID )))
94
94
if r0 == 0 {
95
95
err = e1
96
96
return
@@ -107,7 +107,7 @@ func OpenAdapter(name string) (wireguard *Adapter, err error) {
107
107
if err != nil {
108
108
return
109
109
}
110
- r0 , _ , e1 := syscall .Syscall (procWireGuardOpenAdapter .Addr (), 1 , uintptr (unsafe .Pointer (name16 )), 0 , 0 )
110
+ r0 , _ , e1 := syscall .SyscallN (procWireGuardOpenAdapter .Addr (), uintptr (unsafe .Pointer (name16 )))
111
111
if r0 == 0 {
112
112
err = e1
113
113
return
@@ -120,7 +120,7 @@ func OpenAdapter(name string) (wireguard *Adapter, err error) {
120
120
// Close closes a WireGuard adapter.
121
121
func (wireguard * Adapter ) Close () (err error ) {
122
122
runtime .SetFinalizer (wireguard , nil )
123
- r1 , _ , e1 := syscall .Syscall (procWireGuardCloseAdapter .Addr (), 1 , wireguard .handle , 0 , 0 )
123
+ r1 , _ , e1 := syscall .SyscallN (procWireGuardCloseAdapter .Addr (), wireguard .handle )
124
124
if r1 == 0 {
125
125
err = e1
126
126
}
@@ -129,7 +129,7 @@ func (wireguard *Adapter) Close() (err error) {
129
129
130
130
// Uninstall removes the driver from the system if no drivers are currently in use.
131
131
func Uninstall () (err error ) {
132
- r1 , _ , e1 := syscall .Syscall (procWireGuardDeleteDriver .Addr (), 0 , 0 , 0 , 0 )
132
+ r1 , _ , e1 := syscall .SyscallN (procWireGuardDeleteDriver .Addr ())
133
133
if r1 == 0 {
134
134
err = e1
135
135
}
@@ -146,7 +146,7 @@ const (
146
146
147
147
// SetLogging enables or disables logging on the WireGuard adapter.
148
148
func (wireguard * Adapter ) SetLogging (logState AdapterLogState ) (err error ) {
149
- r1 , _ , e1 := syscall .Syscall (procWireGuardSetAdapterLogging .Addr (), 2 , wireguard .handle , uintptr (logState ), 0 )
149
+ r1 , _ , e1 := syscall .SyscallN (procWireGuardSetAdapterLogging .Addr (), wireguard .handle , uintptr (logState ))
150
150
if r1 == 0 {
151
151
err = e1
152
152
}
@@ -155,7 +155,7 @@ func (wireguard *Adapter) SetLogging(logState AdapterLogState) (err error) {
155
155
156
156
// RunningVersion returns the version of the loaded driver.
157
157
func RunningVersion () (version uint32 , err error ) {
158
- r0 , _ , e1 := syscall .Syscall (procWireGuardGetRunningDriverVersion .Addr (), 0 , 0 , 0 , 0 )
158
+ r0 , _ , e1 := syscall .SyscallN (procWireGuardGetRunningDriverVersion .Addr ())
159
159
version = uint32 (r0 )
160
160
if version == 0 {
161
161
err = e1
@@ -165,6 +165,6 @@ func RunningVersion() (version uint32, err error) {
165
165
166
166
// LUID returns the LUID of the adapter.
167
167
func (wireguard * Adapter ) LUID () (luid winipcfg.LUID ) {
168
- syscall .Syscall (procWireGuardGetAdapterLUID .Addr (), 2 , wireguard .handle , uintptr (unsafe .Pointer (& luid )), 0 )
168
+ syscall .SyscallN (procWireGuardGetAdapterLUID .Addr (), wireguard .handle , uintptr (unsafe .Pointer (& luid )))
169
169
return
170
170
}
0 commit comments