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.

266 lines
7.9 KiB

  1. /**********************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. lmomemb.hxx
  7. MEMBERSHIP_LMOBJ class declaration
  8. FILE HISTORY:
  9. rustanl 20-Aug-1991 Created
  10. jonn 03-Sep-1991 Added USER_MEMB::Query/SetName
  11. terryk 07-Oct-1991 type change for NT
  12. jonn 11-Oct-1991 Added GROUP_MEMB::SetName
  13. jonn 14-Oct-1991 Added GROUP_MEMB::I_ChangeToNew etc.
  14. terryk 17-Oct-1991 Remove 2 parameters from CallAPI
  15. function
  16. jonn 07-Jun-1992 Added _slAddedNames to MEMBERSHIP_LM_OBJ
  17. */
  18. #ifndef _LMOMEMB_HXX_
  19. #define _LMOMEMB_HXX_
  20. #include "lmobj.hxx"
  21. #include "lmoloc.hxx"
  22. #include "lmoenum.hxx"
  23. #include "strlst.hxx"
  24. /*************************************************************************
  25. NAME: ENUM_CALLER_LM_OBJ
  26. SYNOPSIS: Class providing the nice read/write/new features
  27. of the lmobj hierarchy, and the enumeration capabilities
  28. of the lmoenum hierarchy.
  29. INTERFACE: ENUM_CALLER_LM_OBJ() - constructor
  30. PARENT: LOC_LM_OBJ, ENUM_CALLER
  31. HISTORY:
  32. rustanl 21-Aug-1991 Created
  33. **************************************************************************/
  34. DLL_CLASS ENUM_CALLER_LM_OBJ : public LOC_LM_OBJ, public ENUM_CALLER
  35. {
  36. private:
  37. // Virtuals from ENUM_CALLER class
  38. virtual BYTE * EC_QueryBufferPtr() const;
  39. virtual APIERR EC_SetBufferPtr( BYTE * pBuffer );
  40. virtual UINT EC_QueryBufferSize() const;
  41. virtual APIERR EC_ResizeBuffer( UINT cNewRequestedSize );
  42. protected:
  43. // Rooted in NEW_LM_OBJ
  44. virtual APIERR W_CreateNew();
  45. // Rooted in ENUM_CALLER
  46. virtual APIERR CallAPI( BYTE ** pBuffer,
  47. UINT * pcEntriesRead) = 0;
  48. virtual UINT QueryItemSize() const = 0;
  49. APIERR W_CloneFrom( const ENUM_CALLER_LM_OBJ & eclmobj );
  50. public:
  51. ENUM_CALLER_LM_OBJ( const LOCATION & loc );
  52. }; // class ENUM_CALLER_LM_OBJ
  53. /*************************************************************************
  54. NAME: MEMBERSHIP_LM_OBJ
  55. SYNOPSIS: Group/user membership lmobj class
  56. INTERFACE: MEMBERSHIP_LM_OBJ() - constructor
  57. QueryAssocName - returns name of an associated item
  58. FindAssocName - finds an associated name
  59. AddAssocName - adds an associated name
  60. DeleteAssocName - deletes an associated name
  61. PARENT: ENUM_CALLER_LM_OBJ
  62. NOTES: This class is specialized to handle the NetGroupGetUsers
  63. and NetUserGetGropus (and the corresponding Set methods).
  64. It assumes a lot of things about these structures and
  65. APIs. Hence, this is not a generic membership/association
  66. lmobj class. This is not bad because of the following
  67. reasons:
  68. 0. The ENUM_CALLER_LM_OBJ class exists to provide
  69. clients with lmobj classes that call enumeration
  70. type Net APIs.
  71. 1. If groups and users will not look as identical
  72. to each other as they do today (8/21/91), the
  73. 'virtual' keyword can be added in front of
  74. appropriate methods, and the subclasses can
  75. take appropriate actions.
  76. See also note in MEMBERSHIP_LM_OBJ::QueryItemSize method
  77. header.
  78. The USER_MEMB subclass revolves around a user and its
  79. associated groups. The GROUP_MEMB subclass revolves
  80. around a group and its associated users. The term
  81. "associated name" will be used in methods and comments.
  82. HISTORY:
  83. rustanl 21-Aug-1991 Created
  84. jonn 07-Jun-1992 Added _slAddedNames to MEMBERSHIP_LM_OBJ
  85. **************************************************************************/
  86. DLL_CLASS MEMBERSHIP_LM_OBJ : public ENUM_CALLER_LM_OBJ
  87. {
  88. private:
  89. UINT _uAssocNameType;
  90. #ifdef WIN32
  91. STRLIST _slAddedNames;
  92. #endif // WIN32
  93. protected:
  94. // Replaced from ENUM_CALLER
  95. virtual APIERR CallAPI( BYTE ** pBuffer,
  96. UINT * pcEntriesRead) = 0;
  97. virtual UINT QueryItemSize() const;
  98. // Replaced from NEW_LM_OBJ
  99. virtual APIERR I_GetInfo();
  100. virtual APIERR I_WriteNew();
  101. APIERR W_CloneFrom( const MEMBERSHIP_LM_OBJ & memblmobj );
  102. public:
  103. MEMBERSHIP_LM_OBJ( const LOCATION & loc,
  104. UINT uAssocNameType );
  105. const TCHAR * QueryAssocName( UINT i ) const;
  106. BOOL FindAssocName( const TCHAR * pszName, UINT * pi );
  107. APIERR AddAssocName( const TCHAR * pszName );
  108. APIERR DeleteAssocName( const TCHAR * pszName );
  109. APIERR DeleteAssocName( UINT i );
  110. }; // class MEMBERSHIP_LM_OBJ
  111. /*************************************************************************
  112. NAME: USER_MEMB
  113. SYNOPSIS: User's group membership lmobj class
  114. INTERFACE: USER_MEMB() - constructor
  115. ~USER_MEMB() - destructor
  116. CloneFrom() - clones a USER_ENUM object
  117. QueryName
  118. Returns the user's account name.
  119. SetName
  120. Sets the user's account name.
  121. PARENT: MEMBERSHIP_LM_OBJ
  122. HISTORY:
  123. rustanl 21-Aug-1991 Created
  124. jonn 05-Sep-1991 Added Query/SetName
  125. **************************************************************************/
  126. DLL_CLASS USER_MEMB : public MEMBERSHIP_LM_OBJ
  127. {
  128. private:
  129. DECL_CLASS_NLS_STR( _nlsUser, UNLEN ); // account name, may be ""
  130. protected:
  131. // Replaced from NEW_LM_OBJ
  132. virtual APIERR I_CreateNew();
  133. virtual APIERR W_CreateNew();
  134. virtual APIERR I_ChangeToNew();
  135. virtual APIERR I_WriteInfo();
  136. // Replaced from MEMBERSHIP_LM_OBJ
  137. virtual APIERR CallAPI( BYTE ** pBuffer,
  138. UINT * pcEntriesRead);
  139. public:
  140. USER_MEMB( const LOCATION & loc,
  141. const TCHAR * pszUser );
  142. ~USER_MEMB();
  143. APIERR CloneFrom( const USER_MEMB & umemb );
  144. const TCHAR *QueryName() const;
  145. APIERR SetName( const TCHAR *pszAccount );
  146. }; // class USER_MEMB
  147. /*************************************************************************
  148. NAME: GROUP_MEMB
  149. SYNOPSIS: Group's user members lmobj class
  150. INTERFACE: GROUP_MEMB() - constructor
  151. ~GROUP_MEMB() - destructor
  152. CloneFrom() - clones a GROUP_ENUM object
  153. PARENT: MEMBERSHIP_LM_OBJ
  154. HISTORY:
  155. rustanl 21-Aug-1991 Created
  156. **************************************************************************/
  157. DLL_CLASS GROUP_MEMB : public MEMBERSHIP_LM_OBJ
  158. {
  159. private:
  160. DECL_CLASS_NLS_STR( _nlsGroup, GNLEN ); // account name, may be ""
  161. protected:
  162. // Replaced from MEMBERSHIP_LM_OBJ
  163. virtual APIERR CallAPI( BYTE ** pBuffer,
  164. UINT * pcEntriesRead);
  165. // Replaced from NEW_LM_OBJ
  166. virtual APIERR I_WriteInfo();
  167. virtual APIERR I_CreateNew();
  168. virtual APIERR W_CreateNew();
  169. virtual APIERR I_ChangeToNew();
  170. public:
  171. GROUP_MEMB( const LOCATION & loc,
  172. const TCHAR * pszGroup );
  173. ~GROUP_MEMB();
  174. APIERR CloneFrom( const GROUP_MEMB & gmemb );
  175. const TCHAR *QueryName() const;
  176. APIERR SetName( const TCHAR *pszAccount );
  177. }; // class GROUP_MEMB
  178. #endif // _LMOMEMB_HXX_