Help needed on an SHGetFileInfoW() crash
A friend pointed me to a railway signalling simulation game: http://www.simsig.co.uk/html/downloads.html However, the installer crashes in SHGetFileInfoW(): 000d:Call shell32.SHGetFileInfoA(0045eae8,00000010,0034fcec,00000160,00001010) ret=0045e9f6 000d:trace:seh:raise_exception code=c0000005 flags=0 addr=0x7e8871b2 000d:trace:seh:raise_exception info[0]=00000000 000d:trace:seh:raise_exception info[1]=00000000 More precisely the crash happens on this line: hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1, (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconW, &uDummy, (LPVOID*)&pei); And the reason is that psfParent is NULL. psfParent is initialized a bit above, but only if SHGetFileInfoW() was given a PIDL and SHGFI_USEFILEATTRIBUTES was not used. This means that whenever a 'real path' or SHGFI_USEFILEATTRIBUTES is used in combination with SHGFI_DISPLAYNAME, SHGFI_ICONLOCATION, SHGFI_ICON or SHGFI_SYSICONINDEX, then SHGetFileInfoW() will crash. However we cannot just create a pidl since the 'real path' will usually refer to a nonexistent file or directory (in our case it is 'c:\directory' so it's clear the installer just wants to know what's the icon for a standard directory). Any idea? -- Francois Gouget <fgouget(a)free.fr> http://fgouget.free.fr/ "Lotto: A tax on people who are bad at math." -- unknown "Windows: Microsoft's tax on computer illiterates." -- WE7U
On 04.12.2006 19:20, Francois Gouget wrote:
Any idea?
FWIW, maybe you need an IExtractIcon that does not work on a pidl but only on a filename and file attributes. So if the attribute is a "folder", return the folder icon. Else get the default icon for that particular file type. Maybe the existing IExtractIcon could even be extended for that. -f.r.
participants (2)
-
Francois Gouget -
Frank Richter