如何为我的DLL创建清单? [英] How do I create a manifest for my DLL?

查看:52
本文介绍了如何为我的DLL创建清单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



1.我在Windows 7上创建了一个项目,并且在该项目的一部分中,我创建了一个C ++应用程序和C ++ DLL.在DLL中,我具有需要管理员特权才能执行的逻辑.

2.我想始终以标准用户权限运行我的应用程序,并希望以提升的访问权限从我的应用程序加载dll,以便每当我加载DLL时,都将提示用户输入管理员凭据.

我的第一个问题是,是否可以从具有标准管理员权限的应用程序中以更高的访问权限来加载DLL?

而且我需要有关如何为DLL创建清单的帮助.

谢谢,
Arjun

Hi,

1. I have created a project on Windows 7 and part of this project I have created one C++ application and C++ DLL. In DLL I have the logic which needs admin privileges to get executed.

2. I want to run my application always with standard user privileges and I would want to load my dll from my application with elevated access, So that whenever I load the DLL, user should be prompted for admin credentials.

My first question is, is it possible to load a DLL with elevated access from a application with standard admin privileges?

And I need help on how to create a manifest for my DLL.

Thanks,
Arjun

推荐答案

我不确定第一个问题,但是您可以从项目属性"中的链接器"选项中将特权级别添加到DLL中.快速测试应该能够回答您的第一个问题.
I am not sure about the first question, but you can add the privilege level to your DLL from the Linker options in the Project Properties. A quick test should be able to answer your first question.


高程是过程的属性.
如果EXE已经在没有提升的情况下运行,则表明该进程已经创建,并且加载其链接器选项设置为requireAdministrator的DLL将无效或被加载程序忽略.

一种执行所需操作的方法是启动另一个提升的进程,然后使用命名管道在两个进程之间进行通信.这样,提升的流程可以代表请求流程执行提升的任务.
Elevation is a property of a process.
If an EXE is already running without elevation, the process has already been created and loading a DLL whose linker option is set to requireAdministrator will have no effect or will be ignored by the loader.

One way to do what you want would be to start another elevated process and then communicate between both processes using a named pipe. This way the elevated process can perform elevated tasks on behalf of the requesting process.


这篇关于如何为我的DLL创建清单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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