本文整理汇总了C++中ExitOnNull函数的典型用法代码示例。如果您正苦于以下问题:C++ ExitOnNull函数的具体用法?C++ ExitOnNull怎么用?C++ ExitOnNull使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ExitOnNull函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: WcaGetRecordFormattedString
/********************************************************************
WcaGetRecordFormattedString() - gets formatted string filed from record
********************************************************************/
extern "C" HRESULT WIXAPI WcaGetRecordFormattedString(
__in MSIHANDLE hRec,
__in UINT uiField,
__inout LPWSTR* ppwzData
)
{
if (!hRec || !ppwzData)
{
return E_INVALIDARG;
}
HRESULT hr = S_OK;
UINT er;
DWORD_PTR cch = 0;
PMSIHANDLE hRecFormat;
// get the format string
hr = WcaGetRecordString(hRec, uiField, ppwzData);
ExitOnFailure(hr, "failed to get string from record");
if (!**ppwzData)
{
ExitFunction();
}
// hide the nulls '[~]' so we can get them back after formatting
HideNulls(*ppwzData);
// set up the format record
hRecFormat = ::MsiCreateRecord(1);
ExitOnNull(hRecFormat, hr, E_UNEXPECTED, "Failed to create record to format string");
hr = WcaSetRecordString(hRecFormat, 0, *ppwzData);
ExitOnFailure(hr, "failed to set string to format record");
// format the string
hr = StrMaxLength(*ppwzData, &cch);
ExitOnFailure(hr, "failed to get max length of string");
er = ::MsiFormatRecordW(WcaGetInstallHandle(), hRecFormat, *ppwzData, (DWORD*)&cch);
if (ERROR_MORE_DATA == er)
{
hr = StrAlloc(ppwzData, ++cch);
ExitOnFailure(hr, "Failed to allocate memory for record string");
er = ::MsiFormatRecordW(WcaGetInstallHandle(), hRecFormat, *ppwzData, (DWORD*)&cch);
}
ExitOnWin32Error(er, hr, "Failed to format string");
// put the nulls back
RevealNulls(*ppwzData);
LExit:
return hr;
}
开发者ID:lukaswinzenried,项目名称:WixCustBa,代码行数:58,代码来源:wcawrap.cpp
示例2: UpdateThreadCheck
extern "C" HRESULT WINAPI UpdateThreadCheck(
__in LPCWSTR wzAppId,
__in BOOL fTryExecuteUpdate
)
{
HRESULT hr = S_OK;
BOOL fLocked = FALSE;
BACKGROUND_UPDATE_THREAD_CONTEXT* pContext = NULL;
::EnterCriticalSection(&vUpdateThreadLock);
fLocked = TRUE;
if (vhUpdateThread)
{
DWORD er = ::WaitForSingleObject(vhUpdateThread, 0);
if (WAIT_OBJECT_0 == er)
{
::CloseHandle(vhUpdateThread);
vhUpdateThread = NULL;
}
else
{
hr = S_FALSE;
ExitFunction();
}
}
pContext = static_cast<BACKGROUND_UPDATE_THREAD_CONTEXT*>(MemAlloc(sizeof(BACKGROUND_UPDATE_THREAD_CONTEXT), TRUE));
ExitOnNull(pContext, hr, E_OUTOFMEMORY, "Failed to allocate memory for context.");
hr= StrAllocString(&pContext->pwzApplicationId, wzAppId, 0);
ExitOnFailure(hr, "Failed to copy app id into context.");
pContext->fExecuteUpdate = fTryExecuteUpdate;
vhUpdateThread = ::CreateThread(NULL, 0, BackgroundUpdateThread, reinterpret_cast<LPVOID>(pContext), 0, NULL);
ExitOnNullWithLastError(vhUpdateThread, hr, "Failed to create background update thread.");
pContext = NULL;
LExit:
if (pContext)
{
ReleaseStr(pContext->pwzApplicationId);
MemFree(pContext);
}
if (fLocked)
{
::LeaveCriticalSection(&vUpdateThreadLock);
}
return hr;
}
开发者ID:AnalogJ,项目名称:Wix3.6Toolset,代码行数:54,代码来源:UpdateThread.cpp
示例3: CpiGetCatalogCollection
HRESULT CpiGetCatalogCollection(
ICatalogCollection* piColl,
ICatalogObject* piObj,
LPCWSTR pwzName,
ICatalogCollection** ppiColl
)
{
HRESULT hr = S_OK;
ICOMAdminCatalog* piCatalog = NULL;
IDispatch* piDisp = NULL;
BSTR bstrName = NULL;
VARIANT vtKey;
::VariantInit(&vtKey);
// copy name string
bstrName = ::SysAllocString(pwzName);
ExitOnNull(bstrName, hr, E_OUTOFMEMORY, "Failed to allocate BSTR for collection name");
// get catalog
hr = CpiGetAdminCatalog(&piCatalog);
ExitOnFailure(hr, "Failed to get COM+ admin catalog");
// get key
hr = piObj->get_Key(&vtKey);
ExitOnFailure(hr, "Failed to get object key");
// get collecton from catalog
hr = piColl->GetCollection(bstrName, vtKey, &piDisp);
ExitOnFailure(hr, "Failed to get collection");
hr = piDisp->QueryInterface(IID_ICatalogCollection, (void**)ppiColl);
ExitOnFailure(hr, "Failed to get IID_ICatalogCollection interface");
// populate collection
hr = (*ppiColl)->Populate();
if (COMADMIN_E_OBJECTERRORS == hr)
CpiLogCatalogErrorInfo();
ExitOnFailure(hr, "Failed to populate collection");
hr = S_OK;
LExit:
// clean up
ReleaseObject(piCatalog);
ReleaseObject(piDisp);
ReleaseBSTR(bstrName);
::VariantClear(&vtKey);
return hr;
}
开发者ID:AnalogJ,项目名称:Wix3.6Toolset,代码行数:53,代码来源:cpiutilexec.cpp
示例4: AddFilterToList
// private helper functions
static HRESULT AddFilterToList(SCA_FILTER** ppsfList)
{
HRESULT hr = S_OK;
SCA_FILTER* psf = (SCA_FILTER*)MemAlloc(sizeof(SCA_FILTER), TRUE);
ExitOnNull(psf, hr, E_OUTOFMEMORY, "failed to add filter to filter list");
psf->psfNext = *ppsfList;
*ppsfList = psf;
LExit:
return hr;
}
开发者ID:sillsdev,项目名称:FwSupportTools,代码行数:13,代码来源:scafilter.cpp
示例5: MqiInitialize
HRESULT MqiInitialize()
{
HRESULT hr = S_OK;
// load mqrt.dll
ghMQRT = ::LoadLibraryW(L"mqrt.dll");
ExitOnNull(ghMQRT, hr, E_FAIL, "Failed to load mqrt.dll");
// get MQCreateQueue function address
gpfnMQCreateQueue = (MQCreateQueueFunc)::GetProcAddress(ghMQRT, "MQCreateQueue");
ExitOnNull(gpfnMQCreateQueue, hr, HRESULT_FROM_WIN32(::GetLastError()), "Failed get address for MQCreateQueue() function");
// get MQDeleteQueue function address
gpfnMQDeleteQueue = (MQDeleteQueueFunc)::GetProcAddress(ghMQRT, "MQDeleteQueue");
ExitOnNull(gpfnMQDeleteQueue, hr, HRESULT_FROM_WIN32(::GetLastError()), "Failed get address for MQDeleteQueue() function");
// get MQPathNameToFormatName function address
gpfnMQPathNameToFormatName = (MQPathNameToFormatNameFunc)::GetProcAddress(ghMQRT, "MQPathNameToFormatName");
ExitOnNull(gpfnMQPathNameToFormatName, hr, HRESULT_FROM_WIN32(::GetLastError()), "Failed get address for MQPathNameToFormatName() function");
// get MQGetQueueSecurity function address
gpfnMQGetQueueSecurity = (MQGetQueueSecurityFunc)::GetProcAddress(ghMQRT, "MQGetQueueSecurity");
ExitOnNull(gpfnMQGetQueueSecurity, hr, HRESULT_FROM_WIN32(::GetLastError()), "Failed get address for MQGetQueueSecurity() function");
// get MQSetQueueSecurity function address
gpfnMQSetQueueSecurity = (MQSetQueueSecurityFunc)::GetProcAddress(ghMQRT, "MQSetQueueSecurity");
ExitOnNull(gpfnMQSetQueueSecurity, hr, HRESULT_FROM_WIN32(::GetLastError()), "Failed get address for MQSetQueueSecurity() function");
hr = S_OK;
LExit:
return hr;
}
开发者ID:AnalogJ,项目名称:Wix3.6Toolset,代码行数:33,代码来源:mqiexec.cpp
示例6: AddWebErrorToList
static HRESULT AddWebErrorToList(SCA_WEB_ERROR** ppsweList)
{
HRESULT hr = S_OK;
SCA_WEB_ERROR* pswe = static_cast<SCA_WEB_ERROR*>(MemAlloc(sizeof(SCA_WEB_ERROR), TRUE));
ExitOnNull(pswe, hr, E_OUTOFMEMORY, "failed to allocate memory for new web error list element");
pswe->psweNext = *ppsweList;
*ppsweList = pswe;
LExit:
return hr;
}
开发者ID:925coder,项目名称:wix3,代码行数:13,代码来源:scaweberr.cpp
示例7: NewSqlStr
static HRESULT NewSqlStr(
__out SCA_SQLSTR** ppsss
)
{
HRESULT hr = S_OK;
SCA_SQLSTR* psss = static_cast<SCA_SQLSTR*>(MemAlloc(sizeof(SCA_SQLSTR), TRUE));
ExitOnNull(psss, hr, E_OUTOFMEMORY, "failed to allocate memory for new sql string element");
*ppsss = psss;
LExit:
return hr;
}
开发者ID:BMurri,项目名称:wix3,代码行数:13,代码来源:scasqlstr.cpp
示例8: NewDb
static HRESULT NewDb(
__out SCA_DB** ppsd
)
{
HRESULT hr = S_OK;
SCA_DB* psd = static_cast<SCA_DB*>(MemAlloc(sizeof(SCA_DB), TRUE));
ExitOnNull(psd, hr, E_OUTOFMEMORY, "failed to allocate memory for new database element");
*ppsd = psd;
LExit:
return hr;
}
开发者ID:lukaswinzenried,项目名称:WixCustBa,代码行数:13,代码来源:scadb.cpp
示例9: AddMimeMapToList
static HRESULT AddMimeMapToList(SCA_MIMEMAP** ppsmmList)
{
HRESULT hr = S_OK;
SCA_MIMEMAP* psmm = static_cast<SCA_MIMEMAP*>(MemAlloc(sizeof(SCA_MIMEMAP), TRUE));
ExitOnNull(psmm, hr, E_OUTOFMEMORY, "failed to allocate memory for new mime map list element");
psmm->psmmNext = *ppsmmList;
*ppsmmList = psmm;
LExit:
return hr;
}
开发者ID:AnalogJ,项目名称:Wix3.6Toolset,代码行数:13,代码来源:scamimemap.cpp
示例10: NewAppExt
static HRESULT NewAppExt(
SCA_WEB_APPLICATION_EXTENSION** ppswappext
)
{
HRESULT hr = S_OK;
SCA_WEB_APPLICATION_EXTENSION* pswappext = (SCA_WEB_APPLICATION_EXTENSION*)MemAlloc(sizeof(SCA_WEB_APPLICATION_EXTENSION), TRUE);
ExitOnNull(pswappext, hr, E_OUTOFMEMORY, "failed to allocate memory for new web app ext element");
*ppswappext = pswappext;
LExit:
return hr;
}
开发者ID:sillsdev,项目名称:FwSupportTools,代码行数:13,代码来源:scawebappext.cpp
示例11: ParseWxlControls
static HRESULT ParseWxlControls(
__in IXMLDOMElement* pElement,
__in WIX_LOCALIZATION* pWixLoc
)
{
HRESULT hr = S_OK;
IXMLDOMNode* pixn = NULL;
IXMLDOMNodeList* pixnl = NULL;
DWORD dwIdx = 0;
hr = XmlSelectNodes(pElement, L"UI|Control", &pixnl);
ExitOnLastError(hr, "Failed to get UI child nodes of Wxl File.");
hr = pixnl->get_length(reinterpret_cast<long*>(&pWixLoc->cLocControls));
ExitOnLastError(hr, "Failed to get number of UI child nodes in Wxl File.");
if (0 < pWixLoc->cLocControls)
{
pWixLoc->rgLocControls = static_cast<LOC_CONTROL*>(MemAlloc(sizeof(LOC_CONTROL) * pWixLoc->cLocControls, TRUE));
ExitOnNull(pWixLoc->rgLocControls, hr, E_OUTOFMEMORY, "Failed to allocate memory for localized controls.");
while (S_OK == (hr = XmlNextElement(pixnl, &pixn, NULL)))
{
hr = ParseWxlControl(pixn, dwIdx, pWixLoc);
ExitOnFailure(hr, "Failed to parse localized control.");
++dwIdx;
ReleaseNullObject(pixn);
}
hr = S_OK;
ExitOnFailure(hr, "Failed to enumerate all localized controls.");
}
LExit:
if (FAILED(hr) && pWixLoc->rgLocControls)
{
for (DWORD idx = 0; idx < pWixLoc->cLocControls; ++idx)
{
ReleaseStr(pWixLoc->rgLocControls[idx].wzControl);
ReleaseStr(pWixLoc->rgLocControls[idx].wzText);
}
ReleaseMem(pWixLoc->rgLocControls);
}
ReleaseObject(pixn);
ReleaseObject(pixnl);
return hr;
}
开发者ID:925coder,项目名称:wix3,代码行数:51,代码来源:locutil.cpp
示例12: GetUserAccountName
static HRESULT GetUserAccountName(
LPCWSTR pwzKey,
LPWSTR* ppwzAccount
)
{
HRESULT hr = S_OK;
PMSIHANDLE hView, hRecKey, hRec;
LPWSTR pwzDomain = NULL;
LPWSTR pwzName = NULL;
// create parameter record
hRecKey = ::MsiCreateRecord(1);
ExitOnNull(hRecKey, hr, E_OUTOFMEMORY, "Failed to create record");
hr = WcaSetRecordString(hRecKey, 1, pwzKey);
ExitOnFailure(hr, "Failed to set record string");
// open view
hr = WcaOpenView(vcsUserQuery, &hView);
ExitOnFailure(hr, "Failed to open view on User table");
hr = WcaExecuteView(hView, hRecKey);
ExitOnFailure(hr, "Failed to execute view on User table");
// fetch record
hr = WcaFetchSingleRecord(hView, &hRec);
if (S_FALSE == hr)
ExitOnFailure(hr = HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "User not found, key: %S", pwzKey);
ExitOnFailure(hr, "Failed to fetch user record");
// get user domain
hr = WcaGetRecordFormattedString(hRec, uqDomain, &pwzDomain);
ExitOnFailure(hr, "Failed to get domain");
// get user name
hr = WcaGetRecordFormattedString(hRec, uqName, &pwzName);
ExitOnFailure(hr, "Failed to get name");
// build account name
hr = CpiBuildAccountName(pwzDomain, pwzName, ppwzAccount);
ExitOnFailure(hr, "Failed to build account name");
hr = S_OK;
LExit:
// clean up
ReleaseStr(pwzDomain);
ReleaseStr(pwzName);
return hr;
}
开发者ID:firegiant,项目名称:wix4,代码行数:51,代码来源:cputilsched.cpp
示例13: CpiResetObjectProperty
HRESULT CpiResetObjectProperty(
ICatalogCollection* piColl,
ICatalogObject* piObj,
LPCWSTR pwzPropName
)
{
HRESULT hr = S_OK;
BSTR bstrPropName = NULL;
long lChanges = 0;
VARIANT vtVal;
::VariantInit(&vtVal);
// allocate property name string
bstrPropName = ::SysAllocString(pwzPropName);
ExitOnNull(bstrPropName, hr, E_OUTOFMEMORY, "Failed to allocate deleteable property name string");
// get value
hr = piObj->get_Value(bstrPropName, &vtVal);
ExitOnFailure(hr, "Failed to get deleteable property value");
hr = ::VariantChangeType(&vtVal, &vtVal, 0, VT_BOOL);
ExitOnFailure(hr, "Failed to change variant type");
// if the deleteable property is set
if (VARIANT_FALSE == vtVal.boolVal)
{
// clear property
vtVal.boolVal = VARIANT_TRUE;
hr = piObj->put_Value(bstrPropName, vtVal);
ExitOnFailure(hr, "Failed to get property value");
// save changes
hr = piColl->SaveChanges(&lChanges);
if (COMADMIN_E_OBJECTERRORS == hr)
CpiLogCatalogErrorInfo();
ExitOnFailure(hr, "Failed to save changes");
}
hr = S_OK;
LExit:
// clean up
ReleaseBSTR(bstrPropName);
::VariantClear(&vtVal);
return hr;
}
开发者ID:AnalogJ,项目名称:Wix3.6Toolset,代码行数:51,代码来源:cpiutilexec.cpp
示例14: CabExtractWrite
static __callback UINT FAR DIAMONDAPI CabExtractWrite(__in INT_PTR hf, __in void FAR *pv, __in UINT cb)
{
HRESULT hr = S_OK;
DWORD cbWrite = 0;
ExitOnNull(hf, hr, E_INVALIDARG, "Failed to write file during cabinet extraction - no file given to write");
if (!::WriteFile(reinterpret_cast<HANDLE>(hf), pv, cb, &cbWrite, NULL))
{
ExitWithLastError(hr, "failed to write during cabinet extraction");
}
LExit:
return FAILED(hr) ? -1 : cbWrite;
}
开发者ID:BMurri,项目名称:wix3,代码行数:14,代码来源:cabutil.cpp
示例15: AddPropertyToList
static HRESULT AddPropertyToList(
SCA_PROPERTY** ppspList
)
{
HRESULT hr = S_OK;
SCA_PROPERTY* psp = static_cast<SCA_PROPERTY*>(MemAlloc(sizeof(SCA_PROPERTY), TRUE));
ExitOnNull(psp, hr, E_OUTOFMEMORY, "failed to allocate memory for new property list element");
psp->pspNext = *ppspList;
*ppspList = psp;
LExit:
return hr;
}
开发者ID:BMurri,项目名称:wix3,代码行数:14,代码来源:scaproperty.cpp
示例16: AddVirtualDirToList
static HRESULT AddVirtualDirToList(
__in SCA_VDIR** ppsvdList
)
{
HRESULT hr = S_OK;
SCA_VDIR* psvd = static_cast<SCA_VDIR*>(MemAlloc(sizeof(SCA_VDIR), TRUE));
ExitOnNull(psvd, hr, E_OUTOFMEMORY, "failed to allocate memory for new vdir list element");
psvd->psvdNext= *ppsvdList;
*ppsvdList = psvd;
LExit:
return hr;
}
开发者ID:BMurri,项目名称:wix3,代码行数:14,代码来源:scavdir.cpp
示例17: AddGroupToList
static HRESULT AddGroupToList(
__inout SCA_GROUP** ppsgList
)
{
HRESULT hr = S_OK;
SCA_GROUP* psg = static_cast<SCA_GROUP*>(MemAlloc(sizeof(SCA_GROUP), TRUE));
ExitOnNull(psg, hr, E_OUTOFMEMORY, "failed to allocate memory for new group list element");
psg->psgNext = *ppsgList;
*ppsgList = psg;
LExit:
return hr;
}
开发者ID:HesenWolfi,项目名称:wix3,代码行数:14,代码来源:scauser.cpp
示例18: AddUserToList
static HRESULT AddUserToList(
__inout SCA_USER** ppsuList
)
{
HRESULT hr = S_OK;
SCA_USER* psu = static_cast<SCA_USER*>(MemAlloc(sizeof(SCA_USER), TRUE));
ExitOnNull(psu, hr, E_OUTOFMEMORY, "failed to allocate memory for new user list element");
psu->psuNext = *ppsuList;
*ppsuList = psu;
LExit:
return hr;
}
开发者ID:HesenWolfi,项目名称:wix3,代码行数:14,代码来源:scauser.cpp
示例19: PromptToContinue
/******************************************************************
PromptToContinue - displays the prompt if the application is still
running.
******************************************************************/
static HRESULT PromptToContinue(
__in_z LPCWSTR wzApplication,
__in_z LPCWSTR wzPrompt
)
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
PMSIHANDLE hRecMessage = NULL;
DWORD *prgProcessIds = NULL;
DWORD cProcessIds = 0;
hRecMessage = ::MsiCreateRecord(1);
ExitOnNull(hRecMessage, hr, E_OUTOFMEMORY, "Failed to create record for prompt.");
er = ::MsiRecordSetStringW(hRecMessage, 0, wzPrompt);
ExitOnWin32Error(er, hr, "Failed to set prompt record field string");
do
{
hr = ProcFindAllIdsFromExeName(wzApplication, &prgProcessIds, &cProcessIds);
if (SUCCEEDED(hr) && 0 < cProcessIds)
{
er = WcaProcessMessage(static_cast<INSTALLMESSAGE>(INSTALLMESSAGE_WARNING | MB_ABORTRETRYIGNORE | MB_DEFBUTTON3 | MB_ICONWARNING), hRecMessage);
if (IDABORT == er)
{
hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT);
}
else if (IDRETRY == er)
{
hr = S_FALSE;
}
else if (IDIGNORE == er)
{
hr = S_OK;
}
else
{
ExitOnWin32Error(er, hr, "Unexpected return value from prompt to continue.");
}
}
ReleaseNullMem(prgProcessIds);
cProcessIds = 0;
} while (S_FALSE == hr);
LExit:
ReleaseMem(prgProcessIds);
return hr;
}
开发者ID:925coder,项目名称:wix3,代码行数:54,代码来源:CloseApps.cpp
示例20: AddHttpHeaderToList
static HRESULT AddHttpHeaderToList(
__in SCA_HTTP_HEADER** ppshhList
)
{
HRESULT hr = S_OK;
SCA_HTTP_HEADER* pshh = static_cast<SCA_HTTP_HEADER*>(MemAlloc(sizeof(SCA_HTTP_HEADER), TRUE));
ExitOnNull(pshh, hr, E_OUTOFMEMORY, "failed to allocate memory for new http header list element");
pshh->pshhNext = *ppshhList;
*ppshhList = pshh;
LExit:
return hr;
}
开发者ID:AnalogJ,项目名称:Wix3.6Toolset,代码行数:15,代码来源:scahttpheader7.cpp
注:本文中的ExitOnNull函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论