gcp-cherry-pick-bot[bot] 780b2714ff fix(vpn): fail early if wintun.dll is not present (cherry-pick #16707) (#16738)
Cherry-picked fix(vpn): fail early if wintun.dll is not present (#16707)

Prevents the VPN startup from hanging for 5 minutes due to a startup
backoff if `wintun.dll` cannot be loaded.

Because the `wintun` package doesn't expose an easy `Load() error`
method for us, the only way for us to force it to load (without unwanted
side effects) is through `wintun.Version()` which doesn't return an
error message.

So, we call that function so the `wintun` package loads the DLL and
configures the logging properly, then we try to load the DLL ourselves.
`LoadLibraryEx` will not load the library multiple times and returns a
reference to the existing library.

Closes https://github.com/coder/coder-desktop-windows/issues/24

Co-authored-by: Dean Sheather <dean@deansheather.com>
2025-02-28 12:47:59 +05:00
..