Source code of Windows XP (NT5)
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.

100 lines
2.0 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. History:
  6. --*/
  7. #include "precomp.h"
  8. #include <wmimsg.h>
  9. #include <comutl.h>
  10. #include "msmqctx.h"
  11. /***************************************************************************
  12. CMsgMsmqRcvrCtx
  13. ****************************************************************************/
  14. STDMETHODIMP CMsgMsmqRcvrCtx::GetTimeSent( SYSTEMTIME* pTime )
  15. {
  16. *pTime = *m_pHdr->GetTimeSent();
  17. return S_OK;
  18. }
  19. STDMETHODIMP CMsgMsmqRcvrCtx::GetSendingMachine( WCHAR* awchMachine,
  20. ULONG cMachine,
  21. ULONG* pcMachine )
  22. {
  23. LPCWSTR wszSource = m_pHdr->GetSendingMachine();
  24. *pcMachine = wcslen( wszSource ) + 1;
  25. if ( *pcMachine > cMachine )
  26. {
  27. return S_FALSE;
  28. }
  29. wcscpy( awchMachine, wszSource );
  30. return S_OK;
  31. }
  32. STDMETHODIMP CMsgMsmqRcvrCtx::GetTarget( WCHAR* awchTarget,
  33. ULONG cTarget,
  34. ULONG* pcTarget )
  35. {
  36. LPCWSTR wszTarget = m_pHdr->GetTarget();
  37. *pcTarget = wcslen( wszTarget ) + 1;
  38. if ( *pcTarget > cTarget )
  39. {
  40. return S_FALSE;
  41. }
  42. wcscpy( awchTarget, wszTarget );
  43. return S_OK;
  44. }
  45. STDMETHODIMP CMsgMsmqRcvrCtx::GetSenderId( PBYTE pchSenderId,
  46. ULONG cSenderId,
  47. ULONG* pcSenderId )
  48. {
  49. HRESULT hr;
  50. if ( m_pSenderSid != NULL )
  51. {
  52. *pcSenderId = GetLengthSid( m_pSenderSid );
  53. if ( *pcSenderId <= cSenderId )
  54. {
  55. memcpy( pchSenderId, m_pSenderSid, *pcSenderId );
  56. hr = WBEM_S_NO_ERROR;
  57. }
  58. else
  59. {
  60. hr = WBEM_S_FALSE;
  61. }
  62. }
  63. else
  64. {
  65. *pcSenderId = 0;
  66. hr = WBEM_S_NO_ERROR;
  67. }
  68. return hr;
  69. }
  70. STDMETHODIMP CMsgMsmqRcvrCtx::IsSenderAuthenticated()
  71. {
  72. return m_bAuth ? S_OK : S_FALSE;
  73. }