Shell extensions in .NET with administrator privileges

224 views Asked by At

I have some shell extensions written in .NET 4.5 and they work perfectly fine except when they need administrator privileges. For example, suppose I need my shell extension to operate on a file in C:\Program Files\ and create a new file in the same folder. This would require administrator privileges and the code just silently fails.

I can think of a workaround: wrapping any admin elevated code in an exe with the appropriate app.manifest to have admin rights and calling Process.Start(..) on that exe.

But this is a lot of hassle if there is another way.

It wouldn't be surprising if this is not allowed in Windows, but I cannot find any documentation to suggest that this is the case.

0

There are 0 answers