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.

306 lines
6.7 KiB

  1. // formvw1.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "afxcmn.h"
  5. #include "ISAdmin.h"
  6. #include "formvw1.h"
  7. #include "mimemap1.h"
  8. #include "scrmap1.h"
  9. #include "ssl1.h"
  10. #include "gensheet.h"
  11. #include "compage1.h"
  12. #include "advcom1.h"
  13. #include "ftpgenp1.h"
  14. #include "ftpadvp1.h"
  15. #include "gopgenp1.h"
  16. #include "gopadvp1.h"
  17. #include "webgenp1.h"
  18. #include "webadvp1.h"
  19. #ifdef _DEBUG
  20. #undef THIS_FILE
  21. static char BASED_CODE THIS_FILE[] = __FILE__;
  22. #endif
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CFormVw1
  25. IMPLEMENT_DYNCREATE(CFormVw1, CFormView)
  26. CFormVw1::CFormVw1()
  27. : CFormView(CFormVw1::IDD)
  28. {
  29. TCHAR strTempComputerName[MAX_COMPUTERNAME_LENGTH + 1];
  30. DWORD ulTempComputerNameLen = MAX_COMPUTERNAME_LENGTH + 1;
  31. if (GetComputerName(strTempComputerName, &ulTempComputerNameLen))
  32. m_strMachineNameData1 = strTempComputerName;
  33. else
  34. m_strMachineNameData1 = (TCHAR *) NULL;
  35. m_buttonFTPSettings.LoadBitmaps(IDB_FTPUPBITMAP, IDB_FTPDOWNBITMAP);
  36. m_buttonGopherSettings.LoadBitmaps(IDB_GOPHERUPBITMAP,IDB_GOPHERDOWNBITMAP);
  37. m_buttonWebSettings.LoadBitmaps(IDB_WEBUPBITMAP,IDB_WEBDOWNBITMAP);
  38. #if 0
  39. //{{AFX_DATA_INIT(CFormVw1)
  40. m_strMachineNameData1 = _T("");
  41. //}}AFX_DATA_INIT
  42. #endif
  43. }
  44. CFormVw1::~CFormVw1()
  45. {
  46. }
  47. void CFormVw1::DoDataExchange(CDataExchange* pDX)
  48. {
  49. CFormView::DoDataExchange(pDX);
  50. //{{AFX_DATA_MAP(CFormVw1)
  51. DDX_Control(pDX, IDC_WWWSET4, m_buttonWebSettings);
  52. DDX_Control(pDX, IDC_GOPHSET1, m_buttonGopherSettings);
  53. DDX_Control(pDX, IDC_FTPSET1, m_buttonFTPSettings);
  54. DDX_Text(pDX, IDC_MACHINENAMEDATA1, m_strMachineNameData1);
  55. DDV_MaxChars(pDX, m_strMachineNameData1, 256);
  56. //}}AFX_DATA_MAP
  57. }
  58. BEGIN_MESSAGE_MAP(CFormVw1, CFormView)
  59. //{{AFX_MSG_MAP(CFormVw1)
  60. ON_BN_CLICKED(IDC_WWWSET4, OnWwwset4)
  61. ON_BN_CLICKED(IDC_COMSET1, OnComset1)
  62. ON_BN_CLICKED(IDC_FTPSET1, OnFtpset1)
  63. ON_BN_CLICKED(IDC_GOPHSET1, OnGophset1)
  64. ON_WM_CTLCOLOR()
  65. //}}AFX_MSG_MAP
  66. END_MESSAGE_MAP()
  67. /////////////////////////////////////////////////////////////////////////////
  68. // CFormVw1 diagnostics
  69. #ifdef _DEBUG
  70. void CFormVw1::AssertValid() const
  71. {
  72. CFormView::AssertValid();
  73. }
  74. void CFormVw1::Dump(CDumpContext& dc) const
  75. {
  76. CFormView::Dump(dc);
  77. }
  78. #endif //_DEBUG
  79. /////////////////////////////////////////////////////////////////////////////
  80. // CFormVw1 message handlers
  81. void CFormVw1::OnWwwset4()
  82. {
  83. // TODO: Add your control notification handler code here
  84. UpdateData(TRUE);
  85. CRegKey rkWebSet(HKEY_LOCAL_MACHINE, _T(WEB_REGISTRY_MAINKEY),
  86. REGISTRY_ACCESS_RIGHTS, m_strMachineNameData1);
  87. if (rkWebSet != NULL) {
  88. CGENSHEET s(_T("Web Settings"));
  89. CWEBGENP1 WebPage;
  90. WebPage.m_rkMainKey = &rkWebSet;
  91. s.AddPage(&WebPage);
  92. ScrMap1 ScriptPage;
  93. ScriptPage.m_rkMainKey = &rkWebSet;
  94. s.AddPage(&ScriptPage);
  95. SSL1 SSLPage;
  96. SSLPage.m_rkMainKey = &rkWebSet;
  97. s.AddPage(&SSLPage);
  98. CWEBADVP1 WebAdvPage;
  99. WebAdvPage.m_rkMainKey = &rkWebSet;
  100. s.AddPage(&WebAdvPage);
  101. if (s.DoModal() == IDOK)
  102. s.SavePageData();
  103. }
  104. else {
  105. CString strWebErrMsg(_T(""));
  106. AfxFormatString1(strWebErrMsg, IDS_WEBOPENREGERRMSG1, m_strMachineNameData1);
  107. AfxMessageBox(strWebErrMsg);
  108. }
  109. }
  110. void CFormVw1::OnComset1()
  111. {
  112. // TODO: Add your control notification handler code here
  113. UpdateData(TRUE);
  114. CRegKey rkComSet(HKEY_LOCAL_MACHINE, _T(COMMON_REGISTRY_MAINKEY),
  115. REGISTRY_ACCESS_RIGHTS, m_strMachineNameData1);
  116. if (rkComSet != NULL) {
  117. CGENSHEET s(_T("Common Settings"));
  118. CCOMPAGE1 ComPage;
  119. ComPage.m_rkMainKey = &rkComSet;
  120. s.AddPage(&ComPage);
  121. // CRegKey rkMimeKey(rkComSet,_T("MimeMap"),REGISTRY_ACCESS_RIGHTS);
  122. // if (rkMimeKey != NULL) {
  123. MIMEMAP1 MimePage;
  124. // MimePage.m_rkMimeKey = &rkMimeKey;
  125. MimePage.m_rkMainKey = &rkComSet;
  126. s.AddPage(&MimePage);
  127. // }
  128. CADVCOM1 ComAdvPage;
  129. ComAdvPage.m_rkMainKey = &rkComSet;
  130. s.AddPage(&ComAdvPage);
  131. if (s.DoModal() == IDOK)
  132. s.SavePageData();
  133. }
  134. else {
  135. CString strComErrMsg(_T(""));
  136. AfxFormatString1(strComErrMsg, IDS_COMOPENREGERRMSG1, m_strMachineNameData1);
  137. AfxMessageBox(strComErrMsg);
  138. }
  139. }
  140. void CFormVw1::OnFtpset1()
  141. {
  142. // TODO: Add your control notification handler code here
  143. UpdateData(TRUE);
  144. CRegKey rkFtpSet(HKEY_LOCAL_MACHINE, _T(FTP_REGISTRY_MAINKEY),
  145. REGISTRY_ACCESS_RIGHTS, m_strMachineNameData1);
  146. if (rkFtpSet != NULL) {
  147. CGENSHEET s(_T("FTP Settings"));
  148. CFTPGENP1 FTPPage;
  149. FTPPage.m_rkMainKey = &rkFtpSet;
  150. s.AddPage(&FTPPage);
  151. CFTPADVP1 FTPAdvPage;
  152. FTPAdvPage.m_rkMainKey = &rkFtpSet;
  153. s.AddPage(&FTPAdvPage);
  154. if (s.DoModal() == IDOK)
  155. s.SavePageData();
  156. }
  157. else {
  158. CString strWebErrMsg(_T(""));
  159. AfxFormatString1(strWebErrMsg, IDS_FTPOPENREGERRMSG1, m_strMachineNameData1);
  160. AfxMessageBox(strWebErrMsg);
  161. }
  162. }
  163. void CFormVw1::OnGophset1()
  164. {
  165. // TODO: Add your control notification handler code here
  166. UpdateData(TRUE);
  167. CRegKey rkGopSet(HKEY_LOCAL_MACHINE, _T(GOPHER_REGISTRY_MAINKEY),
  168. REGISTRY_ACCESS_RIGHTS, m_strMachineNameData1);
  169. if (rkGopSet != NULL) {
  170. CGENSHEET s(_T("Gopher Settings"));
  171. CGOPGENP1 GopherPage;
  172. GopherPage.m_rkMainKey = &rkGopSet;
  173. s.AddPage(&GopherPage);
  174. CGOPADVP1 GopherAdvPage;
  175. GopherAdvPage.m_rkMainKey = &rkGopSet;
  176. s.AddPage(&GopherAdvPage);
  177. if (s.DoModal() == IDOK)
  178. s.SavePageData();
  179. }
  180. else {
  181. CString strGopErrMsg(_T(""));
  182. AfxFormatString1(strGopErrMsg, IDS_GOPOPENREGERRMSG1, m_strMachineNameData1);
  183. AfxMessageBox(strGopErrMsg);
  184. }
  185. }
  186. HBRUSH CFormVw1::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  187. {
  188. /* if (pWnd->GetDlgCtrlID() == IDC_FTPSET1) {
  189. pDC->SetBkColor(RGB(255,255,255));
  190. return((HBRUSH)::GetStockObject(WHITE_BRUSH));
  191. }
  192. */
  193. if (nCtlColor == CTLCOLOR_STATIC) {
  194. if (pWnd->GetDlgCtrlID() == IDC_MAINGROUP) {
  195. pDC->SetBkColor(RGB(255,255,255));
  196. return((HBRUSH)::GetStockObject(WHITE_BRUSH));
  197. }
  198. }
  199. else if (nCtlColor == CTLCOLOR_BTN) {
  200. int iTempDlgCtrlID = pWnd->GetDlgCtrlID();
  201. if ((iTempDlgCtrlID == IDC_FTPSET1) || (iTempDlgCtrlID == IDC_GOPHSET1)
  202. || (iTempDlgCtrlID == IDC_WWWSET4)) {
  203. pDC->SetBkColor(RGB(255,255,255));
  204. return((HBRUSH)::GetStockObject(WHITE_BRUSH));
  205. }
  206. }
  207. HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);
  208. // TODO: Change any attributes of the DC here
  209. // TODO: Return a different brush if the default is not desired
  210. return hbr;
  211. }
  212.