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.

185 lines
5.7 KiB

  1. //Copyright (c) 1998 - 2001 Microsoft Corporation
  2. #include "precomp.h"
  3. #include "utils.h"
  4. #include "fancypasting.h"
  5. #include "licensinglink.h"
  6. #include <assert.h>
  7. extern HINSTANCE g_hInstance;
  8. void MoveCaret(int nID, HWND hwnd ) ;
  9. void SetDeleteKeyStatus(int iValue) ;
  10. LRW_DLG_INT CALLBACK
  11. WWWReissueProc(
  12. IN HWND hwnd,
  13. IN UINT uMsg,
  14. IN WPARAM wParam,
  15. IN LPARAM lParam
  16. )
  17. {
  18. BOOL bStatus = TRUE;
  19. DWORD dwNextPage = 0;
  20. HWND hwndLSID;
  21. TCHAR * cwRegistrationID;
  22. TCHAR awBuffer[ 128];
  23. DWORD dwRetCode;
  24. TCHAR tcUserValue[ CHARS_IN_BATCH*NUMBER_OF_BATCHES + 1];
  25. switch (uMsg)
  26. {
  27. case WM_INITDIALOG:
  28. // Now set the Limit of the data entry fields
  29. SendDlgItemMessage (hwnd, IDC_TXT_WWWINFO1, EM_SETLIMITTEXT, CHARS_IN_BATCH,0);
  30. SendDlgItemMessage (hwnd, IDC_TXT_WWWINFO2, EM_SETLIMITTEXT, CHARS_IN_BATCH,0);
  31. SendDlgItemMessage (hwnd, IDC_TXT_WWWINFO3, EM_SETLIMITTEXT, CHARS_IN_BATCH,0);
  32. SendDlgItemMessage (hwnd, IDC_TXT_WWWINFO4, EM_SETLIMITTEXT, CHARS_IN_BATCH,0);
  33. SendDlgItemMessage (hwnd, IDC_TXT_WWWINFO5, EM_SETLIMITTEXT, CHARS_IN_BATCH,0);
  34. SendDlgItemMessage (hwnd, IDC_TXT_WWWINFO6, EM_SETLIMITTEXT, CHARS_IN_BATCH,0);
  35. SendDlgItemMessage (hwnd, IDC_TXT_WWWINFO7, EM_SETLIMITTEXT, CHARS_IN_BATCH,0);
  36. assert(NUMBER_OF_BATCHES == 7);
  37. AddLicensingSiteLink(hwnd);
  38. break;
  39. case WM_SHOWWINDOW:
  40. if (wParam)
  41. {
  42. //SetWindowText(GetDlgItem(hwnd, IDC_CSRINFO), GetCSRNumber());
  43. cwRegistrationID = GetGlobalContext()->GetRegistrationID();
  44. hwndLSID = GetDlgItem(hwnd, IDC_MSID);
  45. swprintf(awBuffer, L"%5.5s-%5.5s-%5.5s-%5.5s-%5.5s-%5.5s-%5.5s",
  46. cwRegistrationID, cwRegistrationID + 5, cwRegistrationID + 10,
  47. cwRegistrationID + 15, cwRegistrationID + 20, cwRegistrationID + 25,
  48. cwRegistrationID + 30);
  49. SetWindowText(hwndLSID, awBuffer);
  50. }
  51. break;
  52. case WM_COMMAND:
  53. if (HIWORD(wParam) == EN_CHANGE)
  54. {
  55. MoveCaret(LOWORD(wParam), hwnd ) ;
  56. }
  57. if (HIWORD(wParam) == EN_UPDATE)
  58. {
  59. if (GetKeyState(VK_DELETE) == -128)
  60. SetDeleteKeyStatus(1) ;
  61. else
  62. SetDeleteKeyStatus(0) ;
  63. }
  64. if (HIWORD(wParam) == EN_MAXTEXT)
  65. {
  66. //Only insert if the paste operation
  67. //originated in the leftmost edit field
  68. if (LOWORD(wParam) == IDC_TXT_WWWINFO1)
  69. InsertClipboardDataIntoIDFields(hwnd, IDC_TXT_WWWINFO1, IDC_TXT_WWWINFO7);
  70. }
  71. break;
  72. case WM_DESTROY:
  73. LRW_SETWINDOWLONG( hwnd, LRW_GWL_USERDATA, NULL );
  74. break;
  75. case WM_NOTIFY:
  76. {
  77. LPNMHDR pnmh = (LPNMHDR)lParam;
  78. switch( pnmh->code )
  79. {
  80. case PSN_SETACTIVE:
  81. PropSheet_SetWizButtons( GetParent( hwnd ), PSWIZB_NEXT | PSWIZB_BACK);
  82. AddLicensingSiteLink(hwnd);
  83. SetWindowText(GetDlgItem(hwnd, IDC_PRODUCT_ID), GetLicenseServerID());
  84. break;
  85. case PSN_WIZNEXT:
  86. {
  87. // Let us get the Information Entered First & concatenate everything into
  88. // One String
  89. GetDlgItemText(hwnd,IDC_TXT_WWWINFO1, tcUserValue, CHARS_IN_BATCH+1);
  90. GetDlgItemText(hwnd,IDC_TXT_WWWINFO2, tcUserValue+1*CHARS_IN_BATCH, CHARS_IN_BATCH+1);
  91. GetDlgItemText(hwnd,IDC_TXT_WWWINFO3, tcUserValue+2*CHARS_IN_BATCH, CHARS_IN_BATCH+1);
  92. GetDlgItemText(hwnd,IDC_TXT_WWWINFO4, tcUserValue+3*CHARS_IN_BATCH, CHARS_IN_BATCH+1);
  93. GetDlgItemText(hwnd,IDC_TXT_WWWINFO5, tcUserValue+4*CHARS_IN_BATCH, CHARS_IN_BATCH+1);
  94. GetDlgItemText(hwnd,IDC_TXT_WWWINFO6, tcUserValue+5*CHARS_IN_BATCH, CHARS_IN_BATCH+1);
  95. GetDlgItemText(hwnd,IDC_TXT_WWWINFO7, tcUserValue+6*CHARS_IN_BATCH, CHARS_IN_BATCH+1);
  96. // OK, Now we have the Information provided by the user
  97. // Need to validate
  98. if (wcsspn(tcUserValue, BASE24_CHARACTERS) != LR_REGISTRATIONID_LEN)
  99. {
  100. // Extraneous characters in the SPK string
  101. LRMessageBox(hwnd, IDS_ERR_INVALIDLSID,IDS_WIZARD_MESSAGE_TITLE);
  102. dwNextPage = IDD_DLG_WWWREG_REISSUE;
  103. }
  104. else
  105. {
  106. dwRetCode = SetLSSPK(tcUserValue);
  107. if (dwRetCode != ERROR_SUCCESS)
  108. {
  109. LRMessageBox(hwnd, dwRetCode,IDS_WIZARD_MESSAGE_TITLE);
  110. dwNextPage = IDD_DLG_WWWREG_REISSUE;
  111. }
  112. else
  113. {
  114. dwRetCode = ShowProgressBox(hwnd, ProcessThread, 0, 0, 0);
  115. dwNextPage = IDD_PROGRESS;
  116. LRPush(IDD_DLG_WWWREG_REISSUE);
  117. }
  118. }
  119. LRW_SETWINDOWLONG(hwnd, LRW_DWL_MSGRESULT, dwNextPage);
  120. bStatus = -1;
  121. }
  122. break;
  123. case PSN_WIZBACK:
  124. dwNextPage = LRPop();
  125. LRW_SETWINDOWLONG(hwnd, LRW_DWL_MSGRESULT, dwNextPage);
  126. bStatus = -1;
  127. break;
  128. case NM_CHAR:
  129. if( ( ( LPNMCHAR )lParam )->ch != VK_SPACE )
  130. break;
  131. // else fall through
  132. case NM_RETURN:
  133. case NM_CLICK:
  134. {
  135. //A value less than 32 indicates an error launching the process
  136. if ((ShellExecute(NULL, L"open", GetWWWSite(), NULL, NULL, SW_SHOWNORMAL)) <= (HINSTANCE)32)
  137. {
  138. TCHAR lpBuffer[512];
  139. memset(lpBuffer,0,sizeof(lpBuffer));
  140. LoadString(GetInstanceHandle(), IDS_WWW_BROWSER_LAUNCH_ERROR, lpBuffer, sizeof(lpBuffer)/sizeof(TCHAR));
  141. }
  142. break;
  143. }
  144. default:
  145. bStatus = FALSE;
  146. break;
  147. }
  148. }
  149. break;
  150. default:
  151. bStatus = FALSE;
  152. break;
  153. }
  154. return bStatus;
  155. }