本文整理汇总了C++中IBindCtx_Release函数的典型用法代码示例。如果您正苦于以下问题:C++ IBindCtx_Release函数的具体用法?C++ IBindCtx_Release怎么用?C++ IBindCtx_Release使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IBindCtx_Release函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: download_to_cache
HRESULT download_to_cache(IUri *uri, stop_cache_binding_proc_t proc, void *ctx, IBindStatusCallback *callback)
{
DownloadBSC *dwl_bsc;
IBindCtx *bindctx;
IMoniker *mon;
IUnknown *unk;
HRESULT hres;
hres = DownloadBSC_Create(callback, NULL, &dwl_bsc);
if(FAILED(hres))
return hres;
dwl_bsc->onstop_proc = proc;
dwl_bsc->ctx = ctx;
dwl_bsc->bindf = BINDF_ASYNCHRONOUS;
hres = CreateAsyncBindCtx(0, &dwl_bsc->IBindStatusCallback_iface, NULL, &bindctx);
IBindStatusCallback_Release(&dwl_bsc->IBindStatusCallback_iface);
if(FAILED(hres))
return hres;
hres = CreateURLMonikerEx2(NULL, uri, &mon, 0);
if(FAILED(hres)) {
IBindCtx_Release(bindctx);
return hres;
}
hres = IMoniker_BindToStorage(mon, bindctx, NULL, &IID_IUnknown, (void**)&unk);
IMoniker_Release(mon);
IBindCtx_Release(bindctx);
if(SUCCEEDED(hres) && unk)
IUnknown_Release(unk);
return hres;
}
示例2: FileMonikerImpl_IsEqual
/******************************************************************************
* FileMoniker_IsEqual
*/
static HRESULT WINAPI
FileMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
{
FileMonikerImpl *This = impl_from_IMoniker(iface);
CLSID clsid;
LPOLESTR filePath;
IBindCtx* bind;
HRESULT res;
TRACE("(%p,%p)\n",iface,pmkOtherMoniker);
if (pmkOtherMoniker==NULL)
return S_FALSE;
IMoniker_GetClassID(pmkOtherMoniker,&clsid);
if (!IsEqualCLSID(&clsid,&CLSID_FileMoniker))
return S_FALSE;
res = CreateBindCtx(0,&bind);
if (FAILED(res)) return res;
res = S_FALSE;
if (SUCCEEDED(IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&filePath))) {
if (!lstrcmpiW(filePath, This->filePathName))
res = S_OK;
CoTaskMemFree(filePath);
}
IBindCtx_Release(bind);
return res;
}
示例3: navigate_bsc
static HRESULT navigate_bsc(DocHost *This, BindStatusCallback *bsc, IMoniker *mon)
{
IBindCtx *bindctx;
VARIANT_BOOL cancel = VARIANT_FALSE;
HRESULT hres;
on_before_navigate2(This, bsc->url, bsc->post_data, bsc->post_data_len, bsc->headers, &cancel);
if(cancel) {
FIXME("Navigation canceled\n");
return S_OK;
}
if(This->document)
deactivate_document(This);
CreateAsyncBindCtx(0, BINDSC(bsc), 0, &bindctx);
if(This->frame)
IOleInPlaceFrame_EnableModeless(This->frame, FALSE);
hres = bind_to_object(This, mon, bsc->url, bindctx, BINDSC(bsc));
if(This->frame)
IOleInPlaceFrame_EnableModeless(This->frame, TRUE);
IBindCtx_Release(bindctx);
return hres;
}
示例4: URLMoniker_IsEqual
static HRESULT WINAPI URLMoniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
{
URLMoniker *This = impl_from_IMoniker(iface);
CLSID clsid;
LPOLESTR urlPath;
IBindCtx* bind;
HRESULT res;
TRACE("(%p,%p)\n",This, pmkOtherMoniker);
if(pmkOtherMoniker==NULL)
return E_INVALIDARG;
IMoniker_GetClassID(pmkOtherMoniker,&clsid);
if(!IsEqualCLSID(&clsid,&CLSID_StdURLMoniker))
return S_FALSE;
res = CreateBindCtx(0,&bind);
if(FAILED(res))
return res;
res = S_FALSE;
if(SUCCEEDED(IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&urlPath))) {
int result = lstrcmpiW(urlPath, This->URLName);
CoTaskMemFree(urlPath);
if(result == 0)
res = S_OK;
}
IBindCtx_Release(bind);
return res;
}
示例5: download_proc
static DWORD WINAPI download_proc(PVOID arg)
{
IMoniker *mon;
IBindCtx *bctx;
IStream *str = NULL;
HRESULT hres;
CreateURLMoniker(NULL, url, &mon);
heap_free(url);
url = NULL;
CreateAsyncBindCtx(0, &InstallCallback, 0, &bctx);
hres = IMoniker_BindToStorage(mon, bctx, NULL, &IID_IStream, (void**)&str);
IBindCtx_Release(bctx);
if(FAILED(hres)) {
ERR("BindToStorage failed: %08x\n", hres);
return 0;
}
if(str)
IStream_Release(str);
return 0;
}
示例6: IHlink_fnGetFriendlyName
static HRESULT WINAPI IHlink_fnGetFriendlyName (IHlink* iface,
DWORD grfHLFNAMEF, LPWSTR* ppwzFriendlyName)
{
HlinkImpl *This = impl_from_IHlink(iface);
TRACE("(%p) -> (%i %p)\n", This, grfHLFNAMEF, ppwzFriendlyName);
/* FIXME: Only using explicitly set and cached friendly names */
if (This->FriendlyName)
*ppwzFriendlyName = hlink_co_strdupW( This->FriendlyName );
else
{
IMoniker *moniker;
HRESULT hres = __GetMoniker(This, &moniker, HLINKGETREF_DEFAULT);
if (FAILED(hres))
{
*ppwzFriendlyName = NULL;
return hres;
}
if (moniker)
{
IBindCtx *bcxt;
CreateBindCtx(0, &bcxt);
IMoniker_GetDisplayName(moniker, bcxt, NULL, ppwzFriendlyName);
IBindCtx_Release(bcxt);
IMoniker_Release(moniker);
}
else
*ppwzFriendlyName = NULL;
}
return S_OK;
}
示例7: HlinkResolveMonikerForData
/***********************************************************************
* HlinkResolveMonikerForData ([email protected])
*/
HRESULT WINAPI HlinkResolveMonikerForData(LPMONIKER pimkReference, DWORD reserved, LPBC pibc,
ULONG cFmtetc, FORMATETC *rgFmtetc, IBindStatusCallback *pibsc, LPMONIKER pimkBase)
{
LPOLESTR name = NULL;
IBindCtx *bctx;
DWORD mksys = 0;
void *obj = NULL;
HRESULT hres;
TRACE("(%p %x %p %d %p %p %p)\n", pimkReference, reserved, pibc, cFmtetc, rgFmtetc, pibsc, pimkBase);
if(cFmtetc || rgFmtetc || pimkBase)
FIXME("Unsupported args\n");
hres = RegisterBindStatusCallback(pibc, pibsc, NULL /* FIXME */, 0);
if(FAILED(hres))
return hres;
hres = IMoniker_IsSystemMoniker(pimkReference, &mksys);
if(SUCCEEDED(hres) && mksys != MKSYS_URLMONIKER)
WARN("sysmk = %x\n", mksys);
/* FIXME: What is it for? */
CreateBindCtx(0, &bctx);
hres = IMoniker_GetDisplayName(pimkReference, bctx, NULL, &name);
IBindCtx_Release(bctx);
if(SUCCEEDED(hres)) {
TRACE("got display name %s\n", debugstr_w(name));
CoTaskMemFree(name);
}
return IMoniker_BindToStorage(pimkReference, pibc, NULL, &IID_IUnknown, &obj);
}
示例8: xmldoc_put_URL
static HRESULT WINAPI xmldoc_put_URL(IXMLDocument *iface, BSTR p)
{
WCHAR url[INTERNET_MAX_URL_LENGTH];
IStream *stream;
IBindCtx *bctx;
IMoniker *moniker;
IPersistStreamInit *persist;
HRESULT hr;
TRACE("(%p, %s)\n", iface, debugstr_w(p));
if (!p)
return E_INVALIDARG;
if (!PathIsURLW(p))
{
WCHAR fullpath[MAX_PATH];
DWORD needed = sizeof(url) / sizeof(WCHAR);
if (!PathSearchAndQualifyW(p, fullpath, sizeof(fullpath) / sizeof(WCHAR)))
{
ERR("can't find path\n");
return E_FAIL;
}
if (FAILED(UrlCreateFromPathW(fullpath, url, &needed, 0)))
{
ERR("can't create url from path\n");
return E_FAIL;
}
p = url;
}
hr = CreateURLMoniker(NULL, p, &moniker);
if (FAILED(hr))
return hr;
CreateAsyncBindCtx(0, &xmldoc_bsc.IBindStatusCallback_iface, 0, &bctx);
hr = IMoniker_BindToStorage(moniker, bctx, NULL, &IID_IStream, (LPVOID *)&stream);
IBindCtx_Release(bctx);
IMoniker_Release(moniker);
if (FAILED(hr))
return hr;
hr = IXMLDocument_QueryInterface(iface, &IID_IPersistStreamInit, (LPVOID *)&persist);
if (FAILED(hr))
{
IStream_Release(stream);
return hr;
}
hr = IPersistStreamInit_Load(persist, stream);
IPersistStreamInit_Release(persist);
IStream_Release(stream);
return hr;
}
示例9: IHlink_fnNavigate
static HRESULT WINAPI IHlink_fnNavigate(IHlink* iface, DWORD grfHLNF, LPBC pbc,
IBindStatusCallback *pbsc, IHlinkBrowseContext *phbc)
{
HlinkImpl *This = impl_from_IHlink(iface);
IMoniker *mon = NULL;
HRESULT r;
FIXME("Semi-Stub:(%p)->(%i %p %p %p)\n", This, grfHLNF, pbc, pbsc, phbc);
r = __GetMoniker(This, &mon, HLINKGETREF_ABSOLUTE);
TRACE("Moniker %p\n", mon);
if (SUCCEEDED(r))
{
IBindCtx *bcxt;
IUnknown *unk = NULL;
IHlinkTarget *target;
CreateBindCtx(0, &bcxt);
RegisterBindStatusCallback(bcxt, pbsc, NULL, 0);
r = IMoniker_BindToObject(mon, bcxt, NULL, &IID_IUnknown, (void**)&unk);
if (r == S_OK)
{
r = IUnknown_QueryInterface(unk, &IID_IHlinkTarget, (void**)&target);
IUnknown_Release(unk);
}
if (r == S_OK)
{
IHlinkTarget_SetBrowseContext(target, phbc);
r = IHlinkTarget_Navigate(target, grfHLNF, This->Location);
IHlinkTarget_Release(target);
}
else
{
static const WCHAR szOpen[] = {'o','p','e','n',0};
LPWSTR target = NULL;
r = IHlink_GetStringReference(iface, HLINKGETREF_DEFAULT, &target, NULL);
if (SUCCEEDED(r) && target)
{
ShellExecuteW(NULL, szOpen, target, NULL, NULL, SW_SHOW);
CoTaskMemFree(target);
}
}
RevokeBindStatusCallback(bcxt, pbsc);
IBindCtx_Release(bcxt);
IMoniker_Release(mon);
}
if (This->Site)
IHlinkSite_OnNavigationComplete(This->Site, This->SiteData, 0, r, NULL);
TRACE("Finished Navigation\n");
return r;
}
示例10: EnumRunningObjectTable
static NTSTATUS EnumRunningObjectTable(
_In_ PVOID ThreadParam
)
{
IRunningObjectTable* iRunningObjectTable = NULL;
IEnumMoniker* iEnumMoniker = NULL;
IMoniker* iMoniker = NULL;
IBindCtx* iBindCtx = NULL;
IMalloc* iMalloc = NULL;
ULONG count = 0;
HWND listViewHandle = (HWND)ThreadParam;
if (!SUCCEEDED(CoGetMalloc(1, &iMalloc)))
return STATUS_INSUFFICIENT_RESOURCES;
// Query the running object table address
if (SUCCEEDED(GetRunningObjectTable(0, &iRunningObjectTable)))
{
// Enum the objects registered
if (SUCCEEDED(IRunningObjectTable_EnumRunning(iRunningObjectTable, &iEnumMoniker)))
{
while (IEnumMoniker_Next(iEnumMoniker, 1, &iMoniker, &count) == S_OK)
{
if (SUCCEEDED(CreateBindCtx(0, &iBindCtx)))
{
OLECHAR* displayName = NULL;
// Query the object name
if (SUCCEEDED(IMoniker_GetDisplayName(iMoniker, iBindCtx, NULL, &displayName)))
{
// Set the items name column
PhAddListViewItem(listViewHandle, MAXINT, displayName, NULL);
// Free the object name
IMalloc_Free(iMalloc, displayName);
}
IBindCtx_Release(iBindCtx);
}
IEnumMoniker_Release(iMoniker);
}
IEnumMoniker_Release(iEnumMoniker);
}
IRunningObjectTable_Release(iRunningObjectTable);
}
IMalloc_Release(iMalloc);
return STATUS_SUCCESS;
}
示例11: URLDownloadToFileW
/***********************************************************************
* URLDownloadToFileW ([email protected])
*
* Downloads URL szURL to file szFileName and call lpfnCB callback to
* report progress.
*
* PARAMS
* pCaller [I] controlling IUnknown interface.
* szURL [I] URL of the file to download
* szFileName [I] file name to store the content of the URL
* dwReserved [I] reserved - set to 0
* lpfnCB [I] callback for progress report
*
* RETURNS
* S_OK on success
*/
HRESULT WINAPI URLDownloadToFileW(LPUNKNOWN pCaller, LPCWSTR szURL, LPCWSTR szFileName,
DWORD dwReserved, LPBINDSTATUSCALLBACK lpfnCB)
{
IBindStatusCallback *callback;
IUnknown *unk;
IMoniker *mon;
IBindCtx *bindctx;
HRESULT hres;
TRACE("(%p %s %s %d %p)\n", pCaller, debugstr_w(szURL), debugstr_w(szFileName), dwReserved, lpfnCB);
if(pCaller)
FIXME("pCaller not supported\n");
hres = DownloadBSC_Create(lpfnCB, szFileName, &callback);
if(FAILED(hres))
return hres;
hres = CreateAsyncBindCtx(0, callback, NULL, &bindctx);
IBindStatusCallback_Release(callback);
if(FAILED(hres))
return hres;
hres = CreateURLMoniker(NULL, szURL, &mon);
if(FAILED(hres)) {
IBindCtx_Release(bindctx);
return hres;
}
hres = IMoniker_BindToStorage(mon, bindctx, NULL, &IID_IUnknown, (void**)&unk);
IMoniker_Release(mon);
IBindCtx_Release(bindctx);
if(unk)
IUnknown_Release(unk);
return hres == MK_S_ASYNCHRONOUS ? S_OK : hres;
}
示例12: AsyncBindCtx_Release
static ULONG WINAPI AsyncBindCtx_Release(IBindCtx *iface)
{
AsyncBindCtx *This = impl_from_IBindCtx(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
if(!ref) {
IBindCtx_Release(This->bindctx);
heap_free(This);
}
return ref;
}
示例13: URLStartDownload
static HRESULT URLStartDownload(LPCWSTR szURL, LPSTREAM *ppStream, IBindStatusCallback *pBSC)
{
HRESULT hr;
IMoniker *pMoniker;
IBindCtx *pbc;
*ppStream = NULL;
hr = CreateURLMoniker(NULL, szURL, &pMoniker);
if (FAILED(hr))
return hr;
hr = CreateBindCtx(0, &pbc);
if (FAILED(hr))
{
IMoniker_Release(pMoniker);
return hr;
}
hr = RegisterBindStatusCallback(pbc, pBSC, NULL, 0);
if (FAILED(hr))
{
IBindCtx_Release(pbc);
IMoniker_Release(pMoniker);
return hr;
}
hr = IMoniker_BindToStorage(pMoniker, pbc, NULL, &IID_IStream, (void **)ppStream);
/* BindToStorage returning E_PENDING because it's asynchronous is not an error */
if (hr == E_PENDING) hr = S_OK;
IBindCtx_Release(pbc);
IMoniker_Release(pMoniker);
return hr;
}
示例14: BindMoniker
/******************************************************************************
* BindMoniker [[email protected]]
*
* Binds to a moniker.
*
* PARAMS
* pmk [I] Moniker to bind to.
* grfOpt [I] Reserved option flags. Set to 0.
* riid [I] ID of the interface to bind to.
* pvResult [O] Address that receives the interface of the object that was bound to.
*
* RETURNS
* Success: S_OK.
* Failure: Any HRESULT code.
*/
HRESULT WINAPI BindMoniker(LPMONIKER pmk, DWORD grfOpt, REFIID riid, LPVOID * ppvResult)
{
HRESULT res;
IBindCtx * pbc;
TRACE("(%p, %x, %s, %p)\n", pmk, grfOpt, debugstr_guid(riid), ppvResult);
res = CreateBindCtx(grfOpt, &pbc);
if (SUCCEEDED(res))
{
res = IMoniker_BindToObject(pmk, pbc, NULL, riid, ppvResult);
IBindCtx_Release(pbc);
}
return res;
}
示例15: IHlink_fnGetStringReference
static HRESULT WINAPI IHlink_fnGetStringReference (IHlink* iface,
DWORD dwWhichRef, LPWSTR *ppwzTarget, LPWSTR *ppwzLocation)
{
HlinkImpl *This = impl_from_IHlink(iface);
TRACE("(%p) -> (%i %p %p)\n", This, dwWhichRef, ppwzTarget, ppwzLocation);
if(dwWhichRef != -1 && dwWhichRef & ~(HLINKGETREF_DEFAULT | HLINKGETREF_ABSOLUTE | HLINKGETREF_RELATIVE))
{
if(ppwzTarget)
*ppwzTarget = NULL;
if(ppwzLocation)
*ppwzLocation = NULL;
return E_INVALIDARG;
}
if (ppwzTarget)
{
IMoniker* mon;
HRESULT hres = __GetMoniker(This, &mon, dwWhichRef);
if (FAILED(hres))
{
if (ppwzLocation)
*ppwzLocation = NULL;
return hres;
}
if (mon)
{
IBindCtx *pbc;
CreateBindCtx( 0, &pbc);
IMoniker_GetDisplayName(mon, pbc, NULL, ppwzTarget);
IBindCtx_Release(pbc);
IMoniker_Release(mon);
}
else
*ppwzTarget = NULL;
}
if (ppwzLocation)
*ppwzLocation = hlink_co_strdupW( This->Location );
TRACE("(Target: %s Location: %s)\n",
(ppwzTarget)?debugstr_w(*ppwzTarget):"<NULL>",
(ppwzLocation)?debugstr_w(*ppwzLocation):"<NULL>");
return S_OK;
}