当前位置: 首页>>代码示例>>C++>>正文


C++ ExitFunction函数代码示例

本文整理汇总了C++中ExitFunction函数的典型用法代码示例。如果您正苦于以下问题:C++ ExitFunction函数的具体用法?C++ ExitFunction怎么用?C++ ExitFunction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ExitFunction函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CompareBinding

BOOL CompareBinding(
    __in IAppHostElement* pBinding,
    __in LPVOID pContext
    )
{
    BOOL fFound = FALSE;
    HRESULT hr = S_OK;
    LPWSTR pwzBindingInfo = NULL;
    SCA_WEB7* psw = (SCA_WEB7*)pContext;

    hr = Iis7GetPropertyString(pBinding, IIS_CONFIG_BINDINGINFO, &pwzBindingInfo);
    ExitOnFailure(hr, "Failed to get bindinginfo for binding element");

    LPWSTR pwzExists = pwzBindingInfo;
    // Break down the address into its constituent parts (IP:Port:Header).
    // Taken from IIS6 CA code for compatibility
    while (S_OK == hr && *pwzExists)
    {
        LPCWSTR pwzIPExists = pwzExists;
        pwzExists = const_cast<LPWSTR>(wcsstr(pwzIPExists, L":"));
        if (NULL == pwzExists)
        {
            ExitFunction();
        }
        *pwzExists = L'\0';

        LPCWSTR pwzPortExists = pwzExists + 1;
        pwzExists = const_cast<LPWSTR>(wcsstr(pwzPortExists, L":"));
        if (NULL == pwzExists)
        {
            ExitFunction();
        }
        *pwzExists = L'\0';
        int iPortExists = wcstol(pwzPortExists, NULL, 10);

        LPCWSTR pwzHeaderExists = pwzExists + 1;

        BOOL fIpMatches = (0 == lstrcmpW(psw->swaBinding.wzIP, pwzIPExists));   // Explicit IP match
        fIpMatches |= (0 == lstrcmpW(psw->swaBinding.wzIP, L"*"));              // Authored * matches any IP
        fIpMatches |= ('\0' != psw->swaBinding.wzIP) &&                         // Unauthored IP
                      (0 == lstrcmpW(pwzIPExists, L"*"));                       // matches the All Unassigned IP : '*'

        // compare the passed in address with the address listed for this web
        if (fIpMatches && psw->swaBinding.iPort == iPortExists &&
            0 == lstrcmpW(psw->swaBinding.wzHeader, pwzHeaderExists))
        {
            fFound = TRUE;
            break;
        }

        // move to the next block of data, this may move beyond the available
        // data and exit the while loop above.
        pwzExists = const_cast<LPWSTR>(pwzHeaderExists + lstrlenW(pwzHeaderExists));
    }

LExit:
    WcaLog(LOGMSG_VERBOSE, "Site with binding %ls %s a match", pwzBindingInfo, fFound ? "is" : "is not");
    ReleaseNullStr(pwzBindingInfo);
    return fFound;
}
开发者ID:BMurri,项目名称:wix3,代码行数:60,代码来源:scaweb7.cpp

示例2: GetCurrentFirewallProfile

