iphlpapi/tests: Call GetAdaptersAddresses() in a loop.

As shown by the testbot, doubling is not always sufficient.
This commit is contained in:
Hans Leidekker 2023-09-13 13:59:47 +02:00 committed by Alexandre Julliard
parent e802019d47
commit c2c0fefb99

View file

@ -1769,6 +1769,13 @@ static void test_GetAdaptersAddresses(void)
osize = size;
ptr = malloc(osize);
ret = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_FRIENDLY_NAME, NULL, ptr, &osize);
while (ret == ERROR_BUFFER_OVERFLOW)
{
size = osize * 2;
osize = size;
ptr = realloc(ptr, osize);
ret = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_FRIENDLY_NAME, NULL, ptr, &osize);
}
ok(!ret, "expected ERROR_SUCCESS got %lu\n", ret);
ok(osize == size, "expected %ld, got %ld\n", size, osize);