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


C++ ExitFunction1函数代码示例

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


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

示例1: DAPI_

DAPI_(HRESULT) PathDirectoryContainsPath(
    __in_z LPCWSTR wzDirectory,
    __in_z LPCWSTR wzPath
    )
{
    HRESULT hr = S_OK;
    LPWSTR sczPath = NULL;
    LPWSTR sczDirectory = NULL;
    LPWSTR sczOriginalPath = NULL;
    LPWSTR sczOriginalDirectory = NULL;

    hr = PathCanonicalizePath(wzPath, &sczOriginalPath);
    ExitOnFailure(hr, "Failed to canonicalize the path.");

    hr = PathCanonicalizePath(wzDirectory, &sczOriginalDirectory);
    ExitOnFailure(hr, "Failed to canonicalize the directory.");

    if (!sczOriginalPath || !*sczOriginalPath)
    {
        ExitFunction1(hr = S_FALSE);
    }
    if (!sczOriginalDirectory || !*sczOriginalDirectory)
    {
        ExitFunction1(hr = S_FALSE);
    }

    sczPath = sczOriginalPath;
    sczDirectory = sczOriginalDirectory;

    for (; *sczDirectory;)
    {
        if (!*sczPath)
        {
            ExitFunction1(hr = S_FALSE);
        }

        if (CSTR_EQUAL != ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, sczDirectory, 1, sczPath, 1))
        {
            ExitFunction1(hr = S_FALSE);
        }

        ++sczDirectory;
        ++sczPath;
    }

    --sczDirectory;
    if (('\\' == *sczDirectory && *sczPath) || '\\' == *sczPath)
    {
        hr = S_OK;
    }
    else
    {
        hr = S_FALSE;
    }

LExit:
    ReleaseStr(sczOriginalPath);
    ReleaseStr(sczOriginalDirectory);
    return hr;
}
开发者ID:BMurri,项目名称:wix3,代码行数:60,代码来源:path2utl.cpp

示例2: ReadFileAll

