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.

218 lines
5.5 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. ClassMod.h
  7. This file contains all of the prototypes for the
  8. option class modification dialog.
  9. FILE HISTORY:
  10. */
  11. #if !defined _CLASSMOD_H
  12. #define _CLASSMOD_H
  13. #if _MSC_VER >= 1000
  14. #pragma once
  15. #endif // _MSC_VER >= 1000
  16. #if !defined _CLASSED_H
  17. #include "classed.h"
  18. #endif
  19. #define CLASS_TYPE_VENDOR 0
  20. #define CLASS_TYPE_USER 1
  21. // CWnd based control for hex editor
  22. class CWndHexEdit : public CWnd
  23. {
  24. DECLARE_DYNAMIC(CWndHexEdit)
  25. protected:
  26. static WNDPROC m_wproc_super ;
  27. static BOOL m_b_inited ;
  28. public:
  29. CWndHexEdit () ;
  30. ~ CWndHexEdit () ;
  31. BOOL Create(LPCTSTR lpszText,
  32. DWORD dwStyle,
  33. const RECT& rect,
  34. CWnd* pParentWnd,
  35. UINT nID = 0xffff
  36. );
  37. WNDPROC * GetSuperWndProcAddr() ;
  38. // One-shot initialization
  39. static BOOL CreateWindowClass ( HINSTANCE hInstance );
  40. };
  41. class CClassInfo
  42. {
  43. public:
  44. CClassInfo() {};
  45. CClassInfo(CClassInfo & classInfo)
  46. {
  47. *this = classInfo;
  48. }
  49. CClassInfo & operator = (const CClassInfo & ClassInfo)
  50. {
  51. strName = ClassInfo.strName;
  52. strComment = ClassInfo.strComment;
  53. bIsVendor = ClassInfo.bIsVendor;
  54. baData.RemoveAll();
  55. baData.Copy(ClassInfo.baData);
  56. return *this;
  57. }
  58. BOOL IsDynBootpClass()
  59. {
  60. BOOL fResult = FALSE;
  61. if (baData.GetSize() == (int) strlen(DHCP_BOOTP_CLASS_TXT))
  62. {
  63. // now mem compare
  64. if (memcmp(baData.GetData(), DHCP_BOOTP_CLASS_TXT, (size_t)baData.GetSize()) == 0)
  65. {
  66. // found it!
  67. fResult = TRUE;
  68. }
  69. }
  70. return fResult;
  71. }
  72. BOOL IsRRASClass()
  73. {
  74. BOOL fResult = FALSE;
  75. if (baData.GetSize() == (int) strlen(DHCP_RAS_CLASS_TXT))
  76. {
  77. // now mem compare
  78. if (memcmp(baData.GetData(), DHCP_RAS_CLASS_TXT, (size_t)baData.GetSize()) == 0)
  79. {
  80. // found it!
  81. fResult = TRUE;
  82. }
  83. }
  84. return fResult;
  85. }
  86. BOOL IsSystemClass()
  87. {
  88. BOOL fResult = FALSE;
  89. // check to see if this is one of the default clasess, if so disable
  90. if ( ((size_t) baData.GetSize() == strlen(DHCP_MSFT50_CLASS_TXT)) ||
  91. ((size_t) baData.GetSize() == strlen(DHCP_MSFT98_CLASS_TXT)) ||
  92. ((size_t) baData.GetSize() == strlen(DHCP_MSFT_CLASS_TXT)) )
  93. {
  94. if ( (memcmp(baData.GetData(), DHCP_MSFT50_CLASS_TXT, (size_t)baData.GetSize()) == 0) ||
  95. (memcmp(baData.GetData(), DHCP_MSFT98_CLASS_TXT, (size_t)baData.GetSize()) == 0) ||
  96. (memcmp(baData.GetData(), DHCP_MSFT_CLASS_TXT, (size_t)baData.GetSize()) == 0) )
  97. {
  98. fResult = TRUE;
  99. }
  100. }
  101. return fResult;
  102. }
  103. public:
  104. CString strName;
  105. CString strComment;
  106. BOOL bIsVendor;
  107. CByteArray baData;
  108. };
  109. typedef CArray<CClassInfo, CClassInfo&> CClassInfoArrayBase;
  110. class CClassInfoArray : public CClassInfoArrayBase
  111. {
  112. public:
  113. CClassInfoArray();
  114. ~CClassInfoArray();
  115. DWORD RefreshData(LPCTSTR pServer);
  116. BOOL RemoveClass(LPCTSTR pClassName);
  117. DWORD ModifyClass(LPCTSTR pServer, CClassInfo & ClassInfo);
  118. DWORD AddClass(LPCTSTR pServer, CClassInfo & ClassInfo);
  119. BOOL IsValidClass(LPCTSTR pClassName);
  120. };
  121. /////////////////////////////////////////////////////////////////////////////
  122. // CDhcpModifyClass dialog
  123. class CDhcpModifyClass : public CBaseDialog
  124. {
  125. // Construction
  126. public:
  127. CDhcpModifyClass(CClassInfoArray * pClassArray, LPCTSTR pszServer, BOOL bCreate, DWORD dwType, CWnd* pParent = NULL); // standard constructor
  128. // Dialog Data
  129. //{{AFX_DATA(CDhcpModifyClass)
  130. enum { IDD = IDD_CLASSID_NEW };
  131. // NOTE: the ClassWizard will add data members here
  132. //}}AFX_DATA
  133. CWndHexEdit m_hexData; // Hex Data
  134. virtual DWORD * GetHelpMap() { return DhcpGetHelpMap(CDhcpModifyClass::IDD); }
  135. // Overrides
  136. // ClassWizard generated virtual function overrides
  137. //{{AFX_VIRTUAL(CDhcpModifyClass)
  138. protected:
  139. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  140. //}}AFX_VIRTUAL
  141. // Implementation
  142. protected:
  143. // Generated message map functions
  144. //{{AFX_MSG(CDhcpModifyClass)
  145. virtual BOOL OnInitDialog();
  146. afx_msg void OnChangeValuename();
  147. afx_msg void OnChangeValuecomment();
  148. virtual void OnOK();
  149. //}}AFX_MSG
  150. DECLARE_MESSAGE_MAP()
  151. afx_msg void OnChangeValueData();
  152. void SetDirty(BOOL bDirty) { m_bDirty = bDirty; }
  153. public:
  154. EDITVALUEPARAM m_EditValueParam;
  155. protected:
  156. HEXEDITDATA * m_pHexEditData;
  157. CString m_strName;
  158. CString m_strComment;
  159. BYTE m_buffer[MAXDATA_LENGTH];
  160. DWORD m_dwType;
  161. CClassInfoArray * m_pClassInfoArray;
  162. CString m_strServer;
  163. BOOL m_bDirty;
  164. BOOL m_bCreate; // are we creating or modifing a class
  165. };
  166. //{{AFX_INSERT_LOCATION}}
  167. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  168. #endif // !defined(AFX_CLASSMOD_H__3995264F_96A1_11D1_93E0_00C04FC3357A__INCLUDED_)