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.

113 lines
3.8 KiB

  1. /*****************************************************************************\
  2. FILE: AutoDiscover.cpp
  3. DESCRIPTION:
  4. This is the Autmation Object to AutoDiscover account information.
  5. BryanSt 10/3/1999
  6. Copyright (C) Microsoft Corp 1999-1999. All rights reserved.
  7. \*****************************************************************************/
  8. #include "priv.h"
  9. #include <cowsite.h>
  10. #include <atlbase.h>
  11. #include "AutoDiscover.h"
  12. class CAccountDiscovery : public CImpIDispatch
  13. , public CAccountDiscoveryBase
  14. , public IAccountDiscovery
  15. {
  16. public:
  17. //////////////////////////////////////////////////////
  18. // Public Interfaces
  19. //////////////////////////////////////////////////////
  20. // *** IUnknown ***
  21. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  22. virtual STDMETHODIMP_(ULONG) AddRef(void) {return CAccountDiscoveryBase::AddRef();}
  23. virtual STDMETHODIMP_(ULONG) Release(void) {return CAccountDiscoveryBase::Release();}
  24. // *** IAccountDiscovery ***
  25. virtual STDMETHODIMP DiscoverNow(IN BSTR bstrEmailAddress, IN DWORD dwFlags, IN BSTR bstrXMLRequest, OUT IXMLDOMDocument ** ppXMLResponse);
  26. virtual STDMETHODIMP WorkAsync(IN HWND hwnd, IN UINT wMsg) {return _WorkAsync(hwnd, wMsg);}
  27. // *** IDispatch ***
  28. virtual STDMETHODIMP GetTypeInfoCount(UINT *pctinfo) { return CImpIDispatch::GetTypeInfoCount(pctinfo); }
  29. virtual STDMETHODIMP GetTypeInfo(UINT itinfo,LCID lcid,ITypeInfo **pptinfo) { return CImpIDispatch::GetTypeInfo(itinfo, lcid, pptinfo); }
  30. virtual STDMETHODIMP GetIDsOfNames(REFIID riid,OLECHAR **rgszNames,UINT cNames, LCID lcid, DISPID * rgdispid) { return CImpIDispatch::GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid); }
  31. virtual STDMETHODIMP Invoke(DISPID dispidMember,REFIID riid,LCID lcid,WORD wFlags, DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,UINT * puArgErr) { return CImpIDispatch::Invoke(dispidMember, riid, lcid, wFlags, pdispparams, pvarResult, pexcepinfo, puArgErr); }
  32. protected:
  33. CAccountDiscovery();
  34. virtual ~CAccountDiscovery(void);
  35. // Friend Functions
  36. friend HRESULT CAccountDiscovery_CreateInstance(IN IUnknown * punkOuter, REFIID riid, void ** ppvObj);
  37. };
  38. //===========================
  39. // *** IAccountDiscovery Interface ***
  40. //===========================
  41. HRESULT CAccountDiscovery::DiscoverNow(IN BSTR bstrEmailAddress, IN DWORD dwFlags, IN BSTR bstrXMLRequest, OUT IXMLDOMDocument ** ppXMLResponse)
  42. {
  43. return CAccountDiscoveryBase::_InternalDiscoverNow(bstrEmailAddress, dwFlags, bstrXMLRequest, ppXMLResponse);
  44. }
  45. HRESULT CAccountDiscovery::QueryInterface(REFIID riid, void **ppvObj)
  46. {
  47. static const QITAB qit[] = {
  48. QITABENT(CAccountDiscovery, IAccountDiscovery),
  49. QITABENT(CAccountDiscovery, IDispatch),
  50. { 0 },
  51. };
  52. HRESULT hr = QISearch(this, qit, riid, ppvObj);
  53. if (FAILED(hr))
  54. {
  55. hr = CAccountDiscoveryBase::QueryInterface(riid, ppvObj);
  56. }
  57. return hr;
  58. }
  59. CAccountDiscovery::CAccountDiscovery() : CImpIDispatch(LIBID_AutoDiscovery, 1, 0, IID_IAccountDiscovery)
  60. {
  61. DllAddRef();
  62. // This needs to be allocated in Zero Inited Memory.
  63. // Assert that all Member Variables are inited to Zero.
  64. }
  65. CAccountDiscovery::~CAccountDiscovery()
  66. {
  67. DllRelease();
  68. }
  69. HRESULT CAccountDiscovery_CreateInstance(IN IUnknown * punkOuter, REFIID riid, void ** ppvObj)
  70. {
  71. HRESULT hr = CLASS_E_NOAGGREGATION;
  72. if (NULL == punkOuter)
  73. {
  74. CAccountDiscovery * pmf = new CAccountDiscovery();
  75. if (pmf)
  76. {
  77. hr = pmf->QueryInterface(riid, ppvObj);
  78. pmf->Release();
  79. }
  80. else
  81. {
  82. *ppvObj = NULL;
  83. hr = E_OUTOFMEMORY;
  84. }
  85. }
  86. return hr;
  87. }