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.

193 lines
8.2 KiB

  1. extern "C" {
  2. #include "ntddndis.h"
  3. #include "wzcsapi.h"
  4. }
  5. #pragma once
  6. ////////////////////////////////////////////////////////////////////////
  7. // CWZCConfig related stuff
  8. //
  9. // flags used in CWZCConfig::m_dwFlags
  10. // the entry is preferred (user defined)
  11. #define WZC_DESCR_PREFRD 0x00000001
  12. // the entry is currently visible in the air
  13. #define WZC_DESCR_VISIBLE 0x00000002
  14. // the entry is currently active (the one plumbed to the adapter)
  15. #define WZC_DESCR_ACTIVE 0x00000004
  16. // object attached to each entry in the list
  17. class CWZCConfig
  18. {
  19. public:
  20. class CWZCConfig *m_pPrev, *m_pNext;
  21. INT m_nListIndex; // index of the entry in the list
  22. DWORD m_dwFlags; // WZC_DESCR* flags
  23. WZC_WLAN_CONFIG m_wzcConfig; // all WZC configuration
  24. class CEapolConfig *m_pEapolConfig; // all 802.1x configuration
  25. public:
  26. // constructor
  27. CWZCConfig(DWORD dwFlags, PWZC_WLAN_CONFIG pwzcConfig);
  28. // destructor
  29. ~CWZCConfig();
  30. // checks whether this SSID matches with the one from pwzcConfig
  31. BOOL Match(PWZC_WLAN_CONFIG pwzcConfig);
  32. // checks whether this configuration is weaker than the one given as parameter
  33. BOOL Weaker(PWZC_WLAN_CONFIG pwzcConfig);
  34. // add the Configuration to the list of entries in the list view
  35. DWORD AddConfigToListView(HWND hwndLV, INT nPos);
  36. };
  37. ////////////////////////////////////////////////////////////////////////
  38. // CWZeroConfPage related stuff
  39. //
  40. // flags used to select state & item images
  41. #define WZCIMG_PREFR_NOSEL 0 // empty check box
  42. #define WZCIMG_PREFR_SELECT 1 // checked check box
  43. #define WZCIMG_INFRA_AIRING 2 // infra icon
  44. #define WZCIMG_INFRA_ACTIVE 3 // infra icon + blue circle
  45. #define WZCIMG_INFRA_SILENT 4 // infra icon + red cross
  46. #define WZCIMG_ADHOC_AIRING 5 // adhoc icon
  47. #define WZCIMG_ADHOC_ACTIVE 6 // adhoc icon + blue circle
  48. #define WZCIMG_ADHOC_SILENT 7 // adhoc icon + red cross
  49. // flags indicating various operational actions.
  50. // flags are used in:
  51. // AddUniqueConfig()
  52. // RefreshListView()
  53. #define WZCADD_HIGROUP 0x00000001 // add in front of its group
  54. #define WZCADD_OVERWRITE 0x00000002 // overwrite data
  55. #define WZCOP_VLIST 0x00000004 // operate on the visible list
  56. #define WZCOP_PLIST 0x00000008 // operate on the preferred list
  57. class CWZCConfigPage;
  58. class CWLANAuthenticationPage;
  59. class CWZeroConfPage: public CPropSheetPage
  60. {
  61. INetConnection * m_pconn;
  62. INetCfg * m_pnc;
  63. IUnknown * m_punk;
  64. const DWORD * m_adwHelpIDs;
  65. // zero conf data on the interface
  66. BOOL m_bHaveWZCData;
  67. INTF_ENTRY m_IntfEntry;
  68. DWORD m_dwOIDFlags;
  69. UINT m_nTimer;
  70. HCURSOR m_hCursor;
  71. // handles to the controls
  72. HWND m_hckbEnable; // checkbox for enabling / disabling the service
  73. HWND m_hwndVLV; // list ctrl holding the visible configurations
  74. HWND m_hwndPLV; // list ctrl holding the preferred configurations
  75. HWND m_hbtnCopy; // "Copy" button
  76. HWND m_hbtnRfsh; // "Refresh" button
  77. HWND m_hbtnAdd; // "Add" button
  78. HWND m_hbtnRem; // "Remove" button
  79. HWND m_hbtnUp; // "Up" button
  80. HWND m_hbtnDown; // "Down" button
  81. HWND m_hbtnAdvanced; // "Advanced" button
  82. HWND m_hbtnProps; // "Properties" button
  83. HWND m_hlblVisNet; // "Visible Networks" label
  84. HWND m_hlblPrefNet; // "Prefered Networks" label
  85. HWND m_hlblAvail; // "Available networks" description
  86. HWND m_hlblPrefDesc; // "Prefered Networks" description
  87. HWND m_hlblAdvDesc; // "Advacned" description
  88. // Handle to the images
  89. HIMAGELIST m_hImgs; // list items images
  90. HICON m_hIcoUp; // "Up" icon
  91. HICON m_hIcoDown; // "Down" icon
  92. // current Infrastructure mode
  93. UINT m_dwCtlFlags;
  94. // internal lists
  95. CWZCConfig *m_pHdVList; // list of visible configs
  96. CWZCConfig *m_pHdPList; // list of preferred configs
  97. private:
  98. DWORD InitListViews();
  99. DWORD GetOIDs(DWORD dwInFlags, LPDWORD pdwOutFlags);
  100. DWORD HelpCenter(LPCTSTR wszTopic);
  101. public:
  102. // misc public handlers
  103. BOOL IsWireless();
  104. BOOL IsConfigInList(CWZCConfig *pHdList, PWZC_WLAN_CONFIG pwzcConfig, CWZCConfig **ppMatchingConfig = NULL);
  105. // calls operating only on the internal lists (m_pHdVList or m_pHdPList)
  106. DWORD AddUniqueConfig(
  107. DWORD dwOpFlags, // operation specific flags (see WZCADD_* flags)
  108. DWORD dwEntryFlags, // flags for the config to be inserted
  109. PWZC_WLAN_CONFIG pwzcConfig, // WZC Configuration
  110. CEapolConfig *pEapolConfig = NULL, // [in] pointer to the Eapol configuration object (if available)
  111. CWZCConfig **ppNewNode = NULL); // [out] gives the pointer of the newly created config object
  112. DWORD FillVisibleList(PWZC_802_11_CONFIG_LIST pwzcVList);
  113. DWORD FillPreferredList(PWZC_802_11_CONFIG_LIST pwzcPList);
  114. DWORD FillCurrentConfig(PINTF_ENTRY pIntf);
  115. DWORD RefreshListView(DWORD dwFlags);
  116. DWORD RefreshButtons();
  117. DWORD SwapConfigsInListView(INT nIdx1, INT nIdx2, CWZCConfig * & pConfig1, CWZCConfig * & pConfig2);
  118. DWORD SavePreferredConfigs(PINTF_ENTRY pIntf);
  119. public:
  120. // UI handlers
  121. BEGIN_MSG_MAP(CWZeroConfPage)
  122. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  123. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
  124. MESSAGE_HANDLER(WM_HELP, OnHelp)
  125. MESSAGE_HANDLER(WM_TIMER, OnTimer)
  126. NOTIFY_CODE_HANDLER(PSN_APPLY, OnApply)
  127. NOTIFY_CODE_HANDLER(NM_DBLCLK, OnDblClick)
  128. NOTIFY_CODE_HANDLER(NM_CLICK, OnClick)
  129. NOTIFY_CODE_HANDLER(NM_RETURN, OnReturn)
  130. NOTIFY_CODE_HANDLER(LVN_ITEMCHANGED, OnItemChanged)
  131. COMMAND_ID_HANDLER(IDC_WZC_CHK_EnableWZC, OnChkWZCEnable)
  132. COMMAND_ID_HANDLER(IDC_WZC_BTN_COPY, OnPushAddOrCopy)
  133. COMMAND_ID_HANDLER(IDC_WZC_BTN_RFSH, OnPushRefresh)
  134. COMMAND_ID_HANDLER(IDC_WZC_BTN_ADD, OnPushAddOrCopy)
  135. COMMAND_ID_HANDLER(IDC_WZC_BTN_REM, OnPushRemove)
  136. COMMAND_ID_HANDLER(IDC_WZC_BTN_UP, OnPushUpOrDown)
  137. COMMAND_ID_HANDLER(IDC_WZC_BTN_DOWN, OnPushUpOrDown)
  138. COMMAND_ID_HANDLER(IDC_ADVANCED, OnPushAdvanced)
  139. COMMAND_ID_HANDLER(IDC_PROPERTIES, OnPushProperties)
  140. END_MSG_MAP()
  141. CWZeroConfPage(
  142. IUnknown* punk,
  143. INetCfg* pnc,
  144. INetConnection* pconn,
  145. const DWORD * adwHelpIDs = NULL);
  146. ~CWZeroConfPage();
  147. // initialization / termination members
  148. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  149. LRESULT OnApply(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  150. // Help related members
  151. LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  152. LRESULT OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  153. // Timer related members
  154. LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  155. // List actions
  156. LRESULT OnDblClick(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  157. LRESULT OnClick(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  158. LRESULT OnReturn(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  159. LRESULT OnItemChanged(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  160. // Controls actions
  161. LRESULT OnChkWZCEnable(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  162. LRESULT OnPushAddOrCopy(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  163. LRESULT OnPushRefresh(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  164. LRESULT OnPushUpOrDown(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  165. LRESULT OnPushRemove(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  166. LRESULT OnPushAdvanced(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  167. LRESULT OnPushProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  168. private:
  169. HRESULT _DoProperties(HWND hwndLV, int iItem);
  170. INT _DoModalPropSheet(CWZCConfigPage *pPpWzcPage, CWLANAuthenticationPage *pPpAuthPage, BOOL bCustomizeTitle = FALSE);
  171. // The advanced dialog
  172. static INT_PTR CALLBACK AdvancedDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  173. };