从"user"帐户下运行的服务调用 OpenWindowStation

Calling OpenWindowStation from a service running under a "user" account

本文关键字:服务 OpenWindowStation 运行 调用 user      更新时间:2023-10-16

我的服务启动了一个交互式客户端进程,类似于下面的内容:https://msdn.microsoft.com/en-us/library/windows/desktop/aa379608(v=vs.85).aspx

当服务登录为本地系统时,它工作,如果它运行在管理员帐户下,具有SE_ASSIGNPRIMARYTOKEN_NAMESE_ASSIGNPRIMARYTOKEN_NAME se_assigne_quota_name 权限。

我的问题是当使用标准用户帐户或本地服务时,它在OpenWindowStation失败,错误码为5 (ACCESS DENIED)。

// Get a handle to the interactive window station.
hwinsta = OpenWindowStation(_T("winsta0"),               // the interactive window station 
                            FALSE,                       // handle is not inheritable
                            READ_CONTROL | WRITE_DAC);   // rights to read/write the DACL

是否可以从标准用户帐户调用OpenWindowStation或我的服务必须在管理员帐户下运行?我尝试了几乎所有的本地策略都没有成功

谢谢!

遗憾的是,这是不可能的,似乎只有管理员才能打开互动站。