Functions using EAP_ERROR descriptor return bool now for code simplicity

This commit is contained in:
2016-06-15 22:59:52 +02:00
parent 03358170f4
commit ec0b283540
27 changed files with 686 additions and 515 deletions

View File

@@ -353,16 +353,14 @@ protected:
if (!m_target.empty()) {
// Read credentials from Credential Manager
EAP_ERROR *pEapError;
DWORD dwResult;
if ((dwResult = m_cred.retrieve(m_target.c_str(), &pEapError)) == ERROR_SUCCESS) {
if (m_cred.retrieve(m_target.c_str(), &pEapError)) {
m_remember->SetValue(true);
} else if (dwResult != ERROR_NOT_FOUND) {
if (pEapError) {
} else if (pEapError) {
if (pEapError->dwWinError != ERROR_NOT_FOUND)
wxLogError(winstd::tstring_printf(_("Error reading credentials from Credential Manager: %ls (error %u)"), pEapError->pRootCauseString, pEapError->dwWinError).c_str());
m_cred.m_module.free_error_memory(pEapError);
} else
wxLogError(_("Reading credentials failed (error %u)."), dwResult);
}
m_cred.m_module.free_error_memory(pEapError);
} else
wxLogError(_("Reading credentials failed."));
}
return true;
@@ -375,13 +373,12 @@ protected:
// Write credentials to credential manager.
if (m_remember->GetValue()) {
EAP_ERROR *pEapError;
DWORD dwResult;
if ((dwResult = m_cred.store(m_target.c_str(), &pEapError)) != ERROR_SUCCESS) {
if (!m_cred.store(m_target.c_str(), &pEapError)) {
if (pEapError) {
wxLogError(winstd::tstring_printf(_("Error writing credentials to Credential Manager: %ls (error %u)"), pEapError->pRootCauseString, pEapError->dwWinError).c_str());
m_cred.m_module.free_error_memory(pEapError);
} else
wxLogError(_("Writing credentials failed (error %u)."), dwResult);
wxLogError(_("Writing credentials failed."));
}
}
}

View File

@@ -54,10 +54,10 @@ namespace eap
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
///
/// \returns
/// - \c ERROR_SUCCESS if succeeded
/// - error code otherwise
/// - \c true if succeeded
/// - \c false otherwise. See \p ppEapError for details.
///
virtual DWORD invoke_config_ui(
virtual bool invoke_config_ui(
_In_ HWND hwndParent,
_Inout_ config_type &cfg,
_Out_ EAP_ERROR **ppEapError) = 0;
@@ -75,10 +75,10 @@ namespace eap
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
///
/// \returns
/// - \c ERROR_SUCCESS if succeeded
/// - error code otherwise
/// - \c true if succeeded
/// - \c false otherwise. See \p ppEapError for details.
///
virtual DWORD invoke_identity_ui(
virtual bool invoke_identity_ui(
_In_ HWND hwndParent,
_In_ DWORD dwFlags,
_Inout_ config_type &cfg,
@@ -97,10 +97,10 @@ namespace eap
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
///
/// \returns
/// - \c ERROR_SUCCESS if succeeded
/// - error code otherwise
/// - \c true if succeeded
/// - \c false otherwise. See \p ppEapError for details.
///
virtual DWORD invoke_interactive_ui(
virtual bool invoke_interactive_ui(
_In_ HWND hwndParent,
_In_ const interactive_request_type &req,
_Out_ interactive_response_type &res,