We are using BURN and have developed our entire installer UI using C++ / MFC.

For non-admin users who are installing our product, we would NOT want them
to navigate through our entire BURN UI Dialog sequence and then finally
click on the "Install" button, to get the UAC prompt; and then realize that
they do not have admin credentials. From a UX perspective, we would rather
prefer that the user is displayed the UAC prompt up-front, and have the user
exit the installer early, rather than he having to navigate through ALL
dialogs.

Reading through previous posts on the newsgroup, I don't think
FORCEPERMACHINE would be of any help here. So we decided to call the
Engine->Elevate method. However this method returns even before the UAC
prompt is displayed. To work around this problem which has also been
mentioned in this earlier newsgroup post titled "Managed bootstrapper;
BootstrapperApplication.Engine.Elevate()", we developed the following logic
that seems to work. 

We want to ratify from experts on this newsgroup if this approach is
appropriate.

Thank You.

NOTE :

1. For below code to work we have set FocePerMachine="yes" on our MSI
package in Bundle.wxs file. If this is NOT set then we get another UAC
prompt when MSI gets called.

2. We create our UIThreadProc from OnStartup() method.


DWORD WINAPI CCustomBA::UiThreadProc(__in LPVOID pvContext)
{
        HRESULT hr = S_OK;
        LONGLONG pllValue;
        BOOL flag = TRUE;
                
        CCustomBA* pThis = (CCustomBA*)pvContext;

        CoInitialize(NULL);

        // First check engine is elevated or NOT. If NOT , then request for
elevation.
        // "WixBundleElevated" variable will determine elevation status of the
engine.
        
        pThis->m_pEngine->GetVariableNumeric(L"WixBundleElevated",&pllValue);
        if(pllValue != 1)
        {
                pThis->m_pEngine->Elevate(NULL); // Request for elevation.
        }

        // Check for engine elevation until UAC prompt occurs and user performs
action on UAC prompt.
        
        do
        {
                
pThis->m_pEngine->GetVariableNumeric(L"WixBundleElevated",&pllValue);
                
        }while(pllValue != 1 && (FALSE == pThis->m_bErrorOccured));
        
        // If user clicks "No" on UAC then engine calls OnError() method and 
from
there we set value of the 
        // variable "m_bErrorOccured" to TRUE; to exit from do-while loop.
        
        // Now we are elevated. So we can show the UI.
}



--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/BURN-Elevate-related-question-tp7586909.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to