diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 461b0f383d4c6eefbd1ca7a5473fbd99f1cd0560..77724d2a0d2f94521fef5c0b6d351fa284cd437a 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1940,6 +1940,7 @@ static inline OSVERSIONINFO winOsVersion()
 #define pGetModuleHandle GetModuleHandleW
 #endif
 
+#ifndef Q_OS_WINCE
     HMODULE ntdll = pGetModuleHandle(L"ntdll.dll");
     if (Q_UNLIKELY(!ntdll))
         return result;
@@ -1959,6 +1960,10 @@ static inline OSVERSIONINFO winOsVersion()
     // GetVersionEx() has been deprecated in Windows 8.1 and will return
     // only Windows 8 from that version on, so use the kernel API function.
     pRtlGetVersion(&result); // always returns STATUS_SUCCESS
+#else // !Q_OS_WINCE
+    GetVersionEx(&result);
+#endif
+
     return result;
 }