Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Vista Newsgroups > Vista security

Vista - Forcing my application to run with administrative privileges

Reply
 
Old 12-24-2007   #1 (permalink)
Sarah M. Weinberger


 
 

Forcing my application to run with administrative privileges

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



My System SpecsSystem Spec
Old 12-24-2007   #2 (permalink)


Vista x64 Ultimate SP2, Windows 7 Ultimate x64
 
 

Re: Forcing my application to run with administrative privileges

Quote  Quote: Originally Posted by Sarah M. Weinberger View Post
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".

Compatibility Mode


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.

Compatibility Mode List of Programs

Shawn
My System SpecsSystem Spec
Old 12-24-2007   #3 (permalink)
Jimmy Brush


 
 

Re: Forcing my application to run with administrative privileges

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@xxxxxx> wrote in message
news:uChIR$lRIHA.3916@xxxxxx
Quote:

> 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
>
My System SpecsSystem Spec
Old 12-26-2007   #4 (permalink)
Sarah M. Weinberger


 
 

Re: Forcing my application to run with administrative privileges

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


My System SpecsSystem Spec
Old 12-26-2007   #5 (permalink)


Vista x64 Ultimate SP2, Windows 7 Ultimate x64
 
 

Re: Forcing my application to run with administrative privileges

Quote  Quote: Originally Posted by Sarah M. Weinberger View Post
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
Sarah,

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

Shawn
My System SpecsSystem Spec
Old 12-27-2007   #6 (permalink)


XP x64
 
 

Re: Forcing my application to run with administrative privileges

Quote  Quote: Originally Posted by Jimmy Brush View Post
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
I came across this thread via a web search. I am in a similar situation, except that I am already using a standard VB6 resource file, which prevents me from adding another one, and it seems that the type needed for the manifest and the standard VB6 resource files are not compatible. So, I was hoping to use your MT.exe method. I tried the syntax you mentioned, but the result is this:

mt.exe:command line error c10100a8:No manifest outputs were specified to store the final manifest. Use the /? option for help on usage and samples.

I figured since you are very experienced with this, you'd probably know right off what needs to be added/changed. Thanks much in advance. Hopefully this will work out for my situation.
My System SpecsSystem Spec
Old 04-12-2008   #7 (permalink)


Vista Home Premium 32bit
 
 

Re: Forcing my application to run with administrative privileges

Quote  Quote: Originally Posted by mystikmedia View Post
Quote  Quote: Originally Posted by Jimmy Brush View Post
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
mt.exe:command line error c10100a8:No manifest outputs were specified to store the final manifest. Use the /? option for help on usage and samples.

I figured since you are very experienced with this, you'd probably know right off what needs to be added/changed. Thanks much in advance. Hopefully this will work out for my situation.

If you haven't found a solution, try deleting hyphens and inserting them manually once again. It should help. The old hyphens probably aren't normal hyphens.
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Re: How to know if a user has administrative privileges VB Script
No administrative privileges on Administrator account? General Discussion
Losing administrative privileges something like Nidma virus System Security
Forcing programs to run with standard user privileges Vista security
Administrative Privileges Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46