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.

295 lines
10 KiB

  1. // webadvp1.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ISAdmin.h"
  5. #include "webadvp1.h"
  6. #ifdef _DEBUG
  7. #undef THIS_FILE
  8. static char BASED_CODE THIS_FILE[] = __FILE__;
  9. #endif
  10. /////////////////////////////////////////////////////////////////////////////
  11. // CWEBADVP1 dialog
  12. IMPLEMENT_DYNCREATE(CWEBADVP1, CGenPage)
  13. CWEBADVP1::CWEBADVP1() : CGenPage(CWEBADVP1::IDD)
  14. {
  15. //{{AFX_DATA_INIT(CWEBADVP1)
  16. m_strServerSideIncludesExtension = _T("");
  17. //}}AFX_DATA_INIT
  18. }
  19. CWEBADVP1::~CWEBADVP1()
  20. {
  21. }
  22. void CWEBADVP1::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CGenPage::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CWEBADVP1)
  26. DDX_Control(pDX, IDC_SERVERSIDEINCLUDESEXTENSIONDATA1, m_editServerSideIncludesExtension);
  27. DDX_Control(pDX, IDC_SERVERSIDEINCLUDESENABLEDDATA1, m_cboxServerSideIncludesEnabled);
  28. DDX_Control(pDX, IDC_ENABLEGLOBALEXPIREDATA1, m_cboxEnableGlobalExpire);
  29. DDX_Control(pDX, IDC_GLOBALEXPIREDATA1, m_editGlobalExpire);
  30. DDX_Control(pDX, IDC_GLOBALEXPIRESPIN1, m_spinGlobalExpire);
  31. DDX_Control(pDX, IDC_CACHEEXTENSIONSDATA1, m_cboxCacheExtensions);
  32. DDX_Control(pDX, IDC_SCRIPTTIMEOUTSPIN1, m_spinScriptTimeout);
  33. DDX_Control(pDX, IDC_WEBDBGFLAGSDATA1, m_editWebDbgFlags);
  34. DDX_TexttoHex(pDX, IDC_WEBDBGFLAGSDATA1, m_ulWebDbgFlags);
  35. DDX_Text(pDX, IDC_SERVERSIDEINCLUDESEXTENSIONDATA1, m_strServerSideIncludesExtension);
  36. DDV_MaxChars(pDX, m_strServerSideIncludesExtension, 256);
  37. //}}AFX_DATA_MAP
  38. }
  39. BEGIN_MESSAGE_MAP(CWEBADVP1, CGenPage)
  40. //{{AFX_MSG_MAP(CWEBADVP1)
  41. ON_EN_CHANGE(IDC_WEBDBGFLAGSDATA1, OnChangeWebdbgflagsdata1)
  42. ON_EN_CHANGE(IDC_SCRIPTTIMEOUTDATA1, OnChangeScripttimeoutdata1)
  43. ON_BN_CLICKED(IDC_CACHEEXTENSIONSDATA1, OnCacheextensionsdata1)
  44. ON_EN_CHANGE(IDC_GLOBALEXPIREDATA1, OnChangeGlobalexpiredata1)
  45. ON_BN_CLICKED(IDC_ENABLEGLOBALEXPIREDATA1, OnEnableglobalexpiredata1)
  46. ON_EN_CHANGE(IDC_SERVERSIDEINCLUDESEXTENSIONDATA1, OnChangeServersideincludesextensiondata1)
  47. ON_BN_CLICKED(IDC_SERVERSIDEINCLUDESENABLEDDATA1, OnServersideincludesenableddata1)
  48. //}}AFX_MSG_MAP
  49. END_MESSAGE_MAP()
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CWEBADVP1 message handlers
  52. BOOL CWEBADVP1::OnInitDialog()
  53. {
  54. int i;
  55. CGenPage::OnInitDialog();
  56. // TODO: Add extra initialization here
  57. for (i = 0; i < AdvWebPage_TotalNumRegEntries; i++) {
  58. m_binNumericRegistryEntries[i].bIsChanged = FALSE;
  59. m_binNumericRegistryEntries[i].ulMultipleFactor = 1;
  60. }
  61. for (i = 0; i < AdvWebPage_TotalStringRegEntries; i++) {
  62. m_binStringRegistryEntries[i].bIsChanged = FALSE;
  63. }
  64. m_binNumericRegistryEntries[AdvWebPage_DebugFlags].strFieldName = _T(DEBUGFLAGSNAME);
  65. m_binNumericRegistryEntries[AdvWebPage_DebugFlags].ulDefaultValue = DEFAULTDEBUGFLAGS;
  66. m_binNumericRegistryEntries[AdvWebPage_ScriptTimeout].strFieldName = _T(SCRIPTTIMEOUTNAME);
  67. m_binNumericRegistryEntries[AdvWebPage_ScriptTimeout].ulMultipleFactor = 60;
  68. m_binNumericRegistryEntries[AdvWebPage_ScriptTimeout].ulDefaultValue = DEFAULTSCRIPTTIMEOUT;
  69. m_binNumericRegistryEntries[AdvWebPage_CacheExtensions].strFieldName = _T(CACHEEXTENSIONSNAME);
  70. m_binNumericRegistryEntries[AdvWebPage_CacheExtensions].ulDefaultValue = DEFAULTCACHEEXTENSIONS;
  71. m_binNumericRegistryEntries[AdvWebPage_ServerSideIncludesEnabled].strFieldName = _T(SERVERSIDEINCLUDESENABLEDNAME);
  72. m_binNumericRegistryEntries[AdvWebPage_ServerSideIncludesEnabled].ulDefaultValue = DEFAULTSERVERSIDEINCLUDESENABLED;
  73. m_binNumericRegistryEntries[AdvWebPage_GlobalExpire].strFieldName = _T(GLOBALEXPIRENAME);
  74. m_binNumericRegistryEntries[AdvWebPage_GlobalExpire].ulDefaultValue = DEFAULTGLOBALEXPIRE;
  75. m_binNumericRegistryEntries[AdvWebPage_GlobalExpire].ulMultipleFactor = 60;
  76. m_binStringRegistryEntries[AdvWebPage_ServerSideIncludesExtension].strFieldName = _T(SERVERSIDEINCLUDESEXTENSIONNAME);
  77. m_binStringRegistryEntries[AdvWebPage_ServerSideIncludesExtension].strFieldValue = _T(DEFAULTSERVERSIDEINCLUDESEXTENSION);
  78. for (i = 0; i < AdvWebPage_TotalNumRegEntries; i++) {
  79. if (m_rkMainKey->QueryValue(m_binNumericRegistryEntries[i].strFieldName,
  80. m_binNumericRegistryEntries[i].ulFieldValue) != ERROR_SUCCESS) {
  81. m_binNumericRegistryEntries[i].ulFieldValue = m_binNumericRegistryEntries[i].ulDefaultValue;
  82. }
  83. }
  84. for (i = 0; i < AdvWebPage_TotalStringRegEntries; i++) {
  85. m_rkMainKey->QueryValue(m_binStringRegistryEntries[i].strFieldName,
  86. m_binStringRegistryEntries[i].strFieldValue);
  87. }
  88. m_spinScriptTimeout.SetRange(MINSCRIPTTIMEOUT, MAXSCRIPTTIMEOUT);
  89. m_spinScriptTimeout.SetPos(LESSOROF((m_binNumericRegistryEntries[AdvWebPage_ScriptTimeout].ulFieldValue /
  90. m_binNumericRegistryEntries[AdvWebPage_ScriptTimeout].ulMultipleFactor), MAXSCRIPTTIMEOUT));
  91. m_cboxCacheExtensions.SetCheck(GETCHECKBOXVALUEFROMREG(m_binNumericRegistryEntries[AdvWebPage_CacheExtensions].ulFieldValue));
  92. m_strServerSideIncludesExtension = m_binStringRegistryEntries[AdvWebPage_ServerSideIncludesExtension].strFieldValue;
  93. m_cboxServerSideIncludesEnabled.SetCheck(GETCHECKBOXVALUEFROMREG(m_binNumericRegistryEntries[AdvWebPage_ServerSideIncludesEnabled].ulFieldValue));
  94. SetServerSideIncludesEnabledState();
  95. m_spinGlobalExpire.SetRange(MINGLOBALEXPIRE, MAXGLOBALEXPIRE);
  96. if (m_binNumericRegistryEntries[AdvWebPage_GlobalExpire].ulFieldValue != 0xffffffff) {
  97. m_spinGlobalExpire.SetPos(LESSOROF ((m_binNumericRegistryEntries[AdvWebPage_GlobalExpire].ulFieldValue /
  98. m_binNumericRegistryEntries[AdvWebPage_GlobalExpire].ulMultipleFactor),MAXGLOBALEXPIRE));
  99. SetGlobalExpireEnabledState(TRUE);
  100. }
  101. else {
  102. m_spinGlobalExpire.SetPos(LESSOROF((m_binNumericRegistryEntries[AdvWebPage_GlobalExpire].ulDefaultValue /
  103. m_binNumericRegistryEntries[AdvWebPage_GlobalExpire].ulMultipleFactor),MAXGLOBALEXPIRE));
  104. SetGlobalExpireEnabledState(FALSE);
  105. }
  106. m_editWebDbgFlags.LimitText(8);
  107. m_ulWebDbgFlags = m_binNumericRegistryEntries[AdvWebPage_DebugFlags].ulFieldValue;
  108. UpdateData(FALSE); // Force Edit box(es) to pick up value(s)
  109. m_bSetChanged = TRUE; // Any more changes come from the user
  110. return TRUE; // return TRUE unless you set the focus to a control
  111. // EXCEPTION: OCX Property Pages should return FALSE
  112. }
  113. void CWEBADVP1::OnChangeWebdbgflagsdata1()
  114. {
  115. // TODO: Add your control notification handler code here
  116. if (m_bSetChanged) {
  117. m_binNumericRegistryEntries[AdvWebPage_DebugFlags].bIsChanged = TRUE;
  118. m_bIsDirty = TRUE;
  119. SetModified(TRUE);
  120. }
  121. }
  122. void CWEBADVP1::OnChangeScripttimeoutdata1()
  123. {
  124. // TODO: Add your control notification handler code here
  125. if (m_bSetChanged) {
  126. m_binNumericRegistryEntries[AdvWebPage_ScriptTimeout].bIsChanged = TRUE;
  127. m_binNumericRegistryEntries[AdvWebPage_ScriptTimeout].ulFieldValue = m_spinScriptTimeout.GetPos() *
  128. m_binNumericRegistryEntries[AdvWebPage_ScriptTimeout].ulMultipleFactor;
  129. m_bIsDirty = TRUE;
  130. SetModified(TRUE);
  131. }
  132. }
  133. void CWEBADVP1::OnCacheextensionsdata1()
  134. {
  135. // TODO: Add your control notification handler code here
  136. if (m_bSetChanged) {
  137. m_binNumericRegistryEntries[AdvWebPage_CacheExtensions].bIsChanged = TRUE;
  138. m_binNumericRegistryEntries[AdvWebPage_CacheExtensions].ulFieldValue =
  139. GETREGVALUEFROMCHECKBOX(m_cboxCacheExtensions.GetCheck());
  140. m_bIsDirty = TRUE;
  141. SetModified(TRUE);
  142. }
  143. }
  144. void CWEBADVP1::OnServersideincludesenableddata1()
  145. {
  146. // TODO: Add your control notification handler code here
  147. SetServerSideIncludesEnabledState();
  148. if (m_bSetChanged) {
  149. m_binNumericRegistryEntries[AdvWebPage_ServerSideIncludesEnabled].bIsChanged = TRUE;
  150. m_binNumericRegistryEntries[AdvWebPage_ServerSideIncludesEnabled].ulFieldValue =
  151. GETREGVALUEFROMCHECKBOX(m_cboxServerSideIncludesEnabled.GetCheck());
  152. m_bIsDirty = TRUE;
  153. SetModified(TRUE);
  154. }
  155. }
  156. void CWEBADVP1::OnChangeServersideincludesextensiondata1()
  157. {
  158. // TODO: Add your control notification handler code here
  159. if (m_bSetChanged) {
  160. m_binStringRegistryEntries[AdvWebPage_ServerSideIncludesExtension].bIsChanged = TRUE;
  161. m_bIsDirty = TRUE;
  162. SetModified(TRUE);
  163. }
  164. }
  165. void CWEBADVP1::OnEnableglobalexpiredata1()
  166. {
  167. // TODO: Add your control notification handler code here
  168. SetGlobalExpireEnabledState(m_cboxEnableGlobalExpire.GetCheck());
  169. if (m_bSetChanged) {
  170. m_binNumericRegistryEntries[AdvWebPage_GlobalExpire].bIsChanged = TRUE;
  171. m_bIsDirty = TRUE;
  172. SetModified(TRUE);
  173. }
  174. }
  175. void CWEBADVP1::OnChangeGlobalexpiredata1()
  176. {
  177. // TODO: Add your control notification handler code here
  178. if (m_bSetChanged) {
  179. m_binNumericRegistryEntries[AdvWebPage_GlobalExpire].bIsChanged = TRUE;
  180. m_binNumericRegistryEntries[AdvWebPage_GlobalExpire].ulFieldValue = m_spinGlobalExpire.GetPos()
  181. * m_binNumericRegistryEntries[AdvWebPage_GlobalExpire].ulMultipleFactor;
  182. m_bIsDirty = TRUE;
  183. SetModified(TRUE);
  184. }
  185. }
  186. void CWEBADVP1::SaveInfo()
  187. {
  188. if (m_bIsDirty) {
  189. m_binNumericRegistryEntries[AdvWebPage_DebugFlags].ulFieldValue = m_ulWebDbgFlags;
  190. m_binStringRegistryEntries[AdvWebPage_ServerSideIncludesExtension].strFieldValue = m_strServerSideIncludesExtension;
  191. SaveNumericInfo(m_binNumericRegistryEntries, AdvWebPage_TotalNumRegEntries);
  192. SaveStringInfo(m_binStringRegistryEntries, AdvWebPage_TotalStringRegEntries);
  193. }
  194. CGenPage::SaveInfo();
  195. }
  196. void CWEBADVP1::SetGlobalExpireEnabledState(BOOL bEnabled)
  197. {
  198. if (bEnabled) {
  199. m_binNumericRegistryEntries[AdvWebPage_GlobalExpire].ulFieldValue =
  200. m_spinGlobalExpire.GetPos() *
  201. m_binNumericRegistryEntries[AdvWebPage_GlobalExpire].ulMultipleFactor;
  202. m_cboxEnableGlobalExpire.SetCheck(CHECKEDVALUE);
  203. m_spinGlobalExpire.EnableWindow(TRUE);
  204. m_editGlobalExpire.EnableWindow(TRUE);
  205. }
  206. else {
  207. m_binNumericRegistryEntries[AdvWebPage_GlobalExpire].ulFieldValue = 0xffffffff;
  208. m_cboxEnableGlobalExpire.SetCheck(UNCHECKEDVALUE);
  209. m_spinGlobalExpire.EnableWindow(FALSE);
  210. m_editGlobalExpire.EnableWindow(FALSE);
  211. }
  212. }
  213. void CWEBADVP1::SetServerSideIncludesEnabledState()
  214. {
  215. if (m_cboxServerSideIncludesEnabled.GetCheck() != 0) {
  216. m_editServerSideIncludesExtension.EnableWindow(TRUE);
  217. if (m_bSetChanged) { //if user enabled this, make sure there's a value there
  218. m_binStringRegistryEntries[AdvWebPage_ServerSideIncludesExtension].bIsChanged = TRUE;
  219. } // Don't need to set bIsDirty, as get's set anyway
  220. }
  221. else {
  222. m_editServerSideIncludesExtension.EnableWindow(FALSE);
  223. }
  224. }