static HRESULT ReadFileAll(
	HANDLE hFile,
	PBYTE pbBuffer,
	DWORD dwBufferLength
	)
{
	HRESULT hr = S_OK;

	DWORD dwBytesRead;

	while (dwBufferLength)
	{
		if (!::ReadFile(hFile, pbBuffer, dwBufferLength, &dwBytesRead, NULL))
			ExitFunction1(hr = HRESULT_FROM_WIN32(::GetLastError()));

		if (0 == dwBytesRead)
			ExitFunction1(hr = HRESULT_FROM_WIN32(ERROR_HANDLE_EOF));

		dwBufferLength -= dwBytesRead;
		pbBuffer += dwBytesRead;
	}

	hr = S_OK;

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

示例3: PolcReadNumber

extern "C" HRESULT DAPI PolcReadNumber(
    __in_z LPCWSTR wzPolicyPath,
    __in_z LPCWSTR wzPolicyName,
    __in DWORD dwDefault,
    __out DWORD* pdw
    )
{
    HRESULT hr = S_OK;
    HKEY hk = NULL;

    hr = OpenPolicyKey(wzPolicyPath, &hk);
    if (E_FILENOTFOUND == hr || E_PATHNOTFOUND == hr)
    {
        ExitFunction1(hr = S_FALSE);
    }
    ExitOnFailure1(hr, "Failed to open policy key: %ls", wzPolicyPath);

    hr = RegReadNumber(hk, wzPolicyName, pdw);
    if (E_FILENOTFOUND == hr || E_PATHNOTFOUND == hr)
    {
        ExitFunction1(hr = S_FALSE);
    }
    ExitOnFailure2(hr, "Failed to open policy key: %ls, name: %ls", wzPolicyPath, wzPolicyName);

LExit:
    ReleaseRegKey(hk);

    if (S_FALSE == hr || FAILED(hr))
    {
        *pdw = dwDefault;
    }

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

示例4: 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

示例5: CpiReadRollbackDataList

HRESULT CpiReadRollbackDataList(
	HANDLE hFile,
	CPI_ROLLBACK_DATA** pprdList
	)
{
	HRESULT hr = S_OK;

	int iCount;

	CPI_ROLLBACK_DATA* pItm = NULL;

	// read count
	hr = ReadFileAll(hFile, (PBYTE)&iCount, sizeof(int));
	if (HRESULT_FROM_WIN32(ERROR_HANDLE_EOF) == hr)
		ExitFunction1(hr = S_OK); // EOF reached, nothing left to read
	ExitOnFailure(hr, "Failed to read count");

	for (int i = 0; i < iCount; i++)
	{
		// allocate new element
		pItm = (CPI_ROLLBACK_DATA*)::HeapAlloc(::GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CPI_ROLLBACK_DATA));
		if (!pItm)
			ExitFunction1(hr = E_OUTOFMEMORY);

		// read from file
		hr = ReadFileAll(hFile, (PBYTE)pItm->wzKey, MAX_DARWIN_KEY * sizeof(WCHAR));
		if (HRESULT_FROM_WIN32(ERROR_HANDLE_EOF) == hr)
			break; // EOF reached, nothing left to read
		ExitOnFailure(hr, "Failed to read key");

		hr = ReadFileAll(hFile, (PBYTE)&pItm->iStatus, sizeof(int));
		if (HRESULT_FROM_WIN32(ERROR_HANDLE_EOF) == hr)
			pItm->iStatus = 0; // EOF reached, the operation was interupted; set status to zero
		else
			ExitOnFailure(hr, "Failed to read status");

		// add to list
		if (*pprdList)
			pItm->pNext = *pprdList;
		*pprdList = pItm;
		pItm = NULL;
	}

	hr = S_OK;

LExit:
	// clean up
	if (pItm)
		CpiFreeRollbackDataList(pItm);

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

示例6: RemoveApplicationRole

static HRESULT RemoveApplicationRole(
    CPI_APPLICATION_ROLE_ATTRIBUTES* pAttrs
    )
{
    HRESULT hr = S_OK;

    ICatalogCollection* piRolesColl = NULL;

    long lChanges = 0;

    // log
    WcaLog(LOGMSG_VERBOSE, "Removing application role, key: %S", pAttrs->pwzKey);

    // get roles collection
    hr = CpiGetRolesCollection(pAttrs->pwzPartID, pAttrs->pwzAppID, &piRolesColl);
    ExitOnFailure(hr, "Failed to get roles collection");

    if (S_FALSE == hr)
    {
        // roles collection not found
        WcaLog(LOGMSG_VERBOSE, "Unable to retrieve roles collection, nothing to delete, key: %S", pAttrs->pwzKey);
        ExitFunction1(hr = S_OK);
    }

    // remove
    hr = CpiRemoveCollectionObject(piRolesColl, NULL, pAttrs->pwzName, FALSE);
    ExitOnFailure(hr, "Failed to remove role");

    if (S_FALSE == hr)
    {
        // role not found
        WcaLog(LOGMSG_VERBOSE, "Role not found, nothing to delete, key: %S", pAttrs->pwzKey);
        ExitFunction1(hr = S_OK);
    }

    // save changes
    hr = piRolesColl->SaveChanges(&lChanges);
    if (COMADMIN_E_OBJECTERRORS == hr)
        CpiLogCatalogErrorInfo();
    ExitOnFailure(hr, "Failed to save changes");

    // log
    WcaLog(LOGMSG_VERBOSE, "%d changes saved to catalog, key: %S", lChanges, pAttrs->pwzKey);

    hr = S_OK;

LExit:
    // clean up
    ReleaseObject(piRolesColl);

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

示例7: DAPI_

DAPI_(HRESULT) SrpCreateRestorePoint(
    __in_z LPCWSTR wzApplicationName,
    __in SRP_ACTION action
    )
{
    HRESULT hr = S_OK;
    RESTOREPOINTINFOW restorePoint = { };
    STATEMGRSTATUS status = { };

    if (!vpfnSRSetRestorePointW)
    {
        ExitFunction1(hr = E_NOTIMPL);
    }

    restorePoint.dwEventType = BEGIN_SYSTEM_CHANGE;
    restorePoint.dwRestorePtType = (SRP_ACTION_INSTALL == action) ? APPLICATION_INSTALL : (SRP_ACTION_UNINSTALL == action) ? APPLICATION_UNINSTALL : MODIFY_SETTINGS;
    ::StringCbCopyW(restorePoint.szDescription, sizeof(restorePoint.szDescription), wzApplicationName);

    if (!vpfnSRSetRestorePointW(&restorePoint, &status))
    {
        ExitOnWin32Error(status.nStatus, hr, "Failed to create system restore point.");
    }

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

示例8: ApprovedExesFindById

extern "C" HRESULT ApprovedExesFindById(
    __in BURN_APPROVED_EXES* pApprovedExes,
    __in_z LPCWSTR wzId,
    __out BURN_APPROVED_EXE** ppApprovedExe
    )
{
    HRESULT hr = S_OK;
    BURN_APPROVED_EXE* pApprovedExe = NULL;

    for (DWORD i = 0; i < pApprovedExes->cApprovedExes; ++i)
    {
        pApprovedExe = &pApprovedExes->rgApprovedExes[i];

        if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, pApprovedExe->sczId, -1, wzId, -1))
        {
            *ppApprovedExe = pApprovedExe;
            ExitFunction1(hr = S_OK);
        }
    }

    hr = E_NOTFOUND;

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

示例9: StrMaxLength

/********************************************************************
StrMaxLength - returns maximum number of characters that can be stored in dynamic string p

NOTE:  assumes Unicode string
********************************************************************/
extern "C" HRESULT DAPI StrMaxLength(
	__in LPVOID p,
	__out DWORD_PTR* pcch
	)
{
	Assert(pcch);
	HRESULT hr = S_OK;

	if (p)
	{
		*pcch = MemSize(p);   // get size of entire buffer
		if (-1 == *pcch)
		{
			ExitFunction1(hr = E_FAIL);
		}

		*pcch /= sizeof(WCHAR);   // reduce to count of characters
	}
	else
	{
		*pcch = 0;
	}
	Assert(S_OK == hr);

LExit:
	return hr;
}
开发者ID:sillsdev,项目名称:FwSupportTools,代码行数:32,代码来源:strutil.cpp

示例10: ConfigureSmbUninstall

/********************************************************************
ConfigureSmb - CUSTOM ACTION ENTRY POINT for installing fileshare settings

********************************************************************/
extern "C" UINT __stdcall ConfigureSmbUninstall(
    __in MSIHANDLE hInstall
    )
{
    HRESULT hr = S_OK;
    UINT er = ERROR_SUCCESS;

    SCA_SMB* pssList = NULL;

    // initialize
    hr = WcaInitialize(hInstall, "ConfigureSmbUninstall");
    ExitOnFailure(hr, "Failed to initialize");

    // check to see if necessary tables are specified
    if (WcaTableExists(L"FileShare") != S_OK)
    {
        WcaLog(LOGMSG_VERBOSE, "Skipping SMB CustomAction, no FileShare table");
        ExitFunction1(hr = S_FALSE);
    }

    hr = ScaSmbRead(&pssList);
    ExitOnFailure(hr, "failed to read FileShare table");

    hr = ScaSmbUninstall(pssList);
    ExitOnFailure(hr, "failed to uninstall FileShares");

LExit:
    if (pssList)
        ScaSmbFreeList(pssList);

    er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
    return WcaFinalize(er);
}
开发者ID:925coder,项目名称:wix3,代码行数:37,代码来源:scasched.cpp

示例11: FindEmbeddedBySourcePath

static HRESULT FindEmbeddedBySourcePath(
    __in BURN_PAYLOADS* pPayloads,
    __in_opt BURN_CONTAINER* pContainer,
    __in_z LPCWSTR wzStreamName,
    __out BURN_PAYLOAD** ppPayload
    )
{
    HRESULT hr = S_OK;

    for (DWORD i = 0; i < pPayloads->cPayloads; ++i)
    {
        BURN_PAYLOAD* pPayload = &pPayloads->rgPayloads[i];

        if (BURN_PAYLOAD_PACKAGING_EMBEDDED == pPayload->packaging && (!pContainer || pPayload->pContainer == pContainer))
        {
            if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, pPayload->sczSourcePath, -1, wzStreamName, -1))
            {
                *ppPayload = pPayload;
                ExitFunction1(hr = S_OK);
            }
        }
    }

    hr = E_NOTFOUND;

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

示例12: PayloadFindEmbeddedBySourcePath

extern "C" HRESULT PayloadFindEmbeddedBySourcePath(
    __in BURN_PAYLOADS* pPayloads,
    __in_z LPCWSTR wzStreamName,
    __out BURN_PAYLOAD** ppPayload
    )
{
    HRESULT hr = S_OK;
    BURN_PAYLOAD* pPayload = NULL;

    for (DWORD i = 0; i < pPayloads->cPayloads; ++i)
    {
        pPayload = &pPayloads->rgPayloads[i];

        if (BURN_PAYLOAD_PACKAGING_EMBEDDED == pPayload->packaging)
        {
            if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, pPayload->sczSourcePath, -1, wzStreamName, -1))
            {
                *ppPayload = pPayload;
                ExitFunction1(hr = S_OK);
            }
        }
    }

    hr = E_NOTFOUND;

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

示例13: PayloadFindById

extern "C" HRESULT PayloadFindById(
    __in BURN_PAYLOADS* pPayloads,
    __in_z LPCWSTR wzId,
    __out BURN_PAYLOAD** ppPayload
    )
{
    HRESULT hr = S_OK;
    BURN_PAYLOAD* pPayload = NULL;

    for (DWORD i = 0; i < pPayloads->cPayloads; ++i)
    {
        pPayload = &pPayloads->rgPayloads[i];

        if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, pPayload->sczKey, -1, wzId, -1))
        {
            *ppPayload = pPayload;
            ExitFunction1(hr = S_OK);
        }
    }

    hr = E_NOTFOUND;

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