/******************************************************************
 GetCurrentFirewallProfile - get the active firewall profile as an
   INetFwProfile, which owns the lists of exceptions we're 
   updating.

********************************************************************/
static HRESULT GetCurrentFirewallProfile(
    __in BOOL fIgnoreFailures,
    __out INetFwProfile** ppfwProfile
    )
{
    HRESULT hr = S_OK;
    INetFwMgr* pfwMgr = NULL;
    INetFwPolicy* pfwPolicy = NULL;
    INetFwProfile* pfwProfile = NULL;
    *ppfwProfile = NULL;
    
    do
    {
        ReleaseNullObject(pfwPolicy);
        ReleaseNullObject(pfwMgr);
        ReleaseNullObject(pfwProfile);

        if (SUCCEEDED(hr = ::CoCreateInstance(__uuidof(NetFwMgr), NULL, CLSCTX_INPROC_SERVER, __uuidof(INetFwMgr), (void**)&pfwMgr)) &&
            SUCCEEDED(hr = pfwMgr->get_LocalPolicy(&pfwPolicy)) &&
            SUCCEEDED(hr = pfwPolicy->get_CurrentProfile(&pfwProfile)))
        {
            break;
        }
        else if (fIgnoreFailures)
        {
            ExitFunction1(hr = S_FALSE);
        }
        else
        {
            WcaLog(LOGMSG_STANDARD, "Failed to connect to Windows Firewall");
            UINT er = WcaErrorMessage(msierrFirewallCannotConnect, hr, INSTALLMESSAGE_ERROR | MB_ABORTRETRYIGNORE, 0);
            switch (er)
            {
            case IDABORT: // exit with the current HRESULT
                ExitFunction();
            case IDRETRY: // clean up and retry the loop
                hr = S_FALSE;
                break;
            case IDIGNORE: // pass S_FALSE back to the caller, who knows how to ignore the failure
                ExitFunction1(hr = S_FALSE);
            default: // No UI, so default is to fail.
                ExitFunction();
            }
        }
    } while (S_FALSE == hr);

    *ppfwProfile = pfwProfile;
    pfwProfile = NULL;
    
LExit:
    ReleaseObject(pfwPolicy);
    ReleaseObject(pfwMgr);
    ReleaseObject(pfwProfile);

    return hr;
}
开发者ID:BobSilent,项目名称:wix3,代码行数:62,代码来源:firewall.cpp

示例3: RedirectLoggingOverPipe

static HRESULT DAPI RedirectLoggingOverPipe(
    __in_z LPCSTR szString,
    __in_opt LPVOID pvContext
    )
{
    static BOOL s_fCurrentlyLoggingToPipe = FALSE;

    HRESULT hr = S_OK;
    BURN_ENGINE_STATE* pEngineState = static_cast<BURN_ENGINE_STATE*>(pvContext);
    BOOL fStartedLogging = FALSE;
    HANDLE hPipe = INVALID_HANDLE_VALUE;
    BYTE* pbData = NULL;
    SIZE_T cbData = 0;
    DWORD dwResult = 0;

    // Prevent this function from being called recursively.
    if (s_fCurrentlyLoggingToPipe)
    {
        ExitFunction();
    }

    s_fCurrentlyLoggingToPipe = TRUE;
    fStartedLogging = TRUE;

    // Make sure the current thread set the pipe in TLS.
    hPipe = ::TlsGetValue(pEngineState->dwElevatedLoggingTlsId);
    if (!hPipe || INVALID_HANDLE_VALUE == hPipe)
    {
        hr = HRESULT_FROM_WIN32(ERROR_PIPE_NOT_CONNECTED);
        ExitFunction();
    }

    // Do not log or use ExitOnFailure() macro here because they will be discarded
    // by the recursive block at the top of this function.
    hr = BuffWriteStringAnsi(&pbData, &cbData, szString);
    if (SUCCEEDED(hr))
    {
        hr = PipeSendMessage(hPipe, static_cast<DWORD>(BURN_PIPE_MESSAGE_TYPE_LOG), pbData, cbData, NULL, NULL, &dwResult);
        if (SUCCEEDED(hr))
        {
            hr = (HRESULT)dwResult;
        }
    }

LExit:
    ReleaseBuffer(pbData);

    // We started logging so remember to say we are no longer logging.
    if (fStartedLogging)
    {
        s_fCurrentlyLoggingToPipe = FALSE;
    }

    return hr;
}
开发者ID:Alyoshak,项目名称:wix3,代码行数:55,代码来源:engine.cpp

示例4: ApprovedExesVerifySecureLocation

