开发者

E_ACCESSDENIED on CoCreateInstance, where it used to work

开发者 https://www.devze.com 2023-02-18 15:26 出处:网络
I have some code that used to work, but recently stopped.It\'s in an Adobe Reader Plugin, and the latest Reader version has a \"Protected Mode\" which causes my problem.

I have some code that used to work, but recently stopped. It's in an Adobe Reader Plugin, and the latest Reader version has a "Protected Mode" which causes my problem.

My plugin can load some of my normal dlls, which load in-process:

MyNormalLib::IMyClassPtr foo;
HRESULT hr = foo.Create开发者_运维问答Instance(__uuidof(MyNormalLib::MyClass));

But when I try to get a com pointer to my service (running on the same machine):

MyOtherLib::IMyServicePtr bar;
HRESULT hr = bar.CreateInstance(__uuidof(MyOtherLib::MyService));

I get E_ACCESSDENIED for my HRESULT.

This used to work fine, until Adobe Reader X came along. Without Protected Mode, Adobe runs normally and everything works. With Protected Mode, Adobe spawns another Reader process, with some restrictions on it. Looking at this with Process Explorer, I can see that the Security Tab for the parent Reader process has pretty much everything set to Mandatory; but the child Reader process has most groups set to "Deny, Mandatory", some "Mandatory, Restricted", some are just Mandatory. If this matters, I can provide more details.

All processes (my service and both Reader) are run as the same user -- me. I have admin rights, if that matters.

What can cause an AccessDenied error when trying to reach my own service? What security hoops do I have to jump through to get this to work?


The restricted process does not have admin rights. That's pretty much the point of the exercise - Reader X drops as many rights as it can from its token so that if it is pwned your computer is not.

(That's basically how UAC works too, you have to go to the Kernel to get permission to re-enable your Administrator group once you have disabled it).

Basically you need to look at the privs that Reader X has, and make sure your component can be used with those permissions. Process Monitor is your friend - just filter for DENIED and the problems will pop right out at you!

0

精彩评论

暂无评论...
验证码 换一张
取 消