PDA

View Full Version : Run As Admin shortcut



NewsArchive
04-17-2008, 01:34 AM
Hi Friedrich,

In Vista you can set a shortcut to run as Administrator. I can't see
that it's possible to create that kind of shortcut in SB. Is it
possible?

I have a program that I have designed so that part of it requires
elevation if it's running under Vista/2008. I can detect if UAC is on
but I haven't implemented code that I found that can give me the
elevation level (will be in there few builds down the road:) so in the
meantime I thought I could just create TWO shortcuts, one asInvoker
and one requireAdministrator. But I can't see an option in the latest
build of 6.7 to do that. Any insights?

Best regards,

Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php

NewsArchive
04-17-2008, 01:36 AM
Hi Arnór,

Well, Windows does not really store these settings in the Shortcut
properties ;-)

You can use the "Set App Compatibility Mode..." script function and mark the
"Run this program as administrator" option to set the compatibility mode
(and privilege level under Vista/2008) for an application.

Does this help?

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6.7
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
04-17-2008, 01:37 AM
Hi Friedrich,

>Well, Windows does not really store these settings in the Shortcut
>properties ;-)

Figures<g>

>You can use the "Set App Compatibility Mode..." script function and mark the
>"Run this program as administrator" option to set the compatibility mode
>(and privilege level under Vista/2008) for an application.
>
>Does this help?

For now I think I'll leave it as is. I'll add the code to check for
the elveation and see how that works. I may end up pulling this part
of the program out and into a separate exe (it's an advanced option
anyway, so that fits the bill just right) or dll and manifest it to
requireAdmin. Guess that needs to be an exe or can you link a
manifest into a dll that is different than the exe using it???

Best regards,

Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php

NewsArchive
04-17-2008, 01:38 AM
Arnór,

>>You can use the "Set App Compatibility Mode..." script function and mark
>>the
>>"Run this program as administrator" option to set the compatibility mode
>>(and privilege level under Vista/2008) for an application.
>>
>>Does this help?
>
> For now I think I'll leave it as is. I'll add the code to check for
> the elveation and see how that works. I may end up pulling this part
> of the program out and into a separate exe (it's an advanced option
> anyway, so that fits the bill just right) or dll and manifest it to
> requireAdmin. Guess that needs to be an exe or can you link a
> manifest into a dll that is different than the exe using it???

The "Set App Compatibility Mode..." script function in SetupBuilder works on
any Windows program.

Let us assume, you have a program named Arnór.exe and it has an embedded
"asInvoker" Vista manifest. If you use "Set App Compatibility Mode..." and
you enable the "Run this program as administrator" option, then Arnór.exe
will be executed elevated when the user starts the application (directly via
Explorer or the Shortcut).

BTW, if you open the Shortcut Properties for Arnór.exe then the "Run this
program as administrator" option will be enabled if you do the above.

Does this help?

Friedrich

NewsArchive
04-17-2008, 11:48 PM
Hi Friedrich,

>BTW, if you open the Shortcut Properties for Arnór.exe then the "Run this
>program as administrator" option will be enabled if you do the above.
>
>Does this help?

Yes! My mind is clearing up;) In my case I _need the main exe to run
asInvoker. It does not need to access any elevated paths or keys or
anything for write access (I coded it FOR vista<g>) It reads some
stuff, but that's ok. This other part of it is part of the Developer
Edition and it requires writing to folders that are protected. So the
more I think about it, the more it makes sense to take that part out
of the main exe and have that a separate exe alltogether. I can run
it elevated from my main exe and I'm good to go:)

Best regards,

Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php

NewsArchive
04-17-2008, 11:49 PM
Have your app detect whether it's running under Vista.
If so, unhide a button that has the elevation shield icon to start your
requireAdministrator setup app.
I'd remind you to use ShellExecute to start the elevated app, but I realize
you're already dealing with that ;)

Jane

NewsArchive
04-17-2008, 11:49 PM
Hi Jane,

>Have your app detect whether it's running under Vista.
>If so, unhide a button that has the elevation shield icon to start your
>requireAdministrator setup app.

If I'm running => vista _and_ UAC is on I will run it elevated,
otherwise I don't care:) Any harm in running it elevated if UAC is
not or I'm on XP? I'm using the "runas" verb to elevate it and as far
as I can tell it works perfectly:)

Best regards,

Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php