Forcing my application to run with administrative privileges

Posted: 12-24-2007, 07:04 PM
Hi,

I have a VB6 based application and I read a post that I should post an entry
here, so I am doing so. My application needs to run with administrative
privileges. As a VB6 appliction it is not a .Net application that has built
in support for manifests. Visual Basic v6.0 does not support direct
manifests, but I am using InstallShield, which is running with
administrative privileges. The question is what changes do I need to make to
cause my application to forcibly run in administrative mode? Another post
mentioned that all the manifest does is to make an entry to the

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentViersion\AppCompatFlags\Layers

hive/folder. I checked this path on my Windows Vista installation and I do
not see the Layers sub-folder. Sadly, the post does not mention what the
settings are. I figured as much that all the manifest does is to set a
registry entry in the registry, which tells Windows that whenever and
however the application runs, be it by shortcut or direct launch, that the
privilege level should be as an administrator.

What are the settings that I should make to the registry to affect my VB6
application to run as with administrator privileges?

Is there another method?

Thanks in advance,

Sarah M. Weinberger
ButterflyVista, LLC


Reply With Quote

Responses to "Forcing my application to run with administrative privileges"

brink
Guest
Posts: n/a
 
Re: Forcing my application to run with administrative privileges
Posted: 12-24-2007, 08:32 PM

Sarah M. Weinberger;552715 Wrote:
> Hi,
>
> I have a VB6 based application and I read a post that I should post an
> entry
> here, so I am doing so. My application needs to run with administrative
> privileges. As a VB6 appliction it is not a .Net application that has
> built
> in support for manifests. Visual Basic v6.0 does not support direct
> manifests, but I am using InstallShield, which is running with
> administrative privileges. The question is what changes do I need to
> make to
> cause my application to forcibly run in administrative mode? Another
> post
> mentioned that all the manifest does is to make an entry to the
>
> HKLM\SOFTWARE\Microsoft\Windows
> NT\CurrentViersion\AppCompatFlags\Layers
>
> hive/folder. I checked this path on my Windows Vista installation and I
> do
> not see the Layers sub-folder. Sadly, the post does not mention what
> the
> settings are. I figured as much that all the manifest does is to set a
> registry entry in the registry, which tells Windows that whenever and
> however the application runs, be it by shortcut or direct launch, that
> the
> privilege level should be as an administrator.
>
> What are the settings that I should make to the registry to affect my
> VB6
> application to run as with administrator privileges?
>
> Is there another method?
>
> Thanks in advance,
>
> Sarah M. Weinberger
> ButterflyVista, LLC
Hi Sarah,

This tutorial will show you the normal method to have your program
always run with "Run this program as an administrator".

http://www.vistax64.com/tutorials/75...lity-mode.html


If this option is grayed out and you need to force the program to, then
this tutorial will show you how using the method you described.

http://www.vistax64.com/tutorials/63...-programs.html

Shawn


--
brink

