Reece Dunn : crypt32: Fix CryptFreeTls when calling with a freed index.
Alexandre Julliard
julliard at winehq.org
Wed Mar 3 11:15:45 CST 2010
Module: wine
Branch: master
Commit: a15dbfac22b4d75af2d54941a549b358ac14780c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a15dbfac22b4d75af2d54941a549b358ac14780c
Author: Reece Dunn <msclrhd at gmail.com>
Date: Tue Mar 2 21:31:46 2010 +0000
crypt32: Fix CryptFreeTls when calling with a freed index.
---
dlls/crypt32/main.c | 7 ++++++-
dlls/crypt32/tests/main.c | 6 ++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/crypt32/main.c b/dlls/crypt32/main.c
index 1a5972f..5844b18 100644
--- a/dlls/crypt32/main.c
+++ b/dlls/crypt32/main.c
@@ -161,8 +161,13 @@ BOOL WINAPI I_CryptSetTls(DWORD dwTlsIndex, LPVOID lpTlsValue)
BOOL WINAPI I_CryptFreeTls(DWORD dwTlsIndex, DWORD unknown)
{
+ BOOL ret;
+
TRACE("(%d, %d)\n", dwTlsIndex, unknown);
- return TlsFree(dwTlsIndex);
+
+ ret = TlsFree(dwTlsIndex);
+ if (!ret) SetLastError( E_INVALIDARG );
+ return ret;
}
BOOL WINAPI I_CryptGetOssGlobal(DWORD x)
diff --git a/dlls/crypt32/tests/main.c b/dlls/crypt32/tests/main.c
index 9b622bb..7c11e8e 100644
--- a/dlls/crypt32/tests/main.c
+++ b/dlls/crypt32/tests/main.c
@@ -254,10 +254,8 @@ static void test_cryptTls(void)
ret = pI_CryptFreeTls(index, 0);
ok(ret, "I_CryptFreeTls failed: %08x\n", GetLastError());
ret = pI_CryptFreeTls(index, 0);
- /* Not sure if this fails because TlsFree should fail, so leave as
- * todo for now.
- */
- todo_wine ok(!ret && GetLastError() == E_INVALIDARG,
+ ok(!ret, "I_CryptFreeTls succeeded\n");
+ ok(GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
}
/* Similar pass, check I_CryptDetachTls */
More information about the wine-cvs
mailing list