Prevent panic when wintun dll fails to load
This commit is contained in:
parent
b76e852f59
commit
a8cb01e6df
1 changed files with 4 additions and 0 deletions
|
|
@ -39,6 +39,10 @@ func closeAdapter(wintun *Adapter) {
|
||||||
// deterministically. If it is set to nil, the GUID is chosen by the system at random,
|
// deterministically. If it is set to nil, the GUID is chosen by the system at random,
|
||||||
// and hence a new NLA entry is created for each new adapter.
|
// and hence a new NLA entry is created for each new adapter.
|
||||||
func CreateAdapter(name string, tunnelType string, requestedGUID *windows.GUID) (wintun *Adapter, err error) {
|
func CreateAdapter(name string, tunnelType string, requestedGUID *windows.GUID) (wintun *Adapter, err error) {
|
||||||
|
err = procWintunCloseAdapter.Find()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
var name16 *uint16
|
var name16 *uint16
|
||||||
name16, err = windows.UTF16PtrFromString(name)
|
name16, err = windows.UTF16PtrFromString(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue