Race-condition when removing instance of WinTUN adapter?
Thomas Eizinger
thomas at eizinger.io
Sun Feb 16 22:51:11 UTC 2025
Hello!
We are receiving variations of the following errors on multiple Windows machines from customers. The UUID is what we are setting as the tunnel adapter ID.
```
Spawning native process to remove instance
Error executing worker process: "SWD\WINTUN\{E9245BC1-B8C1-44CA-AB1D-C6AAD4F13B9C}": The system cannot find the path specified. (Code 0x00000003)
```
and
```
Spawning native process to remove instance
Failed to create process: rundll32 "C:\Windows\Temp\ab11b60bba2fb3bcc9a355e9e3a89003522ede647bc6c00704e734a8447c1ce5\setupapihost.dll",RemoveInstance "SWD\WINTUN\{E9245BC1-B8C1-44CA-AB1D-C6AAD4F13B9C}": Het systeem kan het opgegeven pad niet vinden. (Code 0x00000003)
```
(Error message here is Dutch because that particular customer is in the Netherlands. It means "The system cannot find the path specified")
>From reading the source code at [0], I suspect that this is "only" a race condition where the adapter is simply no longer present at the time we want to remove it? I am not very well versed at C code which is why I figured I'd ask here before attempting to patch the code. Would it make sense to add a check for this particular error code and not fail as a result, making the function idempotent?
Any insight is much appreciated.
Kind regards,
Thomas Eizinger
[0]: https://git.zx2c4.com/wintun/tree/api/rundll32.c#n160
More information about the WireGuard
mailing list