开发者

What is a good alternative to using CopyData to an elevated application

I have an application that stops a service, copies a file, then starts the service again. I want it to display a progress bar and no extra window, no changing screens, just let the UAC do its thing and continue from there (it's a configuration program, so it is still usable as standard user, with the shield icon on the copy button).

The way it does this is by opening a separate application (another of itself, made invisible, like what开发者_开发技巧 msiexec does) as admin, then the new one does its thing and sends back progress reports through SendMessage. This works fine, but it turns out SendMessage only works one way between admin/non-admin applications. Redirecting StandardInput won't work, because that needs ShellExecute to be off, and "runas" needs ShellExecute to be on.

I don't want to use a file, because that would be slow and a security risk (I was sending a key code alongside the CopyData messages that contained the commands before). Could there be another way to redirect the StandardInput/Output? How does MSI do it?

I'm using C# for this.


i was going to suggest pipes, as Simon did.

One of the tricks, though, is that the higher integrity process needs to create the pipe and tag it with the medium mandatory integrity level, so that your medium integrity process can access it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