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.

151 lines
4.3 KiB

  1. //
  2. // File: select.cpp
  3. //
  4. // Description: This file contains the implmentation code for the
  5. // "Certificate Select" dialog.
  6. //
  7. #pragma warning (disable: 4201) // nameless struct/union
  8. #pragma warning (disable: 4514) // remove inline functions
  9. #pragma warning (disable: 4127) // conditional expression is constant
  10. #include "pch.hxx"
  11. #include "demand.h"
  12. extern HINSTANCE HinstDll;
  13. #ifndef MAC
  14. extern HMODULE HmodRichEdit;
  15. #endif // !MAC
  16. INT_PTR CALLBACK FinePrintDlgProc(HWND hwndDlg, UINT msg,
  17. WPARAM wParam, LPARAM lParam)
  18. {
  19. #if 0
  20. int c;
  21. CERT_VIEWPROPERTIES_STRUCT_W cvps;
  22. DWORD dw;
  23. int i;
  24. DWORD iStore;
  25. LPWSTR pwsz;
  26. PCERT_SELECT_STRUCT pcss;
  27. #endif // 0
  28. BOOL f;
  29. PCCERT_CONTEXT pccert;
  30. switch (msg) {
  31. case WM_INITDIALOG:
  32. // Center the dialog on its parent
  33. // CenterThisDialog(hwndDlg);
  34. //
  35. pccert = (PCCERT_CONTEXT) lParam;
  36. FormatSubject(hwndDlg, IDC_ISSUED_TO, pccert);
  37. FormatIssuer(hwndDlg, IDC_ISSUED_BY, pccert);
  38. //
  39. // Setup the CPS if we can find one
  40. //
  41. if (FormatCPS(hwndDlg, IDC_TEXT, pccert)) {
  42. RecognizeURLs(GetDlgItem(hwndDlg, IDC_TEXT));
  43. SendDlgItemMessage(hwndDlg, IDC_TEXT, EM_SETEVENTMASK, 0,
  44. ENM_LINK);
  45. }
  46. // Grey out the rich edit boxs
  47. SendDlgItemMessage(hwndDlg, IDC_TEXT, EM_SETBKGNDCOLOR, 0,
  48. GetSysColor(COLOR_3DFACE));
  49. SendDlgItemMessage(hwndDlg, IDC_ISSUED_TO, EM_SETBKGNDCOLOR, 0,
  50. GetSysColor(COLOR_3DFACE));
  51. SendDlgItemMessage(hwndDlg, IDC_ISSUED_BY, EM_SETBKGNDCOLOR, 0,
  52. GetSysColor(COLOR_3DFACE));
  53. break;
  54. case WM_NOTIFY:
  55. if (((NMHDR FAR *) lParam)->code == EN_LINK) {
  56. if (((ENLINK FAR *) lParam)->msg == WM_LBUTTONDOWN) {
  57. f = FNoteDlgNotifyLink(hwndDlg, (ENLINK *) lParam, NULL);
  58. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, f);
  59. return f;
  60. }
  61. }
  62. break;
  63. case WM_COMMAND:
  64. switch (LOWORD(wParam)) {
  65. case IDOK:
  66. case IDCANCEL:
  67. EndDialog(hwndDlg, IDOK);
  68. return TRUE;
  69. }
  70. break;
  71. //
  72. // Use the default handler -- we don't do anything for it
  73. //
  74. default:
  75. return FALSE;
  76. }
  77. return TRUE;
  78. } // FinePrint()
  79. BOOL FinePrint(PCCERT_CONTEXT pccert, HWND hwndParent)
  80. {
  81. int ret;
  82. // We use the common controls -- so make sure they have been loaded
  83. #ifndef WIN16
  84. #ifndef MAC
  85. if (FIsWin95) {
  86. if (HmodRichEdit == NULL) {
  87. HmodRichEdit = LoadLibraryA("RichEd32.dll");
  88. if (HmodRichEdit == NULL) {
  89. return FALSE;
  90. }
  91. }
  92. }
  93. else {
  94. if (HmodRichEdit == NULL) {
  95. HmodRichEdit = LoadLibrary(L"RichEd32.dll");
  96. if (HmodRichEdit == NULL) {
  97. return FALSE;
  98. }
  99. }
  100. }
  101. // Now launch the dialog
  102. if (FIsWin95) {
  103. #endif // !MAC
  104. ret = (int) DialogBoxParamA(HinstDll, (LPSTR) MAKEINTRESOURCE(IDD_FINE_PRINT),
  105. hwndParent, FinePrintDlgProc,
  106. (LPARAM) pccert);
  107. #ifndef MAC
  108. }
  109. else {
  110. ret = (int) DialogBoxParamW(HinstDll, MAKEINTRESOURCE(IDD_FINE_PRINT),
  111. hwndParent, FinePrintDlgProc,
  112. (LPARAM) pccert);
  113. }
  114. #endif // !MAC
  115. #else // WIN16
  116. if (HmodRichEdit == NULL) {
  117. HmodRichEdit = LoadLibrary("RichEd.dll");
  118. if (HmodRichEdit == NULL) {
  119. return FALSE;
  120. }
  121. }
  122. // Now launch the dialog
  123. ret = (int) DialogBoxParam(HinstDll, MAKEINTRESOURCE(IDD_FINE_PRINT),
  124. hwndParent, FinePrintDlgProc,
  125. (LPARAM) pccert);
  126. #endif // !WIN16
  127. return (ret == IDOK);
  128. }