From 847d5d1309a4365af7d0f4fa1bff5754b8286e34 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Mon, 17 Aug 2015 09:39:46 +0200 Subject: [PATCH] Implement sessionId/key generation on Windows sessionId and sessionKey generation on Windows was lost in the transition of Qt 4 to Qt 5. During the reimplementation of the QSessionManagement feature, that part has been missed. This patch fixes that. Based on Qt 4 [ChangeLog][QtGui][Windows] Fixed a regression where both sessionId/sessionKey were empty Task-number: QTBUG-47690 Change-Id: I17b5fbee9d0979d292d30b94b3a2cc3107fc54fd Reviewed-by: Friedemann Kleint --- src/gui/kernel/qguiapplication.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 736580f547..710aa714b7 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -99,6 +99,9 @@ #elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) # include # include +# if defined(Q_OS_WINPHONE) +# include +# endif #endif // Q_OS_WIN && !Q_OS_WINCE #include @@ -1232,6 +1235,16 @@ void QGuiApplicationPrivate::init() #ifndef QT_NO_SESSIONMANAGER QString session_id; QString session_key; +# if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + wchar_t guidstr[40]; + GUID guid; + CoCreateGuid(&guid); + StringFromGUID2(guid, guidstr, 40); + session_id = QString::fromWCharArray(guidstr); + CoCreateGuid(&guid); + StringFromGUID2(guid, guidstr, 40); + session_key = QString::fromWCharArray(guidstr); +# endif #endif int j = argc ? 1 : 0; for (int i=1; i