diff options
author | Andrew Knight <andrew.knight@digia.com> | 2014-03-11 08:39:25 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-13 15:38:26 +0100 |
commit | eeb0ad35adb184ff17669a4be120d682b7d08045 (patch) | |
tree | 6e4b1a358fdda397bf018c5155dbb94d89656c03 | |
parent | 0e1837757dbc26dcf7a9f911e693a4a5cffa8b69 (diff) | |
download | qttools-eeb0ad35adb184ff17669a4be120d682b7d08045.tar.gz |
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 <oliver.wolff@digia.com>
-rw-r--r-- | src/qtd3dservice/d3dservice.cpp | 8 | ||||
-rw-r--r-- | src/qtd3dservice/d3dservice.h | 5 | ||||
-rw-r--r-- | src/qtd3dservice/main.cpp | 65 | ||||
-rw-r--r-- | src/qtd3dservice/qtd3dservice.pro | 1 | ||||
-rw-r--r-- | src/qtd3dservice/registry.cpp | 128 |
5 files changed, 1 insertions, 206 deletions
diff --git a/src/qtd3dservice/d3dservice.cpp b/src/qtd3dservice/d3dservice.cpp index 962cc4d6c..1054bc631 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<Worker *> 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 15e8646d9..e5378c53c 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<QStringPair> registrations(); - bool clearRegistrations(); - bool startService(bool replaceMessageHandler = true); bool startDirectly(); diff --git a/src/qtd3dservice/main.cpp b/src/qtd3dservice/main.cpp index aac8c56d2..3592ccfc3 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<QStringPair> registrations = D3DService::registrations(); - foreach (const QStringPair ®istration, registrations) { - std::wcout << " " << reinterpret_cast<const wchar_t *>(registration.first.utf16()) - << " " << reinterpret_cast<const wchar_t *>(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 6923ad037..ab2c9ad90 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 05b189301..000000000 --- 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<LPCWSTR>(device.utf16()), - 0, NULL, 0, KEY_ALL_ACCESS, NULL, &deviceKey, NULL); - if (result != ERROR_SUCCESS) - return false; - - HKEY appKey; - result = RegCreateKeyEx(deviceKey, reinterpret_cast<LPCWSTR>(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<LPCWSTR>(device.utf16()), - 0, NULL, 0, KEY_ALL_ACCESS, NULL, &deviceKey, NULL); - if (result != ERROR_SUCCESS) - return false; - - result = RegDeleteKey(deviceKey, reinterpret_cast<LPCWSTR>(app.utf16())); - return true; -} - -QList<QStringPair> D3DService::registrations() -{ - QList<QStringPair> 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; -} |