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.

165 lines
4.0 KiB

  1. //////////////////////////////////////////////////////////////////////
  2. // AuthMM.h : Declaration of CAuthMM class which implements
  3. // our WMI class Nsp_MMAuthSettings
  4. // Copyright (c)1997-2001 Microsoft Corporation
  5. //
  6. // Original Create Date: 3/8/2001
  7. // Original Author: shawnwu
  8. //////////////////////////////////////////////////////////////////////
  9. #pragma once
  10. #include "globals.h"
  11. #include "IPSecBase.h"
  12. /*
  13. Class description
  14. Naming:
  15. CAuthMM stands for Main Mode Authentication Method.
  16. Base class:
  17. CIPSecBase, because it is a class representing a WMI object - its WMI
  18. class name is Nsp_MMAuthSettings
  19. Purpose of class:
  20. (1) Nsp_MMAuthSettings is the WMI class for SPD's MM_AUTH_METHODS.
  21. Design:
  22. (1) it implements IIPSecObjectImpl.
  23. (2) Since there is one authentication method class, we don't need another layer
  24. of common class. As a result, this class is much bigger so that it can handle
  25. (2.1) Allocation/Deallocation.
  26. (2.2) Rollback support.
  27. (2.3) All creation/remove semantics.
  28. Use:
  29. (1) Other than rollback, we probably will never directly use this class.
  30. All its use is driven by IIPSecObjectImpl.
  31. (2) When you need to rollback all previously added main mode authentication
  32. methods, just call Rollback.
  33. */
  34. class ATL_NO_VTABLE CAuthMM :
  35. public CIPSecBase
  36. {
  37. protected:
  38. CAuthMM(){}
  39. virtual ~CAuthMM(){}
  40. public:
  41. //
  42. // IIPSecObjectImpl methods:
  43. //
  44. STDMETHOD(QueryInstance) (
  45. IN LPCWSTR pszQuery,
  46. IN IWbemContext * pCtx,
  47. IN IWbemObjectSink * pSink
  48. );
  49. STDMETHOD(DeleteInstance) (
  50. IN IWbemContext * pCtx,
  51. IN IWbemObjectSink * pSink
  52. );
  53. STDMETHOD(PutInstance) (
  54. IN IWbemClassObject * pInst,
  55. IN IWbemContext * pCtx,
  56. IN IWbemObjectSink * pSink
  57. );
  58. STDMETHOD(GetInstance) (
  59. IN IWbemContext * pCtx,
  60. IN IWbemObjectSink * pSink
  61. );
  62. static
  63. HRESULT Rollback(
  64. IN IWbemServices * pNamespace,
  65. IN LPCWSTR pszRollbackToken,
  66. IN bool bClearAll
  67. );
  68. private:
  69. static
  70. HRESULT ClearAllAuthMethods (
  71. IN IWbemServices * pNamespace
  72. );
  73. HRESULT CreateWbemObjFromMMAuthMethods (
  74. IN PMM_AUTH_METHODS pMMAuth,
  75. OUT IWbemClassObject ** ppObj
  76. );
  77. HRESULT GetMMAuthMethodsFromWbemObj (
  78. IN IWbemClassObject * pInst,
  79. OUT PMM_AUTH_METHODS * ppMMAuth,
  80. OUT bool * pbPreExist
  81. );
  82. HRESULT UpdateAuthInfos (
  83. IN OUT bool * pPreExist,
  84. IN VARIANT * pVarMethods,
  85. IN VARIANT * pVarInfos,
  86. IN OUT PMM_AUTH_METHODS pAuthMethods
  87. );
  88. HRESULT SetAuthInfo (
  89. IN OUT PIPSEC_MM_AUTH_INFO pInfo,
  90. IN BSTR bstrInfo
  91. );
  92. static
  93. HRESULT AllocAuthMethods(
  94. IN DWORD dwNumInfos,
  95. OUT PMM_AUTH_METHODS * ppMMAuth
  96. );
  97. static
  98. HRESULT AllocAuthInfos(
  99. IN DWORD dwNumInfos,
  100. OUT PIPSEC_MM_AUTH_INFO * ppAuthInfos
  101. );
  102. static
  103. void FreeAuthMethods(
  104. IN OUT PMM_AUTH_METHODS * ppMMAuth,
  105. IN bool bPreExist
  106. );
  107. static
  108. void FreeAuthInfos(
  109. IN DWORD dwNumInfos,
  110. IN OUT PIPSEC_MM_AUTH_INFO * ppAuthInfos
  111. );
  112. static
  113. HRESULT AddAuthMethods(
  114. IN bool bPreExist,
  115. IN PMM_AUTH_METHODS pMMAuth
  116. );
  117. static
  118. HRESULT DeleteAuthMethods(
  119. IN GUID gMMAuthID
  120. );
  121. HRESULT OnAfterAddMMAuthMethods(
  122. IN GUID gMethodID
  123. );
  124. };