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.

172 lines
5.7 KiB

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