diff options
author | Martijn Kaijser <martijn@xbmc.org> | 2016-02-06 17:06:57 +0100 |
---|---|---|
committer | Martijn Kaijser <martijn@xbmc.org> | 2016-02-06 17:06:57 +0100 |
commit | 128848b9a77ad694e1493d05efcc9475e7d0d75e (patch) | |
tree | 9a9e8a27c2e95512e099382e11e1914cd68f7445 | |
parent | a042c48a52860c9a20ce8356b50463544ed9e6b7 (diff) | |
parent | c1ed5e50c15f09834e80663c32a96765b3336437 (diff) |
Merge pull request #9064 from fetzerch/cleanup
[cleanup] Remove unused files
-rw-r--r-- | Kodi.xcodeproj/project.pbxproj | 2 | ||||
-rw-r--r-- | xbmc/utils/WindowsShortcut.cpp | 164 | ||||
-rw-r--r-- | xbmc/utils/WindowsShortcut.h | 43 | ||||
-rw-r--r-- | xbmc/win32/WMIInterface.cpp | 238 | ||||
-rw-r--r-- | xbmc/win32/WMIInterface.h | 54 |
5 files changed, 0 insertions, 501 deletions
diff --git a/Kodi.xcodeproj/project.pbxproj b/Kodi.xcodeproj/project.pbxproj index 8d92d3bb8f..e2eb5051ab 100644 --- a/Kodi.xcodeproj/project.pbxproj +++ b/Kodi.xcodeproj/project.pbxproj @@ -4517,7 +4517,6 @@ E38E1E8C0D25F9FD00618676 /* UdpClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UdpClient.h; sourceTree = "<group>"; }; E38E1E8D0D25F9FD00618676 /* Weather.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Weather.cpp; sourceTree = "<group>"; }; E38E1E8E0D25F9FD00618676 /* Weather.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Weather.h; sourceTree = "<group>"; }; - E38E1E920D25F9FD00618676 /* WindowsShortcut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowsShortcut.h; sourceTree = "<group>"; }; E38E1E930D25F9FD00618676 /* VideoDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VideoDatabase.cpp; sourceTree = "<group>"; }; E38E1E940D25F9FD00618676 /* VideoDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoDatabase.h; sourceTree = "<group>"; }; E38E1E950D25F9FD00618676 /* VideoInfoScanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VideoInfoScanner.cpp; sourceTree = "<group>"; }; @@ -8476,7 +8475,6 @@ 7CF1FB0A123B1AF000B2CBCB /* Variant.h */, E38E1E8D0D25F9FD00618676 /* Weather.cpp */, E38E1E8E0D25F9FD00618676 /* Weather.h */, - E38E1E920D25F9FD00618676 /* WindowsShortcut.h */, F5ED908615538DCE00842059 /* XBMCTinyXML.cpp */, F5ED908715538DCE00842059 /* XBMCTinyXML.h */, 18B7C9811294385F009E7A26 /* XMLUtils.cpp */, diff --git a/xbmc/utils/WindowsShortcut.cpp b/xbmc/utils/WindowsShortcut.cpp deleted file mode 100644 index d2d21e3785..0000000000 --- a/xbmc/utils/WindowsShortcut.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program 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 2, or (at your option) - * any later version. - * - * This Program 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 XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// WindowsShortcut.cpp: implementation of the CWindowsShortcut class. -// -////////////////////////////////////////////////////////////////////// - -#include "sc.h" -#include "WindowsShortcut.h" - -#ifdef _DEBUG -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#define new DEBUG_NEW -#endif - - -#define FLAG_SHELLITEMIDLIST 1 -#define FLAG_FILEORDIRECTORY 2 -#define FLAG_DESCRIPTION 4 -#define FLAG_RELATIVEPATH 8 -#define FLAG_WORKINGDIRECTORY 0x10 -#define FLAG_ARGUMENTS 0x20 -#define FLAG_ICON 0x40 - -#define VOLUME_LOCAL 1 -#define VOLUME_NETWORK 2 - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CWindowsShortcut::CWindowsShortcut() -{ -} - -CWindowsShortcut::~CWindowsShortcut() -{ -} - -bool CWindowsShortcut::GetShortcut(const std::string& strFileName, std::string& strFileOrDir) -{ - strFileOrDir = ""; - if (!IsShortcut(strFileName) ) return false; - - - CFile file; - if (!file.Open(strFileName.c_str(), CFile::typeBinary | CFile::modeRead)) return false; - byte byHeader[2048]; - int iBytesRead = file.Read(byHeader, 2048); - file.Close(); - - DWORD dwFlags = *((DWORD*)(&byHeader[0x14])); - - int iPos = 0x4c; - if (dwFlags & FLAG_SHELLITEMIDLIST) - { - WORD sLength = *((WORD*)(&byHeader[iPos])); - iPos += sLength; - iPos += 2; - } - - // skip File Location Info - DWORD dwLen = 0x1c; - if (dwFlags & FLAG_SHELLITEMIDLIST) - { - dwLen = *((DWORD*)(&byHeader[iPos])); - } - - - DWORD dwVolumeFlags = *((DWORD*)(&byHeader[iPos + 0x8])); - DWORD dwOffsetLocalVolumeInfo = *((DWORD*)(&byHeader[iPos + 0xc])); - DWORD dwOffsetBasePathName = *((DWORD*)(&byHeader[iPos + 0x10])); - DWORD dwOffsetNetworkVolumeInfo = *((DWORD*)(&byHeader[iPos + 0x14])); - DWORD dwOffsetRemainingPathName = *((DWORD*)(&byHeader[iPos + 0x18])); - - - if ((dwVolumeFlags & VOLUME_NETWORK) == 0) return false; - - strFileOrDir = "smb:"; - // share name - iPos += dwOffsetNetworkVolumeInfo + 0x14; - while (iPos < iBytesRead && byHeader[iPos] != 0) - { - if (byHeader[iPos] == '\\') byHeader[iPos] = '/'; - strFileOrDir += (char)byHeader[iPos]; - iPos++; - } - iPos++; - // file/folder name - strFileOrDir += '/'; - while (iPos < iBytesRead && byHeader[iPos] != 0) - { - if (byHeader[iPos] == '\\') byHeader[iPos] = '/'; - strFileOrDir += (char)byHeader[iPos]; - iPos++; - } - return true; -} - -bool CWindowsShortcut::IsShortcut(const std::string& strFileName) -{ - CFile file; - if (!file.Open(strFileName.c_str(), CFile::typeBinary | CFile::modeRead)) return false; - byte byHeader[0x80]; - int iBytesRead = file.Read(byHeader, 0x80); - file.Close(); - if (iBytesRead < 0x4c) - { - return false; - } - //long integer that is always set to 4Ch - if (byHeader[0] != 0x4c) return false; - if (byHeader[1] != 0x0 ) return false; - if (byHeader[2] != 0x0 ) return false; - if (byHeader[3] != 0x0 ) return false; - - //globally unique identifier GUID of the shell links - if (byHeader[0x04] != 0x01) return false; - if (byHeader[0x05] != 0x14) return false; - if (byHeader[0x06] != 0x02) return false; - if (byHeader[0x07] != 0x00) return false; - if (byHeader[0x08] != 0x00) return false; - if (byHeader[0x09] != 0x00) return false; - if (byHeader[0x0a] != 0x00) return false; - if (byHeader[0x0b] != 0x00) return false; - if (byHeader[0x0c] != 0xc0) return false; - if (byHeader[0x0d] != 0x00) return false; - if (byHeader[0x0e] != 0x00) return false; - if (byHeader[0x0f] != 0x00) return false; - if (byHeader[0x10] != 0x00) return false; - if (byHeader[0x11] != 0x00) return false; - if (byHeader[0x12] != 0x00) return false; - if (byHeader[0x13] != 0x46) return false; - - // 2dwords, always 0 - if (byHeader[0x44] != 0x0 ) return false; - if (byHeader[0x45] != 0x0 ) return false; - if (byHeader[0x46] != 0x0 ) return false; - if (byHeader[0x47] != 0x0 ) return false; - if (byHeader[0x48] != 0x0 ) return false; - if (byHeader[0x49] != 0x0 ) return false; - if (byHeader[0x4a] != 0x0 ) return false; - if (byHeader[0x4b] != 0x0 ) return false; - - return true; -} diff --git a/xbmc/utils/WindowsShortcut.h b/xbmc/utils/WindowsShortcut.h deleted file mode 100644 index a79e95f3a4..0000000000 --- a/xbmc/utils/WindowsShortcut.h +++ /dev/null @@ -1,43 +0,0 @@ -// WindowsShortcut.h: interface for the CWindowsShortcut class. -// -////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_WINDOWSSHORTCUT_H__A905CF83_3C3D_44FF_B3EF_778D70676D2C__INCLUDED_) -#define AFX_WINDOWSSHORTCUT_H__A905CF83_3C3D_44FF_B3EF_778D70676D2C__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program 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 2, or (at your option) - * any later version. - * - * This Program 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 XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include <string> - -class CWindowsShortcut -{ -public: - CWindowsShortcut(); - virtual ~CWindowsShortcut(); - static bool IsShortcut(const string& strFileName); - static bool GetShortcut(const string& strFileName, string& strFileOrDir); -}; - -#endif // !defined(AFX_WINDOWSSHORTCUT_H__A905CF83_3C3D_44FF_B3EF_778D70676D2C__INCLUDED_) diff --git a/xbmc/win32/WMIInterface.cpp b/xbmc/win32/WMIInterface.cpp deleted file mode 100644 index eb62894b54..0000000000 --- a/xbmc/win32/WMIInterface.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program 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 2, or (at your option) - * any later version. - * - * This Program 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 XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include "stdafx.h" -#include "WMIInterface.h" -#include "../Util.h" - -CWIN32Wmi::CWIN32Wmi(void) -{ - bconnected = false; - pclsObj = NULL; - Connect(); -} - -CWIN32Wmi::~CWIN32Wmi(void) -{ - Release(); -} - -bool CWIN32Wmi::Connect() -{ - // Initialize COM. ------------------------------------------ - - hres = CoInitializeEx(0, COINIT_MULTITHREADED); - if (FAILED(hres)) - { - return false; // Program has failed. - } - - hres = CoInitializeSecurity( - NULL, - -1, // COM authentication - NULL, // Authentication services - NULL, // Reserved - RPC_C_AUTHN_LEVEL_DEFAULT, // Default authentication - RPC_C_IMP_LEVEL_IMPERSONATE, // Default Impersonation - NULL, // Authentication info - EOAC_NONE, // Additional capabilities - NULL // Reserved - ); - - if (FAILED(hres)) - { - return false; // Program has failed. - } - - pLoc = NULL; - - hres = CoCreateInstance( - CLSID_WbemLocator, - 0, - CLSCTX_INPROC_SERVER, - IID_IWbemLocator, (LPVOID *) &pLoc); - - if (FAILED(hres)) - { - return false; // Program has failed. - } - - pSvc = NULL; - - // Connect to the root\cimv2 namespace with - // the current user and obtain pointer pSvc - // to make IWbemServices calls. - hres = pLoc->ConnectServer( - _bstr_t(L"ROOT\\CIMV2"), // Object path of WMI namespace - NULL, // User name. NULL = current user - NULL, // User password. NULL = current - 0, // Locale. NULL indicates current - NULL, // Security flags. - 0, // Authority (e.g. Kerberos) - 0, // Context object - &pSvc // pointer to IWbemServices proxy - ); - - if (FAILED(hres)) - { - pLoc->Release(); - CoUninitialize(); - return false; // Program has failed. - } - - hres = CoSetProxyBlanket( - pSvc, // Indicates the proxy to set - RPC_C_AUTHN_WINNT, // RPC_C_AUTHN_xxx - RPC_C_AUTHZ_NONE, // RPC_C_AUTHZ_xxx - NULL, // Server principal name - RPC_C_AUTHN_LEVEL_CALL, // RPC_C_AUTHN_LEVEL_xxx - RPC_C_IMP_LEVEL_IMPERSONATE, // RPC_C_IMP_LEVEL_xxx - NULL, // client identity - EOAC_NONE // proxy capabilities - ); - - if (FAILED(hres)) - { - pSvc->Release(); - pLoc->Release(); - CoUninitialize(); - return false; // Program has failed. - } - - pEnumerator = NULL; - - bconnected = true; - return true; -} - -void CWIN32Wmi::Release() -{ - if(pSvc != NULL) - pSvc->Release(); - if(pLoc != NULL) - pLoc->Release(); - if(pEnumerator != NULL) - pEnumerator->Release(); - if(pclsObj != NULL) - pclsObj->Release(); - - CoUninitialize(); - - bconnected = false; - pSvc = NULL; - pLoc = NULL; - pEnumerator = NULL; - pclsObj = NULL; -} - -void CWIN32Wmi::testquery() -{ - hres = pSvc->ExecQuery( - bstr_t("WQL"), - //bstr_t("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE"), - //bstr_t("SELECT * FROM Win32_NetworkAdapter WHERE PhysicalAdapter=TRUE"), - bstr_t("SELECT * FROM Win32_NetworkAdapter WHERE Description='Atheros AR5008X Wireless Network Adapter'"), - WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, - NULL, - &pEnumerator); - - if (FAILED(hres)) - { - return; // Program has failed. - } - ULONG uReturn = 0; - - while (pEnumerator) - { - HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, - &pclsObj, &uReturn); - - if(0 == uReturn) - { - break; - } - - VARIANT vtProp; - VariantInit(&vtProp); - - // Get the value of the Name property - //hr = pclsObj->Get(L"Description", 0, &vtProp, 0, 0); - - vtProp.bstrVal = bstr_t("192.168.1.209"); - hr = pclsObj->Put(L"IPAddress",0,&vtProp,0); - VariantClear(&vtProp); - //iCpu++; - } - pclsObj->Release(); - pclsObj = NULL; -} - -std::vector<std::string> CWIN32Wmi::GetWMIStrVector(std::string& strQuery, std::wstring& strProperty) -{ - std::vector<std::string> strResult; - pEnumerator = NULL; - pclsObj = NULL; - - if(!bconnected) - return strResult; - - hres = pSvc->ExecQuery( - bstr_t("WQL"), - bstr_t(strQuery.c_str()), - WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, - NULL, - &pEnumerator); - - if (FAILED(hres)) - { - return strResult; // Program has failed. - } - ULONG uReturn = 0; - - while (pEnumerator) - { - HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, - &pclsObj, &uReturn); - - if(0 == uReturn) - { - break; - } - - VARIANT vtProp; - VariantInit(&vtProp); - - hr = pclsObj->Get(strProperty.c_str(), 0, &vtProp, 0, 0); - strResult.push_back(vtProp.bstrVal); - VariantClear(&vtProp); - } - if(pEnumerator != NULL) - pEnumerator->Release(); - pEnumerator = NULL; - if(pclsObj != NULL) - pclsObj->Release(); - pclsObj = NULL; - return strResult; -} - -std::string CWIN32Wmi::GetWMIString(std::string& strQuery, std::wstring& strProperty) -{ - return GetWMIStrVector(strQuery, strProperty)[0]; -} diff --git a/xbmc/win32/WMIInterface.h b/xbmc/win32/WMIInterface.h deleted file mode 100644 index ad16f1141b..0000000000 --- a/xbmc/win32/WMIInterface.h +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program 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 2, or (at your option) - * any later version. - * - * This Program 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 XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include <Wbemidl.h> -#pragma comment(lib, "wbemuuid.lib") -#pragma comment(lib, "comsuppw.lib") -#include <string> - -class CWIN32Wmi -{ -public: - CWIN32Wmi(void); - virtual ~CWIN32Wmi(void); - - bool Connect(); - void Release(); - void testquery(); - - std::vector<std::string> GetWMIStrVector(std::string& strQuery, std::wstring& strProperty); - std::string GetWMIString(std::string& strQuery, std::wstring& strProperty); - - - -private: - - HRESULT hres; - IWbemLocator *pLoc; - IWbemServices *pSvc; - IEnumWbemClassObject *pEnumerator; - IWbemClassObject *pclsObj; - - bool bconnected; - - -}; |