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.

257 lines
7.1 KiB

  1. //Copyright (c) 1998 - 2001 Microsoft Corporation
  2. #include "precomp.h"
  3. #include "PINDlg.h"
  4. LRW_DLG_INT CALLBACK
  5. PINDlgProc(
  6. IN HWND hwnd,
  7. IN UINT uMsg,
  8. IN WPARAM wParam,
  9. IN LPARAM lParam
  10. )
  11. {
  12. DWORD dwNextPage = 0;
  13. BOOL bStatus = TRUE;
  14. PageInfo *pi = (PageInfo *)LRW_GETWINDOWLONG( hwnd, LRW_GWL_USERDATA );
  15. TCHAR * cwLicenseServerID;
  16. HWND hwndLSID;
  17. switch (uMsg)
  18. {
  19. case WM_INITDIALOG:
  20. pi = (PageInfo *)((LPPROPSHEETPAGE)lParam)->lParam;
  21. LRW_SETWINDOWLONG( hwnd, LRW_GWL_USERDATA, (LRW_LONG_PTR)pi );
  22. cwLicenseServerID = GetLicenseServerID();
  23. // Get the License Server ID, provided by the License Server
  24. hwndLSID = GetDlgItem(hwnd, IDC_MSID);
  25. // Let us format the License Server ID for showing.
  26. SetWindowText(hwndLSID, cwLicenseServerID);
  27. SendDlgItemMessage (hwnd , IDC_TXT_PIN, EM_SETLIMITTEXT, CA_PIN_LEN,0);
  28. break;
  29. case WM_DESTROY:
  30. LRW_SETWINDOWLONG( hwnd, LRW_GWL_USERDATA, NULL );
  31. break;
  32. case WM_NOTIFY:
  33. {
  34. LPNMHDR pnmh = (LPNMHDR)lParam;
  35. switch( pnmh->code )
  36. {
  37. case PSN_SETACTIVE:
  38. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_NEXT | PSWIZB_BACK);
  39. break;
  40. case PSN_WIZNEXT:
  41. {
  42. CString sPIN;
  43. LPTSTR lpVal = NULL;
  44. DWORD dwRetCode;
  45. lpVal = sPIN.GetBuffer(CA_PIN_LEN + 1);
  46. GetDlgItemText(hwnd,IDC_TXT_PIN,lpVal,CA_PIN_LEN+1);
  47. sPIN.ReleaseBuffer(-1);
  48. sPIN.TrimLeft(); sPIN.TrimRight();
  49. if (sPIN.IsEmpty())
  50. {
  51. LRMessageBox(hwnd,IDS_ERR_FIELD_EMPTY);
  52. dwNextPage = IDD_DLG_PIN;
  53. }
  54. else
  55. {
  56. SetCertificatePIN((LPTSTR)(LPCTSTR)sPIN);
  57. dwRetCode = ShowProgressBox(hwnd, ProcessThread, 0, 0, 0);
  58. dwNextPage = IDD_PROGRESS;
  59. LRPush(IDD_DLG_PIN);
  60. }
  61. LRW_SETWINDOWLONG(hwnd, LRW_DWL_MSGRESULT, dwNextPage);
  62. bStatus = -1;
  63. }
  64. break;
  65. case PSN_WIZBACK:
  66. dwNextPage = LRPop();
  67. LRW_SETWINDOWLONG(hwnd, LRW_DWL_MSGRESULT, dwNextPage);
  68. bStatus = -1;
  69. break;
  70. default:
  71. bStatus = FALSE;
  72. break;
  73. }
  74. }
  75. break;
  76. default:
  77. bStatus = FALSE;
  78. break;
  79. }
  80. return bStatus;
  81. }
  82. LRW_DLG_INT CALLBACK
  83. ContinueReg(
  84. IN HWND hwnd,
  85. IN UINT uMsg,
  86. IN WPARAM wParam,
  87. IN LPARAM lParam
  88. )
  89. {
  90. DWORD dwNextPage = 0;
  91. BOOL bStatus = TRUE;
  92. PageInfo *pi = (PageInfo *)LRW_GETWINDOWLONG( hwnd, LRW_GWL_USERDATA );
  93. switch (uMsg)
  94. {
  95. case WM_INITDIALOG:
  96. pi = (PageInfo *)((LPPROPSHEETPAGE)lParam)->lParam;
  97. LRW_SETWINDOWLONG( hwnd, LRW_GWL_USERDATA, (LRW_LONG_PTR)pi );
  98. //
  99. //By default Check the first RADIO button.
  100. //
  101. SendDlgItemMessage(hwnd,IDC_REG_COMPLETE,BM_SETCHECK,(WPARAM)BST_CHECKED,(LPARAM)0);
  102. break;
  103. case WM_DESTROY:
  104. LRW_SETWINDOWLONG( hwnd, LRW_GWL_USERDATA, NULL );
  105. break;
  106. case WM_COMMAND:
  107. if (HIWORD(wParam) == BN_CLICKED)
  108. {
  109. switch (LOWORD(wParam))
  110. {
  111. case IDC_REG_POSTPONE:
  112. if (SendDlgItemMessage(hwnd, IDC_REG_POSTPONE, BM_GETCHECK,
  113. (WPARAM)0,(LPARAM)0) == BST_CHECKED)
  114. {
  115. TCHAR szBuf[ LR_MAX_MSG_TEXT];
  116. LoadString(GetInstanceHandle(), IDS_ALTFINISHTEXT, szBuf,LR_MAX_MSG_TEXT);
  117. //PropSheet_CancelToClose(GetParent( hwnd ));
  118. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_FINISH );
  119. // PropSheet_SetFinishText( GetParent( hwnd ), szBuf);
  120. }
  121. break;
  122. case IDC_REG_COMPLETE:
  123. if (SendDlgItemMessage(hwnd, IDC_REG_COMPLETE, BM_GETCHECK,
  124. (WPARAM)0,(LPARAM)0) == BST_CHECKED)
  125. {
  126. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_NEXT | PSWIZB_BACK);
  127. }
  128. break;
  129. case IDC_REG_RESTART:
  130. if (SendDlgItemMessage(hwnd, IDC_REG_RESTART, BM_GETCHECK,
  131. (WPARAM)0,(LPARAM)0) == BST_CHECKED)
  132. {
  133. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_NEXT | PSWIZB_BACK);
  134. }
  135. break;
  136. }
  137. }
  138. break;
  139. case WM_NOTIFY:
  140. {
  141. LPNMHDR pnmh = (LPNMHDR)lParam;
  142. switch( pnmh->code )
  143. {
  144. case PSN_SETACTIVE:
  145. SendDlgItemMessage(hwnd,IDC_REG_COMPLETE,BM_SETCHECK,(WPARAM)BST_CHECKED,(LPARAM)0); //Fix bug# 627
  146. SendDlgItemMessage(hwnd,IDC_REG_POSTPONE,BM_SETCHECK,(WPARAM)BST_UNCHECKED,(LPARAM)0); //Fix bug# 627
  147. SendDlgItemMessage(hwnd,IDC_REG_RESTART,BM_SETCHECK,(WPARAM)BST_UNCHECKED,(LPARAM)0); //Fix bug# 627
  148. if(SendDlgItemMessage(hwnd,IDC_REG_COMPLETE,BM_GETCHECK,(WPARAM)0,(LPARAM)0) == BST_CHECKED)
  149. {
  150. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_NEXT | PSWIZB_BACK);
  151. }
  152. else if (SendDlgItemMessage(hwnd,IDC_REG_POSTPONE,BM_GETCHECK,(WPARAM)0,(LPARAM)0) == BST_CHECKED)
  153. {
  154. TCHAR szBuf[ LR_MAX_MSG_TEXT];
  155. LoadString(GetInstanceHandle(), IDS_ALTFINISHTEXT, szBuf,LR_MAX_MSG_TEXT);
  156. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_FINISH | PSWIZB_BACK);
  157. // PropSheet_SetFinishText( GetParent( hwnd ), szBuf);
  158. }
  159. else
  160. {
  161. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_NEXT | PSWIZB_BACK);
  162. }
  163. // PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_NEXT | PSWIZB_BACK);
  164. break;
  165. case PSN_WIZNEXT:
  166. if(SendDlgItemMessage(hwnd,IDC_REG_COMPLETE,BM_GETCHECK,(WPARAM)0,(LPARAM)0) == BST_CHECKED)
  167. {
  168. GetGlobalContext()->SetLSStatus(LSERVERSTATUS_WAITFORPIN);
  169. GetGlobalContext()->SetWizAction(WIZACTION_CONTINUEREGISTERLS);
  170. dwNextPage = IDD_DLG_PIN;
  171. }
  172. else if (SendDlgItemMessage(hwnd,IDC_REG_POSTPONE,BM_GETCHECK,(WPARAM)0,(LPARAM)0) == BST_CHECKED)
  173. {
  174. // GetGlobalContext()->GetContactDataObject()->sProgramName = PROGRAM_MOLP;
  175. // EndDialog(hwnd);
  176. // PropSheet_PressButton(hwnd, PSWIZB_FINISH);
  177. }
  178. else
  179. {
  180. // Restart
  181. GetGlobalContext()->SetLRState(LRSTATE_NEUTRAL);
  182. GetGlobalContext()->SetLSStatus(LSERVERSTATUS_UNREGISTER);
  183. GetGlobalContext()->SetWizAction(WIZACTION_REGISTERLS);
  184. GetGlobalContext()->ClearWizStack();
  185. dwNextPage = IDD_WELCOME_ACTIVATION;
  186. }
  187. LRW_SETWINDOWLONG(hwnd, LRW_DWL_MSGRESULT, dwNextPage);
  188. bStatus = -1;
  189. if (dwNextPage != IDD_WELCOME_ACTIVATION)
  190. {
  191. LRPush(IDD_CONTINUEREG);
  192. }
  193. break;
  194. case PSN_WIZBACK:
  195. GetGlobalContext()->SetLSStatus(LSERVERSTATUS_WAITFORPIN);
  196. GetGlobalContext()->SetWizAction(WIZACTION_CONTINUEREGISTERLS);
  197. dwNextPage = LRPop();
  198. LRW_SETWINDOWLONG(hwnd, LRW_DWL_MSGRESULT, dwNextPage);
  199. bStatus = -1;
  200. break;
  201. default:
  202. bStatus = FALSE;
  203. break;
  204. }
  205. }
  206. break;
  207. default:
  208. bStatus = FALSE;
  209. break;
  210. }
  211. return bStatus;
  212. }