extern "C" HRESULT ApprovedExesVerifySecureLocation(
    __in BURN_VARIABLES* pVariables,
    __in BURN_LAUNCH_APPROVED_EXE* pLaunchApprovedExe
    )
{
    HRESULT hr = S_OK;
    LPWSTR scz = NULL;

    const LPCWSTR vrgSecureFolderVariables[] = {
        L"ProgramFiles64Folder",
        L"ProgramFilesFolder",
    };

    for (DWORD i = 0; i < countof(vrgSecureFolderVariables); ++i)
    {
        LPCWSTR wzSecureFolderVariable = vrgSecureFolderVariables[i];

        hr = VariableGetString(pVariables, wzSecureFolderVariable, &scz);
        if (SUCCEEDED(hr))
        {
            hr = PathDirectoryContainsPath(scz, pLaunchApprovedExe->sczExecutablePath);
            if (S_OK == hr)
            {
                ExitFunction();
            }
        }
        else if (E_NOTFOUND != hr)
        {
            ExitOnFailure1(hr, "Failed to get the variable: %ls", wzSecureFolderVariable);
        }
    }

    // The problem with using a Variable for the root package cache folder is that it might not have been secured yet.
    // Getting it through CacheGetRootCompletedPath makes sure it has been secured.
    hr = CacheGetRootCompletedPath(TRUE, TRUE, &scz);
    ExitOnFailure(hr, "Failed to get the root package cache folder.");

    hr = PathDirectoryContainsPath(scz, pLaunchApprovedExe->sczExecutablePath);
    if (S_OK == hr)
    {
        ExitFunction();
    }

    hr = S_FALSE;

LExit:
    ReleaseStr(scz);

    return hr;
}
开发者ID:BMurri,项目名称:wix3,代码行数:50,代码来源:approvedexe.cpp

示例5: DAPI_

DAPI_(HRESULT) JsonReadNext(
    __in JSON_READER* pReader,
    __out JSON_TOKEN* pToken,
    __out JSON_VALUE* pValue
    )
{
    HRESULT hr = S_OK;
    //WCHAR wz;
    //JSON_TOKEN token = JSON_TOKEN_NONE;

    ::EnterCriticalSection(&pReader->cs);

    hr = NextToken(pReader, pToken);
    if (E_NOMOREITEMS == hr)
    {
        ExitFunction();
    }
    ExitOnFailure(hr, "Failed to get next token.");

    if (JSON_TOKEN_VALUE == *pToken)
    {
        hr = JsonReadValue(pReader, pValue);
    }
    else
    {
        ++pReader->pwz;
    }

LExit:
    ::LeaveCriticalSection(&pReader->cs);
    return hr;
}
开发者ID:AnalogJ,项目名称:Wix3.6Toolset,代码行数:32,代码来源:jsonutil.cpp

示例6: CpiRemoveUserCollectionObject

HRESULT CpiRemoveUserCollectionObject(
	ICatalogCollection* piColl,
	PSID pSid
	)
{
	HRESULT hr = S_OK;

	int i = 0;

	// find index
	hr = FindUserCollectionObjectIndex(piColl, pSid, &i);
	ExitOnFailure(hr, "Failed to find user collection index");

	if (S_FALSE == hr)
		ExitFunction(); // not found, exit with hr = S_FALSE

	// remove object
	hr = piColl->Remove(i);
	ExitOnFailure(hr, "Failed to remove object from collection");

	hr = S_OK;

LExit:
	return hr;
}
开发者ID:AnalogJ,项目名称:Wix3.6Toolset,代码行数:25,代码来源:cpiutilexec.cpp

示例7: FindObjectForApplicationRole

static HRESULT FindObjectForApplicationRole(
    CPI_APPLICATION_ROLE* pItm,
    ICatalogObject** ppiRoleObj
    )
{
    HRESULT hr = S_OK;

    ICatalogCollection* piRoleColl = NULL;

    // get roles collection
    hr = CpiGetRolesCollForApplication(pItm->pApplication, &piRoleColl);
    ExitOnFailure(hr, "Failed to get collection");

    if (S_FALSE == hr)
        ExitFunction(); // exit with hr = S_FALSE

    // find role object
    hr = CpiFindCollectionObject(piRoleColl, NULL, pItm->wzName, ppiRoleObj);
    ExitOnFailure(hr, "Failed to find object");

    // exit with hr from CpiFindCollectionObject()

LExit:
    // clean up
    ReleaseObject(piRoleColl);

    return hr;
}
开发者ID:BMurri,项目名称:wix3,代码行数:28,代码来源:cpapprolesched.cpp

