本文整理汇总了C++中IEnumVARIANT::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ IEnumVARIANT::Release方法的具体用法?C++ IEnumVARIANT::Release怎么用?C++ IEnumVARIANT::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEnumVARIANT
的用法示例。
在下文中一共展示了IEnumVARIANT::Release方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
DEFINE_FINALIZE() {
// if ( obj == jl::Host::getJLHost(fop->runtime()).getCachedProto(JL_THIS_CLASS_NAME) ) // we are finilizing the prototype ?
// return;
IEnumVARIANT *ienumv = (IEnumVARIANT*)JL_GetPrivateFromFinalize(obj);
if ( !ienumv )
return;
ienumv->Release();
}
示例2: UpdateInfo
/**
* @brief Updates information about port maps on router.
*/
void UpnpNatAction::UpdateInfo()
{
HRESULT hResult;
// Cleanup old port map in case this is an update
CleanPortMaps();
// Retrieve current port mappings
hResult = nat->get_StaticPortMappingCollection(&portMapCollection);
_ErrorException((hResult != S_OK), "retrieving current port mappings (!= S_OK)", hResult, __LINE__, __FILE__);
_ErrorException((portMapCollection == NULL), "retrieving current port mappings (NULL)", NULL, __LINE__, __FILE__);
// Scan through list and load port maps into vector
// Code is based on MSDN sample
IUnknown * ptrUnk = NULL;
hResult = portMapCollection->get__NewEnum(&ptrUnk);
if (SUCCEEDED(hResult))
{
IEnumVARIANT * ptrEnumVar = NULL;
hResult = ptrUnk->QueryInterface(IID_IEnumVARIANT, (void **) &ptrEnumVar);
if (SUCCEEDED(hResult))
{
VARIANT varCurDevice;
VariantInit(&varCurDevice);
ptrEnumVar->Reset();
// Loop through each port map in the collection
while (S_OK == ptrEnumVar->Next(1, &varCurDevice, NULL))
{
IStaticPortMapping * ptrPortMap = NULL;
IDispatch * pdispDevice = V_DISPATCH(&varCurDevice);
if (SUCCEEDED(pdispDevice->QueryInterface(IID_IStaticPortMapping, (void **) &ptrPortMap)))
{
// Add port map to vector
UpnpNatPortMapAction * newPortMap = new (nothrow)UpnpNatPortMapAction(ptrPortMap);
Utility::DynamicAllocCheck(newPortMap,__LINE__,__FILE__);
portMaps.Add(newPortMap);
}
VariantClear(&varCurDevice);
}
ptrEnumVar->Release();
}
ptrUnk->Release();
}
}
示例3: VerifyIntegerEnumeration
extern "C" DLL_EXPORT HRESULT STDMETHODCALLTYPE VerifyIntegerEnumeration(IDispatch* pDisp, int start, int count)
{
DISPPARAMS params{};
VARIANT result;
HRESULT hr = pDisp->Invoke(
DISPID_NEWENUM,
IID_NULL,
LOCALE_USER_DEFAULT,
DISPATCH_METHOD | DISPATCH_PROPERTYGET,
¶ms,
&result,
NULL,
NULL
);
if (FAILED(hr))
{
return hr;
}
if(!((V_VT(&result) == VT_UNKNOWN) || (V_VT(&result) == VT_DISPATCH)))
{
return E_UNEXPECTED;
}
IEnumVARIANT* pEnum;
hr = V_UNKNOWN(&result)->QueryInterface<IEnumVARIANT>(&pEnum);
if (FAILED(hr))
{
return hr;
}
hr = VerifyIntegerEnumerator(pEnum, start, count);
pEnum->Release();
return hr;
}
示例4: discover
//.........这里部分代码省略.........
ret = ORTE_ERROR;
goto cleanup;
}
/* Do we have enough processors on the available nodes?
* Question: How do we get the required number of processors?
*/
if ( (Status == NodeStatus_Ready) && (idle_processors > 0) ) {
/* Get node name. */
hr = pNode->get_Name(&node_name);
if (FAILED(hr)) {
OPAL_OUTPUT_VERBOSE((1, orte_ras_base.ras_output,
"ras:ccp:pNode->get_Name failed."));
ret = ORTE_ERROR;
goto cleanup;
}
/* Get node processor architecture. */
hr = pNode->get_ProcessorArchitecture(&node_arch);
if (FAILED(hr)) {
OPAL_OUTPUT_VERBOSE((1, orte_ras_base.ras_output,
"ras:ccp:pNode->get_ProcessorArchitecture failed."));
ret = ORTE_ERROR;
goto cleanup;
}
/* Prevent duplicated nodes in the list*/
for (item = opal_list_get_first(&new_nodes);
opal_list_get_end(&new_nodes) != item;
item = opal_list_get_next(item)) {
node = (orte_node_t*) item;
if (0 == strcmp(node->name, (char *)node_name)) {
++node->slots;
OPAL_OUTPUT_VERBOSE((1, orte_ras_base.ras_output,
"ras:ccp:allocate:discover: found -- bumped slots to %d",
node->slots));
break;
}
}
/* Did we find it? */
if (opal_list_get_end(&new_nodes) == item) {
/* Nope -- didn't find it, so add a new item to the list */
OPAL_OUTPUT_VERBOSE((1, orte_ras_base.ras_output,
"ras:ccp:allocate:discover: not found -- added to list"));
node = OBJ_NEW(orte_node_t);
/* The function _dupenv_s is much safer than getenv on Windows. */
_dupenv_s(&node->username, &len, "username");
node->name = _com_util::ConvertBSTRToString(node_name);
node->launch_id = nodeid;
node->slots_inuse = 0;
node->slots_max = 0;
node->slots = 1;
opal_list_append(nodelist, &node->super);
}
/* up the nodeid */
nodeid++;
}
pNode->Release();
VariantClear(&var);
}
pNodes->Release();
if (nodeid > 0) ret = ORTE_SUCCESS;
/* All done */
cleanup:
if (ORTE_SUCCESS == ret) {
OPAL_OUTPUT_VERBOSE((1, orte_ras_base.ras_output,
"ras:ccp:allocate:discover: success"));
} else {
OPAL_OUTPUT_VERBOSE((1, orte_ras_base.ras_output,
"ras:ccp:allocate:discover: failed (rc=%d)", ret));
}
OBJ_DESTRUCT(&new_nodes);
SysFreeString(node_name);
SysFreeString(node_arch);
/* check for timing request - get stop time and report elapsed time if so */
if (orte_timing) {
gettimeofday(&stop, NULL);
opal_output(0, "ras_ccp: time to allocate is %ld usec",
(long int)((stop.tv_sec - start.tv_sec)*1000000 +
(stop.tv_usec - start.tv_usec)));
gettimeofday(&start, NULL);
}
return ret;
}
示例5: RecursiveIsMember
//.........这里部分代码省略.........
hr = GetObjectGuid(pIDOCurrent,bstrGuidCurrent);
if (FAILED(hr))
return hr;
IADs * pIADsCurrent = NULL;
// Retrieve the IADs Interface for the current object
hr = pIDOCurrent->QueryInterface(IID_IADs,(void**)&pIADsCurrent);
if (FAILED(hr))
return hr;
// Get the ADsPath property for this member
hr = pIADsCurrent->get_ADsPath(&bstrCurrentPath);
if (SUCCEEDED(hr))
{
if (bVerbose)
wprintf(L"Comparing:\n\n%s\nWITH:\n%s\n\n",bstrGuidCurrent,pwszMemberGUID);
// Verify that the member of this group is Equal to passed.
if (_wcsicmp(bstrGuidCurrent,pwszMemberGUID)==0)
{
if (bVerbose)
wprintf(L"!!!!!Object:\n\n%s\n\nIs a member of\n\n%s\n\n",pwszMemberPath,bstrGuidCurrent);
bRet = TRUE;
break;
}
else // Otherwise, bind to this and see if it is a group.
{ // If is it a group then the QI to IADsGroup succeeds
IADsGroup * pIADsGroupAsMember = NULL;
if (pwszUser)
hr = ADsOpenObject( bstrCurrentPath,
pwszUser,
pwszPassword,
ADS_SECURE_AUTHENTICATION,
IID_IADsGroup,
(void**) &pIADsGroupAsMember);
else
hr = ADsGetObject( bstrCurrentPath, IID_IADsGroup,(void **)&pIADsGroupAsMember);
// If bind was completed, then this is a group.
if (SUCCEEDED(hr))
{
// Recursively call this group to verify this group.
BOOL bRetRecurse;
bRetRecurse = RecursiveIsMember(pIADsGroupAsMember,pwszMemberGUID,pwszMemberPath,bVerbose,pwszUser ,pwszPassword );
if (bRetRecurse)
{
bRet = TRUE;
break;
}
pIADsGroupAsMember->Release();
pIADsGroupAsMember = NULL;
}
}
SysFreeString(bstrCurrentPath);
bstrCurrentPath = NULL;
SysFreeString(bstrGuidCurrent);
bstrGuidCurrent = NULL;
}
// Release
pIDOCurrent->Release();
pIDOCurrent = NULL;
if (pIADsCurrent)
{
pIADsCurrent->Release();
pIADsCurrent = NULL;
}
}
}
// Clear the variant array.
memset(VariantArray, 0, sizeof(VARIANT)*FETCH_NUM);
}
else
fContinue = FALSE;
}
pEnumVariant->Release();
pEnumVariant = NULL;
}
pUnknown->Release();
pUnknown = NULL;
}
pADsMembers ->Release();
pADsMembers = NULL;
}
// Free the group path if retrieved.
if (bsGroupPath)
{
SysFreeString(bsGroupPath);
bsGroupPath = NULL;
}
return bRet;
}
示例6: DoTheWork
HRESULT DoTheWork (INetSharingManager * pNSM)
{ // add a port mapping to every firewalled or shared connection
INetSharingEveryConnectionCollection * pNSECC = NULL;
HRESULT hr = pNSM->get_EnumEveryConnection (&pNSECC);
int LastErrorCode = 0;
if (!pNSECC)
return ICS_Error_FailGetEvery;
else {
// enumerate connections
IEnumVARIANT * pEV = NULL;
IUnknown * pUnk = NULL;
hr = pNSECC->get__NewEnum (&pUnk);
if (pUnk) {
hr = pUnk->QueryInterface (__uuidof(IEnumVARIANT),
(void**)&pEV);
pUnk->Release();
}else{
return ICS_Error_FailGetNewEnum;
}
if (pEV) {
VARIANT v;
VariantInit (&v);
while (S_OK == pEV->Next (1, &v, NULL)) {
if (V_VT (&v) == VT_UNKNOWN) {
INetConnection * pNC = NULL;
V_UNKNOWN (&v)->QueryInterface
(__uuidof(INetConnection),
(void**)&pNC);
if (pNC) {
INetConnectionProps * pNCP = NULL;
pNSM->get_NetConnectionProps (pNC, &pNCP);
if (!pNCP)
wprintf (L"failed to get NetConnectionProps!\r\n");
else {
// check properties for firewalled or shared connection
NETCON_MEDIATYPE MediaType;
pNCP->get_MediaType(&MediaType);
NETCON_STATUS Status;
pNCP->get_Status(&Status);
BSTR DevName;
pNCP->get_DeviceName(&DevName);
if (MediaType & (NCM_LAN | NCM_SHAREDACCESSHOST_LAN | NCM_PHONE)
&& Status == NCS_CONNECTED
&& QString(_com_util::ConvertBSTRToString(DevName)).indexOf("hosted network", 0, Qt::CaseInsensitive)==-1
&& QString(_com_util::ConvertBSTRToString(DevName)).indexOf("virtual", 0, Qt::CaseInsensitive)==-1
&& QString(_com_util::ConvertBSTRToString(DevName)).indexOf("teamviewer", 0, Qt::CaseInsensitive)==-1) {
// got a shared/firewalled connection
INetSharingConfiguration * pNSC = NULL;
hr = pNSM->get_INetSharingConfigurationForINetConnection (pNC, &pNSC);
if (!pNSC)
wprintf (L"can't make INetSharingConfiguration object!\r\n");
else {
hr = pNSC->EnableSharing(ICSSHARINGTYPE_PRIVATE);
if(hr!=S_OK){
LastErrorCode = ICS_Error_EnableSharing;
}else{
BSTR Name;
pNCP->get_Name(&Name);
QMessageBox msg;
msg.setText(QString("Network: %1 %2 %3").arg(_com_util::ConvertBSTRToString(Name)).arg(_com_util::ConvertBSTRToString(DevName)).arg(Status));
msg.exec();
return 0;
}
pNSC->Release();
}
}
pNCP->Release();
}
pNC->Release();
}
}
VariantClear (&v);
}
pEV->Release();
}else{
return ICS_Error_FailGetEnumVariant;
}
pNSECC->Release();
}
if(LastErrorCode!=0) return LastErrorCode;
return hr;
}