*There are no dumb questions, just the people that do not ask them.*
VISTA FORUMS X64 (\"HTTP://WWW.VISTAX64.COM/\")
*Please post feedback to help others.*
Reply With Quote
Jimmy Brush
Guest
Posts: n/a
 
Re: Forcing my application to run with administrative privileges
Posted: 12-24-2007, 10:22 PM
Hello,

A manifest is an XML file that is embedded into your application, in the
same way that your application's icon file is embedded into it.

When your application is executed, Windows loads the manifest and uses it to
determine how to start your application.

It does not change/modify the registry.

Applications should not rely on the application compatability layer to mark
their application as requiring elevation. All applications that are designed
to run on Vista should include a manifest (whether they need to elevate or
not)

You have two options: You can either embed the manifest into your
application, or you can create a manifest file named
yourapplication.exe.manifest (where yourapplication.exe is the filename of
your application) and install it to the same location that your application
..exe is installed to.

Obviosuly, the best way when distributing your application is to embed it
into your .exe.

To do that, you need a free tool called mt.exe (available from the Windows
SDK).

The command line looks like this (Note the ;#1 at the end is important):

mt.exe -manifest "path_to_manifest" –outputresource:"path_to_exe";#1

--
- JB
Microsoft MVP Windows Shell/User


"Sarah M. Weinberger" <mweinberger@hotmail.com> wrote in message
news:uChIR$lRIHA.3916@TK2MSFTNGP02.phx.gbl...
> Hi,
>
> I have a VB6 based application and I read a post that I should post an
> entry here, so I am doing so. My application needs to run with
> administrative privileges. As a VB6 appliction it is not a .Net
> application that has built in support for manifests. Visual Basic v6.0
> does not support direct manifests, but I am using InstallShield, which is
> running with administrative privileges. The question is what changes do I
> need to make to cause my application to forcibly run in administrative
> mode? Another post mentioned that all the manifest does is to make an
> entry to the
>
> HKLM\SOFTWARE\Microsoft\Windows NT\CurrentViersion\AppCompatFlags\Layers
>
> hive/folder. I checked this path on my Windows Vista installation and I do
> not see the Layers sub-folder. Sadly, the post does not mention what the
> settings are. I figured as much that all the manifest does is to set a
> registry entry in the registry, which tells Windows that whenever and
> however the application runs, be it by shortcut or direct launch, that the
> privilege level should be as an administrator.
>
> What are the settings that I should make to the registry to affect my VB6
> application to run as with administrator privileges?
>
> Is there another method?
>
> Thanks in advance,
>
> Sarah M. Weinberger
> ButterflyVista, LLC
>
Reply With Quote
Sarah M. Weinberger
Guest
Posts: n/a
 
Re: Forcing my application to run with administrative privileges
Posted: 12-26-2007, 06:33 PM
Hi Jimmy and Brink,

I was finally able to embed a manifest thanks to the prolonged help of
someone in another newsgroup. I do got to comment that the manifest has to
be just right and that finding out how to add the manifest to an existing
resource (using VC++, as that has a nice resource editor) was not all that
obvious, but once done it works. My only complaint to Microsoft is that the
message that UAC pops up should be a bit more clear. It is not obvious that
the application requests to run in elevated / administrative mode, even
though that is what the confirmation screen asks.

Sarah


Reply With Quote
brink
Guest
Posts: n/a
 
Re: Forcing my application to run with administrative privileges
Posted: 12-26-2007, 07:40 PM

Sarah M. Weinberger;553847 Wrote:
> Hi Jimmy and Brink
>
> I was finally able to embed a manifest thanks to the prolonged help o
> someone in another newsgroup. I do got to comment that the manifest ha
> t
> be just right and that finding out how to add the manifest to a
> existin
> resource (using VC++, as that has a nice resource editor) was not al
> tha
> obvious, but once done it works. My only complaint to Microsoft is tha
> th
> message that UAC pops up should be a bit more clear. It is not obviou
> tha
> the application requests to run in elevated / administrative mode, eve
> though that is what the confirmation screen asks
>
> Sara
Sarah

Glad to hear you got it resolved. Thank you for the feedback

Shaw

--
brin

*There are no dumb questions, just the people that do not ask them.*
VISTA FORUMS (\"HTTP://WWW.VISTAX64.COM/\"
*Please post feedback to help others.*
Reply With Quote
 
LinkBack Thread Tools Display Modes
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Forcing programs to run with standard user privileges ainkami Windows Vista Security 5 02-16-2008 07:30 PM
Administrative Privileges DJExtreme Windows Vista 4 06-16-2006 03:05 AM
administrative privileges Dionne Windows XP Security & Administration 5 06-06-2004 09:31 PM
Administrative privileges Jimmie Rand Windows XP Basics 10 08-08-2003 06:25 PM
administrative privileges David Windows XP 1 07-26-2003 04:08 PM