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.

149 lines
4.7 KiB

  1. //Copyright (c) 1998 - 2001 Microsoft Corporation
  2. #include <assert.h>
  3. #include "precomp.h"
  4. void MoveCaret(int nID, HWND hwnd ) ;
  5. void SetDeleteKeyStatus(int iValue) ;
  6. LRW_DLG_INT CALLBACK
  7. TelRegProc(
  8. IN HWND hwnd,
  9. IN UINT uMsg,
  10. IN WPARAM wParam,
  11. IN LPARAM lParam
  12. )
  13. {
  14. DWORD dwNextPage = 0;
  15. BOOL bStatus = TRUE;
  16. PageInfo *pi = (PageInfo *)LRW_GETWINDOWLONG( hwnd, LRW_GWL_USERDATA );
  17. DWORD dwReturn;
  18. HWND hwndLSID;
  19. TCHAR * cwLicenseServerID;
  20. TCHAR tcUserValue[ CHARS_IN_BATCH*NUMBER_OF_BATCHES + 1];
  21. switch (uMsg)
  22. {
  23. case WM_INITDIALOG:
  24. pi = (PageInfo *)((LPPROPSHEETPAGE)lParam)->lParam;
  25. LRW_SETWINDOWLONG( hwnd, LRW_GWL_USERDATA, (LRW_LONG_PTR)pi );
  26. // Now set the Limit of the data entry fields
  27. SendDlgItemMessage (hwnd, IDC_TXT_TELEINFO1, EM_SETLIMITTEXT, CHARS_IN_BATCH,0);
  28. SendDlgItemMessage (hwnd, IDC_TXT_TELEINFO2, EM_SETLIMITTEXT, CHARS_IN_BATCH,0);
  29. SendDlgItemMessage (hwnd, IDC_TXT_TELEINFO3, EM_SETLIMITTEXT, CHARS_IN_BATCH,0);
  30. SendDlgItemMessage (hwnd, IDC_TXT_TELEINFO4, EM_SETLIMITTEXT, CHARS_IN_BATCH,0);
  31. SendDlgItemMessage (hwnd, IDC_TXT_TELEINFO5, EM_SETLIMITTEXT, CHARS_IN_BATCH,0);
  32. SendDlgItemMessage (hwnd, IDC_TXT_TELEINFO6, EM_SETLIMITTEXT, CHARS_IN_BATCH,0);
  33. SendDlgItemMessage (hwnd, IDC_TXT_TELEINFO7, EM_SETLIMITTEXT, CHARS_IN_BATCH,0);
  34. assert(NUMBER_OF_BATCHES == 7);
  35. SetWindowText(GetDlgItem(hwnd, IDC_TXT_TELEINFO1), _T(""));
  36. SetWindowText(GetDlgItem(hwnd, IDC_TXT_TELEINFO2), _T(""));
  37. SetWindowText(GetDlgItem(hwnd, IDC_TXT_TELEINFO3), _T(""));
  38. SetWindowText(GetDlgItem(hwnd, IDC_TXT_TELEINFO4), _T(""));
  39. SetWindowText(GetDlgItem(hwnd, IDC_TXT_TELEINFO5), _T(""));
  40. SetWindowText(GetDlgItem(hwnd, IDC_TXT_TELEINFO6), _T(""));
  41. SetWindowText(GetDlgItem(hwnd, IDC_TXT_TELEINFO7), _T(""));
  42. break;
  43. case WM_COMMAND:
  44. if (HIWORD(wParam) == EN_CHANGE)
  45. {
  46. MoveCaret(LOWORD(wParam), hwnd ) ;
  47. }
  48. if (HIWORD(wParam) == EN_UPDATE)
  49. {
  50. if (GetKeyState(VK_DELETE) == -128)
  51. SetDeleteKeyStatus(1) ;
  52. else
  53. SetDeleteKeyStatus(0) ;
  54. }
  55. break ;
  56. case WM_DESTROY:
  57. LRW_SETWINDOWLONG( hwnd, LRW_GWL_USERDATA, NULL );
  58. break;
  59. case WM_NOTIFY:
  60. {
  61. LPNMHDR pnmh = (LPNMHDR)lParam;
  62. switch( pnmh->code )
  63. {
  64. case PSN_SETACTIVE:
  65. cwLicenseServerID = GetLicenseServerID();
  66. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_NEXT|PSWIZB_BACK);
  67. // Get the License Server ID, provided by the License Server
  68. hwndLSID = GetDlgItem(hwnd, IDC_LICENSESERVER_ID);
  69. SetWindowText(hwndLSID, cwLicenseServerID);
  70. SetWindowText(GetDlgItem(hwnd, IDC_CSRINFO), GetCSRNumber());
  71. break;
  72. case PSN_WIZNEXT:
  73. // Let us get the Information Entered First & concatenate everything into
  74. // One String
  75. GetDlgItemText(hwnd,IDC_TXT_TELEINFO1, tcUserValue, CHARS_IN_BATCH+1);
  76. GetDlgItemText(hwnd,IDC_TXT_TELEINFO2, tcUserValue+1*CHARS_IN_BATCH, CHARS_IN_BATCH+1);
  77. GetDlgItemText(hwnd,IDC_TXT_TELEINFO3, tcUserValue+2*CHARS_IN_BATCH, CHARS_IN_BATCH+1);
  78. GetDlgItemText(hwnd,IDC_TXT_TELEINFO4, tcUserValue+3*CHARS_IN_BATCH, CHARS_IN_BATCH+1);
  79. GetDlgItemText(hwnd,IDC_TXT_TELEINFO5, tcUserValue+4*CHARS_IN_BATCH, CHARS_IN_BATCH+1);
  80. GetDlgItemText(hwnd,IDC_TXT_TELEINFO6, tcUserValue+5*CHARS_IN_BATCH, CHARS_IN_BATCH+1);
  81. GetDlgItemText(hwnd,IDC_TXT_TELEINFO7, tcUserValue+6*CHARS_IN_BATCH, CHARS_IN_BATCH+1);
  82. // OK, Now we have the Information provided by the user
  83. // Need to validate
  84. if (wcsspn(tcUserValue, BASE24_CHARACTERS) != LR_REGISTRATIONID_LEN)
  85. {
  86. // Extraneous characters in the SPK string
  87. LRMessageBox(hwnd, IDS_ERR_INVALIDLSID,IDS_WIZARD_MESSAGE_TITLE);
  88. dwNextPage = IDD_DLG_TELREG;
  89. }
  90. else
  91. {
  92. dwReturn = GetGlobalContext()->SetLSSPK(tcUserValue);
  93. if (dwReturn != ERROR_SUCCESS)
  94. {
  95. LRMessageBox(hwnd, dwReturn, NULL, LRGetLastError());
  96. dwNextPage = IDD_DLG_TELREG;
  97. }
  98. else
  99. {
  100. dwReturn = ShowProgressBox(hwnd, ProcessThread, 0, 0, 0);
  101. dwNextPage = IDD_PROGRESS;
  102. LRPush(IDD_DLG_TELREG);
  103. }
  104. }
  105. LRW_SETWINDOWLONG(hwnd, LRW_DWL_MSGRESULT, dwNextPage);
  106. bStatus = -1;
  107. break;
  108. case PSN_WIZBACK:
  109. dwNextPage = LRPop();
  110. LRW_SETWINDOWLONG(hwnd, LRW_DWL_MSGRESULT, dwNextPage);
  111. bStatus = -1;
  112. break;
  113. default:
  114. bStatus = FALSE;
  115. break;
  116. }
  117. }
  118. break;
  119. default:
  120. bStatus = FALSE;
  121. break;
  122. }
  123. return bStatus;
  124. }