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 7368429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:40:23+00:00 2026-05-29T03:40:23+00:00

Our product allows updates to be installed via an MSI installer. An update consists

  • 0

Our product allows updates to be installed via an MSI installer. An update consists of several files which need to be copied to disk, and the addition of database entries which the installer adds by running several SQL scripts.

Updates can be (and commonly are) installed while the main executable is open. Because of this, I need a way of preventing access to a certain database-intensive feature while the upgrade is in progress.

My current thoughts:

  1. Installer adds a registry key when it starts up.
  2. Update is installed.
  3. On success or failure, the registry key is deleted.

Meanwhile, the application (written in C#) queries for the presence of the registry key, displaying an error dialog if it is set.

Is this reliable? I’m concerned about what happens if the user kills the installer via task manager, then the registry key will never be deleted and the user will be permanently locked out of the feature. Also not sure about any race conditions that the above solution could lead to.

Any suggestions about whether this approach is feasible, or a better approach?

  • 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-29T03:40:23+00:00Added an answer on May 29, 2026 at 3:40 am

    Windows Installer already implements a Mutex to indicate that an installation is in progress. Just code your database intensive code to check for that mutex and no-op while it’s present. Nothing additional needs to be done.

    (Note: using this will stop your processing any time MSI is installing a product which is probably not a bad idea anyways. If you want a unique mutex, it’s trivial to write a custom action. )

    _MSIExecute Mutex


    Update by @LeopardSkinPillBoxHat

    The above answer did what I needed. This is the code I ended up using:

        static void Main(string[] args)
        {
            try
            {
                Mutex mutex = Mutex.OpenExisting(@"Global\_MSIExecute");
                if (!mutex.WaitOne(TimeSpan.FromSeconds(5), false))
                {
                    Console.WriteLine("Installation in progress!");
                    return;
                }
            }
            catch (AbandonedMutexException)
            {
                Console.WriteLine("Mutex was abandoned");
            }
            catch (WaitHandleCannotBeOpenedException)
            {
                Console.WriteLine("MSI installer not running");
            }
    
            // Perform operation here
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our company has a product which relies on local database to work (it allows
Our product includes some custom hardware, that connects to a PC via USB. We've
We use Make to compile our product, which includes, C, C++, Java and a
I'm making MSI's with WiX for our product. The product loads some optional assemblies
Our product contains a task-manager system that allows applications to run code in a
We've got Java and C++ implementations of our product, which is a distributed messaging
I am developing WIX based instller for our product which is having a base
I need to protect against the users of our product from downloading firmware that
We want to use the popular major.minor.update.build_number versioning scheme. Our next product update will
We're working now on the design of a new API for our product, which

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.