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


C++ ReleaseObject函数代码示例

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


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

示例1: CpiFinalize

void CpiFinalize()
{
    // collections
    ReleaseObject(gpiCatalog);
    ReleaseObject(gpiPartColl);
    ReleaseObject(gpiAppColl);
}
开发者ID:firegiant,项目名称:wix4,代码行数:7,代码来源:cputilsched.cpp

示例2: DeleteObject

	MaterialDemo::~MaterialDemo()
	{
		DeleteObject(mBasicMaterial);
		DeleteObject(mBasicEffect);
		ReleaseObject(mVertexBuffer);
		ReleaseObject(mIndexBuffer);
	}
开发者ID:Alcanteria,项目名称:DirectXTest,代码行数:7,代码来源:MaterialDemo.cpp

示例3: GetShellDispatchFromView

static HRESULT GetShellDispatchFromView(
    __in IShellView *psv,
    __in REFIID riid,
    __out void **ppv
    )
{
    HRESULT hr = S_OK;
    IDispatch *pdispBackground = NULL;
    IShellFolderViewDual *psfvd = NULL;
    IDispatch *pdisp = NULL;

    // From a shell view object, gets its automation interface and from that get the shell
    // application object that implements IShellDispatch2 and related interfaces.
    hr = psv->GetItemObject(SVGIO_BACKGROUND, IID_PPV_ARGS(&pdispBackground));
    ExitOnFailure(hr, "Failed to get the automation interface for shell.");

    hr = pdispBackground->QueryInterface(IID_PPV_ARGS(&psfvd));
    ExitOnFailure(hr, "Failed to get shell folder view dual.");

    hr = psfvd->get_Application(&pdisp);
    ExitOnFailure(hr, "Failed to application object.");

    hr = pdisp->QueryInterface(riid, ppv);
    ExitOnFailure(hr, "Failed to get IShellDispatch2.");

LExit:
    ReleaseObject(pdisp);
    ReleaseObject(psfvd);
    ReleaseObject(pdispBackground);

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

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

示例5: ReleaseObject

	RenderStateHelper::~RenderStateHelper()
	{
		ReleaseObject(mRasterizerState);
		ReleaseObject(mBlendState);
		ReleaseObject(mDepthStencilState);
		DeleteObject(mBlendFactor);
	}
开发者ID:DarriusWright,项目名称:Capstone_WrightD,代码行数:7,代码来源:RenderStateHelper.cpp

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

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

示例8: CreatePartition

static HRESULT CreatePartition(
    CPI_PARTITION_ATTRIBUTES* pAttrs
    )
{
    HRESULT hr = S_OK;

    ICatalogCollection* piPartColl = NULL;
    ICatalogObject* piPartObj = NULL;

    long lChanges = 0;

    // log
    WcaLog(LOGMSG_VERBOSE, "Creating partition, key: %S", pAttrs->pwzKey);

    // get partitions collection
    hr = CpiGetPartitionsCollection(&piPartColl);
    ExitOnFailure(hr, "Failed to get partitions collection");

    // check if partition exists
    hr = CpiFindCollectionObjectByStringKey(piPartColl, pAttrs->pwzID, &piPartObj);
    ExitOnFailure(hr, "Failed to find partition");

    if (S_FALSE == hr)
    {
        // create partition
        hr = CpiAddCollectionObject(piPartColl, &piPartObj);
        ExitOnFailure(hr, "Failed to add partition to collection");

        hr = CpiPutCollectionObjectValue(piPartObj, L"ID", pAttrs->pwzID);
        ExitOnFailure(hr, "Failed to set partition id property");

        hr = CpiPutCollectionObjectValue(piPartObj, L"Name", pAttrs->pwzName);
        ExitOnFailure(hr, "Failed to set partition name property");
    }

    // properties
    hr = CpiPutCollectionObjectValues(piPartObj, pAttrs->pPropList);
    ExitOnFailure(hr, "Failed to write properties");

    // save changes
    hr = piPartColl->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(piPartColl);
    ReleaseObject(piPartObj);

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

示例9: CpiPartitionsVerifyUninstall

HRESULT CpiPartitionsVerifyUninstall(
    CPI_PARTITION_LIST* pList
    )
{
    HRESULT hr = S_OK;
    ICatalogCollection* piPartColl = NULL;
    ICatalogObject* piPartObj = NULL;

    for (CPI_PARTITION* pItm = pList->pFirst; pItm; pItm = pItm->pNext)
    {
        // referenced locaters or partitions that are being uninstalled
        if (!pItm->fReferencedForUninstall && !(pItm->fHasComponent && WcaIsUninstalling(pItm->isInstalled, pItm->isAction)))
            continue;

        // get partitions collection
        if (!piPartColl)
        {
            hr = CpiGetPartitionsCollection(&piPartColl);
            ExitOnFailure(hr, "Failed to get partitions collection");
        }

        // get collection object for partition
        hr = CpiFindCollectionObject(piPartColl, pItm->wzID, *pItm->wzID ? NULL : pItm->wzName, &piPartObj);
        ExitOnFailure(hr, "Failed to find collection object for partition");

        // if the partition was found
        if (S_OK == hr)
        {
            // if we don't have an id, copy id from object
            if (!*pItm->wzID)
            {
                hr = CpiGetKeyForObject(piPartObj, pItm->wzID, countof(pItm->wzID));
                ExitOnFailure(hr, "Failed to get id");
            }
        }

        // if the partition was not found
        else
        {
            pItm->fObjectNotFound = TRUE;
            if (pItm->fHasComponent)
                pList->iUninstallCount--; // elements with the fObjectNotFound flag set will not be scheduled for uninstall
        }

        // clean up
        ReleaseNullObject(piPartObj);
    }

    hr = S_OK;

LExit:
    // clean up
    ReleaseObject(piPartColl);
    ReleaseObject(piPartObj);

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

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

示例11: CreateApplicationRole

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

    ICatalogCollection* piRolesColl = NULL;
    ICatalogObject* piRoleObj = NULL;

    long lChanges = 0;

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

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

    // check if role exists
    hr = CpiFindCollectionObjectByName(piRolesColl, pAttrs->pwzName, &piRoleObj);
    ExitOnFailure(hr, "Failed to find role");

    if (S_FALSE == hr)
    {
        // create role
        hr = CpiAddCollectionObject(piRolesColl, &piRoleObj);
        ExitOnFailure(hr, "Failed to add role to collection");

        hr = CpiPutCollectionObjectValue(piRoleObj, L"Name", pAttrs->pwzName);
        ExitOnFailure(hr, "Failed to set role name property");
    }

    // properties
    hr = CpiPutCollectionObjectValues(piRoleObj, pAttrs->pPropList);
    ExitOnFailure(hr, "Failed to write properties");

    // 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);
    ReleaseObject(piRoleObj);

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

示例12: ReleaseObject

void    plDXTextFont::DestroyObjects()
{
    ReleaseObject(fOldStateBlock);
    ReleaseObject(fTextStateBlock);
    ReleaseObject(fD3DTexture);

    fOldStateBlock = fTextStateBlock = 0;
    fD3DTexture = nil;
    fInitialized = false;
}
开发者ID:Asteral,项目名称:Plasma,代码行数:10,代码来源:plDXTextFont.cpp

示例13: GetDesktopShellView

static HRESULT GetDesktopShellView(
    __in REFIID riid,
    __out void **ppv
    )
{
    HRESULT hr = S_OK;
    IShellWindows* psw = NULL;
    HWND hwnd = NULL;
    IDispatch* pdisp = NULL;
    VARIANT vEmpty = {}; // VT_EMPTY
    IShellBrowser* psb = NULL;
    IShellFolder* psf = NULL;
    IShellView* psv = NULL;

    // use the shell view for the desktop using the shell windows automation to find the 
    // desktop web browser and then grabs its view
    // returns IShellView, IFolderView and related interfaces
    hr = ::CoCreateInstance(CLSID_ShellWindows, NULL, CLSCTX_LOCAL_SERVER, IID_PPV_ARGS(&psw));
    ExitOnFailure(hr, "Failed to get shell view.");

    hr = psw->FindWindowSW(&vEmpty, &vEmpty, SWC_DESKTOP, (long*)&hwnd, SWFO_NEEDDISPATCH, &pdisp);
    if (S_OK == hr)
    {
        hr = IUnknown_QueryService(pdisp, SID_STopLevelBrowser, IID_PPV_ARGS(&psb));
        ExitOnFailure(hr, "Failed to get desktop window.");

        hr = psb->QueryActiveShellView(&psv);
        ExitOnFailure(hr, "Failed to get active shell view.");

        hr = psv->QueryInterface(riid, ppv);
        ExitOnFailure(hr, "Failed to query for the desktop shell view.");
    }
    else if (S_FALSE == hr)
    {
        //Windows XP
        hr = SHGetDesktopFolder(&psf);
        ExitOnFailure(hr, "Failed to get desktop folder.");

        hr = psf->CreateViewObject(NULL, IID_IShellView, ppv);
        ExitOnFailure(hr, "Failed to query for the desktop shell view.");
    }
    else
    {
        ExitOnFailure(hr, "Failed to get desktop window.");
    }

LExit:
    ReleaseObject(psv);
    ReleaseObject(psb);
    ReleaseObject(psf);
    ReleaseObject(pdisp);
    ReleaseObject(psw);

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

示例14: SqlCommandExecuteQuery

/********************************************************************
 SqlCommandExecuteQuery - executes a SQL command and returns the results if desired

 NOTE: ppirs and pcRoes are optional
********************************************************************/
extern "C" HRESULT DAPI SqlCommandExecuteQuery(
    __in IDBCreateCommand* pidbCommand, 
    __in __sql_command LPCWSTR wzSql, 
    __out IRowset** ppirs,
    __out DBROWCOUNT* pcRows
    )
{
    Assert(pidbCommand);

    HRESULT hr = S_OK;
    ICommandText* picmdText = NULL;
    ICommand* picmd = NULL;
    DBROWCOUNT cRows = 0;

    if (pcRows)
    {
        *pcRows = NULL;
    }

    //
    // create the command
    //
    hr = pidbCommand->CreateCommand(NULL, IID_ICommand, (IUnknown**)&picmd);
    ExitOnFailure(hr, "failed to create command to execute session");

    //
    // set the sql text into the command
    //
    hr = picmd->QueryInterface(IID_ICommandText, (LPVOID*)&picmdText);
    ExitOnFailure(hr, "failed to get command text object for command");
    hr = picmdText->SetCommandText(DBGUID_DEFAULT , wzSql);
    ExitOnFailure1(hr, "failed to set SQL string: %ls", wzSql);

    //
    // execute the command
    //
    hr = picmd->Execute(NULL, (ppirs) ? IID_IRowset : IID_NULL, NULL, &cRows, reinterpret_cast<IUnknown**>(ppirs));
    ExitOnFailure1(hr, "failed to execute SQL string: %ls", wzSql);

    if (DB_S_ERRORSOCCURRED == hr)
    {
        hr = E_FAIL;
    }

    if (pcRows)
    {
        *pcRows = cRows;
    }

LExit:
    ReleaseObject(picmd);
    ReleaseObject(picmdText);

    return hr;
}
开发者ID:firegiant,项目名称:wix3,代码行数:60,代码来源:sqlutil.cpp

示例15: FreePartition

static void FreePartition(
    CPI_PARTITION* pItm
    )
{
    if (pItm->pProperties)
        CpiPropertiesFreeList(pItm->pProperties);

    ReleaseObject(pItm->piApplicationsColl);
    ReleaseObject(pItm->piRolesColl);

    ::HeapFree(::GetProcessHeap(), 0, pItm);
}
开发者ID:firegiant,项目名称:wix4,代码行数:12,代码来源:cppartsched.cpp


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