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.

214 lines
6.1 KiB

  1. //*************************************************************
  2. //
  3. // Copyright (c) Microsoft Corporation 1999 - 2000
  4. // All rights reserved
  5. //
  6. // log.hxx
  7. //
  8. // Contains declarations for classes related to rsop logging
  9. // for the folder redirection client-side extension
  10. //
  11. // Created: 8-01-1999 adamed
  12. //
  13. //*************************************************************
  14. #if !defined(__LOG_HXX__)
  15. #define __LOG_HXX__
  16. //
  17. // The prefix to the scope of management is always "LDAP://" --
  18. // this constant refers to the length of that prefix
  19. //
  20. #define SOMID_PREFIX_LEN 7
  21. #define REPORT_ATTRIBUTE_SET_STATUS( x , y ) \
  22. { \
  23. if (FAILED( y )) \
  24. { \
  25. DebugMsg((DM_VERBOSE, IDS_RSOP_ATTRIBUTE_FAIL, x, y)); \
  26. } \
  27. }
  28. #define WQL_INSTANCE L"NOT id = \"%s\""
  29. #define WQL_AND L" AND "
  30. WCHAR* StringDuplicate(WCHAR* wszOriginal);
  31. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  32. //
  33. // Class: CRedirectionPolicy
  34. //
  35. // Synopsis: This class describes each folder that could be
  36. // redirected by folder redirection policy and abstracts
  37. // its persistence operations through an rsop schema
  38. //
  39. // Notes:
  40. //
  41. //-------------------------------------------------------------
  42. class CRedirectionPolicy : public CPolicyRecord
  43. {
  44. public:
  45. CRedirectionPolicy(
  46. CFileDB* pGpoData,
  47. CRedirectInfo* rgRedirect,
  48. LONG Precedence,
  49. HRESULT* phr);
  50. ~CRedirectionPolicy();
  51. //
  52. // Operations
  53. //
  54. HRESULT Write();
  55. HRESULT Initialize();
  56. void NormalizePrecedence( LONG Scale );
  57. HRESULT CopyInheritedData( CRedirectionPolicy* pAncestralPolicy );
  58. //
  59. // Information methods
  60. //
  61. int GetFolderIndex();
  62. int GetAncestorIndex();
  63. BOOL HasAncestor();
  64. BOOL HasInheritedData();
  65. BOOL IsRedirected();
  66. //
  67. // Public data
  68. //
  69. CRedirectionPolicy* _pNext; // Used to link these objects in a list
  70. private:
  71. HRESULT GetGroupInformation(
  72. WCHAR* wszGroupRedirectionData);
  73. HRESULT ParseGroupInformation(
  74. WCHAR* wszGroupRedirectionData,
  75. LONG* pCount,
  76. WCHAR** rgwszGroups = NULL,
  77. WCHAR** rgwszPaths = NULL);
  78. HRESULT GenerateInheritedPath(
  79. WCHAR* pwszAncestorPath,
  80. WCHAR** ppwszInheritedPath);
  81. HRESULT GenerateLocalInheritedPath(
  82. WCHAR** ppwszInheritedPath );
  83. //
  84. // The following two arrays are parallel arrays
  85. //
  86. WCHAR** _rgwszGroups; // Security groups applying to this redirection
  87. WCHAR** _rgwszRedirectedPaths; // Paths to which the folder is redirected for each of the groups in _rgwszGroups
  88. LONG _cGroups; // Number of paths / security groups to which folder could be redirected
  89. LONG _Precedence; // Precedence of this redirection with respect to other redirections
  90. UNICODE_STRING _RedirectedSid; // Sid that caused this to redirect
  91. WCHAR* _wszRedirectedPath; // Location to which this folder is redirected
  92. WCHAR* _wszGPODSPath; // unique ds path of gpo from which this redirection came
  93. WCHAR* _wszDisplayName; // Display name of the folder
  94. WCHAR* _wszLocalizedName; // Localized file system name of the folder
  95. WCHAR* _wszSOMId; // Scope of management to which this policy applied
  96. DWORD _dwFlags; // Redirection flags
  97. HRESULT _hrInit; // Result of object initialization
  98. int _iFolderIndex; // Index referring to the folder
  99. int _iAncestorIndex; // Index to this folder's ancestor (parent) folder
  100. BOOL _bHasAncestor; // TRUE if this folder has an ancestor
  101. BOOL _bMissingAncestor; // TRUE if this folder has an ancestor, but
  102. // no policy was specified for that ancestor
  103. CFileDB* _pGpoData; // needed to pass to utility functions
  104. };
  105. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  106. //
  107. // Class: CPrecedenceState
  108. //
  109. // Synopsis: This class keeps track of the precedence relationships
  110. // between redirected folders. It is used to assign
  111. // precedence to each candidate redirection policy
  112. //
  113. // Notes:
  114. //
  115. //-------------------------------------------------------------
  116. class CPrecedenceState
  117. {
  118. public:
  119. CPrecedenceState();
  120. LONG UpdateFolderPrecedence( int iFolder );
  121. LONG GetFolderPrecedence( int iFolder );
  122. private:
  123. LONG _rgFolderPrecedence[ EndRedirectable ]; // stores precedence of each winning policy for each folder
  124. };
  125. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  126. //
  127. // Class: CRedirectionLog
  128. //
  129. // Synopsis: This class abstracts the logging of folder redirection
  130. // policy and provides methods to persist a representation
  131. // of the folder redirection policy via rsop schema
  132. //
  133. // Notes:
  134. //
  135. //-------------------------------------------------------------
  136. class CRedirectionLog : public CPolicyLog
  137. {
  138. public:
  139. CRedirectionLog();
  140. ~CRedirectionLog();
  141. HRESULT AddRedirectionPolicies(
  142. CFileDB* pGpoData,
  143. CRedirectInfo* pRedirectionInfo);
  144. void
  145. InitRsop( CRsopContext* pRsopContext, BOOL bForceRsop );
  146. HRESULT WriteRsopLog();
  147. HRESULT AddPreservedPolicy( WCHAR* wszFolderName );
  148. private:
  149. CRedirectionPolicy* GetAncestor( CRedirectionPolicy* pRedirectionPolicy );
  150. void NormalizePrecedence( CRedirectionPolicy* pRedirectionPolicy );
  151. void ClearRsopLog();
  152. HRESULT AddAncestralPolicy( CRedirectionPolicy* pRedirectionPolicy );
  153. CRedirectionPolicy* _pRedirectionList; // List of all candidate redirections
  154. CRedirectionPolicy** _ppNextRedirection; // Pointer to reference to end of list
  155. CPrecedenceState _PrecedenceState; // State of the precedence relationships among candidate redirections
  156. WCHAR* _wszDeletionQuery; // Query used to clear settings
  157. };
  158. #endif // __LOG_HXX__