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.

174 lines
5.4 KiB

  1. //***************************************************************************
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation.
  4. //
  5. // File: WLBS_Provider.h
  6. //
  7. // Module: WLBS instance provider main project header file
  8. //
  9. // Purpose: General purpose include file.
  10. //
  11. // History:
  12. //
  13. // Author: drbeck
  14. //
  15. //***************************************************************************
  16. #ifndef _WLBSPROVIDER_INCLUDED_
  17. #define _WLBSPROVIDER_INCLUDED_
  18. #include <crtdbg.h>
  19. #include <comdef.h>
  20. #include <iostream>
  21. #include <memory>
  22. #include <string>
  23. #include <wbemprov.h>
  24. #include <genlex.h> //for wmi object path parser
  25. #include <objbase.h>
  26. #include <wlbsconfig.h>
  27. #include <ntrkcomm.h>
  28. using namespace std;
  29. #include "objpath.h"
  30. #include "WLBS_MOFData.h"
  31. #include "WLBS_Root.h"
  32. #include "WLBS_Node.h"
  33. #include "WLBS_Cluster.h"
  34. #include "WLBS_NodeSetting.h"
  35. #include "WLBS_ClusterSetting.h"
  36. #include "WLBS_PortRule.h"
  37. #include "WLBS_ParticipatingNode.h"
  38. #include "WLBS_NodeSetPortRule.h"
  39. #include "WLBS_ClusClusSetting.h"
  40. #include "WLBS_NodeNodeSetting.h"
  41. typedef LPVOID * PPVOID;
  42. class CWLBSProvider : public CImpersonatedProvider
  43. {
  44. private:
  45. void GetClass(IWbemClassObject *a_pClassObject, wstring& a_szClass);
  46. void ParseObjectPath(const BSTR a_strObjectPath, ParsedObjectPath **a_pParsedObjectPath);
  47. HRESULT GetMOFSupportClass( LPCWSTR a_szObjectClass,
  48. auto_ptr<CWlbs_Root> &a_pMofClass,
  49. IWbemObjectSink* a_pResponseHandler );
  50. BOOL IsCallerAdmin(VOID);
  51. public:
  52. CWLBSProvider( BSTR ObjectPath = NULL,
  53. BSTR User = NULL,
  54. BSTR Password = NULL,
  55. IWbemContext *pCtx = NULL );
  56. virtual ~CWLBSProvider();
  57. HRESULT STDMETHODCALLTYPE DoGetObjectAsync(
  58. /* [in] */ BSTR ObjectPath,
  59. /* [in] */ long lFlags,
  60. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  61. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  62. HRESULT STDMETHODCALLTYPE DoPutInstanceAsync(
  63. /* [in] */ IWbemClassObject __RPC_FAR *pInst,
  64. /* [in] */ long lFlags,
  65. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  66. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) ;
  67. HRESULT STDMETHODCALLTYPE DoDeleteInstanceAsync(
  68. /* [in] */ BSTR ObjectPath,
  69. /* [in] */ long lFlags,
  70. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  71. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  72. HRESULT STDMETHODCALLTYPE DoCreateInstanceEnumAsync(
  73. /* [in] */ BSTR Class,
  74. /* [in] */ long lFlags,
  75. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  76. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  77. HRESULT STDMETHODCALLTYPE DoExecQueryAsync(
  78. /* [in] */ BSTR QueryLanguage,
  79. /* [in] */ BSTR Query,
  80. /* [in] */ long lFlags,
  81. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  82. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  83. {return WBEM_E_NOT_SUPPORTED;}
  84. HRESULT STDMETHODCALLTYPE DoExecMethodAsync(
  85. BSTR,
  86. BSTR,
  87. long,
  88. IWbemContext*,
  89. IWbemClassObject*,
  90. IWbemObjectSink* );
  91. //IWbemProviderInit
  92. HRESULT STDMETHODCALLTYPE Initialize(
  93. LPWSTR pszUser,
  94. LONG lFlags,
  95. LPWSTR pszNamespace,
  96. LPWSTR pszLocale,
  97. IWbemServices * pNamespace,
  98. IWbemContext * pCtx,
  99. IWbemProviderInitSink * pInitSink
  100. );
  101. };
  102. typedef CWLBSProvider * PCWLBSProvider;
  103. // This class is the class factory for CWLBSProvider objects.
  104. class CWLBSClassFactory : public IClassFactory
  105. {
  106. protected:
  107. long m_cRef;
  108. public:
  109. CWLBSClassFactory(void);
  110. ~CWLBSClassFactory(void);
  111. //IUnknown members
  112. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  113. STDMETHODIMP_(ULONG) AddRef(void);
  114. STDMETHODIMP_(ULONG) Release(void);
  115. //IClassFactory members
  116. STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID
  117. ,PPVOID);
  118. STDMETHODIMP LockServer(BOOL);
  119. };
  120. typedef CWLBSClassFactory *PCWLBSClassFactory;
  121. _COM_SMARTPTR_TYPEDEF(IWbemClassObject, _uuidof(IWbemClassObject));
  122. _COM_SMARTPTR_TYPEDEF(IWbemQualifierSet, _uuidof(IWbemQualifierSet));
  123. //Global Variables
  124. // These variables keep track of when the module can be unloaded
  125. extern long g_cComponents;
  126. extern long g_cServerLocks;
  127. //The one and only instance of the WLBS control class. All
  128. //WLBS control commands are implemented via this class.
  129. class CWlbsControlWrapper;
  130. extern CWlbsControlWrapper* g_pWlbsControl;
  131. // General purpose utilities.
  132. SCODE CreateInst( IWbemServices * pNamespace,
  133. LPWSTR pKey,
  134. long lVal,
  135. IWbemClassObject ** pNewInst,
  136. WCHAR * pwcClassName,
  137. IWbemContext * pCtx);
  138. #endif //_WLBSPROVIDER_INCLUDED_