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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:42:06+00:00 2026-06-14T10:42:06+00:00

TL;DR version: In an InnoSetup script, how can I detect if a restart is

  • 0

TL;DR version:

In an InnoSetup script, how can I detect if a restart is needed because of files that were in use?

More detailed version:

I have an Inno Setup script with the following characteristics:

  • the ShouldSkipPage function is implemented so that all pages (except the welcome page) are skipped unless a custom “Advanced options” checkbox on the welcome page is checked:

    function ShouldSkipPage(PageID: Integer): Boolean;
    begin
        if ((PageID = wpSelectDir) or
            (PageID = wpSelectProgramGroup) or
            (PageID = wpSelectTasks) or
            (PageID = wpFinished) or
            (PageID = wpReady)) then
        begin
            Result := not advancedCheckBox.Checked;
        end;
    end;
    
  • CloseApplications and RestartApplications are set to false (*), and some files have the restartreplace and uninsrestartdelete flags, so a restart will be required to complete the installation if the files were in use

Now, if a restart is needed, I want to show the Finished page regardless of the state of the “Advanced options” checkbox, because I don’t want to cause a restart without prompting the user. So my code would be something like that:

    function ShouldSkipPage(PageID: Integer): Boolean;
    begin
        if ((PageID = wpSelectDir) or
            (PageID = wpSelectProgramGroup) or
            (PageID = wpSelectTasks) or
            (PageID = wpReady)) then
        begin
            Result := not advancedCheckBox.Checked;
        end
        else if ((PageID = wpFinished)) then
        begin
            Result := (not advancedCheckBox.Checked) and (not IsRestartNeeded);
        end
    end;

Unfortunately, there is no IsRestartNeeded function (NeedRestart exists, but it’s an event function). I spent a long time looking at the documentation, but I didn’t find any function that could give me this information.

The only option I can think of is to look at HKLM\System\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations to see if it contains any of my files, but it’s a rather ugly solution…


(*) The files I want to replace or remove are a shell extension and some DLLs used by this extension. The reason why I’m not relying on the Restart Manager is because it doesn’t seem to work with explorer.exe: the process is immediately restarted, and my files are locked again.

  • 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-06-14T10:42:07+00:00Added an answer on June 14, 2026 at 10:42 am

    The usual recommendation is to call MakePendingFileRenameOperationsChecksum near the start of your installation process, and then again whenever you want to check whether a restart will be required. As long as it keeps returning the same value, a restart is not required.

    Note that this won’t take into account “forced restarts” eg. from you implementing NeedRestart and returning true or from a component marked with the restart flag; you’re expected to be able to figure that out on your own, since you’re in control of that.

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

Sidebar

Related Questions

How can I remove a desktop shortcut by Innosetup? It's created by previous version
I can set the minimum version required (for example XP SP3) in Inno-Setup by
Version: Crystal Report 2008 I have 2 parameters that prompt the user to enter
I have written an application in Inno Setup to install files on users PCs.
Version used: Delphi 7. I'm working on a program that does a simple for
Short version: Can I grant access to external databases to a role? Long version:
My InnoSetup script opens a web page (with the user's default browser) at the
I'm comparing these two tools. The impression I have is: Inno Setup does not
version:SQL Server 2008 R2 I have granted a user the ability to EXECUTE and
We have an ASP.NET 2.0 application that is available as a trial download. As

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.