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.

256 lines
3.9 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. xpprov.cpp
  5. Abstract:
  6. This module contains the CXPProvider class implementation.
  7. Author:
  8. Wesley Witt (wesw) 13-Aug-1996
  9. --*/
  10. #define INITGUID
  11. #define USES_IID_IXPProvider
  12. #define USES_IID_IXPLogon
  13. #define USES_IID_IMAPIStatus
  14. #define USES_IID_IMAPIProp
  15. #define USES_IID_IMAPIPropData
  16. #define USES_IID_IMAPIControl
  17. #define USES_IID_IMAPIContainer
  18. #define USES_IID_IMAPIFolder
  19. #define USES_IID_IMAPITableData
  20. #define USES_IID_IStreamDocfile
  21. #define USES_PS_PUBLIC_STRINGS
  22. #include "faxxp.h"
  23. #include "debugex.h"
  24. #pragma hdrstop
  25. CXPProvider::CXPProvider(
  26. HINSTANCE hInst
  27. )
  28. /*++
  29. Routine Description:
  30. Constructor of the object. Parameters are passed to initialize the
  31. data members with the appropiate values.
  32. Arguments:
  33. hInst - Handle to instance of this XP DLL
  34. Return Value:
  35. None.
  36. --*/
  37. {
  38. m_hInstance = hInst;
  39. m_cRef = 1;
  40. InitializeCriticalSection( &m_csTransport );
  41. }
  42. CXPProvider::~CXPProvider()
  43. /*++
  44. Routine Description:
  45. Close down and release resources and libraries.
  46. Arguments:
  47. None.
  48. Return Value:
  49. None.
  50. --*/
  51. {
  52. m_hInstance = NULL;
  53. DeleteCriticalSection( &m_csTransport );
  54. }
  55. STDMETHODIMP
  56. CXPProvider::QueryInterface(
  57. REFIID riid,
  58. LPVOID * ppvObj
  59. )
  60. /*++
  61. Routine Description:
  62. Returns a pointer to a interface requested if the interface is
  63. supported and implemented by this object. If it is not supported, it
  64. returns NULL
  65. Arguments:
  66. Refer to MAPI Documentation on this method.
  67. Return Value:
  68. An HRESULT.
  69. --*/
  70. {
  71. *ppvObj = NULL;
  72. if (riid == IID_IXPProvider || riid == IID_IUnknown) {
  73. *ppvObj = (LPVOID)this;
  74. AddRef();
  75. return S_OK;
  76. }
  77. return E_NOINTERFACE;
  78. }
  79. STDMETHODIMP
  80. CXPProvider::Shutdown(
  81. ULONG * pulFlags
  82. )
  83. /*++
  84. Routine Description:
  85. Stub method.
  86. Arguments:
  87. Refer to MAPI Documentation on this method.
  88. Return Value:
  89. An HRESULT.
  90. --*/
  91. {
  92. DBG_ENTER(TEXT("CXPProvider::Shutdown"));
  93. return S_OK;
  94. }
  95. STDMETHODIMP
  96. CXPProvider::TransportLogon(
  97. LPMAPISUP pSupObj,
  98. ULONG ulUIParam,
  99. LPTSTR pszProfileName,
  100. ULONG *pulFlags,
  101. LPMAPIERROR *ppMAPIError,
  102. LPXPLOGON *ppXPLogon
  103. )
  104. /*++
  105. Routine Description:
  106. Display the logon dialog to show the options saved in the profile for
  107. this provider and allow changes to it. Save new configuration settings
  108. back in the profile.
  109. Create a new CXPLogon object and return it to the spooler. Also,
  110. initialize the properties array for each address type handled
  111. by this transport. Check all the flags and return them to the spooler
  112. Arguments:
  113. Refer to MAPI Documentation on this method.
  114. Return Value:
  115. An HRESULT.
  116. --*/
  117. {
  118. HRESULT hResult = S_OK;
  119. DBG_ENTER(TEXT("CXPProvider::TransportLogon"),hResult);
  120. CXPLogon *LogonObj = new CXPLogon( m_hInstance, pSupObj, pszProfileName );
  121. if (!LogonObj) {
  122. hResult = E_OUTOFMEMORY;
  123. goto exit;
  124. }
  125. hResult = LogonObj->InitializeStatusRow(0);
  126. if(HR_SUCCEEDED(hResult))
  127. {
  128. *ppXPLogon = LogonObj;
  129. }
  130. else
  131. {
  132. delete LogonObj;
  133. }
  134. exit:
  135. return hResult;
  136. }
  137. STDMETHODIMP_(ULONG)
  138. CXPProvider::AddRef()
  139. /*++
  140. Routine Description:
  141. Arguments:
  142. Refer to MAPI Documentation on this method.
  143. Return Value:
  144. An HRESULT.
  145. --*/
  146. {
  147. ++m_cRef;
  148. return m_cRef;
  149. }
  150. STDMETHODIMP_(ULONG)
  151. CXPProvider::Release()
  152. /*++
  153. Routine Description:
  154. Arguments:
  155. Refer to MAPI Documentation on this method.
  156. Return Value:
  157. An HRESULT.
  158. --*/
  159. {
  160. ULONG ulCount = --m_cRef;
  161. if (!ulCount) {
  162. delete this;
  163. }
  164. return ulCount;
  165. }