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.

133 lines
3.3 KiB

  1. //*************************************************************
  2. //
  3. // Copyright (c) Microsoft Corporation 1999 - 2000
  4. // All rights reserved
  5. //
  6. // context.hxx
  7. //
  8. // Contains declarations for classes related to the
  9. // rsop context abstraction
  10. //
  11. // Created: 12-06-1999 adamed
  12. //
  13. //*************************************************************/
  14. #if !defined (_CONTEXT_HXX_)
  15. #define _CONTEXT_HXX_
  16. // Parent of gp state key
  17. #define GPSTATEKEY L"Software\\Microsoft\\Windows\\CurrentVersion\\Group Policy\\State"
  18. #define EXTENSIONLISTKEY L"\\Extension-List\\"
  19. // String representation of "user" sid for machine account in registry
  20. #define MACHINESUBKEY L"Machine"
  21. // Registry Value names under per-cse rsop subkey
  22. #define RSOPNAMESPACE L"DiagnosticNamespace"
  23. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  24. //
  25. // Class: CRsopContext
  26. //
  27. // Synopsis: This class abstracts the context necessary for
  28. // rsop logging
  29. //
  30. //-------------------------------------------------------------
  31. class CRsopContext
  32. {
  33. public:
  34. CRsopContext(
  35. PRSOP_TARGET pRsopTarget,
  36. BOOL bReportingMode,
  37. WCHAR* wszExtensionGuid );
  38. CRsopContext(
  39. IWbemServices* pWbemServices,
  40. HRESULT* phrLoggingStatus,
  41. WCHAR* wszExtensionGuid );
  42. CRsopContext( WCHAR* wszExtensionGuid );
  43. ~CRsopContext();
  44. BOOL IsRsopEnabled();
  45. BOOL IsPlanningModeEnabled();
  46. BOOL IsDiagnosticModeEnabled();
  47. BOOL IsReportingModeEnabled();
  48. HRESULT GetRsopStatus();
  49. void SetNameSpace( WCHAR* wszNameSpace );
  50. void EnableRsop();
  51. void DisableRsop( HRESULT hrReason );
  52. HRESULT Bind( IWbemServices** ppWbemServices );
  53. HRESULT GetNameSpace( WCHAR** ppwszNameSpace );
  54. HRESULT MoveContextState( CRsopContext* pRsopContext );
  55. HRESULT GetExclusiveLoggingAccess( BOOL bMachine );
  56. void ReleaseExclusiveLoggingAccess();
  57. LONG GetRsopNamespaceKeyPath( PSID pUserSid, WCHAR** ppwszDiagnostic );
  58. void InitializeContext( PSID pUserSid );
  59. void InitializeSavedNameSpace();
  60. void SaveNameSpace();
  61. void DeleteSavedNameSpace();
  62. BOOL HasNameSpace()
  63. {
  64. return NULL != _pWbemServices;
  65. }
  66. HKEY GetNameSpaceKey()
  67. {
  68. return _hkRsop;
  69. }
  70. PRSOP_TARGET _pRsopTarget; // planning mode context
  71. private:
  72. enum
  73. {
  74. MODE_NOLOGGING,
  75. MODE_PLANNING,
  76. MODE_DIAGNOSTIC,
  77. MODE_REPORTING
  78. };
  79. IWbemServices* _pWbemServices; // interface to existing namespace
  80. WCHAR* _wszNameSpace; // namespace to bind to
  81. WCHAR* _wszExtensionGuid; // Guid for the cse using this context to log RSoP data
  82. BOOL _bEnabled; // true of rsop is enabled
  83. DWORD _dwMode; // original rsop mode
  84. HRESULT* _phrLoggingStatus; // status code to report logging (as opposed to policy) errors
  85. CPolicyDatabase _PolicyDatabase; // database for rsop information
  86. HANDLE _hPolicyAccess; // Handle to critical policy section
  87. HKEY _hkRsop; // Handle to persistent rsop namespace path key
  88. };
  89. #endif // _CONTEXT_HXX_