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.

221 lines
6.1 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. // All rights reserved.
  5. //
  6. // File Name:
  7. // stdalone.c
  8. //
  9. // Description:
  10. // This file contains the dlgproc for the IDD_STANDALONE page. This
  11. // is a simple YES/NO flow page. If user says NO, we skip all of the
  12. // pages that edit a distribution folder.
  13. //
  14. // Note the title of this page is "Distribution Folder", but internally,
  15. // it is IDD_STANDALONE.
  16. //
  17. //----------------------------------------------------------------------------
  18. #include "pch.h"
  19. #include "resource.h"
  20. VOID
  21. OnInitStandAlone(HWND hwnd)
  22. {
  23. TCHAR *pText1, *pText2, *p;
  24. int nBytes, len;
  25. pText1 = MyLoadString(IDS_STANDALONE_TEXT1);
  26. pText2 = MyLoadString(IDS_STANDALONE_TEXT2);
  27. nBytes = ((len=lstrlen(pText1)) + lstrlen(pText2) + 1) * sizeof(TCHAR);
  28. if ( (p = malloc(nBytes)) == NULL )
  29. return;
  30. lstrcpyn(p, pText1, (nBytes/sizeof(TCHAR)));
  31. lstrcpyn(p+len, pText2, ((nBytes/sizeof(TCHAR))-len));
  32. free(pText1);
  33. free(pText2);
  34. SetDlgItemText(hwnd, IDC_TEXT, p);
  35. }
  36. //----------------------------------------------------------------------------
  37. //
  38. // Function: OnSetActiveStandAlone
  39. //
  40. // Purpose: Called at SETACTIVE time. Init controls.
  41. //
  42. //----------------------------------------------------------------------------
  43. VOID OnSetActiveStandAlone(HWND hwnd)
  44. {
  45. int nButtonId = WizGlobals.bStandAloneScript ? IDC_NODISTFOLD
  46. : IDC_DODISTFOLD;
  47. CheckRadioButton(hwnd,
  48. IDC_DODISTFOLD,
  49. IDC_MODDISTFOLD,
  50. nButtonId);
  51. WIZ_BUTTONS(hwnd, PSWIZB_BACK | PSWIZB_NEXT);
  52. }
  53. //----------------------------------------------------------------------------
  54. //
  55. // Function: OnRadioButtonStandAlone
  56. //
  57. // Purpose: Called when one of the radio buttons is pushed.
  58. //
  59. //----------------------------------------------------------------------------
  60. VOID OnRadioButtonStandAlone(HWND hwnd, int nButtonId)
  61. {
  62. CheckRadioButton(hwnd,
  63. IDC_DODISTFOLD,
  64. IDC_MODDISTFOLD,
  65. nButtonId);
  66. }
  67. //----------------------------------------------------------------------------
  68. //
  69. // Function: OnWizNextStandAlone
  70. //
  71. // Purpose: Called when NEXT button is pushed.
  72. //
  73. //----------------------------------------------------------------------------
  74. BOOL OnWizNextStandAlone(HWND hwnd)
  75. {
  76. WizGlobals.bStandAloneScript = IsDlgButtonChecked( hwnd, IDC_NODISTFOLD );
  77. WizGlobals.bCreateNewDistFolder = IsDlgButtonChecked(hwnd, IDC_DODISTFOLD);
  78. //
  79. // Warn the user that if they have already picked files that need a
  80. // distribution folder but then here have chosen not to create a distrib
  81. // folder.
  82. //
  83. if( WizGlobals.bStandAloneScript )
  84. {
  85. INT iCount = GetNameListSize( &GenSettings.LanguageGroups );
  86. if( ( ( GenSettings.IeCustomizeMethod == IE_USE_BRANDING_FILE ) &&
  87. GenSettings.szInsFile[0] != _T('\0') ) ||
  88. ( iCount != 0 ) )
  89. {
  90. INT iRet;
  91. iRet = ReportErrorId( hwnd,
  92. MSGTYPE_YESNO,
  93. IDS_ERR_NEED_DIST_FOLDER_FOR_FILES );
  94. if( iRet == IDNO )
  95. {
  96. return FALSE;
  97. }
  98. }
  99. }
  100. return TRUE;
  101. }
  102. //----------------------------------------------------------------------------
  103. //
  104. // Function: DlgStandAlonePage
  105. //
  106. // Purpose: This is the dialog procedure the IDD_ADVANCED1 page. It simply
  107. // asks if the user wants to deal with advanced features or not.
  108. //
  109. //----------------------------------------------------------------------------
  110. INT_PTR CALLBACK DlgStandAlonePage(
  111. IN HWND hwnd,
  112. IN UINT uMsg,
  113. IN WPARAM wParam,
  114. IN LPARAM lParam)
  115. {
  116. BOOL bStatus = TRUE;
  117. switch (uMsg) {
  118. case WM_INITDIALOG:
  119. OnInitStandAlone(hwnd);
  120. break;
  121. case WM_COMMAND:
  122. {
  123. int nButtonId;
  124. switch ( nButtonId = LOWORD(wParam) ) {
  125. case IDC_DODISTFOLD:
  126. case IDC_MODDISTFOLD:
  127. case IDC_NODISTFOLD:
  128. if ( HIWORD(wParam) == BN_CLICKED )
  129. OnRadioButtonStandAlone(hwnd, LOWORD(wParam));
  130. break;
  131. default:
  132. bStatus = FALSE;
  133. break;
  134. }
  135. }
  136. break;
  137. case WM_NOTIFY:
  138. {
  139. LPNMHDR pnmh = (LPNMHDR)lParam;
  140. switch( pnmh->code ) {
  141. case PSN_QUERYCANCEL:
  142. WIZ_CANCEL(hwnd);
  143. break;
  144. case PSN_SETACTIVE:
  145. g_App.dwCurrentHelp = IDH_DIST_FLDR;
  146. if ( WizGlobals.iProductInstall != PRODUCT_UNATTENDED_INSTALL )
  147. WIZ_SKIP( hwnd );
  148. else
  149. OnSetActiveStandAlone(hwnd);
  150. break;
  151. case PSN_WIZBACK:
  152. bStatus = FALSE;
  153. break;
  154. case PSN_WIZNEXT:
  155. if ( !OnWizNextStandAlone(hwnd) )
  156. WIZ_FAIL(hwnd);
  157. else
  158. bStatus = FALSE;
  159. break;
  160. case PSN_HELP:
  161. WIZ_HELP();
  162. break;
  163. default:
  164. bStatus = FALSE;
  165. break;
  166. }
  167. }
  168. break;
  169. default:
  170. bStatus = FALSE;
  171. break;
  172. }
  173. return bStatus;
  174. }