Inner EAP method support progress continues...
This commit is contained in:
parent
c53ed21d55
commit
7d13222838
@ -100,6 +100,7 @@ namespace eap
|
||||
virtual const wchar_t* get_method_str() const;
|
||||
|
||||
public:
|
||||
EAP_METHOD_TYPE m_type;
|
||||
EAP_METHOD_TYPE m_type; ///< EapHost method type: (EAP type, vendor ID, vendor type, author ID) tuple
|
||||
sanitizing_blob m_cfg_blob; ///< Method configuration BLOB
|
||||
};
|
||||
}
|
||||
|
@ -35,15 +35,17 @@ eap::config_method_eapmsg::config_method_eapmsg(_In_ module &mod, _In_ unsigned
|
||||
|
||||
|
||||
eap::config_method_eapmsg::config_method_eapmsg(_In_ const config_method_eapmsg &other) :
|
||||
m_type(other.m_type),
|
||||
config_method(other)
|
||||
m_type (other.m_type ),
|
||||
m_cfg_blob (other.m_cfg_blob),
|
||||
config_method(other )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config_method_eapmsg::config_method_eapmsg(_Inout_ config_method_eapmsg &&other) :
|
||||
m_type(std::move(other.m_type)),
|
||||
config_method(std::move(other))
|
||||
m_type (std::move(other.m_type )),
|
||||
m_cfg_blob (std::move(other.m_cfg_blob)),
|
||||
config_method(std::move(other ))
|
||||
{
|
||||
}
|
||||
|
||||
@ -53,6 +55,7 @@ eap::config_method_eapmsg& eap::config_method_eapmsg::operator=(_In_ const confi
|
||||
if (this != &other) {
|
||||
(config_method&)*this = other;
|
||||
m_type = other.m_type;
|
||||
m_cfg_blob = other.m_cfg_blob;
|
||||
}
|
||||
|
||||
return *this;
|
||||
@ -62,8 +65,9 @@ eap::config_method_eapmsg& eap::config_method_eapmsg::operator=(_In_ const confi
|
||||
eap::config_method_eapmsg& eap::config_method_eapmsg::operator=(_Inout_ config_method_eapmsg &&other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(config_method&&)*this = std::move(other);
|
||||
m_type = std::move(other.m_type);
|
||||
(config_method&&)*this = std::move(other );
|
||||
m_type = std::move(other.m_type );
|
||||
m_cfg_blob = std::move(other.m_cfg_blob);
|
||||
}
|
||||
|
||||
return *this;
|
||||
@ -84,6 +88,6 @@ eap_type_t eap::config_method_eapmsg::get_method_id() const
|
||||
|
||||
const wchar_t* eap::config_method_eapmsg::get_method_str() const
|
||||
{
|
||||
// TODO: Query registry for EAP method name (PeerFriendlyName).
|
||||
// TODO: Query registry for EAP method name (PeerFriendlyName using RegLoadMUIString()).
|
||||
return L"EAPMsg";
|
||||
}
|
||||
|
@ -60,8 +60,9 @@ public:
|
||||
wxEAPMethodTypeClientData(const EAP_METHOD_TYPE &type, DWORD properties);
|
||||
|
||||
public:
|
||||
EAP_METHOD_TYPE m_type; ///< EapHost method type
|
||||
DWORD m_properties; ///< Method properties
|
||||
EAP_METHOD_TYPE m_type; ///< EapHost method type
|
||||
DWORD m_properties; ///< Method properties
|
||||
eap::sanitizing_blob m_cfg_blob; ///< Method configuration BLOB
|
||||
};
|
||||
|
||||
|
||||
@ -79,9 +80,14 @@ public:
|
||||
|
||||
protected:
|
||||
/// \cond internal
|
||||
virtual bool TransferDataToWindow();
|
||||
virtual bool TransferDataFromWindow();
|
||||
virtual void OnUpdateUI(wxUpdateUIEvent& event);
|
||||
virtual void OnSettings(wxCommandEvent& event);
|
||||
/// \endcond
|
||||
|
||||
protected:
|
||||
eap::config_method_eapmsg &m_cfg; ///< Method configuration
|
||||
};
|
||||
|
||||
|
||||
|
@ -38,10 +38,11 @@ wxEAPMethodTypeClientData::wxEAPMethodTypeClientData(const EAP_METHOD_TYPE &type
|
||||
// wxEAPMsgMethodConfigPanel
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPMsgMethodConfigPanel::wxEAPMsgMethodConfigPanel(const eap::config_provider &prov, eap::config_method_eapmsg &cfg, wxWindow *parent) : wxEAPMsgMethodConfigPanelBase(parent)
|
||||
wxEAPMsgMethodConfigPanel::wxEAPMsgMethodConfigPanel(const eap::config_provider &prov, eap::config_method_eapmsg &cfg, wxWindow *parent) :
|
||||
m_cfg(cfg),
|
||||
wxEAPMsgMethodConfigPanelBase(parent)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(prov);
|
||||
UNREFERENCED_PARAMETER(cfg);
|
||||
|
||||
// Load and set icon.
|
||||
winstd::library lib_shell32;
|
||||
@ -49,8 +50,8 @@ wxEAPMsgMethodConfigPanel::wxEAPMsgMethodConfigPanel(const eap::config_provider
|
||||
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);
|
||||
winstd::eap_error error;
|
||||
DWORD dwResult = EapHostPeerGetMethods(&methods, &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));
|
||||
@ -61,6 +62,42 @@ wxEAPMsgMethodConfigPanel::wxEAPMsgMethodConfigPanel(const eap::config_provider
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPMsgMethodConfigPanel::TransferDataToWindow()
|
||||
{
|
||||
if (m_method->HasClientObjectData()) {
|
||||
// Find configured method and set its selection and configuration BLOB.
|
||||
for (unsigned int i = 0, n = m_method->GetCount(); i < n; i++) {
|
||||
wxEAPMethodTypeClientData *data = dynamic_cast<wxEAPMethodTypeClientData*>(m_method->GetClientObject(i));
|
||||
if (data->m_type == m_cfg.m_type) {
|
||||
m_method->SetSelection(i);
|
||||
data->m_cfg_blob = m_cfg.m_cfg_blob;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return wxEAPMsgMethodConfigPanelBase::TransferDataToWindow();
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPMsgMethodConfigPanel::TransferDataFromWindow()
|
||||
{
|
||||
wxCHECK(wxEAPMsgMethodConfigPanelBase::TransferDataFromWindow(), false);
|
||||
|
||||
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) {
|
||||
// Save method selection and configuration.
|
||||
m_cfg.m_type = data->m_type;
|
||||
m_cfg.m_cfg_blob = data->m_cfg_blob;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void wxEAPMsgMethodConfigPanel::OnUpdateUI(wxUpdateUIEvent& event)
|
||||
{
|
||||
wxEAPMsgMethodConfigPanelBase::OnUpdateUI(event);
|
||||
@ -79,15 +116,24 @@ void wxEAPMsgMethodConfigPanel::OnSettings(wxCommandEvent& event)
|
||||
wxEAPMsgMethodConfigPanelBase::OnSettings(event);
|
||||
|
||||
int sel = m_method->GetSelection();
|
||||
const wxEAPMethodTypeClientData *data =
|
||||
wxEAPMethodTypeClientData *data =
|
||||
sel != wxNOT_FOUND && m_method->HasClientObjectData() ?
|
||||
dynamic_cast<const wxEAPMethodTypeClientData*>(m_method->GetClientObject(sel)) :
|
||||
dynamic_cast<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);
|
||||
winstd::eap_blob cfg_data;
|
||||
winstd::eap_error error;
|
||||
DWORD dwResult = EapHostPeerInvokeConfigUI(GetHWND(), 0, data->m_type, (DWORD)data->m_cfg_blob.size(), data->m_cfg_blob.data(), &cfg_data_size, &cfg_data._Myptr, &error._Myptr);
|
||||
if (dwResult == ERROR_SUCCESS) {
|
||||
const BYTE *_cfg_data = cfg_data.get();
|
||||
data->m_cfg_blob.assign(_cfg_data, _cfg_data + cfg_data_size);
|
||||
} else if (dwResult == ERROR_CANCELLED) {
|
||||
// Not really an error.
|
||||
} else if (error)
|
||||
wxLogError(_("Configuring EAP method failed (error %u, %s, %s)."), error->dwWinError, error->pRootCauseString, error->pRepairString);
|
||||
else
|
||||
wxLogError(_("Configuring EAP method failed (error %u)."), dwResult);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 7b0b38aab38c777d2b058baaab62fe55cba09b64
|
||||
Subproject commit 71c630085df8151af99cfdcf52f67ac52f44dcfe
|
Loading…
x
Reference in New Issue
Block a user