Using Wintun 0.9.2 on Windows 10 Enterprise 1909 x86_64, creating an adapter (and then deleting it) works fine.  And, using the API to move packets in and out also works fine.  But, if we create an adapter, then delete it, and _then_ try to either open or create again in the same process, we get an unexpected error.  For example:

From `WintunOpenAdapter()`:

```
wintun: NamespaceRuntimeInit: Failed to open private namespace: You were not connected because a duplicate name exists on the network. If joining a domain, go to System in Control Panel to change the computer name and try again. If joining a workgroup, choose another workgroup name. (Code 0x00000034)
wintun: WintunOpenAdapter: Failed to take pool mutex
```

Alternatively, from `WintunCreateAdapter()`:

```
wintun: CreateAdapter: Creating adapter
wintun: NamespaceRuntimeInit: Failed to open private namespace: You were not connected because a duplicate name exists on the network. If joining a domain, go to System in Control Panel to change the computer name and try again. If joining a workgroup, choose another workgroup name. (Code 0x00000034)
wintun: SelectDriver: Failed to take driver installation mutex
```

If we create and destroy, and then start a new process, we can create and destroy again in that process, but only once.  It does not seem to matter if we create a session on the first adapter before destroying it or if we actually use it or not to move packets.

We have tried sleeping for 10 seconds (and much longer!) between iterations and it seems to make no difference.

Are we misusing or misunderstanding the API?  Is this a bug?

We have created a small stand-alone program that demonstrates the bug on a freshly installed Windows 10 Enterprise 1909: https://github.com/b-spencer/wintun-adapter-error

--
Brad Spencer

Reply via email to