masters: I am trying to inject a dll into explorer.exe via registering a icon handler shell extension and put a file with the specified extension name in desktop. It works fine in Win7 but not very well in windows xp. the phenomenon is:

  1. when the first time a register the extension, the dll is injected successfully.
  2. when restart the system, the dll is not loaded by explorer.exe. but if I create a new file with the extension name, it can be loaded.

I guess the reason it that the desktop had cached the file icon, so it don't need to call the iconhandler to extract the icon. so how can i prevent the desktop to cache the icon of specified file.

Thanks a lot for your help.

Below is part of my codes: // CShellIcon

HRESULT CShellIcon::GetIconLocation(UINT uFlags, LPWSTR szIconFile, UINT cchMax, LPINT piIndex, UINT* pwFlags)
{ 
    // I inject the dll to subclass the desktop window
    SubclassDesktop();

    *piIndex = 0; 

    *pwFlags = GIL_DONTCACHE | GIL_NOTFILENAME | GIL_PERINSTANCE;
    return S_FALSE;
} 

HRESULT CShellIcon::Extract(LPCTSTR pszFile, UINT nIconIndex, HICON* phiconLarge, HICON* phiconSmall, UINT nIconSize )
{ 
    phiconLarge = NULL;
    phiconSmall = NULL;
    return S_OK; 
} 
0

There are 0 answers