示例14: Direct3DCreate9Ex

/********************************************************************
DetectWDDMDriver

 Set a property if the driver on the machine is a WDDM driver. One
 reliable way to detect the presence of a WDDM driver is to try and
 use the Direct3DCreate9Ex() function. This method attempts that
 then sets the property appropriately.
********************************************************************/
static HRESULT DetectWDDMDriver()
{
    HRESULT hr = S_OK;
    HMODULE hModule = NULL;

    // Manually load the d3d9.dll library. If the library couldn't be loaded then we obviously won't be able
    // to try calling the function so just return.
    hr = LoadSystemLibrary(L"d3d9.dll", &hModule);
    if (E_MODNOTFOUND == hr)
    {
        TraceError(hr, "Unable to load DirectX APIs, skipping WDDM driver check.");
        ExitFunction1(hr = S_OK);
    }
    ExitOnFailure(hr, "Failed to the load the existing DirectX APIs.");

    // Obtain the address of the Direct3DCreate9Ex function. If this fails we know it isn't a WDDM
    // driver so just exit.
    const void* Direct3DCreate9ExPtr = ::GetProcAddress(hModule, "Direct3DCreate9Ex");
    ExitOnNull(Direct3DCreate9ExPtr, hr, S_OK, "Unable to load Direct3DCreateEx function, so the driver is not a WDDM driver.");

    // At this point we know it's a WDDM driver so set the property.
    hr = WcaSetIntProperty(L"WIX_WDDM_DRIVER_PRESENT", 1);
    ExitOnFailure(hr, "Failed write property");

LExit:
    if (NULL != hModule)
    {
        FreeLibrary(hModule);
    }

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

示例15: LocGetControl

extern "C" HRESULT DAPI LocGetControl(
    __in const WIX_LOCALIZATION* pWixLoc,
    __in_z LPCWSTR wzId,
    __out LOC_CONTROL** ppLocControl
    )
{
    HRESULT hr = S_OK;
    LOC_CONTROL* pLocControl = NULL;

    for (DWORD i = 0; i < pWixLoc->cLocControls; ++i)
    {
        pLocControl = &pWixLoc->rgLocControls[i];

        if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, pLocControl->wzControl, -1, wzId, -1))
        {
            *ppLocControl = pLocControl;
            ExitFunction1(hr = S_OK);
        }
    }

    hr = E_NOTFOUND;

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


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