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.

135 lines
3.2 KiB

  1. /********************************************************************
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. Session.cpp
  5. Abstract:
  6. SAFSession Object
  7. Revision History:
  8. KalyaninN created 09/29/'00
  9. ********************************************************************/
  10. // User.cpp : Implementation of CSAFSession
  11. #include "stdafx.h"
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CSAFSession
  14. #include <HCP_trace.h>
  15. /////////////////////////////////////////////////////////////////////////////
  16. // construction / destruction
  17. // **************************************************************************
  18. CSAFSession::CSAFSession()
  19. {
  20. // CComBSTR m_bstrUserName;
  21. // CComBSTR m_bstrDomainName;
  22. // DWORD m_dwSessionID;
  23. // SessionStateEnum m_SessionConnectState;
  24. }
  25. // **************************************************************************
  26. CSAFSession::~CSAFSession()
  27. {
  28. Cleanup();
  29. }
  30. // **************************************************************************
  31. void CSAFSession::Cleanup(void)
  32. {
  33. }
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CSAFSession Properties
  36. STDMETHODIMP CSAFSession::get_SessionID(DWORD *dwSessionID)
  37. {
  38. if (dwSessionID == NULL)
  39. return E_INVALIDARG;
  40. *dwSessionID = m_dwSessionID;
  41. return S_OK;
  42. }
  43. STDMETHODIMP CSAFSession::put_SessionID(DWORD dwSessionID)
  44. {
  45. m_dwSessionID = dwSessionID;
  46. return S_OK;
  47. }
  48. STDMETHODIMP CSAFSession::get_SessionState(SessionStateEnum *pSessionState)
  49. {
  50. __HCP_BEGIN_PROPERTY_GET2("CSAFSession::get_SessionState",hr,pSessionState,pchStateInvalid);
  51. *pSessionState = m_SessionConnectState;
  52. __HCP_END_PROPERTY(hr);
  53. }
  54. STDMETHODIMP CSAFSession::put_SessionState(SessionStateEnum SessionState)
  55. {
  56. __HCP_BEGIN_PROPERTY_PUT("CSAFSession::put_SessionState",hr);
  57. switch(SessionState)
  58. {
  59. case pchActive:
  60. case pchConnected:
  61. case pchConnectQuery:
  62. case pchShadow:
  63. case pchDisconnected:
  64. case pchIdle:
  65. case pchListen:
  66. case pchReset:
  67. case pchDown:
  68. case pchInit:
  69. m_SessionConnectState = SessionState;
  70. break;
  71. default:
  72. __MPC_SET_ERROR_AND_EXIT(hr, E_INVALIDARG);
  73. }
  74. __HCP_END_PROPERTY(hr);
  75. }
  76. STDMETHODIMP CSAFSession::get_UserName(BSTR *pbstrUserName)
  77. {
  78. MPC::SmartLock<_ThreadModel> lock( this );
  79. return MPC::GetBSTR( m_bstrUserName, pbstrUserName );
  80. }
  81. STDMETHODIMP CSAFSession::put_UserName(BSTR bstrUserName)
  82. {
  83. __HCP_BEGIN_PROPERTY_PUT("CSAFSession::put_UserName",hr);
  84. m_bstrUserName = bstrUserName ;
  85. __HCP_END_PROPERTY(hr);
  86. }
  87. STDMETHODIMP CSAFSession::get_DomainName(BSTR *pbstrDomainName)
  88. {
  89. MPC::SmartLock<_ThreadModel> lock( this );
  90. return MPC::GetBSTR( m_bstrDomainName, pbstrDomainName );
  91. }
  92. STDMETHODIMP CSAFSession::put_DomainName(BSTR bstrDomainName)
  93. {
  94. __HCP_BEGIN_PROPERTY_PUT("CSAFSession::put_DomainName",hr);
  95. m_bstrDomainName = bstrDomainName;
  96. __HCP_END_PROPERTY(hr);
  97. }