Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.2 KiB

  1. #include "..\\inc\\urlint.h"
  2. #include "..\\inc\\wcheckcb.h"
  3. #include "..\\inc\\debug.h"
  4. // createion method
  5. STDMETHODIMP CreateCallbackClassFactory(IClassFactory** ppCF)
  6. {
  7. *ppCF = (IClassFactory*)new CCallbackObjFactory;
  8. if (*ppCF == NULL)
  9. return E_OUTOFMEMORY;
  10. return S_OK;
  11. }
  12. // constructor
  13. CCallbackObjFactory::CCallbackObjFactory()
  14. {
  15. DllAddRef();
  16. m_cRef = 1;
  17. m_cLocks = 0;
  18. }
  19. // destructor
  20. CCallbackObjFactory::~CCallbackObjFactory()
  21. {
  22. Assert(m_cRef == 0 && m_cLocks == 0);
  23. DllRelease();
  24. }
  25. /******************************************************************************
  26. IUnknown methods
  27. ******************************************************************************/
  28. STDMETHODIMP CCallbackObjFactory::QueryInterface(REFIID iid, void** ppvObject)
  29. {
  30. *ppvObject = NULL;
  31. if (iid == IID_IUnknown || iid == IID_IClassFactory)
  32. {
  33. *ppvObject = (void*)this;
  34. ((LPUNKNOWN)*ppvObject)->AddRef();
  35. return S_OK;
  36. }
  37. return E_NOINTERFACE;
  38. }
  39. STDMETHODIMP_(ULONG) CCallbackObjFactory::AddRef(void)
  40. {
  41. return ++m_cRef;
  42. }
  43. STDMETHODIMP_(ULONG) CCallbackObjFactory::Release(void)
  44. {
  45. if (--m_cRef)
  46. return m_cRef;
  47. delete this;
  48. return 0;
  49. }
  50. /******************************************************************************
  51. IClassFactory methods
  52. ******************************************************************************/
  53. STDMETHODIMP CCallbackObjFactory::CreateInstance(
  54. LPUNKNOWN pUnkOuter,
  55. REFIID riid,
  56. LPVOID* ppv)
  57. {
  58. *ppv = NULL;
  59. HRESULT hr = S_OK;
  60. if (pUnkOuter != NULL)
  61. return CLASS_E_NOAGGREGATION;
  62. CControlRefreshCallback *pCRC = new CControlRefreshCallback;
  63. if (pCRC == NULL)
  64. return E_OUTOFMEMORY;
  65. hr = pCRC->QueryInterface(riid, ppv);
  66. pCRC->Release();
  67. return hr;
  68. }
  69. STDMETHODIMP CCallbackObjFactory::LockServer(BOOL fLock)
  70. {
  71. if (fLock)
  72. DllAddRef();
  73. else
  74. DllRelease();
  75. return S_OK;
  76. }