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.

138 lines
3.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997 - 2000
  5. //
  6. // File: H N A P I P R P . C P P
  7. //
  8. // Contents: OEM API
  9. //
  10. // Notes: Props (IDispatch wrappers)
  11. //
  12. // Author: bhanlon 17 Jan 2001
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #pragma hdrstop
  17. //////////////////////////////////////////////////////////////////////////////
  18. // CNetSharingPortMappingProps
  19. STDMETHODIMP CNetSharingPortMappingProps::get_Name (BSTR * pbstrName)
  20. { // can't validate m_IPM
  21. HNET_OEM_API_ENTER
  22. _ASSERT (pbstrName);
  23. if (!pbstrName)
  24. return E_POINTER;
  25. *pbstrName = SysAllocString (m_IPM.pszwName);
  26. if (!*pbstrName)
  27. return E_OUTOFMEMORY;
  28. return S_OK;
  29. HNET_OEM_API_LEAVE
  30. }
  31. STDMETHODIMP CNetSharingPortMappingProps::get_IPProtocol (UCHAR * pucIPProt)
  32. {
  33. HNET_OEM_API_ENTER
  34. _ASSERT (pucIPProt);
  35. if (!pucIPProt)
  36. return E_POINTER;
  37. *pucIPProt = m_IPM.ucIPProtocol;
  38. return S_OK;
  39. HNET_OEM_API_LEAVE
  40. }
  41. STDMETHODIMP CNetSharingPortMappingProps::get_ExternalPort (long * pusPort)
  42. {
  43. HNET_OEM_API_ENTER
  44. _ASSERT (pusPort);
  45. if (!pusPort)
  46. return E_POINTER;
  47. *pusPort = m_IPM.usExternalPort;
  48. return S_OK;
  49. HNET_OEM_API_LEAVE
  50. }
  51. STDMETHODIMP CNetSharingPortMappingProps::get_InternalPort (long * pusPort)
  52. {
  53. HNET_OEM_API_ENTER
  54. _ASSERT (pusPort);
  55. if (!pusPort)
  56. return E_POINTER;
  57. *pusPort = m_IPM.usInternalPort;
  58. return S_OK;
  59. HNET_OEM_API_LEAVE
  60. }
  61. STDMETHODIMP CNetSharingPortMappingProps::get_Options (long * pdwOptions)
  62. {
  63. HNET_OEM_API_ENTER
  64. _ASSERT (pdwOptions);
  65. if (!pdwOptions)
  66. return E_POINTER;
  67. *pdwOptions = m_IPM.dwOptions;
  68. return S_OK;
  69. HNET_OEM_API_LEAVE
  70. }
  71. STDMETHODIMP CNetSharingPortMappingProps::get_TargetName (BSTR * pbstrTargetName)
  72. {
  73. HNET_OEM_API_ENTER
  74. _ASSERT (pbstrTargetName);
  75. if (!pbstrTargetName)
  76. return E_POINTER;
  77. *pbstrTargetName = SysAllocString (m_IPM.pszwTargetName);
  78. if (!*pbstrTargetName)
  79. return E_OUTOFMEMORY;
  80. return S_OK;
  81. HNET_OEM_API_LEAVE
  82. }
  83. STDMETHODIMP CNetSharingPortMappingProps::get_TargetIPAddress(BSTR * pbstrTargetIPAddress)
  84. {
  85. HNET_OEM_API_ENTER
  86. _ASSERT (pbstrTargetIPAddress);
  87. if (!pbstrTargetIPAddress)
  88. return E_POINTER;
  89. *pbstrTargetIPAddress = SysAllocString (m_IPM.pszwTargetIPAddress);
  90. if (!*pbstrTargetIPAddress)
  91. return E_OUTOFMEMORY;
  92. return S_OK;
  93. HNET_OEM_API_LEAVE
  94. }
  95. STDMETHODIMP CNetSharingPortMappingProps::get_Enabled (VARIANT_BOOL * pbool)
  96. {
  97. HNET_OEM_API_ENTER
  98. _ASSERT (pbool);
  99. if (!pbool)
  100. return E_POINTER;
  101. *pbool = m_IPM.bEnabled;
  102. return S_OK;
  103. HNET_OEM_API_LEAVE
  104. }