Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Terminating an Installation


3 replies to this topic

Donald Bristol

Donald Bristol
  • Members
  • 35 posts

Posted 25 June 2001 - 21:17

Can anyone offer any suggestion on how to terminate an installation if a condition fails.

Background information:
My installation runs silently, authenticate a code that a user enters.  If the code is invalid the installation should terminate.  This does not happen in my case, this is the  code that I'm using.

begin
      if productcode != validValue then

      WriteLine( hwndLog,"Installation failure code03");
     abort;
....  endif;
end;


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 26 June 2001 - 08:51

Try this:
return ERROR_INSTALL_FAILURE;

Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 26 June 2001 - 09:06

1) Return from a custom action with the value ERROR_INSTALL_FAILURE

2) Use a type 19 Custom Action to generate error

3) Use process message to send error message eg.

hError=MsiCreateRecord(2);
MsiRecordSetString(hError, 0, NULL);
MsiRecordSetInteger(hError, 1, MyErrorCode);
MsiProcessMessage(hMsi, INSTALLMESSAGE_FATALEXIT,  hError);
return  ERROR_INSTALL_FAILURE;

MyErrorCode is an index into the error table. hMsi is the handle of the installer object.

4) Validate ealy and use the install conditions.


Note a possibly better way to record log messages is to use MsiProcessMessage to record a log message in the msi log eg.

MSIHANDLE hInfo;
hInfo = MsiCreateRecord(1);
MsiRecordSetString(hInfo, 0, "Something Interesting");
MsiProcessMessage(hMsi, INSTALLMESSAGE_INFO, hInfo);
MsiCloseHandle(hInfo);

Hope this helps