mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Windows MTP driver: Fix error when enumerating device storage not being reported during debug device detection
This commit is contained in:
parent
997d1e85d0
commit
fcc7de203a
@ -54,7 +54,7 @@ IPortableDevice *open_device(const wchar_t *pnp_id, IPortableDeviceValues *clien
|
||||
hr = CoCreateInstance(CLSID_PortableDevice, NULL, CLSCTX_INPROC_SERVER,
|
||||
IID_PPV_ARGS(&device));
|
||||
Py_END_ALLOW_THREADS;
|
||||
if (FAILED(hr)) hresult_set_exc("Failed to create IPortableDevice", hr);
|
||||
if (FAILED(hr)) { hresult_set_exc("Failed to create IPortableDevice", hr); device = NULL; }
|
||||
else {
|
||||
Py_BEGIN_ALLOW_THREADS;
|
||||
hr = device->Open(pnp_id, client_information);
|
||||
@ -354,7 +354,17 @@ PyObject* get_device_information(IPortableDevice *device, IPortableDevicePropert
|
||||
|
||||
if (t == Py_True) {
|
||||
storage = get_storage_info(device);
|
||||
if (storage == NULL) goto end;
|
||||
if (storage == NULL) {
|
||||
PyObject *exc_type, *exc_value, *exc_tb;
|
||||
PyErr_Fetch(&exc_type, &exc_value, &exc_tb);
|
||||
if (exc_type != NULL && exc_value != NULL) {
|
||||
PyErr_NormalizeException(&exc_type, &exc_value, &exc_tb);
|
||||
PyDict_SetItemString(ans, "storage_error", exc_value);
|
||||
Py_DECREF(exc_value); exc_value = NULL;
|
||||
}
|
||||
Py_XDECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_tb);
|
||||
goto end;
|
||||
}
|
||||
PyDict_SetItemString(ans, "storage", storage);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user