//接口查询 void * __cdecl CTableFrameSink::QueryInterface(const IID & Guid, DWORD dwQueryVer) { QUERYINTERFACE(ITableFrameSink,Guid,dwQueryVer); QUERYINTERFACE(ITableUserAction,Guid,dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(ITableFrameSink,Guid,dwQueryVer); return NULL; }
//接口查询 VOID * CCustomFaceManager::QueryInterface(REFGUID Guid, DWORD dwQueryVer) { QUERYINTERFACE(IDownLoadSink,Guid,dwQueryVer); QUERYINTERFACE(ICustomFaceManager,Guid,dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(ICustomFaceManager,Guid,dwQueryVer); return NULL; }
//接口查询 void * __cdecl CChannelService::QueryInterface(const IID & Guid, DWORD dwQueryVer) { QUERYINTERFACE(IChannelService,Guid,dwQueryVer); QUERYINTERFACE(IChannelMessageSink,Guid,dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(IChannelService,Guid,dwQueryVer); return NULL; }
//接口查询 VOID * CServerUserItem::QueryInterface(REFGUID Guid, DWORD dwQueryVer) { QUERYINTERFACE(IServerUserItem,Guid,dwQueryVer); QUERYINTERFACE(IServerUserService,Guid,dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(IServerUserItem,Guid,dwQueryVer); return NULL; }
//基础接口 ////////////////////////////////////////////////////////////////////////// //接口查询 void * __cdecl CTCPSocketService::QueryInterface(const IID & Guid, DWORD dwQueryVer) { QUERYINTERFACE(ITCPSocketService, Guid, dwQueryVer); QUERYINTERFACE(IQueueServiceSink, Guid, dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(ITCPSocketService, Guid, dwQueryVer); return NULL; }
//接口查询 void * __cdecl CDataBaseEngine::QueryInterface(const IID & Guid, DWORD dwQueryVer) { QUERYINTERFACE(IDataBaseEngine, Guid, dwQueryVer); QUERYINTERFACE(IQueueServiceSink, Guid, dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(IDataBaseEngine, Guid, dwQueryVer); return NULL; }
//接口查询 void * __cdecl CCenterSocket::QueryInterface(const IID & Guid, DWORD dwQueryVer) { QUERYINTERFACE(IClientSocketSink,Guid,dwQueryVer); QUERYINTERFACE(IAsynchronismEngineSink,Guid,dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(IAsynchronismEngineSink,Guid,dwQueryVer); return NULL; }
//接口查询 void * __cdecl CTableFrame::QueryInterface(const IID & Guid, DWORD dwQueryVer) { QUERYINTERFACE(ITableFrame,Guid,dwQueryVer); QUERYINTERFACE(ITableFrameManager,Guid,dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(ITableFrameManager,Guid,dwQueryVer); return NULL; }
//接口查询 void * __cdecl CAttributeManager::QueryInterface(const IID & Guid, DWORD dwQueryVer) { QUERYINTERFACE(IAttributeManager,Guid,dwQueryVer); QUERYINTERFACE(IAttributeService,Guid,dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(IAttributeManager,Guid,dwQueryVer); return NULL; }
//接口查询 VOID * CGameFrameWnd::QueryInterface(REFGUID Guid, DWORD dwQueryVer) { QUERYINTERFACE(IGameFrameWnd,Guid,dwQueryVer); QUERYINTERFACE(IFlashControlSink,Guid,dwQueryVer); QUERYINTERFACE(IClientPropertySink,Guid,dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(IGameFrameWnd,Guid,dwQueryVer); return NULL; }
//接口查询 void * __cdecl CPlazaViewItem::QueryInterface(const IID & Guid, DWORD dwQueryVer) { QUERYINTERFACE(IViewItem,Guid,dwQueryVer); QUERYINTERFACE(IPlazaViewItem,Guid,dwQueryVer); QUERYINTERFACE(IClientSocketSink,Guid,dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(IViewItem,Guid,dwQueryVer); return NULL; }
void ProcessSlaveActivity::main() { #ifdef TIME_ACTIVITIES if (timeActivities) lastCycles = get_cycles_now(); #endif try { process(); } catch (IException *_e) { IThorException *e = QUERYINTERFACE(_e, IThorException); if (e) { if (!e->queryActivityId()) { e->setGraphId(container.queryOwner().queryGraphId()); e->setActivityKind(container.getKind()); e->setActivityId(container.queryId()); } } else { e = MakeActivityException(this, _e); if (QUERYINTERFACE(_e, ISEH_Exception)) { IThorException *e2 = MakeThorFatal(e, TE_SEH, "FATAL: (SEH)"); e->Release(); e = e2; } _e->Release(); } ActPrintLog(e, NULL); exception.setown(e); } catch (std::exception & es) { StringBuffer m("FATAL std::exception "); if(dynamic_cast<std::bad_alloc *>(&es)) m.append("out of memory (std::bad_alloc)"); else m.append("standard library exception (std::exception ").append(es.what()).append(")"); m.appendf(" in %"ACTPF"d",container.queryId()); ActPrintLogEx(&queryContainer(), thorlog_null, MCerror, "%s", m.str()); exception.setown(MakeThorFatal(NULL, TE_UnknownException, "%s", m.str())); } catch (CATCHALL) { ActPrintLogEx(&queryContainer(), thorlog_null, MCerror, "Unknown exception thrown in process()"); exception.setown(MakeThorFatal(NULL, TE_UnknownException, "FATAL: Unknown exception thrown by ProcessThread")); } try { endProcess(); } catch (IException *_e) { ActPrintLog(_e, "Exception calling activity endProcess"); fireException(_e); exception.set(_e); _e->Release(); } }
void COleClientItem::DeactivateUI() { ASSERT_VALID(this); ASSERT(m_lpObject != NULL); ASSERT(GetItemState() == activeUIState); // get IOleInPlaceObject interface LPOLEINPLACEOBJECT lpInPlaceObject = QUERYINTERFACE(m_lpObject, IOleInPlaceObject); if (lpInPlaceObject == NULL) { Close(); // handle rare failure cases by calling Close return; } // call IOleInPlaceObject::UIDeactivate m_scLast = lpInPlaceObject->UIDeactivate(); lpInPlaceObject->Release(); if (FAILED(m_scLast)) { Close(); // handle rare failure cases by calling Close return; } if (m_nItemState == activeUIState) m_nItemState = activeState; // just in case server has crashed }
BOOL COleClientItem::ReactivateAndUndo() { ASSERT_VALID(this); ASSERT(m_lpObject != NULL); ASSERT(IsInPlaceActive()); // get IOleInPlaceObject interface LPOLEINPLACEOBJECT lpInPlaceObject = QUERYINTERFACE(m_lpObject, IOleInPlaceObject); if (lpInPlaceObject == NULL) { Close(); // handle rare failure cases by calling Close return FALSE; } // call IOleInPlaceObject::ReactivateAndUndo m_scLast = lpInPlaceObject->ReactivateAndUndo(); lpInPlaceObject->Release(); if (FAILED(m_scLast)) { Close(); // handle rare failure cases by calling Close return FALSE; } return TRUE; }
int CEclDirectSoapBindingEx::onGet(CHttpRequest* request, CHttpResponse* response) { const char *path = request->queryPath(); if (strieq(path, "/EclDirect/RunEclEx/Form")) return sendRunEclExForm(*request->queryContext(), request, response); if(strieq(path, "/EclDirect/RunEclEx/DisplayResult")) { IEspContext& context = *request->queryContext(); request->queryParameters()->setProp("display_xslt", 1); CRunEclExRequest reqObj(&context, "EclDirect", request->queryParameters(), request->queryAttachments()); CRunEclExResponse respObj("EclDirect"); theService->onRunEclEx(context, *QUERYINTERFACE(&reqObj, IEspRunEclExRequest), *QUERYINTERFACE(&respObj, IEspRunEclExResponse)); const char *result = respObj.getResults(); if (result && *result) { response->setContent(result); response->setContentType(runEclExFormatMimeType(reqObj.getFormat())); } else { response->setContent("No result in Ecl execution."); response->setContentType("text/html"); } response->setStatus(HTTP_STATUS_OK); response->send(); return 0; } return CEclDirectSoapBinding::onGet(request,response); }
IHqlExpression * XmlEclRepository::doLoadSymbol(IPropertyTree * repository, IAtom * modname, IAtom * attrname) { StringBuffer s; IPropertyTree* module = repository->queryPropTree(s.append("./Module[@name=\"").append(*modname).append("\"]").str()); if(!module) { if (logging()) DBGLOG("No data for module %s",modname->getAtomNamePtr()); return 0; } int access = module->getPropInt("@access",cs_full); s.clear().append("./Attribute[@name=\"").append(*attrname).append("\"]"); Owned<IPropertyTreeIterator> it = module->getElements(s.str()); for(it->first();it->isValid();it->next()) { Owned<IHqlExpression> item = toNamedSymbol(&it->query(), *modname,access); CHqlNamedSymbol* cur = QUERYINTERFACE(item.get(), CHqlNamedSymbol); if(cur) return LINK(cur); } return 0; }
void COleClientItem::SetLinkUpdateOptions(OLEUPDATE dwUpdateOpt) { ASSERT_VALID(this); ASSERT(m_lpObject != NULL); LPOLELINK lpOleLink = QUERYINTERFACE(m_lpObject, IOleLink); ASSERT(lpOleLink != NULL); // perhaps not a link? SCODE sc = lpOleLink->SetUpdateOptions(dwUpdateOpt); lpOleLink->Release(); CheckGeneral(sc); }
CDfuPlusHelper::~CDfuPlusHelper() { #ifdef DAFILESRV_LOCAL if (dafsthread.get()) { CDafsThread *dthread = QUERYINTERFACE(dafsthread.get(),CDafsThread); if (dthread) dthread->stop(); if (!dafsthread->join(1000*60)) error("CDfuPlusHelper dafsthread not stopped\n"); dafsthread.clear(); } #endif }
OLEUPDATE COleClientItem::GetLinkUpdateOptions() { ASSERT_VALID(this); ASSERT(m_lpObject != NULL); LPOLELINK lpOleLink = QUERYINTERFACE(m_lpObject, IOleLink); ASSERT(lpOleLink != NULL); // perhaps not a link? DWORD dwUpdateOpt; SCODE sc = lpOleLink->GetUpdateOptions(&dwUpdateOpt); lpOleLink->Release(); CheckGeneral(sc); // may throw an exception return (OLEUPDATE)dwUpdateOpt; }
virtual void serializeCreateContext(MemoryBuffer &mb) { // bit of hack, need to tell slave if wuidread converted to diskread (see master activity) CMasterGraphElement::serializeCreateContext(mb); if (kind == TAKworkunitread) { if (!activity) doCreateActivity(); IHThorArg *helper = activity->queryHelper(); IHThorDiskReadArg *diskHelper = QUERYINTERFACE(helper, IHThorDiskReadArg); mb.append(NULL != diskHelper); // flag to slaves that they should create diskread if (diskHelper) { OwnedRoxieString fileName(diskHelper->getFileName()); mb.append(fileName); } } }
BOOL COleClientItem::SetItemRects(LPCRECT lpPosRect, LPCRECT lpClipRect) { ASSERT_VALID(this); ASSERT(m_lpObject != NULL); ASSERT(IsInPlaceActive()); ASSERT(lpPosRect == NULL || AfxIsValidAddress(lpPosRect, sizeof(RECT), FALSE)); ASSERT(lpClipRect == NULL || AfxIsValidAddress(lpClipRect, sizeof(RECT), FALSE)); // get IOleInPlaceObject interface LPOLEINPLACEOBJECT lpInPlaceObject = QUERYINTERFACE(m_lpObject, IOleInPlaceObject); if (lpInPlaceObject == NULL) return FALSE; // perhaps server crashed? // use OnGetPosRect if rectangle not specified CRect rectPos; if (lpPosRect == NULL) { ASSERT(lpClipRect == NULL); OnGetItemPosition(rectPos); lpPosRect = &rectPos; } // use OnGetClipRect if clipping rectangle not specified CRect rectClip; if (lpClipRect == NULL) { OnGetClipRect(rectClip); lpClipRect = &rectClip; } ASSERT(lpPosRect != NULL); ASSERT(lpClipRect != NULL); // notify the server of the new item rectangles m_scLast = lpInPlaceObject->SetObjectRects(lpPosRect, lpClipRect); lpInPlaceObject->Release(); // remember position rectangle as cached position return !FAILED(m_scLast); }
BOOL COleDispatchDriver::CreateDispatch(REFCLSID clsid, COleException* pError) { ASSERT(m_lpDispatch == NULL); m_bAutoRelease = TRUE; // good default is to auto-release // create an instance of the object LPUNKNOWN lpUnknown = NULL; SCODE sc = CoCreateInstance(clsid, NULL, CLSCTX_ALL | CLSCTX_REMOTE_SERVER, IID_IUnknown, (LPLP)&lpUnknown); if (sc == E_INVALIDARG) { // may not support CLSCTX_REMOTE_SERVER, so try without sc = CoCreateInstance(clsid, NULL, CLSCTX_ALL & ~CLSCTX_REMOTE_SERVER, IID_IUnknown, (LPLP)&lpUnknown); } if (FAILED(sc)) goto Failed; // make sure it is running sc = OleRun(lpUnknown); if (FAILED(sc)) goto Failed; // query for IDispatch interface m_lpDispatch = QUERYINTERFACE(lpUnknown, IDispatch); if (m_lpDispatch == NULL) goto Failed; lpUnknown->Release(); ASSERT(m_lpDispatch != NULL); return TRUE; Failed: RELEASE(lpUnknown); if (pError != NULL) pError->m_sc = sc; TRACE1("Warning: CreateDispatch returning scode = %s.\n", AfxGetFullScodeString(sc)); return FALSE; }
void COleClientItem::OnActivateUI() { ASSERT_VALID(this); // notify the item of the state change if (m_nItemState != activeUIState) { OnChange(OLE_CHANGED_STATE, (DWORD)activeUIState); m_nItemState = activeUIState; } // the container window must have WS_CLIPCHILDREN set ASSERT_VALID(m_pView); m_dwContainerStyle = m_pView->GetStyle(); m_pView->ModifyStyle(0, WS_CLIPCHILDREN); // cache the server's HWND for later LPOLEINPLACEOBJECT lpInPlaceObject = QUERYINTERFACE(m_lpObject, IOleInPlaceObject); ASSERT(lpInPlaceObject != NULL); // get the HWND for the in-place active object HWND hWnd; if (lpInPlaceObject->GetWindow(&hWnd) != S_OK) hWnd = NULL; lpInPlaceObject->Release(); m_hWndServer = hWnd; // make sure top-level frame is hooked if (m_pInPlaceFrame != NULL) { ASSERT_VALID(m_pInPlaceFrame->m_pFrameWnd); m_pInPlaceFrame->m_pFrameWnd->m_pNotifyHook = m_pInPlaceFrame; } // make sure doc-level frame is hooked if (m_pInPlaceDoc != NULL) { ASSERT_VALID(m_pInPlaceDoc->m_pFrameWnd); m_pInPlaceDoc->m_pFrameWnd->m_pNotifyHook = m_pInPlaceDoc; } }
STDMETHODIMP COleUILinkInfo::GetLinkSource( DWORD dwLink, LPTSTR* lplpszDisplayName, ULONG* lplenFileName, LPTSTR* lplpszFullLinkType, LPTSTR* lplpszShortLinkType, BOOL* lpfSourceAvailable, BOOL* lpfIsSelected) { COleClientItem* pItem = (COleClientItem*)dwLink; ASSERT_VALID(pItem); ASSERT_KINDOF(COleClientItem, pItem); ASSERT(pItem->GetType() == OT_LINK); // set OUT params to NULL ASSERT(lplpszDisplayName != NULL); *lplpszDisplayName = NULL; if (lplpszFullLinkType != NULL) *lplpszFullLinkType = NULL; if (lplpszShortLinkType != NULL) *lplpszShortLinkType = NULL; if (lplenFileName != NULL) *lplenFileName = 0; if (lpfSourceAvailable != NULL) *lpfSourceAvailable = !pItem->m_bLinkUnavail; // get IOleLink interface LPOLELINK lpOleLink = QUERYINTERFACE(pItem->m_lpObject, IOleLink); ASSERT(lpOleLink != NULL); // get moniker & object information LPMONIKER lpmk; if (lpOleLink->GetSourceMoniker(&lpmk) == S_OK) { if (lplenFileName != NULL) *lplenFileName = _AfxOleGetLenFilePrefixOfMoniker(lpmk); lpmk->Release(); } // attempt to get the type names of the link if (lplpszFullLinkType != NULL) { LPOLESTR lpOleStr = NULL; pItem->m_lpObject->GetUserType(USERCLASSTYPE_FULL, &lpOleStr); *lplpszFullLinkType = TASKSTRINGOLE2T(lpOleStr); if (*lplpszFullLinkType == NULL) { TCHAR szUnknown[256]; VERIFY(AfxLoadString(AFX_IDS_UNKNOWNTYPE, szUnknown) != 0); *lplpszFullLinkType = AfxAllocTaskString(szUnknown); } } if (lplpszShortLinkType != NULL) { LPOLESTR lpOleStr = NULL; pItem->m_lpObject->GetUserType(USERCLASSTYPE_SHORT, &lpOleStr); *lplpszShortLinkType = TASKSTRINGOLE2T(lpOleStr); if (*lplpszShortLinkType == NULL) { TCHAR szUnknown[256]; VERIFY(AfxLoadString(AFX_IDS_UNKNOWNTYPE, szUnknown) != 0); *lplpszShortLinkType = AfxAllocTaskString(szUnknown); } } // get source display name for moniker LPOLESTR lpOleStr = NULL; SCODE sc = lpOleLink->GetSourceDisplayName(&lpOleStr); *lplpszDisplayName = TASKSTRINGOLE2T(lpOleStr); lpOleLink->Release(); if (sc != S_OK) return sc; // see if item is selected if specified if (lpfIsSelected) { *lpfIsSelected = (m_pSelectedItem == pItem); } return S_OK; }
STDMETHODIMP COleUILinkInfo::SetLinkSource( DWORD dwLink, LPTSTR lpszDisplayName, ULONG lenFileName, ULONG* pchEaten, BOOL fValidateSource) { USES_CONVERSION; COleClientItem* pItem = (COleClientItem*)dwLink; ASSERT_VALID(pItem); ASSERT_KINDOF(COleClientItem, pItem); ASSERT(pItem->GetType() == OT_LINK); LPOLEOBJECT lpObject = NULL; CLSID clsid; // parse the portion known to be a file name into a file moniker TCHAR szName[_MAX_PATH]; lstrcpyn(szName, lpszDisplayName, (int)lenFileName + 1); LPMONIKER lpmk = NULL; SCODE sc = CreateFileMoniker(T2COLE(szName), &lpmk); if (lpmk == NULL) return sc; LPBC lpbc = NULL; if (fValidateSource) { sc = CreateBindCtx(0, &lpbc); if (sc != S_OK) { lpmk->Release(); return sc; } } // nUneaten is the number of chars left to parse UINT nUneaten = lstrlen(lpszDisplayName) - lenFileName; // lpszRemainder is the left over display name LPTSTR lpszRemainder = lpszDisplayName + lenFileName; *pchEaten = lenFileName; // parse the rest of the display name while (nUneaten > 0) { // attempt to parse next moniker ULONG nEaten = 0; LPMONIKER lpmkNext = NULL; sc = _AfxParseDisplayName(lpmk, lpbc, lpszRemainder, &nEaten, &lpmkNext); if (sc != S_OK) { lpmk->Release(); lpbc->Release(); return sc; } // advance through the display name nUneaten -= nEaten; *pchEaten += nEaten; lpszRemainder += nEaten; if (lpmkNext != NULL) { // create composite out of current and next LPMONIKER lpmkTemp = NULL; sc = CreateGenericComposite(lpmk, lpmkNext, &lpmkTemp); if (FAILED(sc)) { lpmk->Release(); lpmkNext->Release(); lpbc->Release(); return sc; } // make current = next lpmkNext->Release(); lpmk->Release(); lpmk = lpmkTemp; } } if (fValidateSource) { // attempt to bind the the object sc = lpmk->BindToObject(lpbc, NULL, IID_IOleObject, (LPLP)&lpObject); if (FAILED(sc)) { pItem->m_bLinkUnavail = TRUE; lpbc->Release(); lpmk->Release(); RELEASE(lpObject); return sc; } ASSERT(lpObject != NULL); // call GetUserClassID while bound so default handler updates lpObject->GetUserClassID(&clsid); pItem->m_bLinkUnavail = FALSE; } // get IOleLink interface LPOLELINK lpOleLink = QUERYINTERFACE(pItem->m_lpObject, IOleLink); ASSERT(lpOleLink != NULL); // set source from moniker sc = lpOleLink->SetSourceMoniker(lpmk, clsid); // update the cache if object was successfully bound if (lpObject != NULL) { lpObject->Update(); lpObject->Release(); } // cleanup lpOleLink->Release(); RELEASE(lpmk); RELEASE(lpbc); return sc; }
//接口查询 void * CGameFrameControl::QueryInterface(const IID & Guid, DWORD dwQueryVer) { QUERYINTERFACE(IPurchaseInfo,Guid,dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(IPurchaseInfo,Guid,dwQueryVer); return NULL; }
//基础接口 ////////////////////////////////////////////////////////////////////////// //接口查询 VOID * __cdecl CRichEditTrace::QueryInterface(const IID & Guid, DWORD dwQueryVer) { QUERYINTERFACE(ITraceService, Guid, dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(ITraceService, Guid, dwQueryVer); return NULL; }
//接口查询 void * __cdecl CTimerEngine::QueryInterface(const IID & Guid, DWORD dwQueryVer) { QUERYINTERFACE(ITimerEngine, Guid, dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(ITimerEngine, Guid, dwQueryVer); return NULL; }
//接口查询 void * __cdecl CServerListCenter::QueryInterface(const IID & Guid, DWORD dwQueryVer) { QUERYINTERFACE(IServerListCenter,Guid,dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(IServerListCenter,Guid,dwQueryVer); return NULL; }
//接口查询 void * __cdecl CUserFaceRes::QueryInterface(const IID & Guid, DWORD dwQueryVer) { QUERYINTERFACE(IUserFaceRes,Guid,dwQueryVer); QUERYINTERFACE_IUNKNOWNEX(IUserFaceRes,Guid,dwQueryVer); return NULL; }