From 7db9a9436d8734d050582afdb3a2dfda21c606e1 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Sat, 1 Aug 2026 22:55:27 -0400 Subject: Add CancelWhenDeferred, like FailWhenDeferred. Useful for integration testing packages. --- src/ext/Util/ca/test.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/ext/Util/ca/test.cpp') diff --git a/src/ext/Util/ca/test.cpp b/src/ext/Util/ca/test.cpp index e9d02ed3..8f1c238b 100644 --- a/src/ext/Util/ca/test.cpp +++ b/src/ext/Util/ca/test.cpp @@ -39,6 +39,21 @@ static LRESULT CALLBACK WndProc( ); +/****************************************************************** +WixCancelWhenDeferred - entry point for WixCancelWhenDeferred + custom action which always cancels when running as a deferred + custom action (otherwise it blindly succeeds). It's useful when + testing the rollback of deferred custom actions: Schedule it + immediately after the rollback/deferred CA pair you're testing + and it will fail, causing your rollback CA to get invoked. +********************************************************************/ +extern "C" UINT __stdcall WixCancelWhenDeferred( + __in MSIHANDLE hInstall +) +{ + return ::MsiGetMode(hInstall, MSIRUNMODE_SCHEDULED) ? ERROR_INSTALL_USEREXIT : ERROR_SUCCESS; +} + /****************************************************************** WixFailWhenDeferred - entry point for WixFailWhenDeferred custom action which always fails when running as a deferred -- cgit v1.2.3-55-g6feb