OpenProcessToken返回Access Denied [英] OpenProcessToken returns Access Denied

查看:117
本文介绍了OpenProcessToken返回Access Denied的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

Hi,

我有一个在本地用户帐户下运行的服务(它是本地Administrators组的成员)。此服务必须为当前登录的用户(不同的用户)启动应用程序。这些是我的步骤:

I have a service running under a local user account (which is a member of the local Administrators group). This service has to launch an application for a currently logged on user (a different user). These are my steps:

1。查找由登录用户运行的众所周知的进程ID(explorer.exe)。

1. Find a well known process id (explorer.exe) that is ran by a logged on user.

2。调整权限以启用SE_DEBUG_NAME。

2. Adjust privileges  to get SE_DEBUG_NAME enabled.

3。使用h = OpenProcess( PROCESS_ALL_ACCESS,.... )来获取进程的句柄。

3. Use h = OpenProcess(PROCESS_ALL_ACCESS, .... ) to get a handle to the process.

4。使用OpenProcessToken(h,TOKEN_QUERY | TOKEN_IMPERSONATE | TOKEN_DUPLICATE,.... )获取用户令牌。 < ---这是始终因访问被拒绝错误而失败的步骤。

4. Use OpenProcessToken(h, TOKEN_QUERY | TOKEN_IMPERSONATE | TOKEN_DUPLICATE, ....) to get a user token.  <--- this is the step that is always failing with access denied error.

如果我使用本地系统来运行该服务,它可以完美运行。管理员 - 没有。管理员缺少什么特权来为另一个进程调用OpenProcessToken?

If I use Local System to run the service, it works perfect. Administrator - not. What privileges the administrator is missing to call  OpenProcessToken for another process?

谢谢,

Leonid

推荐答案

您是否找到了解决此问题的方法,我遇到了同样的问题
Did you ever find a solution to this problem, I am having the same issue


这篇关于OpenProcessToken返回Access Denied的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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