Throw away the WPD lister and add a WMDM lister
This commit is contained in:
parent
ec22230f3c
commit
164d4f6f6f
|
@ -47,9 +47,8 @@ pkg_check_modules(LIBMTP libmtp)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
find_library(PORTABLEDEVICEAPI_LIBRARIES PortableDeviceApi)
|
find_library(MSWMDM_LIBRARIES MSWMDM)
|
||||||
find_library(PORTABLEDEVICEGUIDS_LIBRARIES PortableDeviceGuids)
|
find_library(SAC_SHIM_LIBRARIES sac_shim)
|
||||||
find_library(PORTABLEDEVICETYPES_LIBRARIES PortableDeviceTypes)
|
|
||||||
endif (WIN32)
|
endif (WIN32)
|
||||||
|
|
||||||
find_library(LASTFM_LIBRARIES lastfm)
|
find_library(LASTFM_LIBRARIES lastfm)
|
||||||
|
|
|
@ -534,10 +534,10 @@ if(LIBMTP_FOUND)
|
||||||
list(APPEND HEADERS devices/mtploader.h)
|
list(APPEND HEADERS devices/mtploader.h)
|
||||||
endif(LIBMTP_FOUND)
|
endif(LIBMTP_FOUND)
|
||||||
|
|
||||||
# Windows portable device lister
|
# Windows media lister
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
list(APPEND SOURCES devices/wpdlister.cpp)
|
list(APPEND SOURCES devices/wmdmlister.cpp)
|
||||||
list(APPEND HEADERS devices/wpdlister.h)
|
list(APPEND HEADERS devices/wmdmlister.h)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
# Mac specific startup stuff
|
# Mac specific startup stuff
|
||||||
|
@ -573,8 +573,8 @@ list(APPEND OTHER_SOURCES
|
||||||
devices/mtpdevice.h
|
devices/mtpdevice.h
|
||||||
devices/mtploader.cpp
|
devices/mtploader.cpp
|
||||||
devices/mtploader.h
|
devices/mtploader.h
|
||||||
devices/wpdlister.cpp
|
devices/wmdmlister.cpp
|
||||||
devices/wpdlister.h
|
devices/wmdmlister.h
|
||||||
ui/macsystemtrayicon.h
|
ui/macsystemtrayicon.h
|
||||||
ui/macsystemtrayicon.mm
|
ui/macsystemtrayicon.mm
|
||||||
widgets/osd_mac.mm
|
widgets/osd_mac.mm
|
||||||
|
@ -672,10 +672,11 @@ if(HAVE_STATIC_SQLITE)
|
||||||
endif(HAVE_STATIC_SQLITE)
|
endif(HAVE_STATIC_SQLITE)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(clementine_lib ${ZLIB_LIBRARIES})
|
target_link_libraries(clementine_lib
|
||||||
target_link_libraries(clementine_lib ${PORTABLEDEVICEAPI_LIBRARIES})
|
${ZLIB_LIBRARIES}
|
||||||
target_link_libraries(clementine_lib ${PORTABLEDEVICEGUIDS_LIBRARIES})
|
${MSWMDM_LIBRARIES}
|
||||||
target_link_libraries(clementine_lib ${PORTABLEDEVICETYPES_LIBRARIES})
|
${SAC_SHIM_LIBRARIES}
|
||||||
|
)
|
||||||
endif (WIN32)
|
endif (WIN32)
|
||||||
|
|
||||||
add_dependencies(clementine_lib qtsingleapplication)
|
add_dependencies(clementine_lib qtsingleapplication)
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
# include "macdevicelister.h"
|
# include "macdevicelister.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
# include "wpdlister.h"
|
# include "wmdmlister.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LIBGPOD
|
#ifdef HAVE_LIBGPOD
|
||||||
# include "gpoddevice.h"
|
# include "gpoddevice.h"
|
||||||
|
@ -170,7 +170,7 @@ DeviceManager::DeviceManager(BackgroundThread<Database>* database,
|
||||||
AddLister(new MacDeviceLister);
|
AddLister(new MacDeviceLister);
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
AddLister(new WpdLister);
|
AddLister(new WmdmLister);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_IMOBILEDEVICE
|
#ifdef HAVE_IMOBILEDEVICE
|
||||||
AddLister(new iLister);
|
AddLister(new iLister);
|
||||||
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
/* This file is part of Clementine.
|
||||||
|
|
||||||
|
Clementine is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Clementine is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "wmdmlister.h"
|
||||||
|
|
||||||
|
#include <icomponentauthenticate.h>
|
||||||
|
#include <objbase.h>
|
||||||
|
#include <sac_shim.h>
|
||||||
|
#include <mswmdm.h>
|
||||||
|
#include <mswmdm_i.c>
|
||||||
|
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QtDebug>
|
||||||
|
|
||||||
|
BYTE abPVK[] = {0x00};
|
||||||
|
BYTE abCert[] = {0x00};
|
||||||
|
|
||||||
|
WmdmLister::WmdmLister()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void WmdmLister::Init() {
|
||||||
|
qDebug() << "Creating IPortableDeviceManager";
|
||||||
|
|
||||||
|
qDebug() << "CoInitialize says" << CoInitialize(0);
|
||||||
|
|
||||||
|
IComponentAuthenticate* auth;
|
||||||
|
HRESULT result = CoCreateInstance(
|
||||||
|
CLSID_MediaDevMgr, NULL, CLSCTX_ALL, IID_IComponentAuthenticate, (void **)&auth);
|
||||||
|
qDebug() << "Auth" << result << auth;
|
||||||
|
|
||||||
|
SacHandle sac = CSecureChannelClient_New();
|
||||||
|
qDebug() << "SAC is" << sac;
|
||||||
|
|
||||||
|
result = CSecureChannelClient_SetCertificate(sac,
|
||||||
|
SAC_CERT_V1,
|
||||||
|
abCert, sizeof(abCert),
|
||||||
|
abPVK, sizeof(abPVK));
|
||||||
|
qDebug() << "SetCertificate" << result << abCert << sizeof(abCert);
|
||||||
|
|
||||||
|
CSecureChannelClient_SetInterface(sac, auth);
|
||||||
|
|
||||||
|
DWORD* prot;
|
||||||
|
DWORD prot_count;
|
||||||
|
result = auth->SACGetProtocols(&prot, &prot_count);
|
||||||
|
qDebug() << "SACGetProtocols" << result << prot_count;
|
||||||
|
qDebug() << "Prot is" << prot;
|
||||||
|
qDebug() << "Prot is" << prot[0];
|
||||||
|
|
||||||
|
result = CSecureChannelClient_Authenticate(sac, prot[0]);
|
||||||
|
qDebug() << "Authenticate" << result;
|
||||||
|
|
||||||
|
CoTaskMemFree(prot);
|
||||||
|
|
||||||
|
IWMDeviceManager* device_manager;
|
||||||
|
result = auth->QueryInterface(IID_IWMDeviceManager, (void**)device_manager);
|
||||||
|
qDebug() << "Manager" << result << device_manager;
|
||||||
|
|
||||||
|
CoUninitialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList WmdmLister::DeviceUniqueIDs() {
|
||||||
|
return QStringList();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList WmdmLister::DeviceIcons(const QString& id) {
|
||||||
|
return QStringList();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString WmdmLister::DeviceManufacturer(const QString& id) {
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString WmdmLister::DeviceModel(const QString& id) {
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
quint64 WmdmLister::DeviceCapacity(const QString& id) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
quint64 WmdmLister::DeviceFreeSpace(const QString& id) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap WmdmLister::DeviceHardwareInfo(const QString& id) {
|
||||||
|
return QVariantMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString WmdmLister::MakeFriendlyName(const QString& id) {
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QUrl> WmdmLister::MakeDeviceUrls(const QString& id) {
|
||||||
|
return QList<QUrl>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WmdmLister::UnmountDevice(const QString& id) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void WmdmLister::UpdateDeviceFreeSpace(const QString& id) {
|
||||||
|
}
|
|
@ -14,16 +14,19 @@
|
||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef WPDLISTER_H
|
#ifndef WMDMLISTER_H
|
||||||
#define WPDLISTER_H
|
#define WMDMLISTER_H
|
||||||
|
|
||||||
#include "devicelister.h"
|
#include "devicelister.h"
|
||||||
|
|
||||||
class WpdLister : public DeviceLister {
|
class WmdmLister : public DeviceLister {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WpdLister();
|
WmdmLister();
|
||||||
|
|
||||||
|
static uchar* kDRMCert;
|
||||||
|
static uchar* kDRMPrivateKey;
|
||||||
|
|
||||||
virtual void Init();
|
virtual void Init();
|
||||||
|
|
||||||
|
@ -40,7 +43,6 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void UpdateDeviceFreeSpace(const QString& id);
|
virtual void UpdateDeviceFreeSpace(const QString& id);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WPDLISTER_H
|
#endif // WMDMLISTER_H
|
|
@ -1,93 +0,0 @@
|
||||||
/* This file is part of Clementine.
|
|
||||||
|
|
||||||
Clementine is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
Clementine is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "wpdlister.h"
|
|
||||||
|
|
||||||
// Vista, for the property system
|
|
||||||
#define WINVER 0x0501
|
|
||||||
|
|
||||||
#include <objbase.h>
|
|
||||||
|
|
||||||
// I have no idea where these are meant to be defined...
|
|
||||||
typedef struct _tagpropertykey {
|
|
||||||
GUID fmtid;
|
|
||||||
DWORD pid;
|
|
||||||
} PROPERTYKEY;
|
|
||||||
typedef const PROPERTYKEY& REFPROPERTYKEY;
|
|
||||||
|
|
||||||
#include <PortableDeviceApi.h>
|
|
||||||
|
|
||||||
#include <QStringList>
|
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
WpdLister::WpdLister() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void WpdLister::Init() {
|
|
||||||
qDebug() << "Creating IPortableDeviceManager";
|
|
||||||
|
|
||||||
qDebug() << "CoInitialize says" << CoInitialize(0);
|
|
||||||
|
|
||||||
IPortableDeviceManager* manager = NULL;
|
|
||||||
HRESULT ret = CoCreateInstance(
|
|
||||||
CLSID_PortableDeviceManager, NULL, CLSCTX_INPROC_SERVER,
|
|
||||||
IID_IPortableDeviceManager, (void**)&manager);
|
|
||||||
qDebug() << "Created" << ret << manager;
|
|
||||||
|
|
||||||
CoUninitialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList WpdLister::DeviceUniqueIDs() {
|
|
||||||
return QStringList();
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList WpdLister::DeviceIcons(const QString& id) {
|
|
||||||
return QStringList();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString WpdLister::DeviceManufacturer(const QString& id) {
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString WpdLister::DeviceModel(const QString& id) {
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
quint64 WpdLister::DeviceCapacity(const QString& id) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
quint64 WpdLister::DeviceFreeSpace(const QString& id) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap WpdLister::DeviceHardwareInfo(const QString& id) {
|
|
||||||
return QVariantMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString WpdLister::MakeFriendlyName(const QString& id) {
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QUrl> WpdLister::MakeDeviceUrls(const QString& id) {
|
|
||||||
return QList<QUrl>();
|
|
||||||
}
|
|
||||||
|
|
||||||
void WpdLister::UnmountDevice(const QString& id) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void WpdLister::UpdateDeviceFreeSpace(const QString& id) {
|
|
||||||
}
|
|
Loading…
Reference in New Issue