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.

180 lines
6.0 KiB

  1. //*********************************************************************
  2. //* Microsoft Windows **
  3. //* Copyright(c) Microsoft Corp., 1994 **
  4. //*********************************************************************
  5. //
  6. // BRANDED.C - Functions for OEM/ISP branded first Wizard pages
  7. //
  8. // HISTORY:
  9. //
  10. //
  11. //*********************************************************************
  12. #include "pre.h"
  13. #include "icwextsn.h"
  14. #include "webvwids.h" // Needed to create an instance of the ICW WebView object
  15. extern UINT GetDlgIDFromIndex(UINT uPageIndex);
  16. // This function is in intro.cpp
  17. BOOL WINAPI ConfigureSystem(HWND hDlg);
  18. /*******************************************************************
  19. NAME: BrandedIntroInitProc
  20. SYNOPSIS: Called when "Intro" page is displayed
  21. ENTRY: hDlg - dialog window
  22. fFirstInit - TRUE if this is the first time the dialog
  23. is initialized, FALSE if this InitProc has been called
  24. before (e.g. went past this page and backed up)
  25. ********************************************************************/
  26. BOOL CALLBACK BrandedIntroInitProc
  27. (
  28. HWND hDlg,
  29. BOOL fFirstInit,
  30. UINT *puNextPage
  31. )
  32. {
  33. // This is the very first page, so no back is needed
  34. PropSheet_SetWizButtons(GetParent(hDlg),PSWIZB_NEXT);
  35. if (!fFirstInit)
  36. {
  37. // if we've travelled through external apprentice pages,
  38. // it's easy for our current page pointer to get munged,
  39. // so reset it here for sanity's sake.
  40. gpWizardState->uCurrentPage = ORD_PAGE_BRANDEDINTRO;
  41. }
  42. return TRUE;
  43. }
  44. BOOL CALLBACK BrandedIntroPostInitProc
  45. (
  46. HWND hDlg,
  47. BOOL fFirstInit,
  48. UINT *puNextPage
  49. )
  50. {
  51. BOOL bRet = TRUE;
  52. if (fFirstInit)
  53. {
  54. BOOL bFail = FALSE;
  55. // For the window to paint itself
  56. UpdateWindow(GetParent(hDlg));
  57. // Co-Create the browser object
  58. if (FAILED(CoCreateInstance(CLSID_ICWWEBVIEW,
  59. NULL,
  60. CLSCTX_INPROC_SERVER,
  61. IID_IICWWebView,
  62. (LPVOID *)&gpWizardState->pICWWebView)))
  63. {
  64. bFail = TRUE;
  65. }
  66. // Co-Create the browser object
  67. if(FAILED(CoCreateInstance(CLSID_ICWWALKER,
  68. NULL,
  69. CLSCTX_INPROC_SERVER,
  70. IID_IICWWalker,
  71. (LPVOID *)&gpWizardState->pHTMLWalker)))
  72. {
  73. bFail = TRUE;
  74. }
  75. if (bFail)
  76. {
  77. MsgBox(NULL,IDS_LOADLIB_FAIL,MB_ICONEXCLAMATION,MB_OK);
  78. bRet = FALSE;
  79. gfQuitWizard = TRUE; // Quit the wizard
  80. }
  81. }
  82. else
  83. {
  84. TCHAR szURL[INTERNET_MAX_URL_LENGTH];
  85. ASSERT(gpWizardState->pICWWebView);
  86. gpWizardState->pICWWebView->ConnectToWindow(GetDlgItem(hDlg, IDC_BRANDEDWEBVIEW), PAGETYPE_BRANDED);
  87. // Form the URL
  88. wsprintf (szURL, TEXT("FILE://%s"), g_szBrandedHTML);
  89. gpWizardState->pICWWebView->DisplayHTML(szURL);
  90. PropSheet_SetWizButtons(GetParent(hDlg),PSWIZB_NEXT);
  91. }
  92. return bRet;
  93. }
  94. BOOL CALLBACK BrandedIntroOKProc
  95. (
  96. HWND hDlg,
  97. BOOL fForward,
  98. UINT *puNextPage,
  99. BOOL *pfKeepHistory
  100. )
  101. {
  102. ASSERT(puNextPage);
  103. if (fForward)
  104. {
  105. //Are we in some special branding mode?
  106. if(gpWizardState->cmnStateData.dwFlags & ICW_CFGFLAG_IEAKMODE)
  107. {
  108. TCHAR szTemp[MAX_PATH] = TEXT("\0");
  109. IWebBrowser2* pIWebBrowser2 = NULL;
  110. gpWizardState->pICWWebView->get_BrowserObject(&pIWebBrowser2);
  111. ASSERT(pIWebBrowser2);
  112. gpWizardState->pHTMLWalker->AttachToDocument(pIWebBrowser2);
  113. gpWizardState->pHTMLWalker->get_IeakIspFile(szTemp);
  114. if(lstrlen(szTemp) != 0)
  115. {
  116. TCHAR szDrive [_MAX_DRIVE] = TEXT("\0");
  117. TCHAR szDir [_MAX_DIR] = TEXT("\0");
  118. _tsplitpath(gpWizardState->cmnStateData.ispInfo.szISPFile, szDrive, szDir, NULL, NULL);
  119. _tmakepath (gpWizardState->cmnStateData.ispInfo.szISPFile, szDrive, szDir, szTemp, NULL);
  120. }
  121. //OK make sure we don't try and download something, JIC.
  122. gpWizardState->bDoneRefServDownload = TRUE;
  123. gpWizardState->bDoneRefServRAS = TRUE;
  124. gpWizardState->bStartRefServDownload = TRUE;
  125. // BUGBUG, need to set a legit last page, maybe!
  126. if (LoadICWCONNUI(GetParent(hDlg),
  127. GetDlgIDFromIndex(ORD_PAGE_BRANDEDINTRO),
  128. gpWizardState->cmnStateData.bOEMCustom ? IDD_PAGE_ENDOEMCUSTOM : IDD_PAGE_END,
  129. gpWizardState->cmnStateData.dwFlags))
  130. {
  131. if( DialogIDAlreadyInUse( g_uICWCONNUIFirst) )
  132. {
  133. // we're about to jump into the external apprentice, and we don't want
  134. // this page to show up in our history list, infact, we need to back
  135. // the history up 1, because we are going to come back here directly
  136. // from the DLL, not from the history list.
  137. *pfKeepHistory = FALSE;
  138. *puNextPage = g_uICWCONNUIFirst;
  139. // Backup 1 in the history list, since we the external pages navigate back
  140. // here, we want this history list to be in the correct spot
  141. gpWizardState->uPagesCompleted --;
  142. }
  143. }
  144. }
  145. }
  146. return TRUE;
  147. }