From: Andrew Knight Date: Tue, 11 Mar 2014 06:39:25 +0000 (+0200) Subject: qtd3dservice: Remove registry options X-Git-Tag: upstream/5.2.90+alpha~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eeb0ad35adb184ff17669a4be120d682b7d08045;p=platform%2Fupstream%2Fqttools.git qtd3dservice: Remove registry options As the service is automatic now, remove these options before the utility is released these become "API". Change-Id: I710990d85d9efe3be06ab07b9c73547975c3f78d Reviewed-by: Oliver Wolff --- diff --git a/src/qtd3dservice/d3dservice.cpp b/src/qtd3dservice/d3dservice.cpp index 962cc4d..1054bc6 100644 --- a/src/qtd3dservice/d3dservice.cpp +++ b/src/qtd3dservice/d3dservice.cpp @@ -445,14 +445,6 @@ void __stdcall run(DWORD argc, LPWSTR argv[]) // Device monitoring threads - one per device QVector deviceWorkers(emulatorNames.size() + 1, NULL); - // Static list of registrations - foreach (const QStringPair ®istration, D3DService::registrations()) { - Worker *worker = new Worker(registration, &appWorker); - workers.insert(registration, worker); - workerThreads.insert(worker->thread(), registration); - waitHandles.append(worker->thread()); - } - // If a Windows Phone is already connected, queue a device worker HDEVINFO info = SetupDiGetClassDevs(&GUID_DEVICE_WINPHONE8_USB, NULL, NULL, DIGCF_DEVICEINTERFACE|DIGCF_PRESENT); diff --git a/src/qtd3dservice/d3dservice.h b/src/qtd3dservice/d3dservice.h index 15e8646..e5378c5 100644 --- a/src/qtd3dservice/d3dservice.h +++ b/src/qtd3dservice/d3dservice.h @@ -57,11 +57,6 @@ namespace D3DService bool install(); bool remove(); - bool registerApp(const QString &device, const QString &app); - bool unregisterApp(const QString &device, const QString &app); - QList registrations(); - bool clearRegistrations(); - bool startService(bool replaceMessageHandler = true); bool startDirectly(); diff --git a/src/qtd3dservice/main.cpp b/src/qtd3dservice/main.cpp index aac8c56..3592ccf 100644 --- a/src/qtd3dservice/main.cpp +++ b/src/qtd3dservice/main.cpp @@ -70,24 +70,6 @@ int main(int argc, char *argv[]) QStringLiteral("remove"), QStringLiteral("Uninstall the Qt D3D shader compilation service.")); parser.addOption(removeOption); - QCommandLineOption registerOption( - QStringLiteral("register"), - QStringLiteral("Register an application for monitoring."), - QStringLiteral("[device_id:]application_id")); - parser.addOption(registerOption); - QCommandLineOption unregisterOption( - QStringLiteral("unregister"), - QStringLiteral("Unregister an application for monitoring."), - QStringLiteral("[device_id:]application_id")); - parser.addOption(unregisterOption); - QCommandLineOption listOption( - QStringLiteral("list"), - QStringLiteral("List the registered applications.")); - parser.addOption(listOption); - QCommandLineOption clearOption( - QStringLiteral("clear"), - QStringLiteral("Removes all registered applications.")); - parser.addOption(clearOption); QCommandLineOption directOption( QStringLiteral("direct"), QStringLiteral("Run directly (not as a Windows service).")); @@ -146,13 +128,9 @@ int main(int argc, char *argv[]) const bool installSet = parser.isSet(installOption); const bool removeSet = parser.isSet(removeOption); - const bool registerSet = parser.isSet(registerOption); - const bool unregisterSet = parser.isSet(unregisterOption); - const bool listSet = parser.isSet(listOption); - const bool clearSet = parser.isSet(clearOption); const bool directSet = parser.isSet(directOption); // All options are mutually exclusive - if (installSet + removeSet + registerSet + unregisterSet + listSet + clearSet + directSet > 1) + if (installSet + removeSet + directSet > 1) parser.showHelp(1); if (installSet) @@ -161,47 +139,6 @@ int main(int argc, char *argv[]) if (removeSet) return D3DService::remove() ? 0 : 1; - if (clearSet) - return D3DService::clearRegistrations() ? 0 : 1; - - if (listSet) { - std::wcout << "Registered applications:" << std::endl; - QList registrations = D3DService::registrations(); - foreach (const QStringPair ®istration, registrations) { - std::wcout << " " << reinterpret_cast(registration.first.utf16()) - << " " << reinterpret_cast(registration.second.utf16()) << std::endl; - } - return 0; - } - - if (registerSet || unregisterSet) { - QStringList parts = parser.value(registerSet ? registerOption : unregisterOption).split(QLatin1Char(':')); - if (parts.size() == 1) - parts.prepend(QStringLiteral("local")); - if (parts.size() != 2) - parser.showHelp(1); - - // Validation? - - if (registerSet) { - if (D3DService::registerApp(parts.at(0), parts.at(1))) { - qCWarning(lcD3DService) << "Registered application."; - return 0; - } - qCWarning(lcD3DService) << "Unable to register application."; - return 1; - } - - if (unregisterSet) { - if (D3DService::unregisterApp(parts.at(0), parts.at(1))) { - qCWarning(lcD3DService) << "Unregistered application."; - return 0; - } - qCWarning(lcD3DService) << "Unable to unregister application."; - return 1; - } - } - if (directSet) { if (D3DService::startDirectly()) return 0; diff --git a/src/qtd3dservice/qtd3dservice.pro b/src/qtd3dservice/qtd3dservice.pro index 6923ad0..ab2c9ad 100644 --- a/src/qtd3dservice/qtd3dservice.pro +++ b/src/qtd3dservice/qtd3dservice.pro @@ -15,7 +15,6 @@ SOURCES = \ main.cpp \ xaphandler.cpp \ compilation.cpp \ - registry.cpp \ credentials.cpp HEADERS = \ diff --git a/src/qtd3dservice/registry.cpp b/src/qtd3dservice/registry.cpp deleted file mode 100644 index 05b1893..0000000 --- a/src/qtd3dservice/registry.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "d3dservice.h" - -static HKEY openBase() -{ - HKEY regKey; - LONG result = RegCreateKeyEx(HKEY_CURRENT_USER_LOCAL_SETTINGS, L"qtd3dservice", - 0, NULL, 0, KEY_ALL_ACCESS, NULL, ®Key, NULL); - if (result != ERROR_SUCCESS) { - qCCritical(lcD3DService) << "Unable to open registry:" << qt_error_string(result); - return 0; - } - return regKey; -} - -bool D3DService::registerApp(const QString &device, const QString &app) -{ - HKEY baseKey = openBase(); - if (!baseKey) - return false; - - HKEY deviceKey; - LONG result = RegCreateKeyEx(baseKey, reinterpret_cast(device.utf16()), - 0, NULL, 0, KEY_ALL_ACCESS, NULL, &deviceKey, NULL); - if (result != ERROR_SUCCESS) - return false; - - HKEY appKey; - result = RegCreateKeyEx(deviceKey, reinterpret_cast(app.utf16()), - 0, NULL, 0, KEY_ALL_ACCESS, NULL, &appKey, NULL); - return result == ERROR_SUCCESS; -} - -bool D3DService::unregisterApp(const QString &device, const QString &app) -{ - HKEY baseKey = openBase(); - if (!baseKey) - return false; - - HKEY deviceKey; - LONG result = RegCreateKeyEx(baseKey, reinterpret_cast(device.utf16()), - 0, NULL, 0, KEY_ALL_ACCESS, NULL, &deviceKey, NULL); - if (result != ERROR_SUCCESS) - return false; - - result = RegDeleteKey(deviceKey, reinterpret_cast(app.utf16())); - return true; -} - -QList D3DService::registrations() -{ - QList registrations; - - HKEY baseKey = openBase(); - if (!baseKey) - return registrations; - - int index = 0; - forever { - wchar_t device[256]; - wchar_t app[256]; - DWORD size = 256; - LONG result = RegEnumKeyEx(baseKey, index++, device, &size, NULL, NULL, NULL, NULL); - if (result != ERROR_SUCCESS) - break; - HKEY subKey; - result = RegOpenKeyEx(baseKey, device, 0, KEY_READ, &subKey); - if (result != ERROR_SUCCESS) - continue; - int subIndex = 0; - forever { - size = 256; - result = RegEnumKeyEx(subKey, subIndex++, app, &size, NULL, NULL, NULL, NULL); - if (result != ERROR_SUCCESS) - break; - registrations.append(qMakePair(QString::fromWCharArray(device), - QString::fromWCharArray(app))); - } - } - - return registrations; -} - -bool D3DService::clearRegistrations() -{ - LONG result = RegDeleteTree(HKEY_CURRENT_USER_LOCAL_SETTINGS, L"qtd3dservice"); - return result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND; -}