-1

How to create a simple COM DLL which can be used to elevate administrative tasks,

I found a sample on codeproject but it deal with EXE, and i want to convert it to DLL.

http://www.codeproject.com/Articles/35196/Elevating-your-application-for-dummies-A-step-by-s

Please guide.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
Rahul
  • 441
  • 1
  • 6
  • 16
  • please try yourself and paste code that doesn't work.this is not a contracting site.. – Dory Zidon Jun 02 '13 at 07:06
  • Please read the [main FAQ](http://stackoverflow.com/faq) and [How To Ask Questions FAQ](http://stackoverflow.com/questions/how-to-ask) for information on posting questions on StackOverflow. – Captain Obvlious Jun 02 '13 at 07:14
  • 2
    @Dory Rahul is just asking for guidance. He doesn't ask for code. It's not that hard a question to answer. – David Heffernan Jun 02 '13 at 10:19
  • @DoryZidon I am not asking any source code – Rahul Jun 02 '13 at 13:20
  • What's difficult in this question, it is on the person who want to understand, else it is difficult to answer, Anyways, thanx everyone. – Rahul Jun 02 '13 at 13:22
  • Also a duplicate of http://stackoverflow.com/questions/127042/how-to-uac-elevate-a-com-component-with-net?rq=1. The .Net part in that question is a red herring, the solution provided (`CoCreateInstanceAsAdmin`) seems appropriate here too. – MSalters Jun 02 '13 at 22:52

1 Answers1

2

The reason that the article chose to use an executable rather than a DLL is that an out of process COM server is required. That's because UAC elevation affects the entire process and so you cannot elevate for an in process COM server.

So, if you put the COM server in a DLL, then you'll need to also arrange for an out of process host for that DLL which is a needless complication. It's much simpler to do it as described in the article.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • thanks, i was looking for this only. Maybe i was bit wrong on how to ask a question. – Rahul Jun 02 '13 at 13:24
  • 1
    I think the commentors overreacted a little. The question seemed alright to me. Perhaps it could have been a little clearer, but it's always easy to say that when you know the answer. When you are asking it's hard to know exactly how to ask. – David Heffernan Jun 02 '13 at 13:53