From c43805b6d6edfba6a962201db5aa7d9f14dc2f26 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Thu, 6 Mar 2014 11:35:37 +0200 Subject: [PATCH] winrtrunner: Display developer license dialog ... when the license is expired. The installation can then continue. Change-Id: I11bc13643406ad59611c53da22bdf32dfcd715e7 Reviewed-by: Oliver Wolff --- src/winrtrunner/appxengine.cpp | 12 ++++++++++++ src/winrtrunner/winrtrunner.pro | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/winrtrunner/appxengine.cpp b/src/winrtrunner/appxengine.cpp index d847017..678946a 100644 --- a/src/winrtrunner/appxengine.cpp +++ b/src/winrtrunner/appxengine.cpp @@ -49,6 +49,7 @@ #include #include +#include #include #include #include @@ -470,6 +471,17 @@ bool AppxEngine::install(bool removeFirst) qCWarning(lcWinRtRunner) << "Unable to register package:" << QString::fromWCharArray(WindowsGetStringRawBuffer(errorText, 0)); } + if (HRESULT_CODE(errorCode) == ERROR_INSTALL_POLICY_FAILURE) { + // The user's license has expired. Give them the opportunity to renew it. + FILETIME expiration; + hr = AcquireDeveloperLicense(GetForegroundWindow(), &expiration); + if (FAILED(hr)) { + qCWarning(lcWinRtRunner) << "Unable to renew developer license:" + << qt_error_string(hr); + } + if (SUCCEEDED(hr)) + return install(false); + } return false; } diff --git a/src/winrtrunner/winrtrunner.pro b/src/winrtrunner/winrtrunner.pro index bda4d9d..a321d4a 100644 --- a/src/winrtrunner/winrtrunner.pro +++ b/src/winrtrunner/winrtrunner.pro @@ -11,7 +11,7 @@ DEFINES += RTRUNNER_NO_APPX RTRUNNER_NO_XAP win32-msvc2012|win32-msvc2013 { SOURCES += appxengine.cpp HEADERS += appxengine.h - LIBS += -lruntimeobject + LIBS += -lruntimeobject -lwsclient DEFINES -= RTRUNNER_NO_APPX include(../shared/corecon/corecon.pri) -- 2.7.4