winrt: Fix API usage certification

According to MSDN Tls* is inline replaced by Fls* on Windows (Phone) 8.1
and beyond.
However, this does not seem to be the case for Windows 10. An
application links against Tls* and the certification step fails due to
using non-allowed APIs.

Hence we do the inline replacement manually. QThreadStorage and QThread
tests continue to work, so it seems to be an oversight by Microsoft.

Task-number: QTBUG-50292
Change-Id: Ice1b6e54fcee238c94af5c6fb1753d903db7476d
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
This commit is contained in:
Maurice Kalinowski 2016-01-08 14:03:04 +01:00
parent becbffe291
commit 14e43c8f42

View File

@ -69,6 +69,30 @@
#ifndef QT_NO_THREAD
QT_BEGIN_NAMESPACE
#ifdef Q_OS_WINRT
inline DWORD qWinRTTlsAlloc() {
return FlsAlloc(0);
}
inline bool qWinRTTlsFree(DWORD dwTlsIndex) {
return FlsFree(dwTlsIndex);
}
inline LPVOID qWinRTTlsGetValue(DWORD dwTlsIndex) {
return FlsGetValue(dwTlsIndex);
}
inline bool qWinRTTlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue) {
return FlsSetValue(dwTlsIndex, lpTlsValue);
}
#define TlsAlloc qWinRTTlsAlloc
#define TlsFree qWinRTTlsFree
#define TlsSetValue qWinRTTlsSetValue
#define TlsGetValue qWinRTTlsGetValue
#endif // Q_OS_WINRT
void qt_watch_adopted_thread(const HANDLE adoptedThreadHandle, QThread *qthread);
DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID);