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.

111 lines
4.6 KiB

  1. #include "resource.h"
  2. #include "wzcdata.h"
  3. #pragma once
  4. // utility macro to convert a hexa digit into its value
  5. #define HEX(c) ((c)<='9'?(c)-'0':(c)<='F'?(c)-'A'+0xA:(c)-'a'+0xA)
  6. // flags indicating various operational actions.
  7. // flags are used in:
  8. // AddUniqueConfig()
  9. #define WZCADD_HIGROUP 0x00000001 // add in front of its group
  10. #define WZCADD_OVERWRITE 0x00000002 // overwrite data
  11. #define WZCOP_VLIST 0x00000004 // operate on the visible list
  12. #define WZCOP_PLIST 0x00000008 // operate on the preferred list
  13. // defines legal lengths for the WEP Key material
  14. #define WZC_WEPKMAT_40_ASC 5
  15. #define WZC_WEPKMAT_40_HEX 10
  16. #define WZC_WEPKMAT_104_ASC 13
  17. #define WZC_WEPKMAT_104_HEX 26
  18. #define WZC_WEPKMAT_128_ASC 16
  19. #define WZC_WEPKMAT_128_HEX 32
  20. class CWZCQuickCfg:
  21. public CDialogImpl<CWZCQuickCfg>
  22. {
  23. protected:
  24. // handles to the controls
  25. HWND m_hLblInfo;
  26. HWND m_hLblNetworks;
  27. HWND m_hLstNetworks;
  28. HWND m_hWarnIcon;
  29. HWND m_hLblNoWepKInfo;
  30. HWND m_hChkNoWepK;
  31. HWND m_hLblWepKInfo;
  32. HWND m_hLblWepK;
  33. HWND m_hEdtWepK;
  34. HWND m_hLblWepK2;
  35. HWND m_hEdtWepK2;
  36. HWND m_hChkOneX;
  37. HWND m_hBtnAdvanced;
  38. HWND m_hBtnConnect;
  39. // Handle to the images
  40. HIMAGELIST m_hImgs; // list items images
  41. BEGIN_MSG_MAP(CWZCQuickCfg)
  42. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  43. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
  44. MESSAGE_HANDLER(WM_HELP, OnHelp)
  45. MESSAGE_HANDLER(WM_TIMER, OnTimer)
  46. NOTIFY_CODE_HANDLER(LVN_ITEMCHANGED, OnItemChanged)
  47. NOTIFY_CODE_HANDLER(NM_DBLCLK, OnDbClick);
  48. COMMAND_ID_HANDLER(IDC_WZCQCFG_CONNECT, OnConnect)
  49. COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
  50. COMMAND_ID_HANDLER(IDCLOSE, OnCancel)
  51. COMMAND_ID_HANDLER(IDC_WZCQCFG_ADVANCED, OnAdvanced)
  52. COMMAND_ID_HANDLER(IDC_WZCQCFG_WEPK, OnWepKMatCmd)
  53. COMMAND_ID_HANDLER(IDC_WZCQCFG_CHK_NOWK, OnCheckConfirmNoWep)
  54. END_MSG_MAP()
  55. enum {IDD = IDD_WZCQCFG };
  56. // GUID on which we're operating
  57. GUID m_Guid;
  58. // zero conf data on the interface
  59. BOOL m_bHaveWZCData;
  60. INTF_ENTRY m_IntfEntry;
  61. DWORD m_dwOIDFlags;
  62. UINT m_nTimer;
  63. HCURSOR m_hCursor;
  64. BOOL m_bKMatTouched; // tells whether the user changed the wep key
  65. // internal lists
  66. CWZCConfig *m_pHdVList; // list of visible configs
  67. CWZCConfig *m_pHdPList; // list of preferred configs
  68. DWORD GetWepKMaterial(UINT *pnKeyLen, LPBYTE *ppszKMat, DWORD *pdwCtlFlags);
  69. BOOL IsConfigInList(CWZCConfig *pHdList, PWZC_WLAN_CONFIG pwzcConfig, CWZCConfig **ppMatchingConfig = NULL);
  70. DWORD InitListView();
  71. DWORD GetOIDs(DWORD dwInFlags, LPDWORD pdwOutFlags);
  72. DWORD SavePreferredConfigs(PINTF_ENTRY pIntf, CWZCConfig *pStartCfg = NULL);
  73. DWORD FillVisibleList(PWZC_802_11_CONFIG_LIST pwzcVList);
  74. DWORD FillPreferredList(PWZC_802_11_CONFIG_LIST pwzcPList);
  75. DWORD RefreshListView();
  76. DWORD RefreshControls();
  77. // calls operating only on the internal lists (m_pHdVList or m_pHdPList)
  78. DWORD AddUniqueConfig(
  79. DWORD dwOpFlags, // operation specific flags (see WZCADD_* flags)
  80. DWORD dwEntryFlags, // flags for the config to be inserted
  81. PWZC_WLAN_CONFIG pwzcConfig, // WZC Configuration
  82. CWZCConfig **ppNewNode = NULL); // [out] gives the pointer of the newly created config object
  83. public:
  84. LPWSTR m_wszTitle;
  85. // class constructor
  86. CWZCQuickCfg(const GUID * pGuid);
  87. // class destructor
  88. ~CWZCQuickCfg();
  89. // Dialog related members
  90. LRESULT OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  91. LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  92. LRESULT OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  93. LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  94. LRESULT OnItemChanged(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  95. LRESULT OnDbClick(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  96. LRESULT OnConnect(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  97. LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  98. LRESULT OnAdvanced(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  99. LRESULT OnWepKMatCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  100. LRESULT OnCheckConfirmNoWep(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  101. };