(Jump lists) IApplicationDestinations::RemoveAllDestinations sometimes fails with strange error codes

Nikita Provotorov 21 Reputation points
2021-05-29T13:33:57.353+00:00

Hey! I have something like the following code:

CComPtr<IApplicationDestinations> rfHandle = nullptr;

auto hr = rfHandle.CoCreateInstance(
    CLSID_ApplicationDestinations,
    nullptr,
    CLSCTX_INPROC_SERVER
);

if (hr != S_OK)
    /* throw exception */

assert( (rfHandle!= nullptr) );

hr = rfHandle->RemoveAllDestinations();
if ( (hr != S_OK) &&
     // it is ok if no recent docs were registered before
     (hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) )
    /* throw exception */

Sometimes on users machines rfHandle->RemoveAllDestinations() returns strange error codes e.g.:

  • 0x80030021 (STG_E_LOCKVIOLATION);
  • 0x80030020 (STG_E_SHAREVIOLATION);
  • 0x80030100 (STG_E_INUSE);
  • 0x80070020;
  • 0x80070005.

I can't reproduce it and can't understand such errors in this context. Can you help me what should I look or do?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,427 questions
{count} votes