microsoft / microsoft/Windows-classic-samples

IThumbnailProvider doesn't work with IInitializeWithFile - Initialize is never called

Open
#211 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
5.7k
Forks
3.3k
PR merge metrics
No merged PRs in 30d

Description

I took the RecipeThumbnailProvider sample and tweaked it to implement IInitializeWithFile intead of IInitializeWithStream, but Iinitialize is never called.

I added a registry entry to disable process isolation. Documentation here says to do it this way:
{HKEY_CLASSES_ROOT, L"CLSID\\" SZ_CLSID_RECIPETHUMBHANDLER, L"DisableProcessIsolation", L"1"},
But I also tried with this:
{HKEY_CLASSES_ROOT, L"SOFTWARE\\Classes\\CLSID\\" SZ_CLSID_RECIPETHUMBHANDLER, L"DisableProcessIsolation", L"1"},

I happened to fail to update the Query interface when I first tried this, so it looked like this (note I'm referencing IInitializeWithStream):

    IFACEMETHODIMP QueryInterface(REFIID riid, void** ppv)
    {
        static const QITAB qit[] =
        {
            QITABENT(CRecipeThumbProvider, IInitializeWithStream),
            QITABENT(CRecipeThumbProvider, IThumbnailProvider),
            { 0 },
        };
        return QISearch(this, qit, riid, ppv);
    }

With this code, Initialize IS called, but the file path is empty. When I update the query interface to reference IInitializeWithFile, Initialize isn't called at all.

In my google searches it seems like other people have run into the same issue w/no resolution. I have not been able to find a working sample. Any chance of getting some working sample code?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the RecipeThumbnailProvider sample, its QueryInterface implementation, and the DisableProcessIsolation registry entry described in the issue. Compare the IInitializeWithStream and IInitializeWithFile paths and verify which interface is queried. Done means a working sample invokes Initialize with the expected file path.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.