Source code of Windows XP (NT5)
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.

118 lines
4.7 KiB

  1. extern "C" {
  2. #include "ntddndis.h"
  3. #include "wzcsapi.h"
  4. }
  5. #pragma once
  6. ////////////////////////////////////////////////////////////////////////
  7. // CWZCConfigPage related stuff
  8. //
  9. // flags used for CWZCConfigProps::m_dwFlags
  10. #define WZCDLG_PROPS_RWALL 0x000000ff // enable all settings for writing
  11. #define WZCDLG_PROPS_RWSSID 0x00000001 // enable SSID for writing
  12. #define WZCDLG_PROPS_RWINFR 0x00000002 // enable Infrastructure Mode for writing
  13. #define WZCDLG_PROPS_RWAUTH 0x00000004 // enable Authentication Mode for writing
  14. #define WZCDLG_PROPS_RWWEP 0x00000010 // enable the WEP entry for selecting
  15. #define WZCDLG_PROPS_ONEX_CHECK 0x00000100 // correlate the 802.1X state with the existence of the key
  16. #define WZCDLG_PROPS_DEFOK 0x00002000 // "OK" = defpushbutton (otherwise, "Cancel"=defpushbutton)
  17. // utility macro to convert a hexa digit into its value
  18. #define HEX(c) ((c)<='9'?(c)-'0':(c)<='F'?(c)-'A'+0xA:(c)-'a'+0xA)
  19. // defines used for the valid WEP Key indices
  20. #define WZC_WEPKIDX_NDIGITS 16 // more than we ever need
  21. #define WZC_WEPKIDX_MIN 1
  22. #define WZC_WEPKIDX_MAX 4
  23. // defines legal lengths for the WEP Key material
  24. #define WZC_WEPKMAT_40_ASC 5
  25. #define WZC_WEPKMAT_40_HEX 10
  26. #define WZC_WEPKMAT_104_ASC 13
  27. #define WZC_WEPKMAT_104_HEX 26
  28. #define WZC_WEPKMAT_128_ASC 16
  29. #define WZC_WEPKMAT_128_HEX 32
  30. class CEapolConfig;
  31. class CWZCConfig;
  32. class CWZCConfigPage:
  33. public CPropSheetPage
  34. {
  35. protected:
  36. BEGIN_MSG_MAP(CWZCConfigPage)
  37. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  38. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
  39. MESSAGE_HANDLER(WM_HELP, OnHelp)
  40. NOTIFY_CODE_HANDLER(PSN_APPLY, OnOK)
  41. COMMAND_ID_HANDLER(IDC_SHAREDMODE, OnUsePW)
  42. COMMAND_ID_HANDLER(IDC_USEPW, OnUsePW)
  43. COMMAND_ID_HANDLER(IDC_USEHARDWAREPW, OnUseHWPassword)
  44. COMMAND_ID_HANDLER(IDC_WZC_EDIT_KMat, OnWepKMatCmd)
  45. COMMAND_ID_HANDLER(IDC_ADHOC, OnCheckEapolAllowed)
  46. END_MSG_MAP()
  47. BOOL m_bKMatTouched; // indicator whether the wep key material has been touched
  48. // handle to the dialog
  49. HWND m_hwndDlg;
  50. // Handles to all the UI controls managed
  51. // by this class (all related to Wireless
  52. // Zero Configuration)
  53. HWND m_hwndEdSSID; // "Service Set Identifier:" edit
  54. HWND m_hwndChkAdhoc; // "Adhoc" vs "Infra" checkbox
  55. HWND m_hwndChkShared; // "Use shared auth mode" checkbox
  56. HWND m_hwndUsePW; // "Use Password" checkbox
  57. // wep key related controls
  58. HWND m_hwndUseHardwarePW; // "Use password from network hardware" check box
  59. HWND m_hwndLblKMat; // "Key material" label
  60. HWND m_hwndLblKMat2; // "Confirm Key material" label
  61. HWND m_hwndEdKMat; // "Key material" edit
  62. HWND m_hwndEdKMat2; // "Confirm Key material" edit
  63. HWND m_hwndLblKIdx; // "Key index" label
  64. HWND m_hwndEdKIdx; // "Key index" edit
  65. // Internal members
  66. DWORD m_dwFlags;
  67. // Pointer to the EAPOL configuration for this network
  68. CEapolConfig *m_pEapolConfig;
  69. // automatically enable/disable state for all the WepK related controls
  70. DWORD EnableWepKControls();
  71. // initializes WEP controls
  72. DWORD InitWepKControls();
  73. // checks the validity of the WEP Key material
  74. DWORD CheckWepKMaterial(LPSTR *ppszKMat, DWORD *pdwKeyFlags);
  75. // parses & copies the WEP Key material from the parameter into the m_wzcConfig object
  76. DWORD CopyWepKMaterial(LPSTR szKMat);
  77. // sets the EAPOL Locked bit
  78. DWORD SetEapolAllowedState();
  79. public:
  80. // wzc configuration settings
  81. WZC_WLAN_CONFIG m_wzcConfig;
  82. // class constructor
  83. CWZCConfigPage(DWORD dwFlags = 0);
  84. // initialize the wzc config data
  85. DWORD UploadWzcConfig(CWZCConfig *pwzcConfig);
  86. // copy a reference to the EAPOL configuration object
  87. DWORD UploadEapolConfig(CEapolConfig *pEapolConfig);
  88. // Sets the dialog flags
  89. DWORD SetFlags(DWORD dwMask, DWORD dwNewFlags);
  90. // Dialog related members
  91. LRESULT OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  92. LRESULT OnOK(UINT idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  93. LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  94. LRESULT OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  95. LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  96. LRESULT OnUsePW(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  97. LRESULT OnUseHWPassword(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  98. LRESULT OnWepKMatCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  99. LRESULT OnCheckEapolAllowed(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  100. };