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.

233 lines
5.9 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1992 **/
  4. /**********************************************************************/
  5. /*
  6. lsaenum.hxx
  7. This file contains the enumerators for enumerating all the accounts
  8. and privileges in the LSA.
  9. NOTE: This file will be merge with Tom's "ntlsa.hxx" as appropriate.
  10. LM_RESUME_ENUM
  11. |
  12. |
  13. LSA_ENUM
  14. / | \
  15. / | ...
  16. / |
  17. LSA_ACCOUNT_ENUM LSA_PRIVILEGE_ENUM
  18. FILE HISTORY:
  19. Yi-HsinS 3-Mar-1992 Created
  20. */
  21. #ifndef _LSAENUM_HXX_
  22. #define _LSAENUM_HXX_
  23. #include "uintlsa.hxx"
  24. #include "lmoersm.hxx"
  25. /*************************************************************************
  26. NAME: LSA_ENUM
  27. SYNOPSIS: LSA_ENUM is a generic LSA enumerator. It will be subclassed
  28. for specific enumerators as desired.
  29. INTERFACE: ~LSA_ENUM() - Destructor
  30. PARENT: LM_RESUME_ENUM
  31. USES: LSA_POLICY
  32. NOTES:
  33. HISTORY:
  34. Yi-HsinS 3-Mar-1992 Created
  35. **************************************************************************/
  36. DLL_CLASS LSA_ENUM: public LM_RESUME_ENUM
  37. {
  38. private:
  39. virtual APIERR CallAPI( BOOL fRestartEnum,
  40. BYTE **ppbBuffer,
  41. UINT *pcbEntries ) = 0;
  42. protected:
  43. // Store the handle of the LSA
  44. const LSA_POLICY *_plsaPolicy;
  45. // Store the enumeration handle to be use in the next API call
  46. // (Note: All enumerations are resumable. )
  47. LSA_ENUMERATION_HANDLE _lsaEnumHandle;
  48. // Free the LSA memory
  49. virtual VOID FreeBuffer( BYTE ** ppbBuffer );
  50. // Protected because we should not instantiate an object of this class.
  51. LSA_ENUM( const LSA_POLICY *plsaPolicy );
  52. public:
  53. ~LSA_ENUM();
  54. };
  55. /*************************************************************************
  56. NAME: LSA_ACCOUNTS_ENUM
  57. SYNOPSIS: The enumerator for returning the accounts in the LSA.
  58. INTERFACE: LSA_ACCOUNTS_ENUM() - Constructor
  59. PARENT: LSA_ENUM
  60. USES:
  61. NOTES:
  62. HISTORY:
  63. Yi-HsinS 3-Mar-1992 Created
  64. **************************************************************************/
  65. DLL_CLASS LSA_ACCOUNTS_ENUM: public LSA_ENUM
  66. {
  67. private:
  68. // The virtual callback invokes the LsaEnumerateAccounts() API.
  69. virtual APIERR CallAPI( BOOL fRestartEnum,
  70. BYTE **ppbBuffer,
  71. UINT *pcbEntries );
  72. public:
  73. LSA_ACCOUNTS_ENUM( const LSA_POLICY *plsaPolicy );
  74. };
  75. /*************************************************************************
  76. NAME: LSA_ACCOUNTS_ENUM_OBJ
  77. SYNOPSIS: The object returned by LSA_ACCOUNTS_ENUM_ITER iterator.
  78. INTERFACE: LSA_ACCOUNTS_ENUM_OBJ() - Constructor
  79. ~LSA_ACCOUNTS_ENUM_OBJ() - Destructor
  80. QueryBufferPtr() - Replaces ENUM_OBJ_BASE method
  81. SetBufferPtr() - Replaces ENUM_OBJ_BASE method
  82. QuerySid() - Returns a pointer to the SID
  83. PARENT: LSA_ENUM
  84. USES:
  85. NOTES:
  86. HISTORY:
  87. Yi-HsinS 3-Mar-1992 Created
  88. **************************************************************************/
  89. DLL_CLASS LSA_ACCOUNTS_ENUM_OBJ : public ENUM_OBJ_BASE
  90. {
  91. public:
  92. // QueryBufferPtr and SetBufferPtr
  93. DECLARE_ENUM_BUFFER_METHODS( PSID );
  94. const PSID QuerySid( VOID ) const
  95. { return *( QueryBufferPtr() ); }
  96. };
  97. // LSA_ACCOUNTS_ENUM_ITER
  98. DECLARE_LM_RESUME_ENUM_ITER_OF( LSA_ACCOUNTS, PSID );
  99. /*************************************************************************
  100. NAME: LSA_PRIVILEGES_ENUM
  101. SYNOPSIS: The enumerator for returning the privileges contained
  102. in the LSA.
  103. INTERFACE: LSA_PRIVILEGES_ENUM() - Constructor
  104. PARENT: LSA_ENUM
  105. USES:
  106. NOTES:
  107. HISTORY:
  108. Yi-HsinS 3-Mar-1992 Created
  109. **************************************************************************/
  110. DLL_CLASS LSA_PRIVILEGES_ENUM: public LSA_ENUM
  111. {
  112. protected:
  113. // The virtual callback invokes the LsaEnumeratePrivileges() API.
  114. virtual APIERR CallAPI( BOOL fRestartEnum,
  115. BYTE **ppbBuffer,
  116. UINT *pcbEntries );
  117. public:
  118. LSA_PRIVILEGES_ENUM( const LSA_POLICY *plsaPolicy );
  119. };
  120. /*************************************************************************
  121. NAME: LSA_PRIVILEGES_ENUM_OBJ
  122. SYNOPSIS: The object returned by LSA_ACCOUNTS_ENUM_ITER iterator.
  123. INTERFACE: LSA_PRIVILEGES_ENUM_OBJ() - Constructor
  124. ~LSA_PRIVILEGES_ENUM_OBJ() - Destructor
  125. QueryBufferPtr() - Replaces ENUM_OBJ_BASE method
  126. SetBufferPtr() - Replaces ENUM_OBJ_BASE method
  127. QueryLuid() - Returns the LUID of the privilege
  128. QueryName() - Returns the name of the privilege
  129. QueryDisplayName() - Returns the name of the privilege
  130. that can be displayed
  131. PARENT: LSA_ENUM
  132. USES:
  133. NOTES:
  134. HISTORY:
  135. Yi-HsinS 3-Mar-1992 Created
  136. **************************************************************************/
  137. DLL_CLASS LSA_PRIVILEGES_ENUM_OBJ : public ENUM_OBJ_BASE
  138. {
  139. public:
  140. // QueryBufferPtr and SetBufferPtr
  141. DECLARE_ENUM_BUFFER_METHODS( POLICY_PRIVILEGE_DEFINITION );
  142. // Accessors
  143. DECLARE_ENUM_ACCESSOR( QueryLuid, LUID, LocalValue );
  144. APIERR QueryName( NLS_STR *pnls ) const
  145. { return pnls->MapCopyFrom( QueryBufferPtr()->Name.Buffer,
  146. QueryBufferPtr()->Name.Length ); }
  147. APIERR QueryDisplayName( NLS_STR *pnls,
  148. const LSA_POLICY *plsaPolicy ) const;
  149. };
  150. // LSA_PRIVILEGES_ENUM_ITER
  151. DECLARE_LM_RESUME_ENUM_ITER_OF( LSA_PRIVILEGES, POLICY_PRIVILEGE_DEFINITION );
  152. #endif