Access violation when using IShellFolder2

John Chapman johnch_atms at hotmail.com
Wed Sep 9 07:18:04 UTC 2020


On Tuesday, 8 September 2020 at 22:24:22 UTC, FreeSlave wrote:
> However if I change the type of recycleBin variable to 
> IShellFolder (not IShellFolder2), the crash does not happen.
>
> Does IShellFolder2 require some special handling?

The issue is caused by druntime's definition of IShellFolder2. To 
fix it temporarily, just redefine it in your module somewhere:

interface IShellFolder2 : IShellFolder {
   HRESULT GetDefaultSearchGUID(GUID*);
   HRESULT EnumSearches(IEnumExtraSearch*);
   HRESULT GetDefaultColumn(DWORD, ULONG*, ULONG*);
   HRESULT GetDefaultColumnState(UINT, SHCOLSTATEF*);
   HRESULT GetDetailsEx(LPCITEMIDLIST, const(SHCOLUMNID)*, 
VARIANT*);
   HRESULT GetDetailsOf(LPCITEMIDLIST, UINT, SHELLDETAILS*);
   HRESULT MapColumnToSCID(UINT, SHCOLUMNID*);
}

IShellFolder2 isn't the only culprit - IShellView2 will need 
fixing too if you intend to use it. There are probably others as 
well.



More information about the Digitalmars-d-learn mailing list