Windows: interface without ComponentId?

113 Views Asked by At

For the application I develop, in C++, I need to get the componentId of an interface. In particular, the WireGuard interface (componentId=wintun that is the adapter installed with the official WireGuard installer). Usually I get it from the registry key,

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-<other_numbers>0318}\<NUMBER>

where the <NUMBER> depends on how many interfaces you have, usually is four digits, like 0015 or 0022...

Inside it, there should be the value "ComponentId", in OpenVPN it should be "tap0901", in WireGuard "wintun".

Sometimes I see that I do not have a ComponentId. I have seen it with WireGuard, but the question is more general:

How can we have an interface without ComponentId? when can it happen? If I don't have the componentId, on which value could I rely?

1

There are 1 best solutions below

0
On BEST ANSWER

I found the solution here

build 10049 breaks openvpn

Basically, if you need the "ComponentId" key, check also the "MatchingDeviceId"