Rantanen / intercom

Object based cross-language FFI for Rust
MIT License
63 stars 7 forks source link

The thumbnail sample doesn't work #185

Closed saschanaz closed 3 years ago

saschanaz commented 3 years ago

The registration itself succeeds as it creates an empty debug.log file, but it still doesn't show thumbnails for .rust files on File Explorer and no actual log is generated. Am I doing something wrong? 🤔

Rantanen commented 3 years ago

Been a while since I worked with that sample, but I just built the debug version with cargo build now, registered the dll with regsvr32 thumbnail_provider.dll (which created the debug.log) and then registered the shell extension by importing the association.reg into registry. The icons didn't become visible immediately but by the time I started process monitor to figure out what was wrong, the icons were visible.

saschanaz commented 3 years ago

It's been several minutes and still no luck. BTW, does 61A6080E-0E9F-3CEF-50A7-622D16145B78 in the reg file have any meaning?

Rantanen commented 3 years ago

Oh wait, did you rename the sample? The e357fccd-a995-4576-b01f-234630154e96 is a hard coded Windows GUID that relates to shell extensions/thumbnail providers, but the 61A6080E-0E9F-3CEF-50A7-622D16145B78 is the CLSID of the ThumbnailProvider com_class. It gets derived from the crate name/type name automatically so if one of those changes, the CLSID changes.

.. probably should have hard coded that as well in the attribute!

(The easiest way to find the correct CLSID is to look it up in the registry by doing Find under HKEY_CLASSES_ROOT\CLSID for ThumbnailProvider.ThumbnailProvider, where the first one is the camel cased crate name and the second one is the struct name.

So if you renamed crate to foo_bar and the struc to to MyProvider, then FooBar.MyProvider.)

saschanaz commented 3 years ago

Oh thanks, it now works! I did have my own crate name. Strangely, building the sample itself didn't work either but now it works. 👀

image

Rantanen commented 3 years ago

Glad to hear you got it working!

Strangely, building the sample itself didn't work either but now it works. 👀

Didn't work even after I pushed 776868b? That's strange.

In any case, I've now updated the sample to use a hard-coded CLSID so hopefully the next person has easier time with it, thanks for pointing out the issues! :)

saschanaz commented 3 years ago

Thanks again! Closing since I have no issue anymore 😁