Search code examples
windows-installerinno-setupmutex

Inno Setup Check additional (Windows Installer) mutex


How can I check for a mutex in Inno Setup? I want my installer to wait if a Windows Installer installation is running.

I've only found the AppMutex Directive in Inno Setup but this does not exactly what I want.


Solution

  • Use the CheckForMutexes function from the InitializeSetup event function.

    [Code]
    
    function InitializeSetup(): Boolean;
    begin
      while CheckForMutexes('_MSIExecute') do
      begin
        MsgBox('Windows Installer Installation is running', mbError, MB_OK);
      end;
    
      Result := True;
    end;
    

    Assuming (based on the deleted answer by @ChristopherPainter) that the _MSIExecute is the mutex to check for.