示例8: FindObjectForSubscription

static HRESULT FindObjectForSubscription(
    CPI_SUBSCRIPTION* pItm,
    BOOL fFindId,
    BOOL fFindName,
    ICatalogObject** ppiSubsObj
    )
{
    HRESULT hr = S_OK;

    ICatalogCollection* piSubsColl = NULL;

    // get applications collection
    hr = CpiGetSubscriptionsCollForComponent(pItm->pAssembly, pItm->pComponent, &piSubsColl);
    ExitOnFailure(hr, "Failed to get collection");

    if (S_FALSE == hr)
        ExitFunction(); // exit with hr = S_FALSE

    // find application object
    hr = CpiFindCollectionObject(piSubsColl, fFindId ? pItm->wzID : NULL, fFindName ? pItm->wzName : NULL, ppiSubsObj);
    ExitOnFailure(hr, "Failed to find object");

    // exit with hr from CpiFindCollectionObject()

LExit:
    // clean up
    ReleaseObject(piSubsColl);

    return hr;
}
开发者ID:925coder,项目名称:wix3,代码行数:30,代码来源:cpsubssched.cpp

示例9: DatabaseListFind

HRESULT DatabaseListFind(
    __in CFGDB_STRUCT *pcdb,
    __in LPCWSTR wzFriendlyName,
    __out SCE_ROW_HANDLE *pSceRow
    )
{
    HRESULT hr = S_OK;
    SCE_QUERY_HANDLE sqhHandle = NULL;

    hr = SceBeginQuery(pcdb->psceDb, DATABASE_INDEX_TABLE, 1, &sqhHandle);
    ExitOnFailure(hr, "Failed to begin query into database index table");

    hr = SceSetQueryColumnString(sqhHandle, wzFriendlyName);
    ExitOnFailure(hr, "Failed to set query column name string to: %ls", wzFriendlyName);

    hr = SceRunQueryExact(&sqhHandle, pSceRow);
    if (E_NOTFOUND == hr)
    {
        // Don't pollute our log with unnecessary messages
        ExitFunction();
    }
    ExitOnFailure(hr, "Failed to query for database '%ls' in database list", wzFriendlyName);

LExit:
    ReleaseSceQuery(sqhHandle);

    return hr;
}
开发者ID:firegiant,项目名称:wix4,代码行数:28,代码来源:dblist.cpp

示例10: RemoveApplicationExceptionFromCurrentProfile

/******************************************************************
 RemoveApplicationExceptionFromCurrentProfile

********************************************************************/
static HRESULT RemoveApplicationExceptionFromCurrentProfile(
    __in LPCWSTR wzFile, 
    __in BOOL fIgnoreFailures
    )
{
    HRESULT hr = S_OK;
    INetFwProfile* pfwProfile = NULL;
    INetFwAuthorizedApplications* pfwApps = NULL;

    // convert to BSTRs to make COM happy
    BSTR bstrFile = ::SysAllocString(wzFile);
    ExitOnNull(bstrFile, hr, E_OUTOFMEMORY, "failed SysAllocString for path");

    // get the firewall profile, which is our entry point for removing exceptions
    hr = GetCurrentFirewallProfile(fIgnoreFailures, &pfwProfile);
    ExitOnFailure(hr, "failed to get firewall profile");
    if (S_FALSE == hr) // user or package author chose to ignore missing firewall
    {
        ExitFunction();
    }

    // now get the list of app exceptions and remove the one
    hr = pfwProfile->get_AuthorizedApplications(&pfwApps);
    ExitOnFailure(hr, "failed to get list of authorized apps");

    hr = pfwApps->Remove(bstrFile);
    ExitOnFailure(hr, "failed to remove authorized app");

LExit:
    ReleaseBSTR(bstrFile);
    ReleaseObject(pfwApps);
    ReleaseObject(pfwProfile);

    return fIgnoreFailures ? S_OK : hr;
}
开发者ID:BobSilent,项目名称:wix3,代码行数:39,代码来源:firewall.cpp

示例11: RemovePortExceptionFromCurrentProfile

