@@ -67,11 +67,11 @@ func setupLogger(dll *lazyDLL) {
6767 } else if runtime .GOARCH == "amd64" || runtime .GOARCH == "arm64" {
6868 callback = windows .NewCallback (logMessage )
6969 }
70- syscall .Syscall (dll .NewProc ("WireGuardSetLogger" ).Addr (), 1 , callback , 0 , 0 )
70+ syscall .SyscallN (dll .NewProc ("WireGuardSetLogger" ).Addr (), callback )
7171}
7272
7373func closeAdapter (wireguard * Adapter ) {
74- syscall .Syscall (procWireGuardCloseAdapter .Addr (), 1 , wireguard .handle , 0 , 0 )
74+ syscall .SyscallN (procWireGuardCloseAdapter .Addr (), wireguard .handle )
7575}
7676
7777// 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
9090 if err != nil {
9191 return
9292 }
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 )))
9494 if r0 == 0 {
9595 err = e1
9696 return
@@ -107,7 +107,7 @@ func OpenAdapter(name string) (wireguard *Adapter, err error) {
107107 if err != nil {
108108 return
109109 }
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 )))
111111 if r0 == 0 {
112112 err = e1
113113 return
@@ -120,7 +120,7 @@ func OpenAdapter(name string) (wireguard *Adapter, err error) {
120120// Close closes a WireGuard adapter.
121121func (wireguard * Adapter ) Close () (err error ) {
122122 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 )
124124 if r1 == 0 {
125125 err = e1
126126 }
@@ -129,7 +129,7 @@ func (wireguard *Adapter) Close() (err error) {
129129
130130// Uninstall removes the driver from the system if no drivers are currently in use.
131131func Uninstall () (err error ) {
132- r1 , _ , e1 := syscall .Syscall (procWireGuardDeleteDriver .Addr (), 0 , 0 , 0 , 0 )
132+ r1 , _ , e1 := syscall .SyscallN (procWireGuardDeleteDriver .Addr ())
133133 if r1 == 0 {
134134 err = e1
135135 }
@@ -146,7 +146,7 @@ const (
146146
147147// SetLogging enables or disables logging on the WireGuard adapter.
148148func (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 ))
150150 if r1 == 0 {
151151 err = e1
152152 }
@@ -155,7 +155,7 @@ func (wireguard *Adapter) SetLogging(logState AdapterLogState) (err error) {
155155
156156// RunningVersion returns the version of the loaded driver.
157157func RunningVersion () (version uint32 , err error ) {
158- r0 , _ , e1 := syscall .Syscall (procWireGuardGetRunningDriverVersion .Addr (), 0 , 0 , 0 , 0 )
158+ r0 , _ , e1 := syscall .SyscallN (procWireGuardGetRunningDriverVersion .Addr ())
159159 version = uint32 (r0 )
160160 if version == 0 {
161161 err = e1
@@ -165,6 +165,6 @@ func RunningVersion() (version uint32, err error) {
165165
166166// LUID returns the LUID of the adapter.
167167func (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 )))
169169 return
170170}
0 commit comments