Commit 1b46c066 authored by Reece Dunn's avatar Reece Dunn Committed by Alexandre Julliard

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

parent 11abad24
...@@ -2496,7 +2496,7 @@ BOOL WINAPI TlsFree( DWORD index ) ...@@ -2496,7 +2496,7 @@ BOOL WINAPI TlsFree( DWORD index )
if (ret) NtSetInformationThread( GetCurrentThread(), ThreadZeroTlsCell, &index, sizeof(index) ); if (ret) NtSetInformationThread( GetCurrentThread(), ThreadZeroTlsCell, &index, sizeof(index) );
else SetLastError( ERROR_INVALID_PARAMETER ); else SetLastError( ERROR_INVALID_PARAMETER );
RtlReleasePebLock(); RtlReleasePebLock();
return TRUE; return ret;
} }
......
...@@ -421,7 +421,17 @@ static VOID test_CreateThread_basic(void) ...@@ -421,7 +421,17 @@ static VOID test_CreateThread_basic(void)
"Thread did not execute successfully\n"); "Thread did not execute successfully\n");
ok(CloseHandle(thread[i])!=0,"CloseHandle failed\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 */ /* Test how passing NULL as a pointer to threadid works */
SetLastError(0xFACEaBAD); SetLastError(0xFACEaBAD);
......
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