开发者

Launching COM (.NET) Object with Elevated Rights throws FileNotFoundException

开发者 https://www.devze.com 2023-02-10 14:34 出处:网络
I am trying to launch a .NET object through the CoGetObject method as outlined in the COM 开发者_如何学运维Elevation Moniker article on MSDN.I started working with the Vista Bridge code and then stumb

I am trying to launch a .NET object through the CoGetObject method as outlined in the COM 开发者_如何学运维Elevation Moniker article on MSDN. I started working with the Vista Bridge code and then stumbled across an older sample that shows some of the bits wired up. At this point I am trying to figure out why I am getting a FileNotFoundException thrown when the call goes through to this method:

var result = UnsafeNativeMethods.CoGetObject(monikerName, ref bindingOptions, interfaceId);

The exception only throws after the consent prompt is displayed which is strange. I am working on a Windows 7 x64 machine if that helps and have posted the full source of my spike.

What am I missing here that might cause a FileNotFoundException to be thrown?


Did you run RegAsm.exe with the /tlb switch to export and register a typelib for the COM server? Not having a registered typelib may result in a FileNotFoundException.


This is not directly an answer, but you can probably use the RunElevatedNet C# sample project to try launching your COM server in either a elevated project or not. Investigating if the same FileNotFoundException error also occur in non-elevated mode might help debug your issue.

0

精彩评论

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