0

I have made a Preview Handler for Windows so in the preview panel in Windows Explorer I can see whatever I want for a given file. I used code from: http://www.uweraabe.de/Blog/2011/06/01/windows-7-previews-the-delphi-way/

It works great, but there's one problem- when I try to save a file I get access denied.

I tried saving using TFileStream and TStringList to both my desktop and even C:\ and I registered my DLL as administrator. I used ShellExecute to run another exe to save file in that exe but same thing- access denied.

How can I save a file from Windows Preview Handler?

enter image description here

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
Tom
  • 2,962
  • 3
  • 39
  • 69
  • 1
    Is the handler running in proc, or in a surrogate process? https://msdn.microsoft.com/en-us/library/windows/desktop/cc144143(v=vs.85).aspx – David Heffernan Sep 07 '15 at 17:20
  • @DavidHeffernan It's a COM so I guess the surrogate. – Tom Sep 07 '15 at 17:42
  • 1
    Add to HKEY_CLASSES_ROOT\CLSID\{YOUR CLSID} additional DWORD value named DisableLowILProcessIsolation equal to 1. – Denis Anisimov Sep 07 '15 at 17:44
  • Not necessarily a surrogate. Could be in proc. Can you find out? – David Heffernan Sep 07 '15 at 18:01
  • @DenisAnisimov Thanks, this worked. If could post this as an answer I could accept it :) – Tom Sep 07 '15 at 18:02
  • @DavidHeffernan I am not sure how to distinguish. The code is here: http://stackoverflow.com/a/6212448/1404447 – Tom Sep 07 '15 at 18:05
  • It depends on how its registered. Probably also you have 32 bit com server and 64 bit excel which means it's definitely surrogate. Logging the process name would tell you if it was explorer or not. – David Heffernan Sep 07 '15 at 18:08
  • 1
    Anyway, if it's a surrogate then I think you need to disable IL isolation as Denis said. That's where I was going with my questions. Did you read about that in the link I gave you? – David Heffernan Sep 07 '15 at 18:09
  • Yes, I read. Thanks. – Tom Sep 07 '15 at 18:14

0 Answers0