Требуемый Уровень Выполнения для dll

У меня есть приложение WinForms, что я продолжаю работать. Существует одна маленькая часть функциональности, которая должна быть выполнена как администратор в Vista/Win7. Я понимаю, как я могу установить requestedExecutionLevel для приложения в декларации. Прием, я не хочу требовать, чтобы пользователь запустил целое приложение как администратор, всего одна часть его. Таким образом, я хотел бы иметь большую часть функциональности выполненный asInvoker.

Если я поместил администраторскую функциональность в dll, есть ли способ отметить ее как requireAdministrator? Я пытался использовать MT для добавления декларации к dll, но это, казалось, не работало. Что я должен сделать?

5
задан epotter 10 December 2009 в 18:09
поделиться

2 ответа

No there is no way to differentiate the execution level of an application on a DLL by DLL basis. This is a process wide setting. You'd have to invoke another process within your application that runs the code in that DLL with elevated privs.

One option you do have though is to use either the rundll or rundll32 program to run the DLL directly. This is a standalone windows program designed to load and run a particular DLL. You could elevate the rundll process and get the isolation you desire.

Googling for rundll will give you plenty of advice on how to use it :).

3
ответ дан 14 December 2019 в 13:38
поделиться

Elevation is per-process, so you can't have a DLL elevated by itself. You need to look at hosting the DLL in a separate, elevated process; or you can look at the elevation COM moniker, and do it that way.

3
ответ дан 14 December 2019 в 13:38
поделиться
Другие вопросы по тегам:

Похожие вопросы: