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.

275 lines
8.0 KiB

  1. /*****************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1989-1990 **/
  4. /*****************************************************************/
  5. #ifndef _WNETPASS_HXX_
  6. #define _WNETPASS_HXX_
  7. /*
  8. * Windows/Network Interface -- LAN Manager Version
  9. *
  10. * This header file describes classes and routines used in
  11. * the Change Password and Password Expiry dialog implementation.
  12. */
  13. #ifndef _BLT_HXX_
  14. #define INCL_BLT_DIALOG
  15. #define INCL_BLT_CONTROL
  16. #include <blt.hxx>
  17. #endif
  18. #include <devcb.hxx> // DOMAIN_COMBO
  19. /*************************************************************************
  20. NAME: PASSWORDBASE_DIALOG
  21. WORKBOOK:
  22. SYNOPSIS: Parent class for the two types of change password dialogs.
  23. PASSWORDBASE_DIALOG controls the three password entry
  24. fields, and handles the eventual attempt to change a
  25. password.
  26. INTERFACE: _passwordOld
  27. _passwordNew - The three password controls
  28. _passwordConfirm
  29. _szPWUsername - Subclass is expected to set this field
  30. to the proper username before calling
  31. PASSWORDBASE_DIALOG::OnOK()
  32. _nlsPWServer - Subclass is expected to set this field
  33. to the proper servername before calling
  34. PASSWORDBASE_DIALOG::OnOK()
  35. _szDomainServerName - Subclass is expected to set this
  36. field to the domain or servername
  37. before calling PASSWORDBASE_DIALOG::OnOK().
  38. If this field contains a domain,
  39. _nlsPWServer contains the PDC of the
  40. domain; otherwise, they are the same.
  41. OnOK() - Validates the PASSWORDBASE_DIALOG edit
  42. fields, and tries to change the
  43. password. _szPWUsername and
  44. _nlsPWServer should already be
  45. correct.
  46. RetrieveServerName() - Converts the provided domain-or-server
  47. name to a server name (copying a
  48. servername in form \\SERVER, otherwise
  49. fetching the domain's PDC), and stores the
  50. server name in _nlsPWServer.
  51. ValidateBase() - Validates the edit fields in the base
  52. dialog. Returns TRUE iff these fields
  53. are valid.
  54. UserEditError() - This virtual method is called when the
  55. username is invalid. The subclass
  56. should redefine this method and return
  57. TRUE if this could be due to user
  58. error, otherwise this is considered a
  59. fatal error.
  60. PARENT: DIALOG_WINDOW
  61. USES: Change Password and Password Expiry dialogs
  62. CAVEATS: This class applies to any dialog with Old/New/Confirm
  63. password edit fields. It should only be used as a base
  64. class. Be certain the control IDs are correct.
  65. NOTES:
  66. Dialogs derived from PASSWORDBASE_DIALOG return TRUE if
  67. they successfully change the password, FALSE otherwise
  68. (including OnCancel).
  69. HISTORY:
  70. JonN 24-Jan-91 Created
  71. JohnL 10-Apr-91 Changed size of_szDomainServerName to
  72. max( DNLEN, UNCLEN ) + 1
  73. IsaacHe 06/16/95 Changed size of _szDomainServerName to
  74. max( DNLEN, MAX_PATH ) + 1
  75. **************************************************************************/
  76. class PASSWORDBASE_DIALOG : public DIALOG_WINDOW
  77. {
  78. private:
  79. PASSWORD_CONTROL _passwordOld;
  80. PASSWORD_CONTROL _passwordNew;
  81. PASSWORD_CONTROL _passwordConfirm;
  82. protected:
  83. // EXPIRY_DIALOG must be able to access _szPasswordNew
  84. TCHAR _szPasswordOld[PWLEN+1];
  85. TCHAR _szPasswordNew[PWLEN+1];
  86. TCHAR _szPasswordConfirm[PWLEN+1];
  87. // subclasses are responsible for initializing these and for
  88. // assigning initial focus
  89. TCHAR _szPWUsername[UNLEN+1];
  90. TCHAR _szDomainServerName[ max(DNLEN, MAX_PATH) + 1 ];
  91. NLS_STR _nlsPWServer;
  92. BOOL OnOK( void );
  93. APIERR RetrieveServerName (PSZ pszServerDomain);
  94. BOOL ValidateBase( void );
  95. virtual BOOL UserEditError( void );
  96. // returns TRUE if username editable, and sets focus
  97. public:
  98. PASSWORDBASE_DIALOG( const TCHAR * pszResourceName, HWND hDlg );
  99. };
  100. /*************************************************************************
  101. NAME: CHANGEPASSWORD_DIALOG
  102. WORKBOOK:
  103. SYNOPSIS: Dialog class for the Change Password dialog. Handles
  104. the Username and Domain edit fields, and interfaces with
  105. the base class PASSWORDBASE_DIALOG.
  106. INTERFACE: _slePWUsername - Edit field for the username
  107. _domaincbPW - Domain Combo Box (see BLT) for the
  108. domain. The contents of this field
  109. are interpreted as a servername if
  110. they start with \\.
  111. OnOK() - Validates the _slePWusername and
  112. _domaincbPW edit fields, fills the
  113. _szPWUsername and _nlsPWServer fields,
  114. and calls down to PASSWORDBASE_DIALOG::OnOK()
  115. QueryHelpContext() - Standard BLT help
  116. UserEditError() - This virtual method is called when the
  117. username is invalid. Since this
  118. dialog has a username edit field, this
  119. handles an edit error there and
  120. returns TRUE.
  121. PARENT: PASSWORDBASE_DIALOG
  122. USES: Change Password dialog
  123. CAVEATS:
  124. NOTES:
  125. Dialogs derived from PASSWORDBASE_DIALOG return TRUE if
  126. they successfully change the password, FALSE otherwise
  127. (including OnCancel).
  128. HISTORY:
  129. JonN 24-Jan-91 Created
  130. **************************************************************************/
  131. class CHANGEPASSWORD_DIALOG : public PASSWORDBASE_DIALOG
  132. {
  133. private:
  134. SLE _slePWUsername;
  135. DOMAIN_COMBO _domaincbPW;
  136. protected:
  137. BOOL OnOK( void );
  138. ULONG QueryHelpContext( void );
  139. BOOL UserEditError( void );
  140. public:
  141. CHANGEPASSWORD_DIALOG( HWND hDlg );
  142. };
  143. /*************************************************************************
  144. NAME: EXPIRY_DIALOG
  145. WORKBOOK:
  146. SYNOPSIS: Dialog class for the Password Expiry dialog. Interfaces with
  147. the base class PASSWORDBASE_DIALOG.
  148. INTERFACE: _sltFirstLine - Handle the two informational lines at the
  149. _sltSecondLine top of the dialog
  150. _sltGroupbox - Handles the text in the groupbox. We
  151. need to manipulate the text of this
  152. groupbox to insert the username.
  153. _pnlsNewPassword - On construction, the caller specifies
  154. an NLS_STR into which the new password
  155. should be stored if the operation is
  156. successful. This is a pointer to that
  157. NLS_STR.
  158. _fServerNameRetrieved - The call to RetrieveServerName
  159. is delayed until the OnOK box is
  160. clicked. This helps reduce overhead
  161. when the user just wants to cancel
  162. this dialog. This instance variable
  163. records whether the server name has
  164. been retrieved yet.
  165. OnOK() - Calls down to PASSWORDBASE_DIALOG::OnOK()
  166. QueryHelpContext() - Standard BLT help
  167. UserEditError() - This dialog has no username edit
  168. field, so this virtual method is not
  169. redefined.
  170. PARENT: PASSWORDBASE_DIALOG
  171. USES: Password Expiry dialog
  172. CAVEATS: The constructor expects a ULONG which is the number
  173. of seconds until the password expires. Pass
  174. EXPIRY_ALREADY_EXPIRED if the password has already
  175. expired.
  176. NOTES:
  177. Dialogs derived from PASSWORDBASE_DIALOG return TRUE if
  178. they successfully change the password, FALSE otherwise
  179. (including OnCancel).
  180. HISTORY:
  181. JonN 24-Jan-91 Created
  182. **************************************************************************/
  183. class EXPIRY_DIALOG : public PASSWORDBASE_DIALOG
  184. {
  185. private:
  186. SLT _sltFirstLine;
  187. SLT _sltSecondLine;
  188. SLT _sltGroupbox;
  189. NLS_STR * _pnlsNewPassword;
  190. BOOL _fServerNameRetrieved;
  191. protected:
  192. BOOL OnOK( void );
  193. ULONG QueryHelpContext( void );
  194. public:
  195. EXPIRY_DIALOG(
  196. HWND hDlg,
  197. const TCHAR * szUser,
  198. const TCHAR * szDomn,
  199. ULONG ulTimeRemaining,
  200. NLS_STR *pnlsNewPassword );
  201. };
  202. #define EXPIRY_ALREADY_EXPIRED (ULONG)0xFFFFFFFF
  203. #endif // _WNETPASS_HXX_