Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 693823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:47:36+00:00 2026-05-14T02:47:36+00:00

We have an application written in both C++ and .NET that installs for all

  • 0

We have an application written in both C++ and .NET that installs for all users in the Program Files folder. This application downloads new versions of itself (as MSI installers) and spawns the new installer process to replace itself.

The install process as it exists today:

  1. Copy an install manager app (C#, .NET 2.0) to the temp directory. Call this ‘Manager’
  2. Manager is executed with elevated privs per this article.
  3. The original application exits.
  4. Manager spawns the MSI installer (with elevated privs, since the copy is elevated)
  5. Manager spawns the new version of the app.

The bug:

The newly installed app is running in an elevated state. This causes problems I won’t enumerate here.

Ideally, the launch of the newly installed app would be run with the permissions of the original user.

I can’t figure out how to demote the app back to being the standard user after elevation.

An inelegant hack:

(yeah, yeah, this whole process is inelegant anyway)

  1. Copy the install manager to the temp directory
  2. Run the install manager with standard user privs. Lets call this instance ‘LowlyManager’.
  3. Original application exits.
  4. LowlyManager spawns the app again, this time with elevated privs. Let’s name this instance ‘UpperManagement’
  5. UpperManagement spawns the installer
  6. UpperManagement exits gracefully, returning the exit code of the installer.
  7. LowlyManager interprets the error code from UpperManagement, and spawns the newly installed application. This time as the original invoker.

Is there a better way to do this?

(I’ve left out a bunch of other details before and after these steps that make the process smoother for the user, but this should be enough to understand the core of the problem I’m trying to solve.)

Other requirements:

  • We can’t install as a per-user app
  • The user shouldn’t be presented with an authentication dialog box if UAC would have simply asked “are you sure you want to allow this?”. I think this might kill a solution using WindowsImpersonationContext, but I’m not sure.
  • The system needs to work on XP, Vista, and Windows 7 (even if there is a separate process for XP).
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:47:36+00:00Added an answer on May 14, 2026 at 2:47 am

    One way: http://www.codeproject.com/KB/vista-security/VistaElevator.aspx

    Another way (mentioned in most recent comment in previous article): http://brandonlive.com/2008/04/27/getting-the-shell-to-run-an-application-for-you-part-2-how/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application written in VB.NET that interacts with Excel via interop. I
I have a fairly complex business application written in ASP.NET that is deployed on
I have an application to be written in ASP.Net 3.5 that needs to manage
We have an enterprise application written in asp.net c# (3.5) and SQL server that
I have a C# application. Currently all modules are written in .NET 2 and
I have an application written in C#.Net (Framework 2.0 if it matters). It calls
We have an application written in C#, using .NET Framework 3.0 or 3.5 or
We have a WinForms application written in C# that uses the AxAcroPDFLib.AxAcroPDF component to
I have code written in .NET that only fails when installed as a Windows
I have single-thread windows form application written with VB.NET and targeting Framework 1.1 .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.