From 2d557b1c5c4d2da8d307519835a0b97287891a9c Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Mon, 31 Aug 2020 08:31:32 +0200 Subject: winrtrunner: Remove Windows Phone support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Windows Phone has not been supported for a while now. With newer Windows versions the functionality causes issues. On build 1909 the application hangs in CoUninitialize when called with --list-devices and in build 2004 the needed classes are not registered at all. Fixes: QTBUG-86293 Change-Id: I74a4cb03c246414df587ef1fc1187577e3c40775 Reviewed-by: André de la Rocha Reviewed-by: Miguel Costa --- src/shared/corecon/ccapi.h | 436 ---------------------------- src/shared/corecon/ccapi_11.h | 73 ----- src/shared/corecon/ccapi_12.h | 73 ----- src/shared/corecon/corecon.cpp | 466 ----------------------------- src/shared/corecon/corecon.h | 94 ------ src/shared/corecon/corecon.pri | 3 - src/winrtrunner/appxphoneengine.cpp | 565 ------------------------------------ src/winrtrunner/appxphoneengine.h | 89 ------ src/winrtrunner/runner.cpp | 22 -- src/winrtrunner/winrtrunner.pro | 7 +- 10 files changed, 2 insertions(+), 1826 deletions(-) delete mode 100644 src/shared/corecon/ccapi.h delete mode 100644 src/shared/corecon/ccapi_11.h delete mode 100644 src/shared/corecon/ccapi_12.h delete mode 100644 src/shared/corecon/corecon.cpp delete mode 100644 src/shared/corecon/corecon.h delete mode 100644 src/shared/corecon/corecon.pri delete mode 100644 src/winrtrunner/appxphoneengine.cpp delete mode 100644 src/winrtrunner/appxphoneengine.h diff --git a/src/shared/corecon/ccapi.h b/src/shared/corecon/ccapi.h deleted file mode 100644 index 01ec1db54..000000000 --- a/src/shared/corecon/ccapi.h +++ /dev/null @@ -1,436 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CCAPI_VERSIONED_H -#define CCAPI_VERSIONED_H - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Core Connectivity API (Experimental) - * - * These interfaces for deploying to Windows Phone devices are available as - * registered DLLs if the Windows Phone tools have been installed. - * As the IDL is not part of the Windows SDK, these interfaces were crafted by - * hand via the MSDN documentation and the information gathered by OLEView. - * As a consequence, not all interfaces have been stubbed out, and not all - * methods have been tested. This means that some methods may end up in the - * wrong position in the vtable, causing unexpected behavior or crashes. - * You have been warned! - * - * CoreConnectivity documentation: - * http://msdn.microsoft.com/en-us/library/ee481381.aspx - * SmartDevice Connectivity documentation: - * http://msdn.microsoft.com/en-us/library/microsoft.smartdevice.connectivity.aspx - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#ifndef CORECON_VER -static_assert(false, "You must define the CoreCon version with CORECON_VER."); -#endif - -#if CORECON_VER==11 - -static const CLSID CLSID_ConMan_11 = { 0x349AB2E8, 0x71B6, 0x4069, 0xAD, 0x9C, 0x11, 0x70, 0x84, 0x9D, 0xA6, 0x4C }; - -// Undefined -struct ICcFormFactorContainer_11; -struct ICcOSImage_11; -struct ICcOSImageContainer_11; -struct ICcPackageContainer_11; -struct ICcProjectContainer_11; -struct ICcServiceCategoryContainer_11; -struct ICcServiceCB_11; -struct ICcServiceInfo_11; -struct ICcTransportStream_11; -struct ICcTypeToArchitectureMap_11; - -// Defined -struct ICcConnection_11; -struct ICcCollection_11; -struct ICcConnection3_11; -struct ICcDatastore_11; -struct ICcDevice_11; -struct ICcDeviceContainer_11; -struct ICcObject_11; -struct ICcObjectContainer_11; -struct ICcPlatform_11; -struct ICcPlatformContainer_11; -struct ICcProperty_11; -struct ICcPropertyContainer_11; -struct ICcServer_11; - -#elif CORECON_VER==12 - -static const CLSID CLSID_ConMan_12 = { 0x2D0A16C9, 0x53D9, 0x42C1, 0xBC, 0xC2, 0x8D, 0x2A, 0x13, 0x5E, 0x21, 0x63 }; - -// Undefined -struct ICcFormFactorContainer_12; -struct ICcOSImage_12; -struct ICcOSImageContainer_12; -struct ICcPackageContainer_12; -struct ICcProjectContainer_12; -struct ICcServiceCategoryContainer_12; -struct ICcServiceCB_12; -struct ICcServiceInfo_12; -struct ICcTransportStream_12; -struct ICcTypeToArchitectureMap_12; - -// Defined -struct ICcConnection_12; -struct ICcCollection_12; -struct ICcConnection3_12; -struct ICcDatastore_12; -struct ICcDevice_12; -struct ICcDeviceContainer_12; -struct ICcObject_12; -struct ICcObjectContainer_12; -struct ICcPlatform_12; -struct ICcPlatformContainer_12; -struct ICcProperty_12; -struct ICcPropertyContainer_12; -struct ICcServer_12; - -#endif - - -#ifndef CCAPI_H -#define CCAPI_H - -typedef struct tagFileInfo{ - LONG m_FileAttribues; - LONGLONG m_FileSize; - FILETIME m_CreationTime; - FILETIME m_LastAccessTime; - FILETIME m_LastWriteTime; -} FileInfo; - -typedef struct tagFileVerifyVersion{ - DWORD m_Major; - DWORD m_Minor; - DWORD m_Build; - DWORD m_Revision; -} FileVerifyVersion; - -typedef struct tagFileVerifyInfo{ - FileVerifyVersion m_AssemblyVersion; - FileVerifyVersion m_Win32Version; - BSTR m_Culture; - BYTE m_PublicKeyToken[12 + 3/*PUBLIC_KEY_TOKEN_LENGTH*/]; //### What is the key length? - DWORD m_Flags; -} FileVerifyInfo; - -typedef struct tagFileVerifyReference{ - BSTR m_Name; - BSTR m_SourcePath; - FileVerifyInfo m_Info; -} FileVerifyReference; - -typedef struct tagFileVerifyResult{ - DWORD m_Version; - FileVerifyInfo _Info; -} FileVerifyResult; - -typedef struct tagPlatformInfo{ - DWORD m_OSMajor; - DWORD m_OSMinor; - DWORD m_BuildNo; - DWORD m_ProcessorArchitecture; - DWORD m_InstructionSet; -} SystemInfo; - -#endif // CCAPI_H - -#if CORECON_VER==11 -struct __declspec(uuid("{7A4AA9D3-0F9E-4CD4-8D52-62B6C0653752}")) ICcCollection_11 : public IDispatch -#elif CORECON_VER==12 -struct __declspec(uuid("{9A83560F-377D-419F-B572-AEC3C1A44671}")) ICcCollection_12 : public IDispatch -#endif -{ - virtual HRESULT __stdcall get_Count(long *count) = 0; -#if CORECON_VER==11 - virtual HRESULT __stdcall get_Item(long index, ICcObject_11 **object) = 0; -#elif CORECON_VER==12 - virtual HRESULT __stdcall get_Item(long index, ICcObject_12 **object) = 0; -#endif - virtual HRESULT __stdcall get_NewEnum(IUnknown **val) = 0; -}; - -#if CORECON_VER==11 -struct __declspec(uuid("{CEF4C928-326F-49A9-B7E7-8FE7588B74B5}")) ICcConnection_11 : public IDispatch -#elif CORECON_VER==12 -struct __declspec(uuid("{906D8E75-8AE6-46B5-B4B6-43B83D9A0948}")) ICcConnection_12 : public IDispatch -#endif -{ - virtual HRESULT __stdcall DeviceId(BSTR *deviceId) = 0; - virtual HRESULT __stdcall GetSystemInfo(SystemInfo *systemInfo) = 0; - virtual HRESULT __stdcall SendFile(BSTR desktopFile, BSTR deviceFile, DWORD creationFlags, BSTR customFileAction) = 0; - virtual HRESULT __stdcall ReceiveFile(BSTR deviceFile, BSTR desktopFile, DWORD fileAction) = 0; - virtual HRESULT __stdcall RemoveFile(BSTR deviceFile) = 0; - virtual HRESULT __stdcall GetFileInfo(BSTR deviceFile, FileInfo *fileInfo) = 0; - virtual HRESULT __stdcall SetFileInfo(BSTR deviceFile, FileInfo *fileInfo) = 0; - virtual HRESULT __stdcall DeleteDirectory(BSTR deviceDirectory, VARIANT_BOOL removeAll) = 0; - virtual HRESULT __stdcall MakeDirectory(BSTR deviceDirectory) = 0; - virtual HRESULT __stdcall DownloadPackage(BSTR packageId) = 0; - virtual HRESULT __stdcall LaunchProcess(BSTR executable, BSTR arguments, DWORD creationFlags, DWORD *processId, DWORD *processHandle) = 0; - virtual HRESULT __stdcall TerminateProcess(DWORD processId) = 0; - virtual HRESULT __stdcall GetProcessExitCode(DWORD processId, VARIANT_BOOL *processExited, DWORD *exitCode) = 0; - virtual HRESULT __stdcall RegistryCreateKey(LONG key, BSTR subKey) = 0; - virtual HRESULT __stdcall RegistryDeleteKey(LONG key, BSTR subKey) = 0; - virtual HRESULT __stdcall RegistrySetValue(LONG key, BSTR subKey, BSTR valueName, DWORD type, BSTR data, DWORD length) = 0; - virtual HRESULT __stdcall RegistryQueryValue(LONG key, BSTR subKey, BSTR valueName, DWORD type, WCHAR *value, LONG *length) = 0; - virtual HRESULT __stdcall RegistryDeleteValue(LONG key, BSTR subKey, BSTR valueName) = 0; - virtual HRESULT __stdcall IsConnected(VARIANT_BOOL *connected) = 0; - virtual HRESULT __stdcall VerifyFilesInstalled(DWORD arraySize, FileVerifyReference *infoArray, FileVerifyResult *existenceArray) = 0; - virtual HRESULT __stdcall ConnectDevice() = 0; - virtual HRESULT __stdcall DisconnectDevice() = 0; - virtual HRESULT __stdcall SearchFileSystem(BSTR criteria, BSTR startingDirectory, SAFEARRAY/**/ *results) = 0; -#if CORECON_VER==11 - virtual HRESULT __stdcall CreateStream(BSTR streamId, DWORD timeout, ICcServiceCB_11 *callback, DWORD *cookieId, ICcTransportStream_11 **stream) = 0; -#elif CORECON_VER==12 - virtual HRESULT __stdcall CreateStream(BSTR streamId, DWORD timeout, ICcServiceCB_12 *callback, DWORD *cookieId, ICcTransportStream_12 **stream) = 0; -#endif - virtual HRESULT __stdcall EnumerateProcesses(SAFEARRAY/**/ **processes, SAFEARRAY/**/ **processIds) = 0; - virtual HRESULT __stdcall CloseProcessHandle(DWORD processHandle) = 0; -}; - -#if CORECON_VER==11 -struct __declspec(uuid("{F4B43EA3-3106-4D3D-94E3-084D4136C40C}")) ICcConnection3_11 : public IUnknown -#elif CORECON_VER==12 -struct __declspec(uuid("{B158FE65-7DCC-4809-9054-A7B52FD43DE3}")) ICcConnection3_12 : public IUnknown -#endif -{ - virtual HRESULT __stdcall GetInstalledApplicationCount(int *count) = 0; // E_NOTIMPL - virtual HRESULT __stdcall GetInstalledApplicationIDs(SAFEARRAY/**/ **productIds, SAFEARRAY/**/ **instanceIds) = 0; - virtual HRESULT __stdcall IsApplicationInstalled(BSTR productId, VARIANT_BOOL *installed) = 0; - virtual HRESULT __stdcall InstallApplication(BSTR productId, BSTR instanceId, BSTR genre, BSTR iconPath, BSTR xapPath) = 0; - virtual HRESULT __stdcall UpdateApplication(BSTR productId, BSTR instanceId, BSTR genre, BSTR applicationPath, BSTR xapPath) = 0; - virtual HRESULT __stdcall GetInstalledFileInfo(BSTR productId, BSTR fileName, FileInfo *fileInfo) = 0; // E_NOTIMPL - virtual HRESULT __stdcall IsApplicationRunning(BSTR productId, VARIANT_BOOL *isRunning) = 0; // E_NOTIMPL - virtual HRESULT __stdcall UninstallApplication(BSTR productId) = 0; - virtual HRESULT __stdcall LaunchApplicationWithService(BSTR productId, BSTR serviceInfo) = 0; // E_NOTIMPL - virtual HRESULT __stdcall TerminateRunningApplicationInstances(BSTR productId) = 0; - virtual HRESULT __stdcall LaunchApplication(BSTR productId, DWORD *processId) = 0; - -// Untested - virtual HRESULT __stdcall UpdateInstalledFile(BSTR productId, BSTR fileRelativePath, BSTR sourceFilePath, VARIANT_BOOL updateFileInfo) = 0; - virtual HRESULT __stdcall UpdateInstalledFilesInfo(BSTR productId, SAFEARRAY/**/ *fileNames, SAFEARRAY/**/ *xapRelativePaths) = 0; - virtual HRESULT __stdcall UpdateInstalledFiles(BSTR productId, SAFEARRAY/**/ *fileNames, SAFEARRAY/**/ *xapRelativePaths) = 0; - virtual HRESULT __stdcall ActivateDevice() = 0; -}; - -#if CORECON_VER==11 -struct __declspec(uuid("{5F25394E-D9B6-4F8E-A0DF-325610A35BFA}")) ICcConnection4_11 : public IUnknown -#elif CORECON_VER==12 -struct __declspec(uuid("{68CBC76F-ADF6-4586-B495-E34771B8EAC2}")) ICcConnection4_12 : public IUnknown -#endif -{ - virtual HRESULT __stdcall GetDirectoryListing(BSTR deviceDirPath, SAFEARRAY/**/ **listing) = 0; - virtual HRESULT __stdcall GetApplicationType(BSTR productId, DWORD *type) = 0; - virtual HRESULT __stdcall GetEndPoints(int localPort, BSTR localIp, BSTR remoteIp, int remotePort) = 0; -}; - -#if CORECON_VER==11 -struct __declspec(uuid("{EDB0A0CA-F0F8-4EBF-9D31-43E182569A5A}")) ICcDatastore_11 : public IDispatch -#elif CORECON_VER==12 -struct __declspec(uuid("{2E6AF7C6-CBAB-4E6E-B78A-90A04A2CE523}")) ICcDatastore_12 : public IDispatch -#endif -{ - virtual HRESULT __stdcall Save() = 0; - virtual HRESULT __stdcall RegisterRefreshEvent(BSTR eventName) = 0; - virtual HRESULT __stdcall UnregisterRefreshEvent() = 0; -#if CORECON_VER==11 - virtual HRESULT __stdcall get_DeviceContainer(ICcDeviceContainer_11 **dc) = 0; - virtual HRESULT __stdcall get_OSImageContainer(ICcOSImageContainer_11 **oc) = 0; - virtual HRESULT __stdcall get_PackageContainer(ICcPackageContainer_11 **pc) = 0; - virtual HRESULT __stdcall get_PlatformContainer(ICcPlatformContainer_11 **pc) = 0; - virtual HRESULT __stdcall get_PropertyContainer(ICcPropertyContainer_11 **pc) = 0; - virtual HRESULT __stdcall get_ServiceCategoryContainer(ICcServiceCategoryContainer_11 **scc) = 0; -#elif CORECON_VER==12 - virtual HRESULT __stdcall get_DeviceContainer(ICcDeviceContainer_12 **dc) = 0; - virtual HRESULT __stdcall get_OSImageContainer(ICcOSImageContainer_12 **oc) = 0; - virtual HRESULT __stdcall get_PackageContainer(ICcPackageContainer_12 **pc) = 0; - virtual HRESULT __stdcall get_PlatformContainer(ICcPlatformContainer_12 **pc) = 0; - virtual HRESULT __stdcall get_PropertyContainer(ICcPropertyContainer_12 **pc) = 0; - virtual HRESULT __stdcall get_ServiceCategoryContainer(ICcServiceCategoryContainer_12 **scc) = 0; -#endif - virtual HRESULT __stdcall get_Version(BSTR *version) = 0; -}; - -#if CORECON_VER==11 -struct __declspec(uuid("{971BF639-8C53-4057-B635-375D7BCDFF3E}")) ICcDevice_11 : public IDispatch -#elif CORECON_VER==12 -struct __declspec(uuid("{22773666-28CC-4AD6-9F07-E06BE40EEDB3}")) ICcDevice_12 : public IDispatch -#endif -{ - virtual HRESULT __stdcall ClearOSImage() = 0; - virtual HRESULT __stdcall ClearServiceMap(BSTR serviceCatetoryId) = 0; -#if CORECON_VER==11 - virtual HRESULT __stdcall GetOSImage(ICcOSImage_11 **image) = 0; - virtual HRESULT __stdcall GetServiceMap(BSTR serviceCategoryId, ICcServiceInfo_11 **serviceInfo) = 0; -#elif CORECON_VER==12 - virtual HRESULT __stdcall GetOSImage(ICcOSImage_12 **image) = 0; - virtual HRESULT __stdcall GetServiceMap(BSTR serviceCategoryId, ICcServiceInfo_12 **serviceInfo) = 0; -#endif - virtual HRESULT __stdcall SetOSImage(BSTR osImage) = 0; - virtual HRESULT __stdcall SetServiceMap(BSTR serviceCategoryId, BSTR serviceInfoId) = 0; -}; - -#if CORECON_VER==11 -struct __declspec(uuid("{88152DD3-5ECB-47A2-8F15-610C4C390122}")) ICcDeviceContainer_11 : public IDispatch -#elif CORECON_VER==12 -struct __declspec(uuid("{D747386E-3EAB-4E04-8DD5-7037D192A06D}")) ICcDeviceContainer_12 : public IDispatch -#endif -{ -}; - -#if CORECON_VER==11 -struct __declspec(uuid("{B669EC21-E8FC-42E4-AEC5-8F0EF3673AB8}")) ICcObject_11 : public IDispatch -#elif CORECON_VER==12 -struct __declspec(uuid("{F84BC223-B877-43A2-BE9C-68CFB0020732}")) ICcObject_12 : public IDispatch -#endif -{ - virtual HRESULT __stdcall get_Name(BSTR *name) = 0; - virtual HRESULT __stdcall put_Name(BSTR name) = 0; - virtual HRESULT __stdcall get_ID(BSTR *id) = 0; - virtual HRESULT __stdcall get_IsProtected(VARIANT_BOOL *isProtected) = 0; -#if CORECON_VER==11 - virtual HRESULT __stdcall get_PropertyContainer(ICcPropertyContainer_11 **pc) = 0; -#elif CORECON_VER==12 - virtual HRESULT __stdcall get_PropertyContainer(ICcPropertyContainer_12 **pc) = 0; -#endif -}; - -#if CORECON_VER==11 -struct __declspec(uuid("{1C0048A9-A73F-41B3-BD75-467D615CB9E5}")) ICcObjectContainer_11 : public IDispatch -#elif CORECON_VER==12 -struct __declspec(uuid("{ADEFAC99-D191-46A1-B42F-58B22755C293}")) ICcObjectContainer_12 : public IDispatch -#endif -{ -#if CORECON_VER==11 - virtual HRESULT __stdcall FindObject(BSTR nameOrId, ICcObject_11 **object) = 0; - virtual HRESULT __stdcall EnumerateObjects(ICcCollection_11 **collection) = 0; - virtual HRESULT __stdcall AddObject(BSTR name, BSTR id, ICcObject_11 **object) = 0; -#elif CORECON_VER==12 - virtual HRESULT __stdcall FindObject(BSTR nameOrId, ICcObject_12 **object) = 0; - virtual HRESULT __stdcall EnumerateObjects(ICcCollection_12 **collection) = 0; - virtual HRESULT __stdcall AddObject(BSTR name, BSTR id, ICcObject_12 **object) = 0; -#endif - virtual HRESULT __stdcall DeleteObject(BSTR nameOrId) = 0; -}; - -#if CORECON_VER==11 -struct __declspec(uuid("{2E12E75A-1625-44B6-B527-7A1E7ED61577}")) ICcPlatform_11 : public IDispatch -#elif CORECON_VER==12 -struct __declspec(uuid("{9124335F-7D55-443D-A86C-4DBC245A1051}")) ICcPlatform_12 : public IDispatch -#endif -{ -#if CORECON_VER==11 - virtual HRESULT __stdcall get_ProjectContainer(ICcProjectContainer_11 **container) = 0; - virtual HRESULT __stdcall get_DeviceContainer(ICcDeviceContainer_11 **container) = 0; - virtual HRESULT __stdcall get_FormFactorContainer(ICcFormFactorContainer_11 **container) = 0; - virtual HRESULT __stdcall get_TypeToArchitectureMap(ICcTypeToArchitectureMap_11 **map) = 0; -#elif CORECON_VER==12 - virtual HRESULT __stdcall get_ProjectContainer(ICcProjectContainer_12 **container) = 0; - virtual HRESULT __stdcall get_DeviceContainer(ICcDeviceContainer_12 **container) = 0; - virtual HRESULT __stdcall get_FormFactorContainer(ICcFormFactorContainer_12 **container) = 0; - virtual HRESULT __stdcall get_TypeToArchitectureMap(ICcTypeToArchitectureMap_12 **map) = 0; -#endif -}; - -#if CORECON_VER==11 -struct __declspec(uuid("{C434B7DA-ABAA-428A-944A-3AF1A7419A92}")) ICcPlatformContainer_11 : public IDispatch -#elif CORECON_VER==12 -struct __declspec(uuid("{2D405E9C-BBA4-406B-9E9F-A4E41CAC520C}")) ICcPlatformContainer_12 : public IDispatch -#endif -{ -}; - -#if CORECON_VER==11 -struct __declspec(uuid("{A918FF41-F287-488D-BE16-99DBF54E331D}")) ICcProperty_11 : public IDispatch -#elif CORECON_VER==12 -struct __declspec(uuid("{750F503B-6686-4715-81EB-9E23EA0FC424}")) ICcProperty_12 : public IDispatch -#endif -{ - virtual HRESULT __stdcall get_Value(BSTR *val) = 0; - virtual HRESULT __stdcall set_Value(BSTR val) = 0; - virtual HRESULT __stdcall AddPropertyContainer() = 0; -}; - -#if CORECON_VER==11 -struct __declspec(uuid("{9636B4A4-633C-4542-A809-9E96ABF01FA5}")) ICcPropertyContainer_11 : public IDispatch -#elif CORECON_VER==12 -struct __declspec(uuid("{E92A5704-87B2-4059-81A2-C5C54424CF38}")) ICcPropertyContainer_12 : public IDispatch -#endif -{ -}; - -#if CORECON_VER==11 -struct __declspec(uuid("{F19FF2DB-0A4E-4148-ABE3-47EE7E31194F}")) ICcServer_11 : public IDispatch -#elif CORECON_VER==12 -struct __declspec(uuid("{D0D076C5-5C71-4947-A056-94E8E760DFFE}")) ICcServer_12 : public IDispatch -#endif -{ - virtual HRESULT __stdcall get_Locale(DWORD *locale) = 0; - virtual HRESULT __stdcall put_Locale(DWORD *locale) = 0; -#if CORECON_VER==11 - virtual HRESULT __stdcall GetDatastore(DWORD locale, ICcDatastore_11 **datastore) = 0; - virtual HRESULT __stdcall GetConnection(ICcDevice_11 *device, DWORD timeout, ICcServiceCB_11 *callback, BSTR *connectionId, ICcConnection_11 **connection) = 0; - virtual HRESULT __stdcall EnumerateConnections(DWORD sizeActual, DWORD *sizeReturned, BSTR *connections, VARIANT_BOOL *moreEntries) = 0; - virtual HRESULT __stdcall GetConnectionFromId(BSTR connectionId, ICcConnection_11 **connection) = 0; -#elif CORECON_VER==12 - virtual HRESULT __stdcall GetDatastore(DWORD locale, ICcDatastore_12 **datastore) = 0; - virtual HRESULT __stdcall GetConnection(ICcDevice_12 *device, DWORD timeout, ICcServiceCB_12 *callback, BSTR *connectionId, ICcConnection_12 **connection) = 0; - virtual HRESULT __stdcall EnumerateConnections(DWORD sizeActual, DWORD *sizeReturned, BSTR *connections, VARIANT_BOOL *moreEntries) = 0; - virtual HRESULT __stdcall GetConnectionFromId(BSTR connectionId, ICcConnection_12 **connection) = 0; -#endif -}; - -#endif diff --git a/src/shared/corecon/ccapi_11.h b/src/shared/corecon/ccapi_11.h deleted file mode 100644 index b863ad73c..000000000 --- a/src/shared/corecon/ccapi_11.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CCAPI_11_H -#define CCAPI_11_H - -#define CORECON_VER 11 -#include "ccapi.h" - -#define CLSID_ConMan CLSID_ConMan_11; -typedef ICcCollection_11 ICcCollection; -typedef ICcConnection_11 ICcConnection; -typedef ICcConnection3_11 ICcConnection3; -typedef ICcConnection4_11 ICcConnection4; -typedef ICcDatastore_11 ICcDatastore; -typedef ICcDevice_11 ICcDevice; -typedef ICcDeviceContainer_11 ICcDeviceContainer; -typedef ICcObject_11 ICcObject; -typedef ICcObjectContainer_11 ICcObjectContainer; -typedef ICcPlatform_11 ICcPlatform; -typedef ICcPlatformContainer_11 ICcPlatformContainer; -typedef ICcProperty_11 ICcProperty; -typedef ICcPropertyContainer_11 ICcPropertyContainer; -typedef ICcServer_11 ICcServer; - -#endif // CCAPI_11_H diff --git a/src/shared/corecon/ccapi_12.h b/src/shared/corecon/ccapi_12.h deleted file mode 100644 index d4f9bb853..000000000 --- a/src/shared/corecon/ccapi_12.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CCAPI_12_H -#define CCAPI_12_H - -#define CORECON_VER 12 -#include "ccapi.h" - -#define CLSID_ConMan CLSID_ConMan_12; -typedef ICcCollection_12 ICcCollection; -typedef ICcConnection_12 ICcConnection; -typedef ICcConnection3_12 ICcConnection3; -typedef ICcConnection4_12 ICcConnection4; -typedef ICcDatastore_12 ICcDatastore; -typedef ICcDevice_12 ICcDevice; -typedef ICcDeviceContainer_12 ICcDeviceContainer; -typedef ICcObject_12 ICcObject; -typedef ICcObjectContainer_12 ICcObjectContainer; -typedef ICcPlatform_12 ICcPlatform; -typedef ICcPlatformContainer_12 ICcPlatformContainer; -typedef ICcProperty_12 ICcProperty; -typedef ICcPropertyContainer_12 ICcPropertyContainer; -typedef ICcServer_12 ICcServer; - -#endif // CCAPI_12_H diff --git a/src/shared/corecon/corecon.cpp b/src/shared/corecon/corecon.cpp deleted file mode 100644 index faa0a2971..000000000 --- a/src/shared/corecon/corecon.cpp +++ /dev/null @@ -1,466 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "corecon.h" - -// Force all versions of CoreCon in scope -#ifdef CCAPI_VERSIONED_H -#undef CCAPI_VERSIONED_H -#endif -#ifdef CORECON_VER -#undef CORECON_VER -#endif -#define CORECON_VER 11 -#include "ccapi.h" - -#ifdef CCAPI_VERSIONED_H -#undef CCAPI_VERSIONED_H -#endif -#ifdef CORECON_VER -#undef CORECON_VER -#endif -#define CORECON_VER 12 -#include "ccapi.h" - -#include -#include -#include - -#include -#include -using namespace Microsoft::WRL; - -QT_USE_NAMESPACE - -Q_LOGGING_CATEGORY(lcCoreCon, "qt.corecon") - -#define wchar(str) reinterpret_cast(str.utf16()) - -template -static inline HRESULT collectionFor(const ComPtr &container, ComPtr &collection) -{ - ComPtr objectContainer; - HRESULT hr = container.As(&objectContainer); - if (FAILED(hr)) - return hr; - hr = objectContainer->EnumerateObjects(&collection); - return hr; -} - -class CoreConDevicePrivate -{ -public: - QString name; - QString id; - bool isEmulator; - int version; - -protected: - CoreConDevicePrivate(int version) : version(version) { } -}; - -template -class CoreConDevicePrivateVersioned : public CoreConDevicePrivate -{ -public: - CoreConDevicePrivateVersioned(int version) : CoreConDevicePrivate(version) { } - ComPtr handle; -}; - -CoreConDevice::CoreConDevice(int version) -{ - if (version == 11) - d_ptr.reset(new CoreConDevicePrivateVersioned(version)); - else if (version == 12) - d_ptr.reset(new CoreConDevicePrivateVersioned(version)); - else - qCCritical(lcCoreCon) << "Invalid CoreCon version specified:" << version; -} - -CoreConDevice::~CoreConDevice() -{ -} - -QString CoreConDevice::name() const -{ - Q_D(const CoreConDevice); - return d->name; -} - -QString CoreConDevice::id() const -{ - Q_D(const CoreConDevice); - return d->id; -} - -bool CoreConDevice::isEmulator() const -{ - Q_D(const CoreConDevice); - return d->isEmulator; -} - -Qt::HANDLE CoreConDevice::handle() const -{ - Q_D(const CoreConDevice); - if (d->version == 11) - return static_cast *>(d)->handle.Get(); - if (d->version == 12) - return static_cast *>(d)->handle.Get(); - return 0; -} - -class ComInitializer -{ -protected: - ComInitializer() - { - hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); - if (FAILED(hr)) - qCDebug(lcCoreCon) << "Failed to initialize COM."; - } - virtual ~ComInitializer() - { - if (SUCCEEDED(hr)) - CoUninitialize(); - } - HRESULT hr; -}; - -class CoreConServerPrivate : private ComInitializer -{ -public: - CoreConServerPrivate(int version) : version(version), langModule(0) - { - } - ~CoreConServerPrivate() - { - qDeleteAll(devices); - devices.clear(); - } - - virtual bool initialize() = 0; - - int version; - QList devices; - HMODULE langModule; - - template - static CoreConDevicePrivateVersioned *deviceHandle(CoreConDevice *device) - { - return static_cast *>(device->d_ptr.data()); - } -}; - -template -class CoreConServerPrivateVersioned : public CoreConServerPrivate -{ -public: - CoreConServerPrivateVersioned(CoreConServer *server, int version) - : CoreConServerPrivate(version) - { - HRESULT hr = E_FAIL; - if (version == 11) - hr = CoCreateInstance(CLSID_ConMan_11, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&handle)); - else if (version == 12) - hr = CoCreateInstance(CLSID_ConMan_12, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&handle)); - else - qCCritical(lcCoreCon) << "Invalid CoreCon version specified:" << version; - - if (FAILED(hr)) - qCWarning(lcCoreCon) << "Failed to initialize connection server." << server->formatError(hr); - - // The language module is available as long as the above succeeded - langModule = GetModuleHandle(L"conmanui"); - } - - bool initialize() - { - ComPtr dataStore; - HRESULT hr = handle->GetDatastore(GetUserDefaultLCID(), &dataStore); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to obtain the data store. HRESULT: 0x%x", hr); - return false; - } - - ComPtr platformContainer; - hr = dataStore->get_PlatformContainer(&platformContainer); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to obtain the platform container. HRESULT: 0x%x", hr); - return false; - } - - ComPtr platformCollection; - hr = collectionFor(platformContainer, platformCollection); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to obtain the platform collection. HRESULT: 0x%x", hr); - return false; - } - - long platformCount; - hr = platformCollection->get_Count(&platformCount); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to obtain the platform object count. HRESULT: 0x%x", hr); - return false; - } - for (long platformIndex = 0; platformIndex < platformCount; ++platformIndex) { - ComPtr platformObject; - hr = platformCollection->get_Item(platformIndex, &platformObject); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "\1: %d", platformIndex); - continue; - } - - ComPtr platform; - hr = platformObject.As(&platform); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "\1: %d", platformIndex); - continue; - } - - ComPtr deviceContainer; - hr = platform->get_DeviceContainer(&deviceContainer); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to obtain the device container.. 0x%x", hr); - continue; - } - - ComPtr deviceCollection; - hr = collectionFor(deviceContainer, deviceCollection); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to obtain the device object collection.. 0x%x", hr); - continue; - } - - long deviceCount; - hr = deviceCollection->get_Count(&deviceCount); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to obtain the device object count.. 0x%x", hr); - continue; - } - for (long deviceIndex = 0; deviceIndex < deviceCount; ++deviceIndex) { - QScopedPointer device(new CoreConDevice(version)); - - ComPtr deviceObject; - hr = deviceCollection->get_Item(deviceIndex, &deviceObject); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to obtain the device object at index: %d", deviceIndex); - continue; - } - - hr = deviceObject.As(&deviceHandle(device.data())->handle); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to confirm a device from the object at index: %d", deviceIndex); - continue; - } - - _bstr_t deviceId; - hr = deviceObject->get_ID(deviceId.GetAddress()); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to obtain device id at index: %d", deviceIndex); - continue; - } - deviceHandle(device.data())->id = QString::fromWCharArray(deviceId); - _bstr_t deviceName; - hr = deviceObject->get_Name(deviceName.GetAddress()); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to obtain device name at index: %d", deviceIndex); - continue; - } - deviceHandle(device.data())->name = QString::fromWCharArray(deviceName); - - ComPtr propertyContainer; - hr = deviceObject->get_PropertyContainer(&propertyContainer); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to obtain a property container at index: %d", deviceIndex); - continue; - } - - ComPtr propertyCollection; - hr = collectionFor(propertyContainer, propertyCollection); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to obtain property collection of device at index: %d", deviceIndex); - continue; - } - - bool isPseudoDevice = false; - long propertyCount; - hr = propertyCollection->get_Count(&propertyCount); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to obtain property count of device at index: %d", deviceIndex); - continue; - } - - for (long propertyIndex = 0; propertyIndex < propertyCount; ++propertyIndex) { - ComPtr propertyObject; - hr = propertyCollection->get_Item(propertyIndex, &propertyObject); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to obtain property at index: %d", propertyIndex); - continue; - } - - _bstr_t id; - hr = propertyObject->get_ID(id.GetAddress()); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to obtain property id at index: %d", propertyIndex); - continue; - } - - ComPtr property; - hr = propertyObject.As(&property); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to cast the property object at index: %d", propertyIndex); - continue; - } - - if (id == _bstr_t(L"IsPseudoDevice")) { - _bstr_t value; - hr = property->get_Value(value.GetAddress()); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to cast the property value at index: %d", propertyIndex); - continue; - } - if (value == _bstr_t(L"true")) { - isPseudoDevice = true; - break; // No need to look at this device further - } - } - - if (id == _bstr_t(L"Emulator")) { - _bstr_t value; - hr = property->get_Value(value.GetAddress()); - if (FAILED(hr)) { - qCDebug(lcCoreCon, "Failed to cast the property value at index: %d", propertyIndex); - continue; - } - deviceHandle(device.data())->isEmulator = value == _bstr_t(L"true"); - } - } - - if (!isPseudoDevice) - devices.append(device.take()); - } - } - return true; - } - - ComPtr handle; -}; - -typedef CoreConServerPrivateVersioned CoreConServerPrivate_11; - -typedef CoreConServerPrivateVersioned CoreConServerPrivate_12; - -CoreConServer::CoreConServer(int version) -{ - if (version == 11) - d_ptr.reset(new CoreConServerPrivate_11(this, version)); - else if (version == 12) - d_ptr.reset(new CoreConServerPrivate_12(this, version)); - else - qCCritical(lcCoreCon) << "Invalid CoreCon version specified:" << version; - - initialize(); -} - -CoreConServer::~CoreConServer() -{ -} - -Qt::HANDLE CoreConServer::handle() const -{ - Q_D(const CoreConServer); - if (d->version == 11) - return static_cast(d)->handle.Get(); - if (d->version == 12) - return static_cast(d)->handle.Get(); - return 0; -} - -QList CoreConServer::devices() const -{ - Q_D(const CoreConServer); - return d->devices; -} - -bool CoreConServer::initialize() -{ - Q_D(CoreConServer); - if (!d || !handle()) - return false; - - if (!d->devices.isEmpty()) - return true; - - return d->initialize(); -} - -QString CoreConServer::formatError(HRESULT hr) const -{ - Q_D(const CoreConServer); - wchar_t error[1024]; - HMODULE module = 0; - DWORD origin = HRESULT_FACILITY(hr); - if (origin == 0x973 || origin == 0x974 || origin == 0x103) - module = d->langModule; - if (module) { - int length = LoadString(module, HRESULT_CODE(hr), error, sizeof(error)/sizeof(wchar_t)); - if (length) - return QString::fromWCharArray(error, length).trimmed(); - } - return qt_error_string(hr); -} diff --git a/src/shared/corecon/corecon.h b/src/shared/corecon/corecon.h deleted file mode 100644 index 39d8f32a1..000000000 --- a/src/shared/corecon/corecon.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CORECON_H -#define CORECON_H - -#include -#include -#include -#include - -QT_USE_NAMESPACE - -class CoreConDevicePrivate; -class CoreConDevice -{ -public: - explicit CoreConDevice(int version); - ~CoreConDevice(); - QString name() const; - QString id() const; - bool isEmulator() const; - Qt::HANDLE handle() const; -private: - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(CoreConDevice) -friend class CoreConServerPrivate; -}; - -class CoreConServerPrivate; -class CoreConServer -{ -public: - explicit CoreConServer(int version); - ~CoreConServer(); - bool initialize(); - Qt::HANDLE handle() const; - QList devices() const; - QString formatError(HRESULT hr) const; -private: - QScopedPointer d_ptr; - Q_DECLARE_PRIVATE(CoreConServer) -}; - -Q_DECLARE_LOGGING_CATEGORY(lcCoreCon) - -#endif // CORECON_H diff --git a/src/shared/corecon/corecon.pri b/src/shared/corecon/corecon.pri deleted file mode 100644 index 7ff7c7c70..000000000 --- a/src/shared/corecon/corecon.pri +++ /dev/null @@ -1,3 +0,0 @@ -INCLUDEPATH += $$PWD -HEADERS += $$PWD/ccapi.h $$PWD/ccapi_11.h $$PWD/ccapi_12.h $$PWD/corecon.h -SOURCES += $$PWD/corecon.cpp diff --git a/src/winrtrunner/appxphoneengine.cpp b/src/winrtrunner/appxphoneengine.cpp deleted file mode 100644 index 39c3b2712..000000000 --- a/src/winrtrunner/appxphoneengine.cpp +++ /dev/null @@ -1,565 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "appxphoneengine.h" -#include "appxengine_p.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace Microsoft::WRL; -using namespace Microsoft::WRL::Wrappers; -using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::Management::Deployment; -using namespace ABI::Windows::ApplicationModel; -using namespace ABI::Windows::System; - -// From Microsoft.Phone.Tools.Deploy assembly -namespace PhoneTools { - enum DeploymentOptions - { - None = 0, - PA = 1, - Debug = 2, - Infused = 4, - Lightup = 8, - Enterprise = 16, - Sideload = 32, - TypeMask = 255, - UninstallDisabled = 256, - SkipUpdateAppInForeground = 512, - DeleteXap = 1024, - InstallOnSD = 65536, - OptOutSD = 131072 - }; - enum PackageType - { - UnknownAppx = 0, - Main = 1, - Framework = 2, - Resource = 4, - Bundle = 8, - Xap = 0 - }; -} - -QT_USE_NAMESPACE - -#include -#include -Q_GLOBAL_STATIC_WITH_ARGS(CoreConServer, coreConServer, (12)) - -#undef RETURN_IF_FAILED -#define RETURN_IF_FAILED(msg, ret) \ - if (FAILED(hr)) { \ - qCWarning(lcWinRtRunner).nospace() << msg << ": 0x" << QByteArray::number(hr, 16).constData() \ - << ' ' << coreConServer->formatError(hr); \ - ret; \ - } - -// Set a break handler for gracefully breaking long-running ops -static bool g_ctrlReceived = false; -static bool g_handleCtrl = false; -static BOOL WINAPI ctrlHandler(DWORD type) -{ - switch (type) { - case CTRL_C_EVENT: - case CTRL_CLOSE_EVENT: - case CTRL_LOGOFF_EVENT: - g_ctrlReceived = g_handleCtrl; - return g_handleCtrl; - case CTRL_BREAK_EVENT: - case CTRL_SHUTDOWN_EVENT: - default: - break; - } - return false; -} - -class AppxPhoneEnginePrivate : public AppxEnginePrivate -{ -public: - QString productId; - - ComPtr connection; - CoreConDevice *device; - QSet dependencies; -}; - -static ProcessorArchitecture toProcessorArchitecture(APPX_PACKAGE_ARCHITECTURE appxArch) -{ - switch (appxArch) { - case APPX_PACKAGE_ARCHITECTURE_X86: - return ProcessorArchitecture_X86; - case APPX_PACKAGE_ARCHITECTURE_ARM: - return ProcessorArchitecture_Arm; - case APPX_PACKAGE_ARCHITECTURE_X64: - return ProcessorArchitecture_X64; - case APPX_PACKAGE_ARCHITECTURE_NEUTRAL: - // fall-through intended - default: - return ProcessorArchitecture_Neutral; - } -} - -static bool getPhoneProductId(IStream *manifestStream, QString *productId) -{ - // Read out the phone product ID (not supported by AppxManifestReader) - ComPtr xmlReader; - HRESULT hr = CreateXmlReader(IID_PPV_ARGS(&xmlReader), NULL); - RETURN_FALSE_IF_FAILED("Failed to create XML reader"); - - hr = xmlReader->SetInput(manifestStream); - RETURN_FALSE_IF_FAILED("Failed to set manifest as input"); - - while (!xmlReader->IsEOF()) { - XmlNodeType nodeType; - hr = xmlReader->Read(&nodeType); - RETURN_FALSE_IF_FAILED("Failed to read next node in manifest"); - if (nodeType == XmlNodeType_Element) { - PCWSTR uri; - hr = xmlReader->GetNamespaceUri(&uri, NULL); - RETURN_FALSE_IF_FAILED("Failed to read namespace URI of current node"); - if (wcscmp(uri, L"http://schemas.microsoft.com/appx/2014/phone/manifest") == 0) { - PCWSTR localName; - hr = xmlReader->GetLocalName(&localName, NULL); - RETURN_FALSE_IF_FAILED("Failed to get local name of current node"); - if (wcscmp(localName, L"PhoneIdentity") == 0) { - hr = xmlReader->MoveToAttributeByName(L"PhoneProductId", NULL); - if (hr == S_FALSE) - continue; - RETURN_FALSE_IF_FAILED("Failed to seek to the PhoneProductId attribute"); - PCWSTR phoneProductId; - UINT length; - hr = xmlReader->GetValue(&phoneProductId, &length); - RETURN_FALSE_IF_FAILED("Failed to read the value of the PhoneProductId attribute"); - *productId = QLatin1Char('{') + QString::fromWCharArray(phoneProductId, length) + QLatin1Char('}'); - return true; - } - } - } - } - return false; -} - -bool AppxPhoneEngine::canHandle(Runner *runner) -{ - return getManifestFile(runner->app()); -} - -RunnerEngine *AppxPhoneEngine::create(Runner *runner) -{ - QScopedPointer engine(new AppxPhoneEngine(runner)); - if (engine->d_ptr->hasFatalError) - return 0; - - return engine.take(); -} - -QStringList AppxPhoneEngine::deviceNames() -{ - QStringList deviceNames; - - const QList devices = coreConServer->devices(); - for (const CoreConDevice *device : devices) - deviceNames.append(device->name()); - return deviceNames; -} - -AppxPhoneEngine::AppxPhoneEngine(Runner *runner) - : AppxEngine(runner, new AppxPhoneEnginePrivate) -{ - Q_D(AppxPhoneEngine); - if (d->hasFatalError) - return; - d->hasFatalError = true; - - ComPtr manifestStream; - HRESULT hr; - if (d->manifestReader) { - hr = d->manifestReader->GetStream(&manifestStream); - RETURN_VOID_IF_FAILED("Failed to query manifest stream from manifest reader."); - } else { - hr = SHCreateStreamOnFile(wchar(d->manifest), STGM_READ, &manifestStream); - RETURN_VOID_IF_FAILED("Failed to open manifest stream"); - } - - if (!getPhoneProductId(manifestStream.Get(), &d->productId)) { - qCWarning(lcWinRtRunner) << "Failed to read phone product ID from the manifest."; - return; - } - - if (!coreConServer->initialize()) { - while (!coreConServer.exists()) - Sleep(1); - } - - // Get the device - d->device = coreConServer->devices().value(d->runner->deviceIndex()); - if (!d->device || !d->device->handle()) { - d->hasFatalError = true; - qCWarning(lcWinRtRunner) << "Invalid device specified:" << d->runner->deviceIndex(); - return; - } - - - - // Set a break handler for gracefully exiting from long-running operations - SetConsoleCtrlHandler(&ctrlHandler, true); - d->hasFatalError = false; -} - -AppxPhoneEngine::~AppxPhoneEngine() -{ -} - -QString AppxPhoneEngine::extensionSdkPath() const -{ - const QByteArray extensionSdkDirRaw = qgetenv("ExtensionSdkDir"); - if (extensionSdkDirRaw.isEmpty()) { - qCWarning(lcWinRtRunner) << "The environment variable ExtensionSdkDir is not set."; - return QString(); - } - return QString::fromLocal8Bit(extensionSdkDirRaw); -} - -bool AppxPhoneEngine::installPackage(IAppxManifestReader *reader, const QString &filePath) -{ - Q_D(AppxPhoneEngine); - qCDebug(lcWinRtRunner) << __FUNCTION__ << filePath; - - ComPtr connection; - HRESULT hr = d->connection.As(&connection); - RETURN_FALSE_IF_FAILED("Failed to obtain connection object"); - - ComPtr manifestStream; - hr = reader->GetStream(&manifestStream); - RETURN_FALSE_IF_FAILED("Failed to get manifest stream from reader"); - - QString productIdString; - if (!getPhoneProductId(manifestStream.Get(), &productIdString)) { - qCWarning(lcWinRtRunner) << "Failed to get phone product ID from manifest reader."; - return false; - } - _bstr_t productId(wchar(productIdString)); - - VARIANT_BOOL isInstalled; - hr = connection->IsApplicationInstalled(productId, &isInstalled); - RETURN_FALSE_IF_FAILED("Failed to determine if package is installed"); - if (isInstalled) { - qCDebug(lcWinRtRunner) << "Package" << productIdString << "is already installed"; - return true; - } - - ComPtr properties; - hr = reader->GetProperties(&properties); - RETURN_FALSE_IF_FAILED("Failed to get manifest properties"); - - BOOL isFramework; - hr = properties->GetBoolValue(L"Framework", &isFramework); - RETURN_FALSE_IF_FAILED("Failed to determine whether package is a framework"); - - const QString deploymentFlags = QString::number(isFramework ? PhoneTools::None : PhoneTools::Sideload); - _bstr_t deploymentFlagsAsGenre(wchar(deploymentFlags)); - const QString packageType = QString::number(isFramework ? PhoneTools::Framework : PhoneTools::Main); - _bstr_t packageTypeAsIconPath(wchar(packageType)); - _bstr_t packagePath(wchar(QDir::toNativeSeparators(filePath))); - hr = connection->InstallApplication(productId, productId, deploymentFlagsAsGenre, - packageTypeAsIconPath, packagePath); - if (hr == 0x80073d06) { // No public E_* macro available - qCWarning(lcWinRtRunner) << "Found a newer version of " << filePath - << " on the target device, skipping..."; - } else { - RETURN_FALSE_IF_FAILED("Failed to install the package"); - } - - return true; -} - -bool AppxPhoneEngine::connect() -{ - Q_D(AppxPhoneEngine); - qCDebug(lcWinRtRunner) << __FUNCTION__; - - HRESULT hr; - if (!d->connection) { - _bstr_t connectionName; - hr = static_cast(coreConServer->handle())->GetConnection( - static_cast(d->device->handle()), 5000, NULL, connectionName.GetAddress(), &d->connection); - RETURN_FALSE_IF_FAILED("Failed to connect to device"); - } - - VARIANT_BOOL connected; - hr = d->connection->IsConnected(&connected); - RETURN_FALSE_IF_FAILED("Failed to determine connection state"); - if (connected) - return true; - - hr = d->connection->ConnectDevice(); - RETURN_FALSE_IF_FAILED("Failed to connect to device"); - - return true; -} - -bool AppxPhoneEngine::install(bool removeFirst) -{ - Q_D(AppxPhoneEngine); - qCDebug(lcWinRtRunner) << __FUNCTION__; - - if (!connect()) - return false; - - ComPtr connection; - HRESULT hr = d->connection.As(&connection); - RETURN_FALSE_IF_FAILED("Failed to obtain connection object"); - - _bstr_t productId(wchar(d->productId)); - VARIANT_BOOL isInstalled; - hr = connection->IsApplicationInstalled(productId, &isInstalled); - RETURN_FALSE_IF_FAILED("Failed to obtain the installation status"); - if (isInstalled) { - if (!removeFirst) - return true; - if (!remove()) - return false; - } - - if (!installDependencies()) - return false; - - const QDir base = QFileInfo(d->executable).absoluteDir(); - const bool existingPackage = d->runner->app().endsWith(QLatin1String(".appx")); - const QString packageFileName = existingPackage - ? d->runner->app() - : base.absoluteFilePath(d->packageFamilyName + QStringLiteral(".appx")); - if (!existingPackage) { - if (!createPackage(packageFileName)) - return false; - - if (!sign(packageFileName)) - return false; - } else { - qCDebug(lcWinRtRunner) << "Installing existing package."; - } - - return installPackage(d->manifestReader.Get(), packageFileName); -} - -bool AppxPhoneEngine::remove() -{ - Q_D(AppxPhoneEngine); - qCDebug(lcWinRtRunner) << __FUNCTION__; - - if (!connect()) - return false; - - if (!d->connection) - return false; - - ComPtr connection; - HRESULT hr = d->connection.As(&connection); - RETURN_FALSE_IF_FAILED("Failed to obtain connection object"); - - _bstr_t app = wchar(d->productId); - hr = connection->UninstallApplication(app); - RETURN_FALSE_IF_FAILED("Failed to uninstall the package"); - - return true; -} - -bool AppxPhoneEngine::start() -{ - Q_D(AppxPhoneEngine); - qCDebug(lcWinRtRunner) << __FUNCTION__; - - if (!connect()) - return false; - - if (!d->runner->arguments().isEmpty()) - qCWarning(lcWinRtRunner) << "Arguments are not currently supported for Windows Phone Appx packages."; - - ComPtr connection; - HRESULT hr = d->connection.As(&connection); - RETURN_FALSE_IF_FAILED("Failed to cast connection object"); - - _bstr_t productId(wchar(d->productId)); - DWORD pid; - hr = connection->LaunchApplication(productId, &pid); - RETURN_FALSE_IF_FAILED("Failed to start the package"); - - d->pid = pid; - return true; -} - -bool AppxPhoneEngine::enableDebugging(const QString &debuggerExecutable, const QString &debuggerArguments) -{ - qCDebug(lcWinRtRunner) << __FUNCTION__; - Q_UNUSED(debuggerExecutable); - Q_UNUSED(debuggerArguments); - return false; -} - -bool AppxPhoneEngine::disableDebugging() -{ - qCDebug(lcWinRtRunner) << __FUNCTION__; - return false; -} - -bool AppxPhoneEngine::setLoopbackExemptClientEnabled(bool) -{ - qCDebug(lcWinRtRunner) << __FUNCTION__; - return false; -} - -bool AppxPhoneEngine::setLoopbackExemptServerEnabled(bool) -{ - qCDebug(lcWinRtRunner) << __FUNCTION__; - return false; -} - -bool AppxPhoneEngine::setLoggingRules(const QByteArray &) -{ - qCDebug(lcWinRtRunner) << __FUNCTION__; - return false; -} - -bool AppxPhoneEngine::suspend() -{ - qCDebug(lcWinRtRunner) << __FUNCTION__; - return false; -} - -bool AppxPhoneEngine::waitForFinished(int secs) -{ - Q_D(AppxPhoneEngine); - qCDebug(lcWinRtRunner) << __FUNCTION__; - - ComPtr connection; - HRESULT hr = d->connection.As(&connection); - RETURN_FALSE_IF_FAILED("Failed to cast connection"); - - g_handleCtrl = true; - int time = 0; - forever { - ++time; - if ((secs && time > secs) || g_ctrlReceived) { - g_handleCtrl = false; - return false; - } - - Sleep(1000); // Wait one second between checks - qCDebug(lcWinRtRunner) << "Waiting for app to quit - msecs to go: " << secs - time; - } - g_handleCtrl = false; - return true; -} - -bool AppxPhoneEngine::stop() -{ - qCDebug(lcWinRtRunner) << __FUNCTION__; - - if (!connect()) - return false; - -#if 0 // This does not actually stop the app - QTBUG-41946 - Q_D(AppxPhoneEngine); - ComPtr connection; - HRESULT hr = d->connection.As(&connection); - RETURN_FALSE_IF_FAILED("Failed to cast connection object"); - - _bstr_t productId(wchar(d->productId)); - hr = connection->TerminateRunningApplicationInstances(productId); - RETURN_FALSE_IF_FAILED("Failed to stop the package"); - - return true; -#else - return remove(); -#endif -} - -QString AppxPhoneEngine::devicePath(const QString &relativePath) const -{ - Q_D(const AppxPhoneEngine); - qCDebug(lcWinRtRunner) << __FUNCTION__; - - return QStringLiteral("%FOLDERID_APPID_ISOROOT%\\") + d->productId - + QStringLiteral("\\%LOCL%\\") + relativePath; -} - -bool AppxPhoneEngine::sendFile(const QString &localFile, const QString &deviceFile) -{ - Q_D(const AppxPhoneEngine); - qCDebug(lcWinRtRunner) << __FUNCTION__; - - HRESULT hr = d->connection->SendFile(_bstr_t(wchar(localFile)), _bstr_t(wchar(deviceFile)), - CREATE_ALWAYS, NULL); - RETURN_FALSE_IF_FAILED("Failed to send the file"); - - return true; -} - -bool AppxPhoneEngine::receiveFile(const QString &deviceFile, const QString &localFile) -{ - Q_D(const AppxPhoneEngine); - qCDebug(lcWinRtRunner) << __FUNCTION__; - - HRESULT hr = d->connection->ReceiveFile(_bstr_t(wchar(deviceFile)), - _bstr_t(wchar(localFile)), uint(2)); - RETURN_FALSE_IF_FAILED("Failed to receive the file"); - - return true; -} diff --git a/src/winrtrunner/appxphoneengine.h b/src/winrtrunner/appxphoneengine.h deleted file mode 100644 index b462e797f..000000000 --- a/src/winrtrunner/appxphoneengine.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef APPXPHONEENGINE_H -#define APPXPHONEENGINE_H - -#include "appxengine.h" -#include "runnerengine.h" -#include "runner.h" - -#include - -QT_USE_NAMESPACE - -class AppxPhoneEnginePrivate; -class AppxPhoneEngine : public AppxEngine -{ -public: - static bool canHandle(Runner *runner); - static RunnerEngine *create(Runner *runner); - static QStringList deviceNames(); - - bool install(bool removeFirst = false) override; - bool remove() override; - bool start() override; - bool enableDebugging(const QString &debuggerExecutable, - const QString &debuggerArguments) override; - bool disableDebugging() override; - bool setLoopbackExemptClientEnabled(bool enabled) override; - bool setLoopbackExemptServerEnabled(bool enabled) override; - bool setLoggingRules(const QByteArray &rules) override; - bool suspend() override; - bool waitForFinished(int secs) override; - bool stop() override; - - QString devicePath(const QString &relativePath) const override; - bool sendFile(const QString &localFile, const QString &deviceFile) override; - bool receiveFile(const QString &deviceFile, const QString &localFile) override; - -private: - explicit AppxPhoneEngine(Runner *runner); - ~AppxPhoneEngine(); - - QString extensionSdkPath() const; - bool installPackage(IAppxManifestReader *reader, const QString &filePath) override; - - bool connect(); - - friend struct QScopedPointerDeleter; - Q_DECLARE_PRIVATE(AppxPhoneEngine) -}; - -#endif // APPXPHONEENGINE_H diff --git a/src/winrtrunner/runner.cpp b/src/winrtrunner/runner.cpp index e816d9baa..ab5176934 100644 --- a/src/winrtrunner/runner.cpp +++ b/src/winrtrunner/runner.cpp @@ -41,9 +41,6 @@ #include "runnerengine.h" -#ifndef RTRUNNER_NO_APPXPHONE -#include "appxphoneengine.h" -#endif #ifndef RTRUNNER_NO_APPXLOCAL #include "appxlocalengine.h" #endif @@ -93,9 +90,6 @@ QMap Runner::deviceNames() QMap deviceNames; #ifndef RTRUNNER_NO_APPXLOCAL deviceNames.insert(QStringLiteral("Appx"), AppxLocalEngine::deviceNames()); -#endif -#ifndef RTRUNNER_NO_APPXPHONE - deviceNames.insert(QStringLiteral("Phone"), AppxPhoneEngine::deviceNames()); #endif return deviceNames; } @@ -127,22 +121,6 @@ Runner::Runner(const QString &app, const QStringList &arguments, return; } } -#endif -#ifndef RTRUNNER_NO_APPXPHONE - if (!deviceIndexKnown) { - d->deviceIndex = AppxPhoneEngine::deviceNames().indexOf(deviceName); - if (d->deviceIndex < 0) - d->deviceIndex = 0; - } - if ((d->profile.isEmpty() || d->profile.toLower() == QStringLiteral("appxphone")) - && AppxPhoneEngine::canHandle(this)) { - if (RunnerEngine *engine = AppxPhoneEngine::create(this)) { - d->engine.reset(engine); - d->isValid = true; - qCWarning(lcWinRtRunner) << "Using the AppxPhone profile."; - return; - } - } #endif // Place other engines here diff --git a/src/winrtrunner/winrtrunner.pro b/src/winrtrunner/winrtrunner.pro index a797bd023..02b1381af 100644 --- a/src/winrtrunner/winrtrunner.pro +++ b/src/winrtrunner/winrtrunner.pro @@ -11,20 +11,17 @@ SOURCES += \ main.cpp \ runner.cpp \ appxengine.cpp \ - appxlocalengine.cpp \ - appxphoneengine.cpp + appxlocalengine.cpp HEADERS += \ runner.h \ runnerengine.h \ appxengine.h \ appxengine_p.h \ - appxlocalengine.h \ - appxphoneengine.h + appxlocalengine.h LIBS += -lruntimeobject -lwsclient -lShlwapi -lurlmon -lxmllite -lcrypt32 -include(../shared/corecon/corecon.pri) include(../shared/winutils/winutils.pri) QMAKE_TARGET_DESCRIPTION = "Qt WinRT Runner" -- cgit v1.2.3