Message ID | 1447787363-15216-2-git-send-email-Andrew.Baumann@microsoft.com |
---|---|
State | New |
Headers | show |
Am 17.11.2015 um 20:09 schrieb Andrew Baumann: > In order to find a named tap device, get_device_guid() enumerates children of > HKLM\SYSTEM\CCS\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318} > (aka NETWORK_CONNECTIONS_KEY). For each child, it then looks for a > "Connection" subkey, but if this key doesn't exist, it aborts the > entire search. This was observed to fail on at least one Windows 10 > machine, where there is an additional child of NETWORK_CONNECTIONS_KEY > (named "Descriptions"). Since registry enumeration doesn't guarantee > any particular sort order, we should continue to search for matching > children rather than aborting the search. > > Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com> > --- > net/tap-win32.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/net/tap-win32.c b/net/tap-win32.c > index 4e2fa55..5e5d6db 100644 > --- a/net/tap-win32.c > +++ b/net/tap-win32.c > @@ -356,7 +356,8 @@ static int get_device_guid( > &len); > > if (status != ERROR_SUCCESS || name_type != REG_SZ) { > - return -1; > + ++i; > + continue; > } > else { > if (is_tap_win32_dev(enum_name)) { Good catch! Reviewed-by: Stefan Weil <sw@weilnetz.de>
diff --git a/net/tap-win32.c b/net/tap-win32.c index 4e2fa55..5e5d6db 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -356,7 +356,8 @@ static int get_device_guid( &len); if (status != ERROR_SUCCESS || name_type != REG_SZ) { - return -1; + ++i; + continue; } else { if (is_tap_win32_dev(enum_name)) {
In order to find a named tap device, get_device_guid() enumerates children of HKLM\SYSTEM\CCS\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318} (aka NETWORK_CONNECTIONS_KEY). For each child, it then looks for a "Connection" subkey, but if this key doesn't exist, it aborts the entire search. This was observed to fail on at least one Windows 10 machine, where there is an additional child of NETWORK_CONNECTIONS_KEY (named "Descriptions"). Since registry enumeration doesn't guarantee any particular sort order, we should continue to search for matching children rather than aborting the search. Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com> --- net/tap-win32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)