Pressing yes to cancel button won't cause rollback

2 messages Options
Embed this post
Permalink
Karma

Pressing yes to cancel button won't cause rollback

Reply Threaded More More options
Print post
Permalink
Hi all,

I am trying to detect whether a user cancels within a custom action by doing

the following

UINT __stdcall CA()
{
    int retVal = 0;
    PMSIHANDLE hRecord = MsiCreateRecord(1);
    ...
     SomeLongOperation(); // trigger cancellation while this function is
running

    MsiRecordSetString(hRecord, 0, L"[1]");
    MsiRecordSetString(hRecord, 1, L"Some Message");
    retVal = MsiProcessMessage(hInstall, INSTALLMESSAGE_INFO, hRecord);
    if(retVal == IDCANCEL)
    {
        MsiLogWrapper(L"User cancellation is detected!");
        return ERROR_USER_EXIT;
    }
    else
    {
        MsiLogWrapper(L"MsiProcessMessage() returned %d", retVal);
    }
    ...
}

The problem is that the value returned by MsiProcessMessage() is always 0.
And I've confirmed that the installation was cancelled during the
SomeLongOperation() was running,and the string L"Some Message" is properly
logged. What is wrong in this
case? am I missing anything? The CA is scheduled to be a deferred and
no-impersonate action.
I wanted to detect it so that I could return ERROR_USER_EXIT from the CA.
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Rob Mensching-6

Re: Pressing yes to cancel button won't cause rollback

Reply Threaded More More options
Print post
Permalink
Many MSI calls can return the user cancel message, not just
::MsiProcessMessage(). It is possible some other call ate the return
value. The WcaUtil functions handle this sort of thing for you.

DONG LEE wrote:

> Hi all,
>
> I am trying to detect whether a user cancels within a custom action by doing
>
> the following
>
> UINT __stdcall CA()
> {
>     int retVal = 0;
>     PMSIHANDLE hRecord = MsiCreateRecord(1);
>     ...
>      SomeLongOperation(); // trigger cancellation while this function is
> running
>
>     MsiRecordSetString(hRecord, 0, L"[1]");
>     MsiRecordSetString(hRecord, 1, L"Some Message");
>     retVal = MsiProcessMessage(hInstall, INSTALLMESSAGE_INFO, hRecord);
>     if(retVal == IDCANCEL)
>     {
>         MsiLogWrapper(L"User cancellation is detected!");
>         return ERROR_USER_EXIT;
>     }
>     else
>     {
>         MsiLogWrapper(L"MsiProcessMessage() returned %d", retVal);
>     }
>     ...
> }
>
> The problem is that the value returned by MsiProcessMessage() is always 0.
> And I've confirmed that the installation was cancelled during the
> SomeLongOperation() was running,and the string L"Some Message" is properly
> logged. What is wrong in this
> case? am I missing anything? The CA is scheduled to be a deferred and
> no-impersonate action.
> I wanted to detect it so that I could return ERROR_USER_EXIT from the CA.
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/blackberry
> _______________________________________________
> WiX-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>  

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users