Clear the reference counter in WSACleanup, with regression test.

This commit is contained in:
Rein Klazes 2005-11-29 17:06:35 +01:00 committed by Alexandre Julliard
parent 7888e7a59b
commit 220edd52d4
2 changed files with 11 additions and 2 deletions

View File

@ -831,8 +831,10 @@ int WINAPI WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData)
*/
INT WINAPI WSACleanup(void)
{
if (num_startup)
if (num_startup) {
num_startup--;
return 0;
}
SetLastError(WSANOTINITIALISED);
return SOCKET_ERROR;
}

View File

@ -709,8 +709,15 @@ static void Init (void)
static void Exit (void)
{
INT ret, err;
TlsFree ( tls );
ok ( WSACleanup() == 0, "WSACleanup failed\n" );
ret = WSACleanup();
err = WSAGetLastError();
ok ( ret == 0, "WSACleanup failed ret = %d GetLastError is %d\n", ret, err);
ret = WSACleanup();
err = WSAGetLastError();
ok ( ret == SOCKET_ERROR && err == WSANOTINITIALISED,
"WSACleanup returned %d GetLastError is %d\n", ret, err);
}
static void StartServer (LPTHREAD_START_ROUTINE routine,