コード例 #1
0
ファイル: cppartsched.cpp プロジェクト: firegiant/wix4
HRESULT CpiPartitionUsersInstall(
    CPI_PARTITION_USER_LIST* pList,
    int iRunMode,
    LPWSTR* ppwzActionData,
    int* piProgress
    )
{
    HRESULT hr = S_OK;

    int iActionType;

    // add action text
    hr = CpiAddActionTextToActionData(L"AddComPlusPartitionUsers", ppwzActionData);
    ExitOnFailure(hr, "Failed to add action text to custom action data");

    // add partition count to action data
    hr = WcaWriteIntegerToCaData(pList->iInstallCount, ppwzActionData);
    ExitOnFailure(hr, "Failed to add count to custom action data");

    // add applications to custom action data
    for (CPI_PARTITION_USER* pItm = pList->pFirst; pItm; pItm = pItm->pNext)
    {
        // partitions that are being installed only
        if (!WcaIsInstalling(pItm->isInstalled, pItm->isAction))
            continue;

        // action type
        if (rmRollback == iRunMode)
        {
            if (CpiIsInstalled(pItm->isInstalled))
                iActionType = atNoOp;
            else
                iActionType = atRemove;
        }
        else
            iActionType = atCreate;

        // add to action data
        hr = AddPartitionUserToActionData(pItm, iActionType, COST_PARTITION_USER_CREATE, ppwzActionData);
        ExitOnFailure(hr, "Failed to add partition user to custom action data, key: %S", pItm->wzKey);
    }

    // add progress tics
    if (piProgress)
        *piProgress += COST_PARTITION_USER_CREATE * pList->iInstallCount;

    hr = S_OK;

LExit:
    return hr;
}
コード例 #2
0
ファイル: cpapprolesched.cpp プロジェクト: BMurri/wix3
HRESULT CpiUsersInApplicationRolesUninstall(
    CPI_USER_IN_APPLICATION_ROLE_LIST* pList,
    int iRunMode,
    LPWSTR* ppwzActionData,
    int* piProgress
    )
{
    HRESULT hr = S_OK;

    int iActionType;

    // add action text
    hr = CpiAddActionTextToActionData(L"RemoveUsersFromComPlusAppRoles", ppwzActionData);
    ExitOnFailure(hr, "Failed to add action text to custom action data");

    // add count to action data
    hr = WcaWriteIntegerToCaData(pList->iUninstallCount, ppwzActionData);
    ExitOnFailure(hr, "Failed to add count to custom action data");

    // add roles to custom action data
    for (CPI_USER_IN_APPLICATION_ROLE* pItm = pList->pFirst; pItm; pItm = pItm->pNext)
    {
        // roles that are being uninstalled only
        if (!WcaIsUninstalling(pItm->isInstalled, pItm->isAction))
            continue;

        // action type
        if (rmRollback == iRunMode)
            iActionType = atCreate;
        else
            iActionType = atRemove;

        // add to action data
        hr = AddUserInApplicationRoleToActionData(pItm, iActionType, COST_USER_IN_APPLICATION_ROLE_DELETE, ppwzActionData);
        ExitOnFailure1(hr, "Failed to add user in application role to custom action data, key: %S", pItm->wzKey);
    }

    // add progress tics
    if (piProgress)
        *piProgress += COST_USER_IN_APPLICATION_ROLE_DELETE * pList->iUninstallCount;

    hr = S_OK;

LExit:
    return hr;
}
コード例 #3
0
ファイル: cppartsched.cpp プロジェクト: firegiant/wix4
HRESULT CpiPartitionsUninstall(
    CPI_PARTITION_LIST* pList,
    int iRunMode,
    LPWSTR* ppwzActionData,
    int* piProgress
    )
{
    HRESULT hr = S_OK;

    int iActionType;

    // add action text
    hr = CpiAddActionTextToActionData(L"RemoveComPlusPartitions", ppwzActionData);
    ExitOnFailure(hr, "Failed to add action text to custom action data");

    // add partition count to action data
    hr = WcaWriteIntegerToCaData(pList->iUninstallCount, ppwzActionData);
    ExitOnFailure(hr, "Failed to add count to custom action data");

    // add partitions to custom action data
    for (CPI_PARTITION* pItm = pList->pFirst; pItm; pItm = pItm->pNext)
    {
        // partitions that are being uninstalled only
        if (!pItm->fHasComponent || pItm->fObjectNotFound || !WcaIsUninstalling(pItm->isInstalled, pItm->isAction))
            continue;

        // action type
        if (rmRollback == iRunMode)
            iActionType = atCreate;
        else
            iActionType = atRemove;

        // add to action data
        hr = AddPartitionToActionData(pItm, iActionType, COST_PARTITION_DELETE, ppwzActionData);
        ExitOnFailure(hr, "Failed to add partition to custom action data, key:", pItm->wzKey);
    }

    // add progress tics
    if (piProgress)
        *piProgress += COST_PARTITION_DELETE * pList->iUninstallCount;

    hr = S_OK;

LExit:
    return hr;
}
コード例 #4
0
ファイル: cpsubssched.cpp プロジェクト: 925coder/wix3
HRESULT CpiSubscriptionsInstall(
    CPI_SUBSCRIPTION_LIST* pList,
    int iRunMode,
    LPWSTR* ppwzActionData,
    int* piProgress
    )
{
    HRESULT hr = S_OK;

    int iActionType;
    int iCount = 0;

    // add action text
    hr = CpiAddActionTextToActionData(L"CreateSubscrComPlusComponents", ppwzActionData);
    ExitOnFailure(hr, "Failed to add action text to custom action data");

    // subscription count
    switch (iRunMode)
    {
    case rmDeferred:
        iCount = pList->iInstallCount - pList->iCommitCount;
        break;
    case rmCommit:
        iCount = pList->iCommitCount;
        break;
    case rmRollback:
        iCount = pList->iInstallCount;
        break;
    }

    // add subscription count to action data
    hr = WcaWriteIntegerToCaData(iCount, ppwzActionData);
    ExitOnFailure(hr, "Failed to add count to custom action data");

    // add assemblies to custom action data in forward order
    for (CPI_SUBSCRIPTION* pItm = pList->pFirst; pItm; pItm = pItm->pNext)
    {
        // roles that are being installed only
        if ((rmCommit == iRunMode && !(pItm->pAssembly->iAttributes & aaRunInCommit)) ||
            (rmDeferred == iRunMode && (pItm->pAssembly->iAttributes & aaRunInCommit)) ||
            !WcaIsInstalling(pItm->isInstalled, pItm->isAction))
            continue;

        // action type
        if (rmRollback == iRunMode)
        {
            if (CpiIsInstalled(pItm->isInstalled))
                iActionType = atNoOp;
            else
                iActionType = atRemove;
        }
        else
            iActionType = atCreate;

        // add to action data
        hr = AddSubscriptionToActionData(pItm, iActionType, COST_SUBSCRIPTION_CREATE, ppwzActionData);
        ExitOnFailure1(hr, "Failed to add subscription to custom action data, key: %S", pItm->wzKey);
    }

    // add progress tics
    if (piProgress)
        *piProgress += COST_SUBSCRIPTION_CREATE * pList->iInstallCount;

    hr = S_OK;

LExit:
    return hr;
}