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.

392 lines
7.9 KiB

  1. #ifndef _KRDLG_H_
  2. #define _KRDLG_H_
  3. /*++
  4. Copyright (c) 2000 Microsoft Corporation
  5. Module Name:
  6. krdlg.h
  7. Abstract:
  8. keyring dialog class definitions
  9. Author:
  10. johnhaw 991118 created
  11. georgema 000310 modified
  12. Environment:
  13. Revision History:
  14. --*/
  15. // keymgr does not currently handle generic credentials. This means that the maximum
  16. // string length for a name is greatly contstrained, to 337 chars from a generic max
  17. // value of 32767.
  18. //#define TARGETNAMEMAXLENGTH (CRED_MAX_GENERIC_TARGET_NAME_LENGTH + MAXSUFFIXSIZE + 1)
  19. #define FULLNAMEMAXLENGTH (UNLEN + UNLEN + 1)
  20. #define TARGETNAMEMAXLENGTH (CRED_MAX_DOMAIN_TARGET_NAME_LENGTH + MAXSUFFIXSIZE + 1)
  21. #define MAX_STRING_SIZE (256) // misc text buffers
  22. #define MAXSUFFIXSIZE (64) // suffix in main dialog display mex length chars
  23. // implemented in krdlg.cpp
  24. DWORD GetPersistenceOptions(DWORD);
  25. #ifdef KRDLG_CPP
  26. #define dllvar
  27. #else
  28. #define dllvar extern
  29. #endif
  30. dllvar HINSTANCE g_hInstance;
  31. dllvar CREDENTIAL *g_pExistingCred; // current cred under edit
  32. dllvar DWORD g_dwPersist;
  33. dllvar DWORD g_dwType;
  34. dllvar TCHAR* g_szTargetName;
  35. // suffix strings used in the UI to mark special credential types
  36. #ifdef SHOWPASSPORT
  37. dllvar TCHAR g_rgcPassport[MAXSUFFIXSIZE];
  38. #endif
  39. dllvar TCHAR g_rgcCert[MAXSUFFIXSIZE]; // Hold suffix read in from resources
  40. //===================================
  41. //////////////////////////////////////////////////////////////////////////////
  42. //
  43. // C_ChangePasswordDlg
  44. //
  45. class C_ChangePasswordDlg
  46. : public C_Dlg
  47. {
  48. public: // operations
  49. C_ChangePasswordDlg(
  50. HWND hwndParent,
  51. HINSTANCE hInstance,
  52. LONG lIDD,
  53. DLGPROC pfnDlgProc = NULL
  54. );
  55. ~C_ChangePasswordDlg( )
  56. {
  57. } // ~C_ChangePasswordDlg
  58. virtual BOOL
  59. OnInitDialog(
  60. HWND hwndDlg,
  61. HWND hwndFocus
  62. );
  63. virtual BOOL
  64. OnCommand(
  65. WORD wNotifyCode,
  66. WORD wSenderId,
  67. HWND hwndSender
  68. );
  69. virtual void
  70. AssertValid( ) const
  71. {
  72. C_Dlg::AssertValid( );
  73. } // AssertValid
  74. protected: // operations
  75. public: // data
  76. HINSTANCE m_hInst;
  77. HWND m_hDlg;
  78. TCHAR m_szFullUsername[FULLNAMEMAXLENGTH + 1 ];
  79. TCHAR m_szUsername[UNLEN + 1];
  80. TCHAR m_szDomain[UNLEN + 1];
  81. TCHAR m_szOldPassword[PWLEN];
  82. TCHAR m_szNewPassword[PWLEN];
  83. TCHAR m_szConfirmPassword[PWLEN];
  84. BOOL m_bIsDefault;
  85. private: // operations
  86. virtual void
  87. OnOK( );
  88. // Explicitly disallow copy constructor and assignment operator.
  89. //
  90. C_ChangePasswordDlg(
  91. const C_ChangePasswordDlg& rhs
  92. );
  93. C_ChangePasswordDlg&
  94. operator=(
  95. const C_ChangePasswordDlg& rhs
  96. );
  97. private: // data
  98. }; // C_ChangePasswordDlg
  99. //////////////////////////////////////////////////////////////////////////////
  100. //
  101. // C_KeyringDlg
  102. //
  103. class C_KeyringDlg
  104. : public C_Dlg
  105. {
  106. public: // operations
  107. C_KeyringDlg(
  108. HWND hwndParent,
  109. HINSTANCE hInstance,
  110. LONG lIDD,
  111. DLGPROC pfnDlgProc = NULL
  112. );
  113. // Perform miscellaneous cleanups required as the dialog is
  114. // destroyed
  115. ~C_KeyringDlg( )
  116. {
  117. } // ~C_KeyringDlg
  118. virtual BOOL
  119. OnInitDialog(
  120. HWND hwndDlg,
  121. HWND hwndFocus
  122. );
  123. virtual BOOL
  124. OnDestroyDialog(void);
  125. virtual BOOL
  126. OnCommand(
  127. WORD wNotifyCode,
  128. WORD wSenderId,
  129. HWND hwndSender
  130. );
  131. // TOOL TIP functions
  132. virtual BOOL
  133. InitTooltips(void);
  134. // HELP functions
  135. virtual BOOL
  136. OnHelpInfo(
  137. LPARAM lp
  138. );
  139. virtual UINT
  140. MapID(UINT uid);
  141. virtual void
  142. AssertValid( ) const
  143. {
  144. C_Dlg::AssertValid( );
  145. } // AssertValid
  146. virtual BOOL
  147. OnAppMessage(
  148. UINT uMessage,
  149. WPARAM wparam,
  150. LPARAM lparam
  151. );
  152. // Register the windows messages expected from the smartcard
  153. // subsystem
  154. BOOL
  155. RegisterMessages(void);
  156. protected:
  157. HINSTANCE m_hInst;
  158. HWND m_hDlg;
  159. BOOL fInit;
  160. private: // operations
  161. virtual void
  162. OnOK( );
  163. BOOL DoEdit(void);
  164. void BuildList();
  165. void SetCurrentKey(LONG_PTR iKey);
  166. void DeleteKey();
  167. void OnChangePassword();
  168. BOOL OnHelpButton(void);
  169. // Explicitly disallow copy constructor and assignment operator.
  170. //
  171. C_KeyringDlg(
  172. const C_KeyringDlg& rhs
  173. );
  174. C_KeyringDlg&
  175. operator=(
  176. const C_KeyringDlg& rhs
  177. );
  178. private: // data
  179. DWORD m_cCredCount;
  180. }; // C_KeyringDlg
  181. //////////////////////////////////////////////////////////////////////////////
  182. //
  183. // C_AddKeyDlg
  184. //
  185. class C_AddKeyDlg
  186. : public C_Dlg
  187. {
  188. public: // operations
  189. C_AddKeyDlg(
  190. HWND hwndParent,
  191. HINSTANCE hInstance,
  192. LONG lIDD,
  193. DLGPROC pfnDlgProc = NULL
  194. );
  195. ~C_AddKeyDlg( )
  196. {
  197. } // ~C_AddKeyDlg
  198. virtual BOOL
  199. OnInitDialog(
  200. HWND hwndDlg,
  201. HWND hwndFocus
  202. );
  203. virtual BOOL
  204. OnDestroyDialog(void);
  205. virtual BOOL
  206. OnCommand(
  207. WORD wNotifyCode,
  208. WORD wSenderId,
  209. HWND hwndSender
  210. );
  211. virtual BOOL
  212. OnHelpInfo(
  213. LPARAM lp
  214. );
  215. virtual UINT
  216. MapID(
  217. UINT uid
  218. );
  219. virtual void
  220. AssertValid( ) const
  221. {
  222. C_Dlg::AssertValid( );
  223. } // AssertValid
  224. virtual BOOL
  225. OnAppMessage(
  226. UINT uMessage,
  227. WPARAM wparam,
  228. LPARAM lparam
  229. );
  230. void
  231. AdviseUser(void);
  232. BOOL
  233. AddItem(TCHAR *psz,INT iImageIndex,INT *pIndexOut);
  234. BOOL
  235. SetItemData(INT_PTR iIndex,LPARAM dwData);
  236. BOOL
  237. GetItemData(INT_PTR iIndex,LPARAM *dwData);
  238. BOOL
  239. SetItemIcon(INT iIndex,INT iWhich);
  240. void
  241. UpdateSCard(INT,CERT_ENUM *pCE);
  242. void
  243. SaveName(void);
  244. void
  245. RestoreName(void);
  246. void
  247. ShowDescriptionText(DWORD,DWORD);
  248. public:
  249. // Public data members
  250. BOOL m_bEdit; // set outside the class
  251. HWND m_hDlg; // used by C_KeyringDlg for g_wmUpdate
  252. private:
  253. void
  254. EditFillDialog(void);
  255. HWND m_hwndTName;
  256. HWND m_hwndCred;
  257. HWND m_hwndDomain;
  258. HWND m_hwndChgPsw;
  259. HWND m_hwndPswLbl;
  260. HWND m_hwndDescription;
  261. INT m_iUNCount;
  262. TCHAR *pUNList;
  263. HINSTANCE m_hInst;
  264. DWORD m_dwOldType;
  265. TCHAR m_szUsername[CRED_MAX_USERNAME_LENGTH + 1];
  266. TCHAR m_szPassword[PWLEN + 1];
  267. TCHAR m_szDomain[UNLEN + 1];
  268. private: // operations
  269. void OnChangePassword();
  270. DWORD
  271. SetPersistenceOptions(void);
  272. virtual void
  273. OnOK( );
  274. // Explicitly disallow copy constructor and assignment operator.
  275. //
  276. C_AddKeyDlg(
  277. const C_AddKeyDlg& rhs
  278. );
  279. C_AddKeyDlg&
  280. operator=(
  281. const C_AddKeyDlg& rhs
  282. );
  283. }; // C_AddKeyDlg
  284. #endif // _KRDLG_H_
  285. //
  286. ///// End of file: KrDlg.h ///////////////////////////////////////