如何从具有管理员权限的应用程序接收键盘输入到非管理员应用程序? [英] How to receive keyboard input from application with admin privileges to a non-admin application?

查看:229
本文介绍了如何从具有管理员权限的应用程序接收键盘输入到非管理员应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个应用程序,该应用程序具有一种窗口叠加层,可以通过热键显示和隐藏该窗口,而另一个应用程序则具有焦点.所说的另一个应用程序是具有管理员权限的DirectX游戏.

I have programmed an application that has an overlay-kind of window that can be shown and hidden via hotkey while another application has the focus. Said other application is a DirectX game that runs with admin privileges.

我已经尝试了3种可能的解决方案来在其他应用程序中按我的热键时得到通知,其中2种工作正常,但也要求我的应用程序也具有管理特权.这是可以接受的,但是我宁愿有一个不需要这些特权的解决方案.我肯定一定有办法,因为像TeamSpeak这样的应用程序确实可以接收输入而无需以管理员身份运行.

I have already tried 3 possible solutions to get notified when my hotkey is pressed in the other application, 2 of them kind of work, but require my application to have administrative privileges too. That is kind of acceptable, but I'd much rather have a solution that does not require those privileges. I am sure that there has to be a way, since applications like TeamSpeak do manage to receive input without being run as admin.

我已经尝试过的东西:

  1. RegisterHotkey -不适合,因为在DirectX窗口中不起作用.
  2. SetWindowsHookEx -作为通用键盘挂钩,但仅具有管理员权限.
  3. GetAsyncKeyState -用于检查指定的热键,但是又没有管理员权限.
  1. RegisterHotkey - not suitable because it doesn't work while in DirectX windows.
  2. SetWindowsHookEx - works as a general keyboard hook, but only with admin privileges.
  3. GetAsyncKeyState - works to check the specified hotkey, but not without admin privileges yet again.

是的,如果有人可以提出其他解决方案的想法,我将非常感激,因为我想不起来了……我正在使用Delphi,但是由于我仍然依赖Windows API,不要以为解决方案是特定于语言的.

So yeah, I'd be really grateful if someone could provide an idea for a different solution since there is nothing more I could think of ... I am using Delp but since I'm relying on Windows API anyways I don't think the solution will be language specific.

推荐答案

我认为TeamSpeak使用DirectInput作为其热键(如果您已经在使用DirectX,则非常适合您).至于与高级程序进行交互,我认为TeamSpeak唯一使用的解决方案是嵌入一个设置uiAccess=true的应用程序清单.这使您可以绕过UIPI,而无需以管理员身份运行应用程序.

I think TeamSpeak uses DirectInput for its hotkeys (a nice fit for you if you are already using DirectX). As for interacting with elevated programs, I think the only solution, and I believe the one TeamSpeak uses, is to embed an application manifest that sets uiAccess=true. This allows you to bypass UIPI without needing to run the application as administrator.

http://msdn.microsoft.com/en-us/library/bb756929.aspx

要执行此操作,请注意以下几点

For this to work there are a few caveats

  • 该应用程序必须经过Authenticode签名
  • 应用程序必须位于受保护的目录(\ ProgramFiles \,\ system32)

您可以对应用程序进行自签名(因为替代方法很昂贵!),但是您必须手动分发证书,并将其安装在运行有问题的应用程序的任何系统上.

You can self-sign the application (as the alternative is expensive!) but you have to distribute the certificate manually and install it on any system running the application in question.

这篇关于如何从具有管理员权限的应用程序接收键盘输入到非管理员应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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