Give me a point what is going in aicustact.dll:RunAsAdmin? - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

antidotcb
Posts: 34
Joined: Mon May 17, 2010 8:10 am

Give me a point what is going in aicustact.dll:RunAsAdmin?

Hello, there

Please, can you give me a point what is going inside CA aicustact.dll:RunAsAdmin?

There is no possibility to run it as deffered one (actyally it is possible, but I cannot pass params RunAsAdminFile & RunAsAdminCmd).
There is no way to path info for it during deffered execution.

I need to run elevated exe after files are installed.

Plz, give me a point what is going on inside RunAsAdmin, what API it use?
So I can create deffered CA with appropriate logic.

Thanks,
Daniil
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Give me a point what is going in aicustact.dll:RunAsAdmin?

Hello,

The RunAsAdmin custom action is intended for use as a UI Custom action only.

If you want to execute a custom action with administrator privileges simply set it as "with no impersonation".

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
antidotcb
Posts: 34
Joined: Mon May 17, 2010 8:10 am

Re: Give me a point what is going in aicustact.dll:RunAsAdmin?

Hi,

When I exec my code inside deffered CA - I get ACCESS_DENIED errors.
But when I transfer my CA code from dll to exe, and execute this code via CA RunAsAdmin - I got UAC.
That's the way I need to implement.

But there is a problem with RunAsAdmin - it's UI CustomAction, but I need to run it as deffered and one more important - to get RESULT from it: success/error.

For short:
1) I MUST have per-user only installation (no any elevated rights required by default, no any UAC, a simple per-user installation).
2) There is a possibility to register service via check-box
3) If end-user decides to install service, during installation process UAC credentials prompt should appear and ask to enter Admin credentials
4) If user cannot enter admin credentials - installation fails

There is a sample solution with DEFFERED CA NO IMPERSONATION:
InstallService.zip
P.S. There is a code and dll, if you afraid of any mal-ware - build the C++ Solution.

Run installation from user with restricted rights, not from admin-account. Look on ACCESS_DENIED error.
Last edited by antidotcb on Wed Jun 02, 2010 12:23 pm, edited 1 time in total.
antidotcb
Posts: 34
Joined: Mon May 17, 2010 8:10 am

Re: Give me a point what is going in aicustact.dll:RunAsAdmin?

This is how I made it now. Per-user only installation, with customizable run of elevated CA (with UAC prompt).
No UAC prompt on start of installation or during progress, if check boxes are unchecked!

There is a sample solution with RunAsAdmin CA:
InstallServiceAsAdmin.zip
P.S. There is a code and dll, if you afraid of any mal-ware - build the C++ Solution.
antidotcb
Posts: 34
Joined: Mon May 17, 2010 8:10 am

Re: Give me a point what is going in aicustact.dll:RunAsAdmin?

Would be there any response?
I have a blocker issue, and need to move on. ASAP
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Give me a point what is going in aicustact.dll:RunAsAdmin?

Hello,

Your custom action really NEEDS to be deferred with no impersonation for it to have elevated privileges and your installer needs to elevate for it to work.

Whether the installer elevates itself or not can not be conditioned.
You will have to use "Per user with administrator rights required" install type from the install parameters page.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
antidotcb
Posts: 34
Joined: Mon May 17, 2010 8:10 am

Re: Give me a point what is going in aicustact.dll:RunAsAdmin?

GabrielBarbu wrote: Whether the installer elevates itself or not can not be conditioned.
You will have to use "Per user with administrator rights required" install type from the install parameters page.
Don't tell me what I can't do! © John Locke
I don't need entire installation that will require administrator rights, and show up UAC prompt always during installation progress.

As I already mentioned,I have done the case (in sample above, using RunAsAdmin):
1) it can run per user installation
2) it doesn't require administrator privileges on start
3) in doesn't have UAC prompt on start
4) it can be installed successfully by standard user without UAC prompt, if "install service" check box is unchecked
5) it can be uninstalled without UAC prompt when "delete service" check box is unchecked

6) it can install service conditionally, in such case it shows UAC prompt and install service successfully
7) it can uninstall service conditionally, also using UAC prompt

The only restriction of already implemented installer - that it uses RunAsAdmin CA.
It's UI CA, and it cannot be setup as deffered, because it uses Properties - RunAsAdminCmd & RunAsAdminFile.
I only ask you to disclose details on RunAsAdmin CA implementation. Point me out the WinAPI it uses for showing UAC prompt.
How it tell to Windows to show UAC prompt, how it run code elevated after this?
Of course, It will be great if Advanced Installer Team will implement deffered RunAsAdmin variant, but I can do it myself if I will know the API.

Such behavior is very often looked by other installation developers. It's great possibility to have per-user installation, with conditional execution of CA with elevated priveleges.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Give me a point what is going in aicustact.dll:RunAsAdmin?

Hello,

Unfortunately Windows Installer can not condition its elevation.

Similarly to RunAsAdmin, you can create a custom action and use the ShellExecute API to launch another process. Request elevation for that process by launching it with the "runas" verb.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
antidotcb
Posts: 34
Joined: Mon May 17, 2010 8:10 am

Re: Give me a point what is going in aicustact.dll:RunAsAdmin?

Thank you,

This is right what I want to know.

Return to “Common Problems”