Source code of Windows XP (NT5)
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.

199 lines
5.3 KiB

  1. //Copyright (c) 1998 - 1999 Microsoft Corporation
  2. #include "precomp.h"
  3. #include "commdlg.h"
  4. LRW_DLG_INT CALLBACK
  5. ProgressDlgProc(
  6. IN HWND hwnd,
  7. IN UINT uMsg,
  8. IN WPARAM wParam,
  9. IN LPARAM lParam
  10. )
  11. {
  12. BOOL bStatus = TRUE;
  13. PageInfo *pi = (PageInfo *)LRW_GETWINDOWLONG( hwnd, LRW_GWL_USERDATA );
  14. switch (uMsg)
  15. {
  16. case WM_INITDIALOG:
  17. {
  18. pi = (PageInfo *)((LPPROPSHEETPAGE)lParam)->lParam;
  19. LRW_SETWINDOWLONG( hwnd, LRW_GWL_USERDATA, (LRW_LONG_PTR)pi );
  20. //
  21. //Set the Font for the Title Fields
  22. //
  23. SetControlFont( pi->hBigBoldFont, hwnd, IDC_BIGBOLDTITLE);
  24. }
  25. break;
  26. case WM_DESTROY:
  27. LRW_SETWINDOWLONG( hwnd, LRW_GWL_USERDATA, NULL );
  28. break;
  29. case WM_COMMAND:
  30. if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_NEXTACTION)
  31. {
  32. if (SendDlgItemMessage(hwnd, IDC_NEXTACTION, BM_GETCHECK,
  33. (WPARAM)0,(LPARAM)0) == BST_CHECKED)
  34. {
  35. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_NEXT);
  36. }
  37. else
  38. {
  39. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_FINISH);
  40. }
  41. }
  42. break;
  43. case WM_NOTIFY:
  44. {
  45. DWORD dwNextPage = 0;
  46. LPNMHDR pnmh = (LPNMHDR)lParam;
  47. switch( pnmh->code )
  48. {
  49. case PSN_SETACTIVE:
  50. {
  51. DWORD dwRetCode = 0;
  52. DWORD dwErrorCode = 0;
  53. TCHAR szBuf[LR_MAX_MSG_TEXT];
  54. TCHAR szMsg[LR_MAX_MSG_TEXT];
  55. dwRetCode = LRGetLastRetCode();
  56. //
  57. // If everything successful, display the message depending
  58. // on the Mode
  59. //
  60. SendDlgItemMessage(hwnd, IDC_NEXTACTION, BM_SETCHECK,
  61. (WPARAM)BST_UNCHECKED,(LPARAM)0);
  62. ShowWindow(GetDlgItem(hwnd, IDC_NEXTACTION), SW_HIDE);
  63. ShowWindow(GetDlgItem(hwnd, IDC_BTN_PRINT), SW_HIDE);
  64. if (dwRetCode == ERROR_SUCCESS)
  65. {
  66. LoadString(GetInstanceHandle(), IDS_FINALSUCCESSMESSAGE, szBuf,LR_MAX_MSG_TEXT);
  67. SetDlgItemText(hwnd, IDC_MESSAGE, szBuf);
  68. switch (GetGlobalContext()->GetWizAction())
  69. {
  70. case WIZACTION_CONTINUEREGISTERLS:
  71. case WIZACTION_REGISTERLS:
  72. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_NEXT);
  73. ShowWindow(GetDlgItem(hwnd, IDC_NEXTACTION), SW_SHOW);
  74. dwRetCode = IDS_MSG_CERT_INSTALLED;
  75. SendDlgItemMessage(hwnd, IDC_NEXTACTION, BM_SETCHECK,
  76. (WPARAM)BST_CHECKED,(LPARAM)0);
  77. SetReFresh(1);
  78. break;
  79. case WIZACTION_DOWNLOADLKP:
  80. case WIZACTION_DOWNLOADLASTLKP:
  81. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_FINISH);
  82. dwRetCode = IDS_MSG_LKP_PROCESSED;
  83. SetReFresh(1);
  84. break;
  85. case WIZACTION_REREGISTERLS:
  86. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_FINISH);
  87. dwRetCode = IDS_MSG_CERT_REISSUED;
  88. SetReFresh(1);
  89. break;
  90. case WIZACTION_UNREGISTERLS:
  91. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_FINISH);
  92. dwRetCode = IDS_MSG_CERT_REVOKED;
  93. SetReFresh(1);
  94. break;
  95. default:
  96. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_FINISH);
  97. break;
  98. }
  99. SetLRState(LRSTATE_NEUTRAL);
  100. LoadString(GetInstanceHandle(),dwRetCode,szMsg,LR_MAX_MSG_TEXT);
  101. }
  102. else //Include the Error code , if any ,in the msg
  103. {
  104. LoadString(GetInstanceHandle(), IDS_FINALFAILMESSAGE, szBuf,LR_MAX_MSG_TEXT);
  105. SetDlgItemText(hwnd, IDC_MESSAGE, szBuf);
  106. LoadString(GetInstanceHandle(),dwRetCode,szBuf,LR_MAX_MSG_TEXT);
  107. dwErrorCode = LRGetLastError();
  108. if( dwErrorCode != 0)
  109. {
  110. _stprintf(szMsg,szBuf,dwErrorCode);
  111. }
  112. else
  113. {
  114. _tcscpy(szMsg,szBuf);
  115. }
  116. //Enable Back button in case of error
  117. // LRPop();
  118. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_BACK);
  119. }
  120. SetDlgItemText(hwnd,IDC_EDIT1,szMsg);
  121. }
  122. break;
  123. case PSN_WIZNEXT:
  124. if (SendDlgItemMessage(hwnd, IDC_NEXTACTION, BM_GETCHECK,
  125. (WPARAM)0,(LPARAM)0) == BST_CHECKED)
  126. {
  127. switch (GetGlobalContext()->GetWizAction())
  128. {
  129. case WIZACTION_REGISTERLS:
  130. case WIZACTION_CONTINUEREGISTERLS:
  131. // Go to Obtain LKPs
  132. // Go to the PIN screen
  133. DWORD dwStatus;
  134. DWORD dwRetCode = GetGlobalContext()->GetLSCertificates(&dwStatus);
  135. // Error Handling $$BM
  136. GetGlobalContext()->ClearWizStack();
  137. dwNextPage = IDD_WELCOME;
  138. if (GetGlobalContext()->GetActivationMethod() == CONNECTION_INTERNET)
  139. {
  140. GetGlobalContext()->SetLRState(LRSTATE_NEUTRAL);
  141. GetGlobalContext()->SetLSStatus(LSERVERSTATUS_REGISTER_INTERNET);
  142. }
  143. else
  144. {
  145. GetGlobalContext()->SetLRState(LRSTATE_NEUTRAL);
  146. GetGlobalContext()->SetLSStatus(LSERVERSTATUS_REGISTER_OTHER);
  147. }
  148. GetGlobalContext()->SetWizAction(WIZACTION_DOWNLOADLKP);
  149. break;
  150. }
  151. LRW_SETWINDOWLONG(hwnd, LRW_DWL_MSGRESULT, dwNextPage);
  152. bStatus = -1;
  153. }
  154. break;
  155. case PSN_WIZBACK:
  156. dwNextPage = LRPop();
  157. LRW_SETWINDOWLONG(hwnd, LRW_DWL_MSGRESULT, dwNextPage);
  158. bStatus = -1;
  159. break;
  160. default:
  161. bStatus = FALSE;
  162. break;
  163. }
  164. }
  165. break;
  166. default:
  167. bStatus = FALSE;
  168. break;
  169. }
  170. return bStatus;
  171. }