]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wincompat: use new protected prefix on Windows
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 19 Mar 2020 22:33:14 +0000 (16:33 -0600)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 19 Mar 2020 22:33:14 +0000 (16:33 -0600)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/wincompat/ipc.c

index ce8fdb6b1bb4b5f3d937e4b62567d9f16cab0b69..86fab07caba10b1b6ca22dbb1dcc1e0356bbf62e 100644 (file)
@@ -115,6 +115,7 @@ err:
 
 static int userspace_get_wireguard_interfaces(struct string_list *list)
 {
+       static const char prefix[] = "ProtectedPrefix\\Administrators\\WireGuard\\";
        WIN32_FIND_DATA find_data;
        HANDLE find_handle;
        int ret = 0;
@@ -123,9 +124,9 @@ static int userspace_get_wireguard_interfaces(struct string_list *list)
        if (find_handle == INVALID_HANDLE_VALUE)
                return -GetLastError();
        do {
-               if (strncmp("WireGuard\\", find_data.cFileName, 10))
+               if (strncmp(prefix, find_data.cFileName, strlen(prefix)))
                        continue;
-               ret = string_list_add(list, find_data.cFileName + 10);
+               ret = string_list_add(list, find_data.cFileName + strlen(prefix));
                if (ret < 0)
                        goto out;
        } while (FindNextFile(find_handle, &find_data));