aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/platform/win32/WIN32Util.cpp65
-rw-r--r--xbmc/platform/win32/WIN32Util.h2
2 files changed, 0 insertions, 67 deletions
diff --git a/xbmc/platform/win32/WIN32Util.cpp b/xbmc/platform/win32/WIN32Util.cpp
index d2cf1363c7..177ab818dc 100644
--- a/xbmc/platform/win32/WIN32Util.cpp
+++ b/xbmc/platform/win32/WIN32Util.cpp
@@ -1174,71 +1174,6 @@ void CWIN32Util::CropSource(CRect& src, CRect& dst, CRect target, UINT rotation
dst.y2 = ceil(dst.y2);
}
-// detect if a drive is a usb device
-// code taken from http://banderlogi.blogspot.com/2011/06/enum-drive-letters-attached-for-usb.html
-
-bool CWIN32Util::IsUsbDevice(const std::wstring &strWdrive)
-{
- if (strWdrive.size() < 2)
- return false;
-
-#ifdef TARGET_WINDOWS_STORE
- bool result = false;
-
- auto removables = winrt::Windows::Storage::KnownFolders::RemovableDevices();
- auto vector = Wait(removables.GetFoldersAsync());
- auto strdrive = KODI::PLATFORM::WINDOWS::FromW(strWdrive);
- for (const auto& device : vector)
- {
- auto path = KODI::PLATFORM::WINDOWS::FromW(device.Path().c_str());
- if (StringUtils::StartsWith(path, strdrive))
- {
- // looks like drive is removable
- result = true;
- }
- }
- return false;
-#else
- std::wstring strWDevicePath = StringUtils::Format(L"\\\\.\\{}", strWdrive.substr(0, 2));
-
- HANDLE deviceHandle = CreateFileW(
- strWDevicePath.c_str(),
- 0, // no access to the drive
- FILE_SHARE_READ | // share mode
- FILE_SHARE_WRITE,
- NULL, // default security attributes
- OPEN_EXISTING, // disposition
- 0, // file attributes
- NULL); // do not copy file attributes
-
- if(deviceHandle == INVALID_HANDLE_VALUE)
- return false;
-
- // setup query
- STORAGE_PROPERTY_QUERY query = {};
- query.PropertyId = StorageDeviceProperty;
- query.QueryType = PropertyStandardQuery;
-
- // issue query
- DWORD bytes;
- STORAGE_DEVICE_DESCRIPTOR devd;
- STORAGE_BUS_TYPE busType = BusTypeUnknown;
-
- if (DeviceIoControl(deviceHandle,
- IOCTL_STORAGE_QUERY_PROPERTY,
- &query, sizeof(query),
- &devd, sizeof(devd),
- &bytes, NULL))
- {
- busType = devd.BusType;
- }
-
- CloseHandle(deviceHandle);
-
- return BusTypeUsb == busType;
-#endif
-}
-
std::string CWIN32Util::WUSysMsg(DWORD dwError)
{
#define SS_DEFLANGID MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT)
diff --git a/xbmc/platform/win32/WIN32Util.h b/xbmc/platform/win32/WIN32Util.h
index 247bed0a35..dcfcf26f17 100644
--- a/xbmc/platform/win32/WIN32Util.h
+++ b/xbmc/platform/win32/WIN32Util.h
@@ -72,8 +72,6 @@ public:
#endif // TARGET_WINDOWS_DESKTOP
static void CropSource(CRect& src, CRect& dst, CRect target, UINT rotation = 0);
- static bool IsUsbDevice(const std::wstring &strWdrive);
-
static std::string WUSysMsg(DWORD dwError);
static bool SetThreadLocalLocale(bool enable = true);