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.

234 lines
5.4 KiB

  1. //=============================================================================
  2. // Copyright (c) 2000 Microsoft Corporation
  3. //
  4. // dialogs.hpp
  5. //
  6. // Credential manager user interface classes used to get credentials.
  7. //
  8. // Created 02/29/2000 johnstep (John Stephens)
  9. //=============================================================================
  10. #ifndef __DIALOGS_HPP__
  11. #define __DIALOGS_HPP__
  12. //-----------------------------------------------------------------------------
  13. #include "controls.hpp"
  14. //-----------------------------------------------------------------------------
  15. // Types
  16. //-----------------------------------------------------------------------------
  17. struct CREDUI_CHANGE_PASSWORD_INFO
  18. {
  19. CONST WCHAR *UserName;
  20. WCHAR *Password;
  21. ULONG PasswordMaxChars;
  22. CreduiBalloonTip BalloonTip;
  23. CreduiPasswordBox OldPasswordBox;
  24. CreduiPasswordBox NewPasswordBox;
  25. CreduiPasswordBox ConfirmPasswordBox;
  26. };
  27. //-----------------------------------------------------------------------------
  28. // Functions
  29. //-----------------------------------------------------------------------------
  30. static
  31. INT_PTR
  32. CALLBACK
  33. CreduiChangePasswordCallback(
  34. HWND changePasswordWindow,
  35. UINT message,
  36. WPARAM wParam,
  37. LPARAM lParam
  38. );
  39. extern
  40. BOOL
  41. CreduiChangeDomainPassword(
  42. HWND parentWindow,
  43. CONST WCHAR *userName,
  44. WCHAR *password,
  45. ULONG passwordMaxChars
  46. );
  47. //-----------------------------------------------------------------------------
  48. // CreduiPasswordDialog Class
  49. //-----------------------------------------------------------------------------
  50. class CreduiPasswordDialog
  51. {
  52. public:
  53. CreduiPasswordDialog(
  54. IN BOOL DoingCommandLine,
  55. IN BOOL DelayCredentialWrite,
  56. IN DWORD credCategory,
  57. CREDUI_INFO *uiInfo,
  58. CONST WCHAR *targetName,
  59. WCHAR *userName,
  60. ULONG userNameMaxChars,
  61. WCHAR *password,
  62. ULONG passwordMaxChars,
  63. BOOL *save,
  64. DWORD flags,
  65. CtxtHandle *securityContext,
  66. DWORD authError,
  67. DWORD *result
  68. );
  69. ~CreduiPasswordDialog();
  70. private:
  71. // Variables:
  72. DWORD Result;
  73. DWORD AuthError;
  74. HWND DialogWindow;
  75. HWND CredControlWindow;
  76. DWORD CredControlStyle;
  77. // User interface control state flags:
  78. enum
  79. {
  80. DISABLED_DIALOG = 0x0001,
  81. DISABLED_CONTROL_CRED = 0x0002,
  82. DISABLED_CONTROL_OK = 0x0004,
  83. };
  84. BOOL DisabledControlMask;
  85. BOOL DelayCredentialWrite;
  86. BOOL EncryptedVisiblePassword;
  87. DWORD Flags;
  88. //
  89. // CredCategory defines the type of the credential
  90. //
  91. DWORD CredCategory;
  92. #define DOMAIN_CATEGORY 0
  93. #define USERNAME_TARGET_CATEGORY CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS
  94. #define GENERIC_CATEGORY CREDUI_FLAGS_GENERIC_CREDENTIALS
  95. BOOL Save;
  96. WCHAR *TargetName;
  97. WCHAR *UserOrTargetName;
  98. CtxtHandle *SecurityContext;
  99. CREDUI_INFO UiInfo;
  100. WCHAR *UserName;
  101. ULONG UserNameMaxChars;
  102. WCHAR *Password;
  103. ULONG PasswordMaxChars;
  104. BOOL fInitialSaveState; // initial state of the Save checkbox
  105. BOOL fPassedUsername;
  106. BOOL fPasswordOnly;
  107. BOOL FirstPaint;
  108. CONST CREDUI_BALLOON *CredBalloon;
  109. enum
  110. {
  111. PASSWORD_UNINIT = 0,
  112. PASSWORD_INIT = 1,
  113. PASSWORD_CHANGED = 2
  114. };
  115. DWORD PasswordState;
  116. LONG ResizeTop;
  117. LONG ResizeDelta;
  118. // Functions:
  119. BOOL InitWindow(HWND dialogWindow);
  120. VOID SelectAndSetWindowCaption();
  121. VOID SelectAndSetWindowMessage();
  122. VOID Enable(BOOL enable = TRUE);
  123. DWORD HandleOk();
  124. void SetCredTargetFromInfo();
  125. DWORD UsernameHandleOk();
  126. DWORD FinishHandleOk();
  127. static LRESULT CALLBACK CmdLineMessageHandlerCallback(
  128. HWND window,
  129. UINT message,
  130. WPARAM wParam,
  131. LPARAM lParam
  132. );
  133. LRESULT
  134. CreduiPasswordDialog::CmdLineMessageHandler(
  135. UINT message,
  136. WPARAM wParam,
  137. LPARAM lParam
  138. );
  139. static INT_PTR CALLBACK DialogMessageHandlerCallback(
  140. HWND dialogWindow,
  141. UINT message,
  142. WPARAM wParam,
  143. LPARAM lParam
  144. );
  145. INT_PTR DialogMessageHandler(
  146. UINT message,
  147. WPARAM wParam,
  148. LPARAM lParam
  149. );
  150. static BOOL CALLBACK ResizeDialogCallback(
  151. HWND childWindow,
  152. LPARAM lParam);
  153. CREDENTIAL_TARGET_INFORMATION *TargetInfo;
  154. CREDENTIAL *PasswordCredential;
  155. CREDENTIAL *OldCredential;
  156. CREDENTIAL NewCredential;
  157. WCHAR OldUserName[CRED_MAX_USERNAME_LENGTH + 1];
  158. WCHAR NewTargetName[CRED_MAX_DOMAIN_TARGET_NAME_LENGTH + 1];
  159. WCHAR NewTargetAlias[CRED_MAX_STRING_LENGTH + 1];
  160. SSOPACKAGE SSOPackage;
  161. DWORD dwIDDResource;
  162. RECT rcBrand;
  163. HBITMAP hBrandBmp;
  164. DWORD MaximumPersist;
  165. DWORD MaximumPersistSso;
  166. //
  167. // Data specific to command line
  168. //
  169. DWORD
  170. CmdLineDialog(
  171. VOID
  172. );
  173. HWND CmdLineWindow;
  174. BOOL DoingCommandLine;
  175. static LONG Registered;
  176. DWORD
  177. CmdlinePasswordPrompt(
  178. VOID
  179. );
  180. // Functions:
  181. BOOL CompleteUserName();
  182. VOID SelectBestTargetName(BOOL serverOnly);
  183. };
  184. //-----------------------------------------------------------------------------
  185. #endif // __DIALOGS_HPP__