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.

369 lines
8.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows NT Security
  4. // Copyright (C) Microsoft Corporation, 1992 - 1999
  5. //
  6. // File: acuictl.h
  7. //
  8. // Contents: UI Control class definitions
  9. //
  10. // History: 12-May-97 kirtd Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #if !defined(__ACUICTL_H__)
  14. #define __ACUICTL_H__
  15. //
  16. // Forward class declaration
  17. //
  18. class CInvokeInfoHelper;
  19. //
  20. // Link subclass definitions
  21. //
  22. typedef struct _TUI_LINK_SUBCLASS_DATA {
  23. HWND hwndParent;
  24. WNDPROC wpPrev;
  25. DWORD_PTR uToolTipText;
  26. DWORD uId;
  27. HWND hwndTip;
  28. LPVOID pvData;
  29. BOOL fMouseCaptured;
  30. } TUI_LINK_SUBCLASS_DATA, *PTUI_LINK_SUBCLASS_DATA;
  31. //
  32. // IACUIControl abstract base class interface. This is used by the
  33. // invoke UI entry point to put up the appropriate UI. There are different
  34. // implementations of this interface based on the invoke reason code
  35. //
  36. class IACUIControl
  37. {
  38. public:
  39. //
  40. // Constructor
  41. //
  42. IACUIControl (CInvokeInfoHelper& riih);
  43. //
  44. // Virtual destructor
  45. //
  46. virtual ~IACUIControl ();
  47. //
  48. // UI Message processing
  49. //
  50. virtual BOOL OnUIMessage (
  51. HWND hwnd,
  52. UINT uMsg,
  53. WPARAM wParam,
  54. LPARAM lParam
  55. );
  56. void LoadActionText(WCHAR **ppszRet, WCHAR *pwszIn, DWORD dwDefId);
  57. void SetupButtons(HWND hwnd);
  58. //
  59. // Pure virtual methods
  60. //
  61. virtual HRESULT InvokeUI (HWND hDisplay) = 0;
  62. virtual BOOL OnInitDialog (HWND hwnd, WPARAM wParam, LPARAM lParam) = 0;
  63. virtual BOOL OnYes (HWND hwnd) = 0;
  64. virtual BOOL OnNo (HWND hwnd) = 0;
  65. virtual BOOL OnMore (HWND hwnd) = 0;
  66. protected:
  67. //
  68. // Invoke Info Helper reference
  69. //
  70. CInvokeInfoHelper& m_riih;
  71. //
  72. // Invoke result
  73. //
  74. HRESULT m_hrInvokeResult;
  75. WCHAR *m_pszCopyActionText;
  76. WCHAR *m_pszCopyActionTextNoTS;
  77. WCHAR *m_pszCopyActionTextNotSigned;
  78. };
  79. //
  80. // CVerifiedTrustUI class is used to invoke authenticode UI where the
  81. // trust hierarchy for the signer has been successfully verified and the
  82. // user has to make an override decision
  83. //
  84. class CVerifiedTrustUI : public IACUIControl
  85. {
  86. public:
  87. //
  88. // Initialization
  89. //
  90. CVerifiedTrustUI (CInvokeInfoHelper& riih, HRESULT& rhr);
  91. ~CVerifiedTrustUI ();
  92. //
  93. // IACUIControl methods
  94. //
  95. virtual HRESULT InvokeUI (HWND hDisplay);
  96. virtual BOOL OnInitDialog (HWND hwnd, WPARAM wParam, LPARAM lParam);
  97. virtual BOOL OnYes (HWND hwnd);
  98. virtual BOOL OnNo (HWND hwnd);
  99. virtual BOOL OnMore (HWND hwnd);
  100. private:
  101. //
  102. // Formatted strings for display
  103. //
  104. LPWSTR m_pszInstallAndRun;
  105. LPWSTR m_pszAuthenticity;
  106. LPWSTR m_pszCaution;
  107. LPWSTR m_pszPersonalTrust;
  108. //
  109. // links
  110. //
  111. TUI_LINK_SUBCLASS_DATA m_lsdPublisher;
  112. TUI_LINK_SUBCLASS_DATA m_lsdOpusInfo;
  113. TUI_LINK_SUBCLASS_DATA m_lsdCA;
  114. TUI_LINK_SUBCLASS_DATA m_lsdAdvanced;
  115. };
  116. //
  117. // CUnverifiedTrustUI class is used to invoke authenticode UI where the
  118. // trust hierarchy for the signer has been NOT been successfully verified and
  119. // the user has to make an override decision
  120. //
  121. class CUnverifiedTrustUI : public IACUIControl
  122. {
  123. public:
  124. //
  125. // Initialization
  126. //
  127. CUnverifiedTrustUI (CInvokeInfoHelper& riih, HRESULT& rhr);
  128. ~CUnverifiedTrustUI ();
  129. //
  130. // IACUIControl methods
  131. //
  132. virtual HRESULT InvokeUI (HWND hDisplay);
  133. virtual BOOL OnInitDialog (HWND hwnd, WPARAM wParam, LPARAM lParam);
  134. virtual BOOL OnYes (HWND hwnd);
  135. virtual BOOL OnNo (HWND hwnd);
  136. virtual BOOL OnMore (HWND hwnd);
  137. private:
  138. //
  139. // Formatted strings for display
  140. //
  141. LPWSTR m_pszNoAuthenticity;
  142. LPWSTR m_pszProblemsBelow;
  143. LPWSTR m_pszInstallAndRun3;
  144. //
  145. // links
  146. //
  147. TUI_LINK_SUBCLASS_DATA m_lsdPublisher;
  148. TUI_LINK_SUBCLASS_DATA m_lsdOpusInfo;
  149. TUI_LINK_SUBCLASS_DATA m_lsdCA;
  150. TUI_LINK_SUBCLASS_DATA m_lsdAdvanced;
  151. };
  152. //
  153. // CNoSignatureUI class is used to invoke authenticode UI where the
  154. // there is no signature for the subject and the user has to make an
  155. // override decision
  156. //
  157. class CNoSignatureUI : public IACUIControl
  158. {
  159. public:
  160. //
  161. // Initialization
  162. //
  163. CNoSignatureUI (CInvokeInfoHelper& riih, HRESULT& rhr);
  164. ~CNoSignatureUI ();
  165. //
  166. // IACUIControl methods
  167. //
  168. virtual HRESULT InvokeUI (HWND hDisplay);
  169. virtual BOOL OnInitDialog (HWND hwnd, WPARAM wParam, LPARAM lParam);
  170. virtual BOOL OnYes (HWND hwnd);
  171. virtual BOOL OnNo (HWND hwnd);
  172. virtual BOOL OnMore (HWND hwnd);
  173. private:
  174. //
  175. // Formatted strings for display
  176. //
  177. LPWSTR m_pszInstallAndRun2;
  178. LPWSTR m_pszNoPublisherFound;
  179. };
  180. //
  181. // ACUIMessageProc, this dialog message procedure is used to dispatch
  182. // dialog messages to the control
  183. //
  184. INT_PTR CALLBACK ACUIMessageProc (
  185. HWND hwnd,
  186. UINT uMsg,
  187. WPARAM wParam,
  188. LPARAM lParam
  189. );
  190. //
  191. // Subclassing helper routines and definitions
  192. //
  193. VOID SubclassEditControlForArrowCursor (HWND hwndEdit);
  194. LRESULT CALLBACK ACUISetArrowCursorSubclass (
  195. HWND hwnd,
  196. UINT uMsg,
  197. WPARAM wParam,
  198. LPARAM lParam
  199. );
  200. VOID SubclassEditControlForLink (
  201. HWND hwndDlg,
  202. HWND hwndEdit,
  203. WNDPROC wndproc,
  204. PTUI_LINK_SUBCLASS_DATA plsd
  205. );
  206. LRESULT CALLBACK ACUILinkSubclass (
  207. HWND hwnd,
  208. UINT uMsg,
  209. WPARAM wParam,
  210. LPARAM lParam
  211. );
  212. //
  213. // UI control resizing helper functions
  214. //
  215. VOID RebaseControlVertical (
  216. HWND hwndDlg,
  217. HWND hwnd,
  218. HWND hwndNext,
  219. BOOL fResizeForText,
  220. int deltavpos,
  221. int oline,
  222. int minsep,
  223. int* pdeltaheight
  224. );
  225. int CalculateControlVerticalDistanceFromDlgBottom (HWND hwnd, UINT Control);
  226. int CalculateControlVerticalDistance (HWND hwnd, UINT Control1, UINT Control2);
  227. VOID ACUICenterWindow (HWND hWndToCenter);
  228. int GetEditControlMaxLineWidth (HWND hwndEdit, HDC hdc, int cline);
  229. void DrawFocusRectangle (HWND hwnd, HDC hdc);
  230. void AdjustEditControlWidthToLineCount(HWND hwnd, int cline, TEXTMETRIC* ptm);
  231. //
  232. // Miscellaneous definitions
  233. //
  234. #define MAX_LOADSTRING_BUFFER 1024
  235. //
  236. // Resource string formatting helper
  237. //
  238. HRESULT FormatACUIResourceString (
  239. UINT StringResourceId,
  240. DWORD_PTR* aMessageArgument,
  241. LPWSTR* ppszFormatted
  242. );
  243. //
  244. // Rendering helper
  245. //
  246. int RenderACUIStringToEditControl (
  247. HWND hwndDlg,
  248. UINT ControlId,
  249. UINT NextControlId,
  250. LPCWSTR psz,
  251. int deltavpos,
  252. BOOL fLink,
  253. WNDPROC wndproc,
  254. PTUI_LINK_SUBCLASS_DATA plsd,
  255. int minsep,
  256. LPCWSTR pszThisTextOnlyInLink
  257. );
  258. //
  259. // HTML help viewing helper
  260. //
  261. VOID ACUIViewHTMLHelpTopic (HWND hwnd, LPSTR pszTopic);
  262. //
  263. // Hotkey helpers
  264. //
  265. int GetHotKeyCharPositionFromString (LPWSTR pwszText);
  266. int GetHotKeyCharPosition (HWND hwnd);
  267. VOID FormatHotKeyOnEditControl (HWND hwnd, int hkcharpos);
  268. #endif