kernel32/tests: Add a test case for calling TlsFree on a freed index.

This commit is contained in:
Reece Dunn 2010-03-02 21:29:48 +00:00 committed by Alexandre Julliard
parent 11abad24dd
commit 1b46c0660d
2 changed files with 12 additions and 2 deletions

View File

@ -2496,7 +2496,7 @@ BOOL WINAPI TlsFree( DWORD index )
if (ret) NtSetInformationThread( GetCurrentThread(), ThreadZeroTlsCell, &index, sizeof(index) );
else SetLastError( ERROR_INVALID_PARAMETER );
RtlReleasePebLock();
return TRUE;
return ret;
}

View File

@ -421,7 +421,17 @@ static VOID test_CreateThread_basic(void)
"Thread did not execute successfully\n");
ok(CloseHandle(thread[i])!=0,"CloseHandle failed\n");
}
ok(TlsFree(tlsIndex)!=0,"TlsFree failed\n");
SetLastError(0xCAFEF00D);
ok(TlsFree(tlsIndex)!=0,"TlsFree failed: %08x\n", GetLastError());
ok(GetLastError()==0xCAFEF00D,
"GetLastError: expected 0xCAFEF00D, got %08x\n", GetLastError());
/* Test freeing an already freed TLS index */
SetLastError(0xCAFEF00D);
ok(TlsFree(tlsIndex)==0,"TlsFree succeeded\n");
ok(GetLastError()==ERROR_INVALID_PARAMETER,
"GetLastError: expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
/* Test how passing NULL as a pointer to threadid works */
SetLastError(0xFACEaBAD);