大家,早安,
对于我开发的应用程序,在 C++ 中,我需要获取接口的 componentId。特别是 WireGuard 接口(componentId=wintun,即使用官方 WireGuard 安装程序安装的适配器)。通常我从注册表项中获取它,
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-<other_numbers>0318}\<NUMBER>
取决于你有<NUMBER>
多少个接口,通常是四位数,比如 0015 或 0022...
在其中,应该有值“ComponentId”,在 OpenVPN 中应该是“tap0901”,在 WireGuard 中应该是“wintun”。
有时我看到我没有 ComponentId。我用 WireGuard 看到过,但问题更笼统:
没有 ComponentId 的接口怎么办?什么时候可以发生?如果我没有 componentId,我可以依赖哪个值?