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.

242 lines
5.3 KiB

  1. #define COMPUTER_USER 1
  2. #define DOMAIN_USER 2
  3. class CWinNTUser;
  4. class CWinNTUser : INHERIT_TRACKING,
  5. public CCoreADsObject,
  6. public ISupportErrorInfo,
  7. public IADsUser,
  8. public IADsPropertyList,
  9. public INonDelegatingUnknown,
  10. public IADsExtension
  11. {
  12. public:
  13. /* IUnknown methods */
  14. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) ;
  15. STDMETHODIMP_(ULONG) AddRef(void);
  16. STDMETHODIMP_(ULONG) Release(void);
  17. // INonDelegatingUnknown methods
  18. STDMETHOD(NonDelegatingQueryInterface)(THIS_
  19. const IID&,
  20. void **
  21. );
  22. DECLARE_NON_DELEGATING_REFCOUNTING
  23. DECLARE_IDispatch_METHODS
  24. DECLARE_ISupportErrorInfo_METHODS
  25. DECLARE_IADs_METHODS
  26. DECLARE_IADsPropertyList_METHODS
  27. DECLARE_IADsUser_METHODS
  28. DECLARE_IADsExtension_METHODS
  29. CWinNTUser::CWinNTUser();
  30. CWinNTUser::~CWinNTUser();
  31. static
  32. HRESULT
  33. CWinNTUser::CreateUser(
  34. BSTR Parent,
  35. ULONG ParentType,
  36. BSTR DomainName,
  37. BSTR ServerName,
  38. BSTR UserName,
  39. DWORD dwObjectState,
  40. REFIID riid,
  41. CWinNTCredentials& Credentials,
  42. void **ppvObj
  43. );
  44. static
  45. HRESULT
  46. CWinNTUser::CreateUser(
  47. BSTR Parent,
  48. ULONG ParentType,
  49. BSTR DomainName,
  50. BSTR ServerName,
  51. BSTR UserName,
  52. DWORD dwObjectState,
  53. DWORD *pdwUserFlags, // OPTIONAL
  54. LPWSTR szFullName, // OPTIONAL
  55. LPWSTR szDescription, // OPTIONAL
  56. PSID pSid, // OPTIONAL
  57. REFIID riid,
  58. CWinNTCredentials& Credentials,
  59. void **ppvObj
  60. );
  61. static
  62. HRESULT
  63. CWinNTUser::AllocateUserObject(
  64. CWinNTUser ** ppUser
  65. );
  66. //
  67. // For current implementation in cuser:
  68. // If this function is called as a public function (ie. by another
  69. // modual/class), fExplicit must be FALSE since the cache is NOT
  70. // flushed in this function.
  71. //
  72. // External functions should ONLY call GetInfo(no param) for explicit
  73. // GetInfo. This will flush the cache properly.
  74. //
  75. STDMETHOD(GetInfo)(
  76. THIS_
  77. DWORD dwApiLevel,
  78. BOOL fExplicit
  79. ) ;
  80. HRESULT
  81. CWinNTUser::SetInfo(
  82. DWORD
  83. dwApiLevel
  84. );
  85. STDMETHOD(ImplicitGetInfo)(void);
  86. protected:
  87. HRESULT
  88. CWinNTUser::GetStandardInfo(
  89. THIS_ DWORD dwApiLevel,
  90. BOOL fExplicit
  91. );
  92. HRESULT
  93. CWinNTUser::UnMarshall(
  94. LPBYTE lpBuffer,
  95. DWORD dwApiLevel,
  96. BOOL fExplicit
  97. );
  98. HRESULT
  99. CWinNTUser::UnMarshall_Level3(
  100. BOOL fExplicit,
  101. LPUSER_INFO_3 pUserInfo3
  102. );
  103. HRESULT
  104. CWinNTUser::Prepopulate(
  105. BOOL fExplicit,
  106. DWORD *pdwUserFlags, // OPTIONAL
  107. LPWSTR szFullName, // OPTIONAL
  108. LPWSTR szDescription, // OPTIONAL
  109. PSID pSid // OPTIONAL
  110. );
  111. HRESULT
  112. CWinNTUser::GetSidInfo(
  113. BOOL fExplicit
  114. );
  115. HRESULT
  116. CWinNTUser::GetRasInfo(
  117. BOOL fExplicit
  118. );
  119. HRESULT
  120. GetModalInfo(
  121. DWORD dwApiLevel,
  122. BOOL fExplicit
  123. ) ;
  124. HRESULT
  125. CWinNTUser::UnMarshallModalInfo(
  126. LPBYTE lpBuffer,
  127. DWORD dwApiLevel,
  128. BOOL fExplicit
  129. );
  130. HRESULT
  131. CWinNTUser::UnMarshall_ModalLevel0(
  132. BOOL fExplicit,
  133. LPUSER_MODALS_INFO_0 pUserInfo0
  134. );
  135. HRESULT
  136. CWinNTUser::UnMarshall_ModalLevel2(
  137. BOOL fExplicit,
  138. LPUSER_MODALS_INFO_2 pUserInfo2
  139. );
  140. HRESULT
  141. CWinNTUser::UnMarshall_ModalLevel3(
  142. BOOL fExplicit,
  143. LPUSER_MODALS_INFO_3 pUserInfo3
  144. );
  145. HRESULT
  146. CWinNTUser::MarshallAndSet(
  147. LPWSTR szHostServerName,
  148. LPBYTE lpBuffer,
  149. DWORD dwApiLevel
  150. );
  151. HRESULT
  152. CWinNTUser::Marshall_Set_Level3(
  153. LPWSTR szHostServerName,
  154. LPUSER_INFO_3 pUserInfo3
  155. );
  156. HRESULT
  157. CWinNTUser::Marshall_Create_Level1(
  158. LPWSTR szHostServerName,
  159. LPUSER_INFO_1 pUserInfo1
  160. );
  161. protected:
  162. HRESULT
  163. CWinNTUser::GetUserFlags(
  164. DWORD *pdwUserFlags
  165. );
  166. ULONG _ParentType;
  167. BSTR _DomainName;
  168. BSTR _ServerName;
  169. CAggregatorDispMgr FAR * _pDispMgr;
  170. CADsExtMgr FAR * _pExtMgr;
  171. CPropertyCache FAR * _pPropertyCache;
  172. CWinNTCredentials _Credentials;
  173. HRESULT setPrivatePassword(PWSTR pszNewPassword);
  174. HRESULT getPrivatePassword(PWSTR * ppszPassword);
  175. private:
  176. // These are needed to set password on a new user
  177. // before setInfo AjayR 7-2-98
  178. BOOL _fPasswordSet;
  179. //
  180. // Keep track of changes to the permissions.
  181. //
  182. DWORD _dwRasPermissions;
  183. // CCredentials is in oleds\noole
  184. CCredentials * _pCCredentialsPwdHolder;
  185. // flag to keep track of whether the account locked information for the
  186. // user is correct in the cache. If the user object was obtained through
  187. // enumeration, then the user flags may not contain the correct value
  188. // for computed bits (since NetQueryDisplayInformation does not return
  189. // this info. correctly while NetUserGetInfo does).
  190. BOOL _fUseCacheForAcctLocked;
  191. BOOL _fComputerAcct;
  192. };