title: In Inno Setup, how to rollback a "verysilent" installation?
body: <p>I have created an installer using Inno Setup. The installer uses a packaged-in DLL to check availability of a specific device on the target machine. If the device is found, the installation is allowed to finish, otherwise the installation is rolled-back (rollback is done using below lines in script):</p>
  
  <pre class="lang-pascal prettyprint-override"><code>if &lt;DeviceNotFound&gt; then
  begin
    CancelWithoutPrompt := true;
    WizardForm.Close;
  end;
  </code></pre>
  
  <p>I have checked that the above check and rollback logic works fine if the setup is run with <code>/silent</code> cmd line param. However, when I use <code>/silent</code> param, the setup displays the Installation progress wizard form.</p>
  
  <p>Also, I found that if I run the above setup in <code>/verysilent</code> mode, then the "DeviceNotFound" check logic works fine but the rollback logic doesn't work and it seems as if rollback logic doesn't get executed at all. Instead of performing rollback, the installer successfully installs.</p>
  
  <p>Now, I have a requirement to run the setup silently so that no window is displayed but it must install or rollback based on device check. Therefore, I have the below queries:</p>
  
  <ol>
  <li><p>Can I rollback the installer when it is running in <code>/verysilent</code> mode? If so, please advise how it may be achieved. I can detect verysilent install mode as shown in question:<br>
  <a href="https://stackoverflow.com/questions/11449561/how-to-detect-whether-the-setup-runs-in-very-silent-mode">How to detect whether the setup runs in very silent mode?</a></p></li>
  <li><p>Alternatively, can I Hide/Minimize the Installation progress window when it is running in <code>/silent</code> mode? If so, please advise how it may be achieved.</p></li>
  </ol>
  
  <p>Please help me with my above queries.</p>
  
  <p>Sorry to be so descriptive but I tried to explain my problem and queries!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I am not doing the above mentioned check in <code>InitializeSetup()</code>. I am doing the check from a function invoked by <code>AfterInstall</code> directive from <code>[Files]</code> section. I have a limitation that I cannot do it from <code>InitializeSetup()</code> as the packaged-in DLL is not extracted till <code>[Files]</code> section completes. I also need to run the installer in Windows PE (Preinstallation Environment), hence I cannot use <code>ExtractTemporaryFile()</code> function to forcefully extract the DLL because the <code>{tmp}</code> path is not valid in that environment. That leaves me with only one option is to check after <code>[Files]</code> section is done. Please advise!</p>