path: root/src
diff options
authorMaurice Kalinowski <>2016-01-08 14:03:04 +0100
committerMaurice Kalinowski <>2016-01-11 10:06:40 +0000
commit14e43c8f42585a8fa07f3fcfea5d9e1255cda0d1 (patch)
treea3ed81e6365312a3d68fac5e4f8bca577fe347f9 /src
parentbecbffe291c1105eb422e8dc66c67c5b6443b96c (diff)
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 <>
Diffstat (limited to 'src')
1 files changed, 24 insertions, 0 deletions
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index 1a4b41fee4..32e8a52a28 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -69,6 +69,30 @@
#ifndef QT_NO_THREAD
+#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);