unknown.cpp
资源名称:shell.rar [点击查看]
上传用户:xhy777
上传日期:2007-02-14
资源大小:24088k
文件大小:1k
源码类别:
系统编程
开发平台:
Visual C++
- //*******************************************************************************************
- //
- // Filename : Unknown.cpp
- //
- // Customized CUnknown implmentations
- //
- // Copyright (c) 1994 - 1996 Microsoft Corporation. All rights reserved
- //
- //*******************************************************************************************
- #include "Pch.H"
- #include "ThisDll.H"
- #include "Unknown.H"
- CUnknown::~CUnknown()
- {
- }
- HRESULT CUnknown::QIHelper(REFIID riid, LPVOID *ppvObj, const IID *apiid[],
- LPUNKNOWN aobj[])
- {
- *ppvObj = NULL;
- LPUNKNOWN pObj;
- if (riid == IID_IUnknown)
- {
- pObj = aobj[0];
- }
- else
- {
- for (int i=0; ; ++i)
- {
- if (!apiid[i])
- {
- return(E_NOINTERFACE);
- }
- if (*apiid[i] == riid)
- {
- pObj = aobj[i];
- break;
- }
- }
- }
- pObj->AddRef();
- *ppvObj = pObj;
- return(NOERROR);
- }
- ULONG CUnknown::AddRefHelper()
- {
- return(m_cRef.AddRef());
- }
- ULONG CUnknown::ReleaseHelper()
- {
- if (!m_cRef.Release())
- {
- delete this;
- return(0);
- }
- return(m_cRef.GetRef());
- }
English