/******************************************************************
 RemovePortExceptionFromCurrentProfile

********************************************************************/
static HRESULT RemovePortExceptionFromCurrentProfile(
    __in int iPort,
    __in int iProtocol,
    __in BOOL fIgnoreFailures
    )
{
    HRESULT hr = S_OK;
    INetFwProfile* pfwProfile = NULL;
    INetFwOpenPorts* pfwPorts = NULL;

    // get the firewall profile, which is our entry point for adding exceptions
    hr = GetCurrentFirewallProfile(fIgnoreFailures, &pfwProfile);
    ExitOnFailure(hr, "failed to get firewall profile");
    if (S_FALSE == hr) // user or package author chose to ignore missing firewall
    {
        ExitFunction();
    }

    hr = pfwProfile->get_GloballyOpenPorts(&pfwPorts);
    ExitOnFailure(hr, "failed to get open ports");

    hr = pfwPorts->Remove(iPort, static_cast<NET_FW_IP_PROTOCOL>(iProtocol));
    ExitOnFailure2(hr, "failed to remove open port %d, protocol %d", iPort, iProtocol);

LExit:
    return fIgnoreFailures ? S_OK : hr;
}
开发者ID:BobSilent,项目名称:wix3,代码行数:31,代码来源:firewall.cpp

示例12: DatabaseListDelete

extern "C" HRESULT DatabaseListDelete(
    __in CFGDB_STRUCT *pcdb,
    __in LPCWSTR wzFriendlyName
    )
{
    HRESULT hr = S_OK;
    SCE_QUERY_HANDLE sqhHandle = NULL;
    SCE_ROW_HANDLE sceRow = NULL;

    hr = DatabaseListFind(pcdb, wzFriendlyName, &sceRow);
    if (E_NOTFOUND == hr)
    {
        ExitFunction();
    }
    ExitOnFailure(hr, "Failed to search for database '%ls' in database list", wzFriendlyName);

    hr = SceDeleteRow(&sceRow);
    ExitOnFailure(hr, "Failed to delete database '%ls' from database list", wzFriendlyName);

LExit:
    ReleaseSceRow(sceRow);
    ReleaseSceQuery(sqhHandle);

    return hr;
}
开发者ID:firegiant,项目名称:wix4,代码行数:25,代码来源:dblist.cpp

示例13: RemoveException

/******************************************************************
 RemoveException - Removes the exception rule with the given name.

********************************************************************/
static HRESULT RemoveException(
    __in LPCWSTR wzName, 
    __in BOOL fIgnoreFailures
    )
{
    HRESULT hr = S_OK;;
    INetFwRules* pNetFwRules = NULL;

    // convert to BSTRs to make COM happy
    BSTR bstrName = ::SysAllocString(wzName);
    ExitOnNull(bstrName, hr, E_OUTOFMEMORY, "failed SysAllocString for path");

    // get the collection of firewall rules
    hr = GetFirewallRules(fIgnoreFailures, &pNetFwRules);
    ExitOnFailure(hr, "failed to get firewall rules object");
    if (S_FALSE == hr) // user or package author chose to ignore missing firewall
    {
        ExitFunction();
    }

    hr = pNetFwRules->Remove(bstrName);
    ExitOnFailure(hr, "failed to remove authorized app");

LExit:
    ReleaseBSTR(bstrName);
    ReleaseObject(pNetFwRules);

    return fIgnoreFailures ? S_OK : hr;
}
开发者ID:BobSilent,项目名称:wix3,代码行数:33,代码来源:firewall.cpp

示例14: AddPortException

