From 23c65a4de93c9ac40465e4eb5724d70b1e3f8184 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 22 May 2021 06:20:02 +0530 Subject: [PATCH] WPD driver: Ignore failures to enum objects It should hopefully just mean that the directory sub-tree is not traveresed, but the rest of the files are still scanned. --- .../devices/mtp/windows/content_enumeration.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/calibre/devices/mtp/windows/content_enumeration.cpp b/src/calibre/devices/mtp/windows/content_enumeration.cpp index 584a8ecff5..f1c7233362 100644 --- a/src/calibre/devices/mtp/windows/content_enumeration.cpp +++ b/src/calibre/devices/mtp/windows/content_enumeration.cpp @@ -312,7 +312,7 @@ bulk_get_filesystem( // find_objects_in() {{{ static bool -find_objects_in(CComPtr &content, CComPtr &object_ids, const wchar_t *parent_id) { +find_objects_in(CComPtr &content, CComPtr &object_ids, const wchar_t *parent_id, bool *enum_failed) { /* * Find all children of the object identified by parent_id. * The child ids are put into object_ids. Returns False if any errors @@ -325,7 +325,8 @@ find_objects_in(CComPtr &content, CComPtrEnumObjects(0, parent_id, NULL, &children); Py_END_ALLOW_THREADS; - if (FAILED(hr)) {hresult_set_exc("Failed to get children from device", hr); return false;} + if (FAILED(hr)) {hresult_set_exc("Failed to get children from device", hr); *enum_failed = true; return false;} + *enum_failed = false; hr = S_OK; @@ -449,7 +450,13 @@ get_files_and_folders(unsigned int level, IPortableDevice *device, CComPtr