Inner EAP method support progress continues...
This commit is contained in:
parent
13d84c3c4d
commit
a834fbcb7c
@ -21,6 +21,11 @@
|
|||||||
#include "../../EAPBase_UI/include/EAP_UI.h"
|
#include "../../EAPBase_UI/include/EAP_UI.h"
|
||||||
#include "../../EAPMsg/include/Config.h"
|
#include "../../EAPMsg/include/Config.h"
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Helper class for auto-destroyable EAP_METHOD_TYPE used in wxWidget's item containers
|
||||||
|
///
|
||||||
|
class wxEAPMethodTypeClientData;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Inner EAP method config panel
|
/// Inner EAP method config panel
|
||||||
///
|
///
|
||||||
@ -46,6 +51,20 @@ class wxEAPMsgConfigPanel;
|
|||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
|
|
||||||
|
class wxEAPMethodTypeClientData : public wxClientData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
/// Constructs client data object with existing handle
|
||||||
|
///
|
||||||
|
wxEAPMethodTypeClientData(const EAP_METHOD_TYPE &type, DWORD properties);
|
||||||
|
|
||||||
|
public:
|
||||||
|
EAP_METHOD_TYPE m_type; ///< EapHost method type
|
||||||
|
DWORD m_properties; ///< Method properties
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class wxEAPMsgMethodConfigPanel : public wxEAPMsgMethodConfigPanelBase
|
class wxEAPMsgMethodConfigPanel : public wxEAPMsgMethodConfigPanelBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -57,6 +76,12 @@ public:
|
|||||||
/// \param[in ] parent Parent window
|
/// \param[in ] parent Parent window
|
||||||
///
|
///
|
||||||
wxEAPMsgMethodConfigPanel(const eap::config_provider &prov, eap::config_method_eapmsg &cfg, wxWindow *parent);
|
wxEAPMsgMethodConfigPanel(const eap::config_provider &prov, eap::config_method_eapmsg &cfg, wxWindow *parent);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/// \cond internal
|
||||||
|
virtual void OnUpdateUI(wxUpdateUIEvent& event);
|
||||||
|
virtual void OnSettings(wxCommandEvent& event);
|
||||||
|
/// \endcond
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,12 +54,14 @@ wxEAPMsgMethodConfigPanelBase::wxEAPMsgMethodConfigPanelBase( wxWindow* parent,
|
|||||||
this->Layout();
|
this->Layout();
|
||||||
|
|
||||||
// Connect Events
|
// Connect Events
|
||||||
|
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPMsgMethodConfigPanelBase::OnUpdateUI ) );
|
||||||
m_settings->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPMsgMethodConfigPanelBase::OnSettings ), NULL, this );
|
m_settings->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPMsgMethodConfigPanelBase::OnSettings ), NULL, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxEAPMsgMethodConfigPanelBase::~wxEAPMsgMethodConfigPanelBase()
|
wxEAPMsgMethodConfigPanelBase::~wxEAPMsgMethodConfigPanelBase()
|
||||||
{
|
{
|
||||||
// Disconnect Events
|
// Disconnect Events
|
||||||
|
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPMsgMethodConfigPanelBase::OnUpdateUI ) );
|
||||||
m_settings->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPMsgMethodConfigPanelBase::OnSettings ), NULL, this );
|
m_settings->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPMsgMethodConfigPanelBase::OnSettings ), NULL, this );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
<event name="OnRightUp"></event>
|
<event name="OnRightUp"></event>
|
||||||
<event name="OnSetFocus"></event>
|
<event name="OnSetFocus"></event>
|
||||||
<event name="OnSize"></event>
|
<event name="OnSize"></event>
|
||||||
<event name="OnUpdateUI"></event>
|
<event name="OnUpdateUI">OnUpdateUI</event>
|
||||||
<object class="wxStaticBoxSizer" expanded="1">
|
<object class="wxStaticBoxSizer" expanded="1">
|
||||||
<property name="id">wxID_ANY</property>
|
<property name="id">wxID_ANY</property>
|
||||||
<property name="label">Inner EAP Method</property>
|
<property name="label">Inner EAP Method</property>
|
||||||
|
@ -43,6 +43,7 @@ class wxEAPMsgMethodConfigPanelBase : public wxPanel
|
|||||||
wxButton* m_settings;
|
wxButton* m_settings;
|
||||||
|
|
||||||
// Virtual event handlers, overide them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
|
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||||
virtual void OnSettings( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnSettings( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,19 @@
|
|||||||
|
|
||||||
#include "StdAfx.h"
|
#include "StdAfx.h"
|
||||||
|
|
||||||
|
#pragma comment(lib, "Eappcfg.lib")
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// wxEAPMsgMethodConfigPanel
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
wxEAPMethodTypeClientData::wxEAPMethodTypeClientData(const EAP_METHOD_TYPE &type, DWORD properties) :
|
||||||
|
m_type(type),
|
||||||
|
m_properties(properties)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// wxEAPMsgMethodConfigPanel
|
// wxEAPMsgMethodConfigPanel
|
||||||
@ -34,6 +47,48 @@ wxEAPMsgMethodConfigPanel::wxEAPMsgMethodConfigPanel(const eap::config_provider
|
|||||||
winstd::library lib_shell32;
|
winstd::library lib_shell32;
|
||||||
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
||||||
m_method_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(175)));
|
m_method_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(175)));
|
||||||
|
|
||||||
|
winstd::eap_method_info_array methods;
|
||||||
|
std::unique_ptr<EAP_ERROR, winstd::EapHostPeerFreeErrorMemory_delete> error;
|
||||||
|
DWORD dwResult = EapHostPeerGetMethods(&methods, &std::addressof(error)->_Myptr);
|
||||||
|
if (dwResult == ERROR_SUCCESS) {
|
||||||
|
for (DWORD i = 0; i < methods.dwNumberOfMethods; i++)
|
||||||
|
m_method->Append(methods.pEapMethods[i].pwszFriendlyName, new wxEAPMethodTypeClientData(methods.pEapMethods[i].eaptype, methods.pEapMethods[i].eapProperties));
|
||||||
|
} else if (error)
|
||||||
|
wxLogError(_("Enumerating EAP methods failed (error %u, %s, %s)."), error->dwWinError, error->pRootCauseString, error->pRepairString);
|
||||||
|
else
|
||||||
|
wxLogError(_("Enumerating EAP methods failed (error %u)."), dwResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxEAPMsgMethodConfigPanel::OnUpdateUI(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
wxEAPMsgMethodConfigPanelBase::OnUpdateUI(event);
|
||||||
|
|
||||||
|
int sel = m_method->GetSelection();
|
||||||
|
const wxEAPMethodTypeClientData *data =
|
||||||
|
sel != wxNOT_FOUND && m_method->HasClientObjectData() ?
|
||||||
|
dynamic_cast<const wxEAPMethodTypeClientData*>(m_method->GetClientObject(sel)) :
|
||||||
|
NULL;
|
||||||
|
m_settings->Enable(data && (data->m_properties & eapPropSupportsConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxEAPMsgMethodConfigPanel::OnSettings(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
wxEAPMsgMethodConfigPanelBase::OnSettings(event);
|
||||||
|
|
||||||
|
int sel = m_method->GetSelection();
|
||||||
|
const wxEAPMethodTypeClientData *data =
|
||||||
|
sel != wxNOT_FOUND && m_method->HasClientObjectData() ?
|
||||||
|
dynamic_cast<const wxEAPMethodTypeClientData*>(m_method->GetClientObject(sel)) :
|
||||||
|
NULL;
|
||||||
|
if (data && (data->m_properties & eapPropSupportsConfig)) {
|
||||||
|
DWORD cfg_data_size = 0;
|
||||||
|
std::unique_ptr<BYTE[], winstd::EapHostPeerFreeMemory_delete> cfg_data;
|
||||||
|
std::unique_ptr<EAP_ERROR, winstd::EapHostPeerFreeErrorMemory_delete> error;
|
||||||
|
DWORD dwResult = EapHostPeerInvokeConfigUI(GetHWND(), 0, data->m_type, 0, NULL, &cfg_data_size, &std::addressof(cfg_data)->_Myptr, &std::addressof(error)->_Myptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,3 +23,7 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS // Prevent warnings from wxWidgets headers
|
#define _CRT_SECURE_NO_WARNINGS // Prevent warnings from wxWidgets headers
|
||||||
|
|
||||||
#include "../include/EAPMsg_UI.h"
|
#include "../include/EAPMsg_UI.h"
|
||||||
|
|
||||||
|
#include <WinStd/EAP.h>
|
||||||
|
|
||||||
|
#include <eaphostpeerconfigapis.h>
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit d02935808605803b51b6b533b9943bf1e3d370a4
|
Subproject commit 129b9c9a10c2145235e8f447706875dcafa4a4a3
|
Loading…
x
Reference in New Issue
Block a user