Windows Service CreateProcessAsUser不运行某些可执行文件 [英] Windows Service CreateProcessAsUser don't run some of the executables

查看:529
本文介绍了Windows Service CreateProcessAsUser不运行某些可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在.net中编写了Windows服务来调用可执行文件.

执行.net可执行文件(如silverlight安装程序)时没有问题.

但是,当我尝试对其他可执行文件(例如winrar安装程序)执行相同操作时,在CreateProcessAsUser()方法上抛出异常.

方法调用是这个

I have written a windows service in .net to call executables.

There is no problem when executing a .net executable like silverlight installer.

But when i try the same thing for another executable like winrar installer an exception is thrown at CreateProcessAsUser() method.

Method call is this

CreateProcessAsUser(m_SessionTokenHandle, m_ApplicationPath, CommandLine, ref l_oSecurityAttributes,ref l_oSecurityAttributes, 0, creationFlags, envBlock, WorkingDirectory,
                    si, pi)


CreationFlags参数设置为CREATE_UNICODE_ENVIRONMENT|DETACHED_PROCESS.

有关于此异常的任何想法吗?


CreationFlags parameter is set as CREATE_UNICODE_ENVIRONMENT|DETACHED_PROCESS.

Is there any idea about this exception?

推荐答案

问题:
-你有什么例外?错误代码可能会给您一些想法.
-您正在处理什么操作系统?请注意,依赖Windows安装程序服务的安装程序在启用UAC的情况下不需要提升的权限,而独立安装程序则需要. 请参阅以下讨论: http: //stackstackflow.com/questions/2426594/starting-a-uac-elevated-process-from-a-non-interactive-service-win32-net-power [
Questions:
- What is the exception you got? Error codes might give you ideas.
- What is the OS, you are dealing with? Be aware, that installers that rely on windows installer service, don''t need elevated rights with UAC enabled, but standalone installers do.
See this discussion: http://stackoverflow.com/questions/2426594/starting-a-uac-elevated-process-from-a-non-interactive-service-win32-net-power[^]


这篇关于Windows Service CreateProcessAsUser不运行某些可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