/******************************************************************
 AddPortException

********************************************************************/
static HRESULT AddPortException(
    __in LPCWSTR wzName,
    __in int iProfile,
    __in_opt LPCWSTR wzRemoteAddresses,
    __in BOOL fIgnoreFailures,
    __in LPCWSTR wzPort,
    __in int iProtocol,
    __in LPCWSTR wzDescription
    )
{
    HRESULT hr = S_OK;
    BSTR bstrName = NULL;
    INetFwRules* pNetFwRules = NULL;
    INetFwRule* pNetFwRule = NULL;

    // convert to BSTRs to make COM happy
    bstrName = ::SysAllocString(wzName);
    ExitOnNull(bstrName, hr, E_OUTOFMEMORY, "failed SysAllocString for name");

    // get the collection of firewall rules
    hr = GetFirewallRules(fIgnoreFailures, &pNetFwRules);
    ExitOnFailure(hr, "failed to get firewall rules object");
    if (S_FALSE == hr) // user or package author chose to ignore missing firewall
    {
        ExitFunction();
    }

    // try to find it (i.e., support reinstall)
    hr = pNetFwRules->Item(bstrName, &pNetFwRule);
    if (HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) == hr)
    {
        hr = CreateFwRuleObject(bstrName, iProfile, wzRemoteAddresses, wzPort, iProtocol, wzDescription, &pNetFwRule);
        ExitOnFailure(hr, "failed to create FwRule object");

        // enable it
        hr = pNetFwRule->put_Enabled(VARIANT_TRUE);
        ExitOnFailure(hr, "failed to to enable port exception");

        // add it to the list of authorized ports
        hr = pNetFwRules->Add(pNetFwRule);
        ExitOnFailure(hr, "failed to add app to the authorized ports list");
    }
    else
    {
        // we found an existing port exception (if we succeeded, that is)
        ExitOnFailure(hr, "failed trying to find existing port rule");

        // enable it (just in case it was disabled)
        pNetFwRule->put_Enabled(VARIANT_TRUE);
    }

LExit:
    ReleaseBSTR(bstrName);
    ReleaseObject(pNetFwRules);
    ReleaseObject(pNetFwRule);

    return fIgnoreFailures ? S_OK : hr;
}
开发者ID:BobSilent,项目名称:wix3,代码行数:62,代码来源:firewall.cpp

示例15: CatalogsParseFromXml

extern "C" HRESULT CatalogsParseFromXml(
    __in BURN_CATALOGS* pCatalogs,
    __in IXMLDOMNode* pixnBundle
    )
{
    HRESULT hr = S_OK;
    IXMLDOMNodeList* pixnNodes = NULL;
    IXMLDOMNode* pixnNode = NULL;
    DWORD cNodes = 0;
    LPWSTR scz = NULL;

    // select catalog nodes
    hr = XmlSelectNodes(pixnBundle, L"Catalog", &pixnNodes);
    ExitOnFailure(hr, "Failed to select catalog nodes.");

    // get catalog node count
    hr = pixnNodes->get_length((long*)&cNodes);
    ExitOnFailure(hr, "Failed to get payload node count.");
    if (!cNodes)
    {
        ExitFunction();
    }

    // allocate memory for catalogs
    pCatalogs->rgCatalogs = (BURN_CATALOG*)MemAlloc(sizeof(BURN_CATALOG) * cNodes, TRUE);
    ExitOnNull(pCatalogs->rgCatalogs, hr, E_OUTOFMEMORY, "Failed to allocate memory for payload structs.");

    pCatalogs->cCatalogs = cNodes;

    // parse catalog elements
    for (DWORD i = 0; i < cNodes; ++i)
    {
        BURN_CATALOG* pCatalog = &pCatalogs->rgCatalogs[i];
        pCatalog->hFile = INVALID_HANDLE_VALUE;

        hr = XmlNextElement(pixnNodes, &pixnNode, NULL);
        ExitOnFailure(hr, "Failed to get next node.");

        // @Id
        hr = XmlGetAttributeEx(pixnNode, L"Id", &pCatalog->sczKey);
        ExitOnFailure(hr, "Failed to get @Id.");

        // @Payload
        hr = XmlGetAttributeEx(pixnNode, L"Payload", &pCatalog->sczPayload);
        ExitOnFailure(hr, "Failed to get @Payload.");

        // prepare next iteration
        ReleaseNullObject(pixnNode);
    }

LExit:
    ReleaseObject(pixnNodes);
    ReleaseObject(pixnNode);
    ReleaseStr(scz);

    return hr;
}
开发者ID:lukaswinzenried,项目名称:WixCustBa,代码行数:57,代码来源:catalog.cpp


注:本文中的ExitFunction函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。