Commit 22434f49 authored by Dan Kegel's avatar Dan Kegel Committed by Alexandre Julliard

iphlpapi: _res is per-thread in glibc.

parent e66198ae
...@@ -66,16 +66,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi); ...@@ -66,16 +66,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi);
#define INADDR_NONE ~0UL #define INADDR_NONE ~0UL
#endif #endif
static int resolver_initialised;
/* call res_init() just once because of a bug in Mac OS X 10.4 */ /* call res_init() just once because of a bug in Mac OS X 10.4 */
/* Call once per thread on systems that have per-thread _res. */
/* FIXME: should do same fix in dnsapi (or use dnsapi here?) */
static void initialise_resolver(void) static void initialise_resolver(void)
{ {
if (!resolver_initialised) if ((_res.options & RES_INIT) == 0)
{
res_init(); res_init();
resolver_initialised = 1;
}
} }
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
......
...@@ -765,11 +765,12 @@ GetBestRoute ...@@ -765,11 +765,12 @@ GetBestRoute
IpReleaseAddress IpReleaseAddress
IpRenewAddress IpRenewAddress
*/ */
static void testWin98Functions(void) static DWORD CALLBACK testWin98Functions(void *p)
{ {
testGetInterfaceInfo(); testGetInterfaceInfo();
testGetAdaptersInfo(); testGetAdaptersInfo();
testGetNetworkParams(); testGetNetworkParams();
return 0;
} }
static void testGetPerAdapterInfo(void) static void testGetPerAdapterInfo(void)
...@@ -885,9 +886,16 @@ START_TEST(iphlpapi) ...@@ -885,9 +886,16 @@ START_TEST(iphlpapi)
loadIPHlpApi(); loadIPHlpApi();
if (hLibrary) { if (hLibrary) {
HANDLE thread;
testWin98OnlyFunctions(); testWin98OnlyFunctions();
testWinNT4Functions(); testWinNT4Functions();
testWin98Functions();
/* run testGetXXXX in two threads at once to make sure we don't crash in that case */
thread = CreateThread(NULL, 0, testWin98Functions, NULL, 0, NULL);
testWin98Functions(NULL);
WaitForSingleObject(thread, INFINITE);
testWin2KFunctions(); testWin2KFunctions();
test_GetAdaptersAddresses(); test_GetAdaptersAddresses();
freeIPHlpApi(); freeIPHlpApi();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment