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.

202 lines
4.6 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997 - 2000.
  5. //
  6. // File: AdminCustomizer.hxx
  7. //
  8. // Contents: Definition of class to provide default customization
  9. // of queries by adding objects and offering prefix searching
  10. // of those objects.
  11. //
  12. // Classes: CAdminCustomizer
  13. //
  14. // History: 06-22-2000 DavidMun Created
  15. //
  16. //---------------------------------------------------------------------------
  17. #ifndef __ADMIN_CUSTOMIZER_HXX_
  18. #define __ADMIN_CUSTOMIZER_HXX_
  19. struct SID_INFO
  20. {
  21. SID_IDENTIFIER_AUTHORITY sii;
  22. ULONG rid;
  23. PSID psid;
  24. WCHAR wzAccountName[MAX_PATH];
  25. WCHAR wzPath[MAX_PATH];
  26. };
  27. #define NUM_SID_INFOS 15
  28. //+--------------------------------------------------------------------------
  29. //
  30. // Class: StringICompare
  31. //
  32. // Purpose: Functional object for use with map having class String as
  33. // the key.
  34. //
  35. // History: 08-26-1998 DavidMun Created
  36. //
  37. //---------------------------------------------------------------------------
  38. class StringICompare
  39. {
  40. public:
  41. bool
  42. operator()(const String &lhs, const String &rhs) const;
  43. };
  44. //+--------------------------------------------------------------------------
  45. //
  46. // Member: StringICompare::operator
  47. //
  48. // Synopsis: Return TRUE if a case insensitive comparison shows lhs < rhs.
  49. //
  50. // History: 08-26-1998 DavidMun Created
  51. //
  52. //---------------------------------------------------------------------------
  53. inline bool
  54. StringICompare::operator()(const String &lhs, const String &rhs) const
  55. {
  56. return lhs.icompare(rhs) < 0;
  57. }
  58. typedef map<String, CDsObjectList, StringICompare> CStringDsObjectListMap;
  59. //+--------------------------------------------------------------------------
  60. //
  61. // Class: CAdminCustomizer
  62. //
  63. // Purpose: Serve as the default customizer object, which adds special
  64. // objects to a query result and performs prefix searches
  65. // among them.
  66. //
  67. // History: 03-10-2000 davidmun Created from CCustomizeDsBrowser
  68. //
  69. //---------------------------------------------------------------------------
  70. class CAdminCustomizer
  71. {
  72. public:
  73. CAdminCustomizer(
  74. const CObjectPicker &rop);
  75. ~CAdminCustomizer();
  76. void
  77. PrefixSearch(
  78. HWND hwnd,
  79. const CScope &ForScope,
  80. const String &strName,
  81. CDsObjectList *pdsolMatches) const;
  82. void
  83. AddObjects(
  84. HWND hwnd,
  85. const CScope &ForScope,
  86. CDsObjectList *pdsolMatches) const;
  87. PSID
  88. LookupDownlevelName(
  89. const String &strName) const;
  90. PCWSTR
  91. LookupDownlevelPath(
  92. PCWSTR pwzAccountName) const;
  93. void
  94. Clear()
  95. {
  96. TRACE_METHOD(CAdminCustomizer, Clear);
  97. m_dsolWKSP.clear();
  98. m_dsomapBuiltins.clear();
  99. }
  100. private:
  101. void
  102. _GetUplevelAddition(
  103. HWND hwnd,
  104. ULONG idOwningScope,
  105. CDsObjectList *pdsol) const;
  106. void
  107. _GetDownlevelAddition(
  108. CDsObjectList *pdsol) const;
  109. void
  110. _AddDownlevelIfMatches(
  111. ULONG idOwningScope,
  112. ULONG flCurObject,
  113. ULONG flObjectsToCompare,
  114. const String &strSearchFor,
  115. CDsObjectList *pdsol) const;
  116. void
  117. _AddBuiltins(
  118. HWND hwnd,
  119. ULONG idOwningScope,
  120. const String &strScopePath,
  121. const String &strSearchFor,
  122. CDsObjectList *pdsol) const;
  123. void
  124. _InitBuiltinsList(
  125. HWND hwnd,
  126. ULONG idOwningScope,
  127. const String &strScopePath,
  128. CDsObjectList *pdsol) const;
  129. void
  130. _AddLocalizedWKSP(
  131. ULONG idOwningScope,
  132. LSA_HANDLE hLsa,
  133. IADs *pADs,
  134. VARIANT *pvarSid) const;
  135. void
  136. _AddWellKnownPrincipals(
  137. HWND hwnd,
  138. ULONG idOwningScope,
  139. const String &strSearchFor,
  140. CDsObjectList *pdsol) const;
  141. void
  142. _InitWellKnownPrincipalsList(
  143. HWND hwnd,
  144. ULONG idOwningScope) const;
  145. void
  146. _AddFromList(
  147. const String &strSearchFor,
  148. const CDsObjectList *pdsolIn,
  149. CDsObjectList *pdsolOut) const;
  150. String
  151. _GetAccountName(
  152. ULONG flUser) const;
  153. // not supported; included to prevent compiler error 4512
  154. CAdminCustomizer &operator =(const CAdminCustomizer &);
  155. const CObjectPicker &m_rop;
  156. mutable CStringDsObjectListMap m_dsomapBuiltins;
  157. mutable CDsObjectList m_dsolWKSP; // well known security principals
  158. mutable SID_INFO m_aSidInfo[NUM_SID_INFOS];
  159. };
  160. #endif // __ADMIN_CUSTOMIZER_HXX_