aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/ipc-windows.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-06-30 01:56:24 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2021-07-20 13:24:18 +0200
commitfabe24df3a350eac3fc6deade05b20108cb13c39 (patch)
tree8ac3b4abafd847fad100ff33905e40c7eebfd229 /src/ipc-windows.h
parentipc: remove windows elevation (diff)
downloadwireguard-tools-fabe24df3a350eac3fc6deade05b20108cb13c39.tar.xz
wireguard-tools-fabe24df3a350eac3fc6deade05b20108cb13c39.zip
ipc: windows: don't display disabled adapters
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r--src/ipc-windows.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ipc-windows.h b/src/ipc-windows.h
index 9c72a62..d19860e 100644
--- a/src/ipc-windows.h
+++ b/src/ipc-windows.h
@@ -37,6 +37,7 @@ static int kernel_get_wireguard_interfaces(struct string_list *list)
SP_DEVINFO_DATA dev_info_data = { .cbSize = sizeof(SP_DEVINFO_DATA) };
HKEY key;
GUID instance_id;
+ ULONG status, problem_code;
char *interface_name;
struct hashtable_entry *entry;
@@ -110,7 +111,9 @@ static int kernel_get_wireguard_interfaces(struct string_list *list)
goto cleanup_buf;
}
- string_list_add(list, interface_name);
+ if (CM_Get_DevNode_Status(&status, &problem_code, dev_info_data.DevInst, 0) == CR_SUCCESS &&
+ (status & (DN_DRIVER_LOADED | DN_STARTED)) == (DN_DRIVER_LOADED | DN_STARTED))
+ string_list_add(list, interface_name);
entry = hashtable_find_or_insert_entry(&cached_kernel_interfaces, interface_name);
free(interface_name);