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.

165 lines
4.5 KiB

  1. /**********************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1990, 1991 **/
  4. /**********************************************************************/
  5. /*
  6. lmoetd.hxx
  7. This file contains the class declarations for the TRUSTED_DOMAIN_ENUM
  8. class and its associated iterator classes.
  9. FILE HISTORY:
  10. KeithMo 09-Apr-1992 Created for the Server Manager.
  11. */
  12. #ifndef _LMOETD_HXX_
  13. #define _LMOETD_HXX_
  14. #ifndef WIN32
  15. #error NT enumerator requires WIN32!
  16. #endif // WIN32
  17. #include "lmoersm.hxx"
  18. #include "uintlsa.hxx"
  19. /*************************************************************************
  20. NAME: TRUSTED_DOMAIN_ENUM
  21. SYNOPSIS: The TRUSTED_DOMAIN_ENUM enumerator is used to enumerate
  22. the domains "trusted" by a specific target domain.
  23. INTERFACE: TRUSTED_DOMAIN_ENUM - Class constructor.
  24. ~TRUSTED_DOMAIN_ENUM - Class destructor.
  25. CallAPI - Invokes the enumeration API.
  26. PARENT: LM_RESUME_ENUM
  27. HISTORY:
  28. KeithMo 09-Apr-1992 Created for the Server Manager.
  29. **************************************************************************/
  30. DLL_CLASS TRUSTED_DOMAIN_ENUM : public LM_RESUME_ENUM
  31. {
  32. private:
  33. //
  34. // The LsaEnumerateTrustedDomain() resume key.
  35. //
  36. LSA_ENUMERATION_HANDLE _ResumeKey;
  37. //
  38. // This LSA_POLICY object represents the target server on which
  39. // the enumeration will be performed.
  40. //
  41. const LSA_POLICY * _plsapolicy;
  42. //
  43. // This is a wrapper around the LSA_TRUST_INFORMATION structure
  44. // (as returned by LSA_POLICY::EnumerateTrustedDomains).
  45. //
  46. LSA_TRUST_INFO_MEM _lsatim;
  47. //
  48. // This virtual callback invokes the LsaEnumerateTrustedDomains() API
  49. // through LSA_POLICY::EnumerateTrustedDomains().
  50. //
  51. virtual APIERR CallAPI( BOOL fRestartEnum,
  52. BYTE ** ppbBuffer,
  53. UINT * pcEntriesRead );
  54. protected:
  55. //
  56. // Destroy the buffer with ::LsaFreeMemory().
  57. //
  58. virtual VOID FreeBuffer( BYTE ** ppbBuffer );
  59. public:
  60. //
  61. // Usual constructor/destructor goodies.
  62. //
  63. TRUSTED_DOMAIN_ENUM( const LSA_POLICY * plsapolicy,
  64. BOOL fKeepBuffers = FALSE );
  65. ~TRUSTED_DOMAIN_ENUM( VOID );
  66. }; // class TRUSTED_DOMAIN_ENUM
  67. class TRUSTED_DOMAIN_ITER; // Forward reference.
  68. /*************************************************************************
  69. NAME: TRUSTED_DOMAIN_ENUM_OBJ
  70. SYNOPSIS: This is basically the return type from the
  71. TRUSTED_DOMAIN_ENUM_ITER iterator.
  72. INTERFACE: QueryUnicodeDomainName - Returns a UNICODE_STRING *
  73. for the domain name.
  74. QueryDomainName - Also returns the domain name,
  75. but stores it in an NLS_STR.
  76. QueryDomainSID - Returns the domain's SID
  77. (actually a PSID).
  78. PARENT: ENUM_OBJ_BASE
  79. HISTORY:
  80. KeithMo 09-Apr-1992 Created for the Server Manager.
  81. **************************************************************************/
  82. DLL_CLASS TRUSTED_DOMAIN_ENUM_OBJ : public ENUM_OBJ_BASE
  83. {
  84. public:
  85. //
  86. // Provide properly-casted buffer Query/Set methods.
  87. //
  88. const LSA_TRUST_INFORMATION * QueryBufferPtr( VOID ) const
  89. { return (const LSA_TRUST_INFORMATION *)ENUM_OBJ_BASE::QueryBufferPtr(); }
  90. VOID SetBufferPtr( const LSA_TRUST_INFORMATION * pBuffer )
  91. { ENUM_OBJ_BASE::SetBufferPtr( (const BYTE *)pBuffer ); }
  92. //
  93. // Accessors.
  94. //
  95. const UNICODE_STRING * QueryUnicodeDomainName( VOID ) const
  96. { return &(QueryBufferPtr()->Name); }
  97. APIERR QueryDomainName( NLS_STR * pnls ) const
  98. {
  99. ASSERT( pnls != NULL );
  100. ASSERT( pnls->QueryError() == NERR_Success );
  101. return pnls->MapCopyFrom( QueryUnicodeDomainName()->Buffer,
  102. QueryUnicodeDomainName()->Length );
  103. }
  104. DECLARE_ENUM_ACCESSOR( QueryDomainSID, PSID, Sid );
  105. }; // class TRUSTED_DOMAIN_ENUM_OBJ
  106. DECLARE_LM_RESUME_ENUM_ITER_OF( TRUSTED_DOMAIN, LSA_TRUST_INFORMATION );
  107. #endif // _LMOETD_HXX_