diff --git a/EAPMethods/src/Main.cpp b/EAPMethods/src/Main.cpp index 8a77e2c..a6cd90d 100644 --- a/EAPMethods/src/Main.cpp +++ b/EAPMethods/src/Main.cpp @@ -755,7 +755,7 @@ DWORD WINAPI EapPeerCredentialsXml2Blob( else { // com_obj pXmlElCredentials; - if (FAILED(eapxml::select_node(pCredentialsDoc, bstr(L"//EapHostUserCredentials/Credentials"), &pXmlElCredentials))) { + if (FAILED(eapxml::select_node(pCredentialsDoc, bstr(L"//EapHostUserCredentials/Credentials"), pXmlElCredentials))) { g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_FOUND, _T(__FUNCTION__) _T(" Error selecting element."))); return dwResult; } diff --git a/EAPMethods/src/Main_UI.cpp b/EAPMethods/src/Main_UI.cpp index c930f08..dd5407a 100644 --- a/EAPMethods/src/Main_UI.cpp +++ b/EAPMethods/src/Main_UI.cpp @@ -133,7 +133,7 @@ DWORD WINAPI EapPeerConfigXml2Blob( // pConfigDoc->setProperty(bstr(L"SelectionNamespaces"), variant(L"xmlns:eaphostconfig=\"http://www.microsoft.com/provisioning/EapHostConfig\"")); com_obj pXmlElConfig; - if (FAILED(eapxml::select_element(pConfigDoc, bstr(L"//eaphostconfig:Config"), &pXmlElConfig))) { + if (FAILED(eapxml::select_element(pConfigDoc, bstr(L"//eaphostconfig:Config"), pXmlElConfig))) { g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" Error reading element."))); return dwResult; } @@ -215,7 +215,7 @@ DWORD WINAPI EapPeerConfigBlob2Xml( // Select node. com_obj pXmlElConfig; pConfigDoc->setProperty(bstr(L"SelectionNamespaces"), variant(L"xmlns:eaphostconfig=\"http://www.microsoft.com/provisioning/EapHostConfig\"")); - if (FAILED(eapxml::select_node(pConfigDoc, bstr(L"eaphostconfig:Config"), &pXmlElConfig))) { + if (FAILED(eapxml::select_node(pConfigDoc, bstr(L"eaphostconfig:Config"), pXmlElConfig))) { g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_FOUND, _T(__FUNCTION__) _T(" Error selecting element."))); return dwResult; } diff --git a/lib/EAPBase/include/EAPXML.h b/lib/EAPBase/include/EAPXML.h index 530d590..f346322 100644 --- a/lib/EAPBase/include/EAPXML.h +++ b/lib/EAPBase/include/EAPXML.h @@ -18,6 +18,8 @@ along with GÉANTLink. If not, see . */ +#include + #include #include #include @@ -27,31 +29,31 @@ namespace eapxml { - inline HRESULT get_document(_In_ IXMLDOMNode *pXmlNode, _Out_ IXMLDOMDocument2 **ppXmlDoc); - inline HRESULT select_node(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNode **ppXmlNode); - inline HRESULT select_nodes(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNodeList **ppXmlNodes); - inline HRESULT select_element(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ IXMLDOMElement **ppXmlElement); - inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, _In_z_ const BSTR bstrElementName, _In_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement); - inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementNameSelect, _In_z_ const BSTR bstrElementNameCreate, _In_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement); + inline HRESULT get_document(_In_ IXMLDOMNode *pXmlNode, _Out_ winstd::com_obj &ppXmlDoc); + inline HRESULT select_node(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ winstd::com_obj &ppXmlNode); + inline HRESULT select_nodes(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ winstd::com_obj &ppXmlNodes); + inline HRESULT select_element(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ winstd::com_obj &ppXmlElement); + inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, _In_z_ const BSTR bstrElementName, _In_z_ const BSTR bstrNamespace, _Out_ winstd::com_obj &ppXmlElement); + inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementNameSelect, _In_z_ const BSTR bstrElementNameCreate, _In_z_ const BSTR bstrNamespace, _Out_ winstd::com_obj &ppXmlElement); inline bool has_parent(_In_ IXMLDOMNode *pXmlNode); - inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ BSTR *pbstrValue, _Out_opt_ IXMLDOMElement **ppXmlElement = NULL); - template inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::basic_string &sValue, _Out_opt_ IXMLDOMElement **ppXmlElement = NULL); - inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ DWORD *pdwValue, _Out_opt_ IXMLDOMElement **ppXmlElement = NULL); - inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ bool *pbValue, _Out_opt_ IXMLDOMElement **ppXmlElement = NULL); - template inline HRESULT get_element_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue, _Out_opt_ IXMLDOMElement **ppXmlElement = NULL); - template inline HRESULT get_element_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue, _Out_opt_ IXMLDOMElement **ppXmlElement = NULL); - inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ BSTR *pbstrValue, _Out_opt_ IXMLDOMElement **ppXmlElement = NULL); - template inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ std::basic_string &sValue, _Out_opt_ IXMLDOMElement **ppXmlElement = NULL); - inline HRESULT put_element(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement); - inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_z_ const BSTR bstrValue, _Out_opt_ IXMLDOMElement **ppXmlElement = NULL); - inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ DWORD dwValue, _Out_opt_ IXMLDOMElement **ppXmlElement = NULL); - inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ bool bValue, _Out_opt_ IXMLDOMElement **ppXmlElement = NULL); - inline HRESULT put_element_base64(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ IXMLDOMElement **ppXmlElement = NULL); - inline HRESULT put_element_hex(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ IXMLDOMElement **ppXmlElement = NULL); - inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ BSTR *pbstrValue); + inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ winstd::bstr &pbstrValue, _Out_opt_ winstd::com_obj *ppXmlElement = NULL); + template inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::basic_string &sValue, _Out_opt_ winstd::com_obj *ppXmlElement = NULL); + inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ DWORD &pdwValue, _Out_opt_ winstd::com_obj *ppXmlElement = NULL); + inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ bool &pbValue, _Out_opt_ winstd::com_obj *ppXmlElement = NULL); + template inline HRESULT get_element_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue, _Out_opt_ winstd::com_obj *ppXmlElement = NULL); + template inline HRESULT get_element_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue, _Out_opt_ winstd::com_obj *ppXmlElement = NULL); + inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ winstd::bstr &pbstrValue, _Out_opt_ winstd::com_obj *ppXmlElement = NULL); + template inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ std::basic_string &sValue, _Out_opt_ winstd::com_obj *ppXmlElement = NULL); + inline HRESULT put_element(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _Out_ winstd::com_obj &ppXmlElement); + inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_z_ const BSTR bstrValue, _Out_opt_ winstd::com_obj *ppXmlElement = NULL); + inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ DWORD dwValue, _Out_opt_ winstd::com_obj *ppXmlElement = NULL); + inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ bool bValue, _Out_opt_ winstd::com_obj *ppXmlElement = NULL); + inline HRESULT put_element_base64(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj *ppXmlElement = NULL); + inline HRESULT put_element_hex(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj *ppXmlElement = NULL); + inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ winstd::bstr &pbstrValue); template inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::basic_string &sValue); - inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ DWORD *pdwValue); - inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ bool *pbValue); + inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ DWORD &pdwValue); + inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ bool &pbValue); template inline HRESULT get_attrib_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::vector<_Ty, _Ax> &aValue); template inline HRESULT get_attrib_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::vector<_Ty, _Ax> &aValue); inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_z_ const BSTR bstrValue); @@ -65,7 +67,6 @@ namespace eapxml #pragma once #include -#include #include #include @@ -73,10 +74,9 @@ namespace eapxml namespace eapxml { - inline HRESULT get_document(_In_ IXMLDOMNode *pXmlNode, _Out_ IXMLDOMDocument2 **ppXmlDoc) + inline HRESULT get_document(_In_ IXMLDOMNode *pXmlNode, _Out_ winstd::com_obj &ppXmlDoc) { assert(pXmlNode); - assert(ppXmlDoc); HRESULT hr; winstd::com_obj doc; @@ -87,50 +87,51 @@ namespace eapxml } - inline HRESULT select_node(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNode **ppXmlNode) + inline HRESULT select_node(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ winstd::com_obj &ppXmlNode) { assert(pXmlParent); - assert(ppXmlNode); HRESULT hr; + IXMLDOMNode *pXmlNode; - return - SUCCEEDED(hr = pXmlParent->selectSingleNode(bstrNodeName, ppXmlNode)) ? - *ppXmlNode ? S_OK : E_NOT_SET : hr; + if (SUCCEEDED(hr = pXmlParent->selectSingleNode(bstrNodeName, &pXmlNode))) { + ppXmlNode.attach(pXmlNode); + return pXmlNode ? S_OK : E_NOT_SET; + } else + return hr; } - inline HRESULT select_nodes(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNodeList **ppXmlNodes) + inline HRESULT select_nodes(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ winstd::com_obj &ppXmlNodes) { assert(pXmlParent); - assert(ppXmlNodes); HRESULT hr; + IXMLDOMNodeList *pXmlNodes; - return - SUCCEEDED(hr = pXmlParent->selectNodes(bstrNodeName, ppXmlNodes)) ? - *ppXmlNodes ? S_OK : E_NOT_SET : hr; + if (SUCCEEDED(hr = pXmlParent->selectNodes(bstrNodeName, &pXmlNodes))) { + ppXmlNodes.attach(pXmlNodes); + return pXmlNodes ? S_OK : E_NOT_SET; + } else + return hr; } - inline HRESULT select_element(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ IXMLDOMElement **ppXmlElement) + inline HRESULT select_element(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ winstd::com_obj &ppXmlElement) { - assert(ppXmlElement); - HRESULT hr; winstd::com_obj pXmlNode; return - SUCCEEDED(hr = select_node(pXmlParent, bstrElementName, &pXmlNode)) ? + SUCCEEDED(hr = select_node(pXmlParent, bstrElementName, pXmlNode)) ? SUCCEEDED(hr = pXmlNode.query_interface(ppXmlElement)) ? - *ppXmlElement ? S_OK : E_NOT_SET : hr : hr; + ppXmlElement ? S_OK : E_NOT_SET : hr : hr; } - inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, _In_z_ const BSTR bstrElementName, _In_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement) + inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, _In_z_ const BSTR bstrElementName, _In_z_ const BSTR bstrNamespace, _Out_ winstd::com_obj &ppXmlElement) { assert(pDoc); - assert(ppXmlElement); static const winstd::variant varNodeTypeEl(NODE_ELEMENT); HRESULT hr; @@ -139,22 +140,21 @@ namespace eapxml return SUCCEEDED(hr = pDoc->createNode(varNodeTypeEl, bstrElementName, bstrNamespace, &pXmlNode)) ? SUCCEEDED(hr = pXmlNode.query_interface(ppXmlElement)) ? - *ppXmlElement ? S_OK : E_NOT_SET : hr : hr; + ppXmlElement ? S_OK : E_NOT_SET : hr : hr; } - inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementNameSelect, _In_z_ const BSTR bstrElementNameCreate, _In_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement) + inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementNameSelect, _In_z_ const BSTR bstrElementNameCreate, _In_z_ const BSTR bstrNamespace, _Out_ winstd::com_obj &ppXmlElement) { assert(pDoc); assert(pXmlParent); - assert(ppXmlElement); HRESULT hr; return SUCCEEDED(hr = select_element(pXmlParent, bstrElementNameSelect, ppXmlElement)) ? S_OK : SUCCEEDED(hr = create_element(pDoc, bstrElementNameCreate, bstrNamespace, ppXmlElement)) ? - SUCCEEDED(hr = pXmlParent->appendChild(*ppXmlElement, NULL)) ? S_OK : hr : hr; + SUCCEEDED(hr = pXmlParent->appendChild(ppXmlElement, NULL)) ? S_OK : hr : hr; } @@ -168,64 +168,57 @@ namespace eapxml } - inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ BSTR *pbstrValue, _Out_opt_ IXMLDOMElement **ppXmlElement) + inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ winstd::bstr &pbstrValue, _Out_opt_ winstd::com_obj *ppXmlElement) { - assert(pbstrValue); - HRESULT hr; winstd::com_obj pXmlElement; + BSTR bstrValue; - if (ppXmlElement) - *ppXmlElement = NULL; - - if (SUCCEEDED(hr = select_element(pXmlParent, bstrElementName, &pXmlElement)) && - SUCCEEDED(hr = pXmlElement->get_text(pbstrValue))) + if (SUCCEEDED(hr = select_element(pXmlParent, bstrElementName, pXmlElement)) && + SUCCEEDED(hr = pXmlElement->get_text(&bstrValue))) { + pbstrValue.attach(bstrValue); if (ppXmlElement) - *ppXmlElement = pXmlElement.detach(); - return *pbstrValue ? S_OK : E_NOT_SET; + *ppXmlElement = std::move(pXmlElement); + return bstrValue ? S_OK : E_NOT_SET; } else return hr; } template - inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::basic_string &sValue, _Out_opt_ IXMLDOMElement **ppXmlElement) + inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::basic_string &sValue, _Out_opt_ winstd::com_obj *ppXmlElement) { winstd::bstr bstr; - HRESULT hr = get_element_value(pXmlParent, bstrElementName, &bstr, ppXmlElement); + HRESULT hr = get_element_value(pXmlParent, bstrElementName, bstr, ppXmlElement); if (SUCCEEDED(hr)) sValue.assign(bstr, bstr.length()); return hr; } - inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ DWORD *pdwValue, _Out_opt_ IXMLDOMElement **ppXmlElement) + inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ DWORD &pdwValue, _Out_opt_ winstd::com_obj *ppXmlElement) { - assert(pdwValue); - winstd::bstr bstr; - HRESULT hr = get_element_value(pXmlParent, bstrElementName, &bstr, ppXmlElement); + HRESULT hr = get_element_value(pXmlParent, bstrElementName, bstr, ppXmlElement); if (SUCCEEDED(hr)) - *pdwValue = wcstoul(bstr, NULL, 10); + pdwValue = wcstoul(bstr, NULL, 10); return hr; } - inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ bool *pbValue, _Out_opt_ IXMLDOMElement **ppXmlElement) + inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ bool &pbValue, _Out_opt_ winstd::com_obj *ppXmlElement) { - assert(pbValue); - winstd::bstr bstr; - HRESULT hr = get_element_value(pXmlParent, bstrElementName, &bstr, ppXmlElement); + HRESULT hr = get_element_value(pXmlParent, bstrElementName, bstr, ppXmlElement); if (SUCCEEDED(hr)) { if (CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"true" , -1, NULL, NULL, 0) == CSTR_EQUAL || CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"1" , -1, NULL, NULL, 0) == CSTR_EQUAL) - *pbValue = true; + pbValue = true; else if ( CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"false", -1, NULL, NULL, 0) == CSTR_EQUAL || CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"0" , -1, NULL, NULL, 0) == CSTR_EQUAL) - *pbValue = false; + pbValue = false; else hr = E_NOT_VALID_STATE; } @@ -235,10 +228,10 @@ namespace eapxml template - inline HRESULT get_element_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue, _Out_opt_ IXMLDOMElement **ppXmlElement) + inline HRESULT get_element_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue, _Out_opt_ winstd::com_obj *ppXmlElement) { winstd::bstr bstr; - HRESULT hr = get_element_value(pXmlParent, bstrElementName, &bstr, ppXmlElement); + HRESULT hr = get_element_value(pXmlParent, bstrElementName, bstr, ppXmlElement); if (SUCCEEDED(hr)) { winstd::base64_dec dec; bool is_last; @@ -250,10 +243,10 @@ namespace eapxml template - inline HRESULT get_element_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue, _Out_opt_ IXMLDOMElement **ppXmlElement) + inline HRESULT get_element_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue, _Out_opt_ winstd::com_obj *ppXmlElement) { winstd::bstr bstr; - HRESULT hr = get_element_value(pXmlParent, bstrElementName, &bstr, ppXmlElement); + HRESULT hr = get_element_value(pXmlParent, bstrElementName, bstr, ppXmlElement); if (SUCCEEDED(hr)) { winstd::hex_dec dec; bool is_last; @@ -264,33 +257,29 @@ namespace eapxml } - inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ BSTR *pbstrValue, _Out_opt_ IXMLDOMElement **ppXmlElement) + inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ winstd::bstr &pbstrValue, _Out_opt_ winstd::com_obj *ppXmlElement) { - assert(pbstrValue); - HRESULT hr; winstd::com_obj pXmlElement; - if (ppXmlElement) - *ppXmlElement = NULL; - - if (FAILED(hr = select_element(pXmlParent, bstrElementName, &pXmlElement))) + if (FAILED(hr = select_element(pXmlParent, bstrElementName, pXmlElement))) return hr; - if (ppXmlElement) { - pXmlElement->AddRef(); + if (ppXmlElement) *ppXmlElement = pXmlElement; - } winstd::com_obj pXmlListLocalizedText; long lCount = 0; - if (FAILED(select_nodes(pXmlElement, winstd::bstr(L"eap-metadata:localized-text"), &pXmlListLocalizedText)) || + if (FAILED(select_nodes(pXmlElement, winstd::bstr(L"eap-metadata:localized-text"), pXmlListLocalizedText)) || FAILED(pXmlListLocalizedText->get_length(&lCount)) || lCount <= 0) { - return - SUCCEEDED(hr = pXmlElement->get_text(pbstrValue)) ? - *pbstrValue ? S_OK : E_NOT_SET : hr; + BSTR bstr; + if (SUCCEEDED(hr = pXmlElement->get_text(&bstr))) { + pbstrValue.attach(bstr); + return bstr ? S_OK : E_NOT_SET; + } else + return hr; } winstd::bstr bstrDefault, bstrEn; @@ -298,11 +287,11 @@ namespace eapxml if (i >= lCount) { if (bstrDefault != NULL) { // Return "C" localization. - *pbstrValue = bstrDefault.detach(); + pbstrValue = std::move(bstrDefault); return S_OK; } else if (bstrEn != NULL) { // Return "en" localization. - *pbstrValue = bstrEn.detach(); + pbstrValue = std::move(bstrEn); return S_OK; } else return ERROR_NOT_FOUND; @@ -314,21 +303,21 @@ namespace eapxml { // Read . winstd::bstr bstrLang; - if (FAILED(get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:lang"), &bstrLang)) || + if (FAILED(get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:lang"), bstrLang)) || CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstrLang, bstrLang.length(), L"C" , -1, NULL, NULL, 0) == CSTR_EQUAL) { // is missing or "C" language found. winstd::bstr bstr; - if (SUCCEEDED(hr = get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:text"), &bstr))) - bstrDefault.attach(bstr.detach()); + if (SUCCEEDED(hr = get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:text"), bstr))) + bstrDefault = std::move(bstr); } else if (CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstrLang, bstrLang.length(), pszLang, -1, NULL, NULL, 0) == CSTR_EQUAL) { // Found an exact match. return get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:text"), pbstrValue); } else if (CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstrLang, bstrLang.length(), L"en", -1, NULL, NULL, 0) == CSTR_EQUAL) { // "en" language found. winstd::bstr bstr; - if (SUCCEEDED(hr = get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:text"), &bstr))) - bstrEn.attach(bstr.detach()); + if (SUCCEEDED(hr = get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:text"), bstr))) + bstrEn = std::move(bstr); } } } @@ -336,17 +325,17 @@ namespace eapxml template - inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ std::basic_string &sValue, _Out_opt_ IXMLDOMElement **ppXmlElement) + inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ std::basic_string &sValue, _Out_opt_ winstd::com_obj *ppXmlElement) { winstd::bstr bstr; - HRESULT hr = get_element_localized(pXmlParent, bstrElementName, pszLang, &bstr, ppXmlElement); + HRESULT hr = get_element_localized(pXmlParent, bstrElementName, pszLang, bstr, ppXmlElement); if (SUCCEEDED(hr)) sValue.assign(bstr, bstr.length()); return hr; } - inline HRESULT put_element(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement) + inline HRESULT put_element(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _Out_ winstd::com_obj &ppXmlElement) { assert(pDoc); assert(pCurrentDOMNode); @@ -363,7 +352,7 @@ namespace eapxml } - inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_z_ const BSTR bstrValue, _Out_opt_ IXMLDOMElement **ppXmlElement) + inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_z_ const BSTR bstrValue, _Out_opt_ winstd::com_obj *ppXmlElement) { assert(pDoc); @@ -378,26 +367,26 @@ namespace eapxml SUCCEEDED(hr = pCurrentDOMNode->appendChild(pXmlEl, NULL))) { if (ppXmlElement) - pXmlEl.query_interface(ppXmlElement); + pXmlEl.query_interface(*ppXmlElement); return S_OK; } else return hr; } - inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ DWORD dwValue, _Out_opt_ IXMLDOMElement **ppXmlElement) + inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ DWORD dwValue, _Out_opt_ winstd::com_obj *ppXmlElement) { return put_element_value(pDoc, pCurrentDOMNode, bstrElementName, bstrNamespace, winstd::bstr(winstd::wstring_printf(L"%d", dwValue)), ppXmlElement); } - inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ bool bValue, _Out_opt_ IXMLDOMElement **ppXmlElement) + inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ bool bValue, _Out_opt_ winstd::com_obj *ppXmlElement) { return put_element_value(pDoc, pCurrentDOMNode, bstrElementName, bstrNamespace, winstd::bstr(bValue ? L"true": L"false"), ppXmlElement); } - inline HRESULT put_element_base64(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ IXMLDOMElement **ppXmlElement) + inline HRESULT put_element_base64(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj *ppXmlElement) { std::wstring sBase64; winstd::base64_enc enc; @@ -406,7 +395,7 @@ namespace eapxml } - inline HRESULT put_element_hex(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ IXMLDOMElement **ppXmlElement) + inline HRESULT put_element_hex(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj *ppXmlElement) { std::wstring sHex; winstd::hex_enc enc; @@ -415,10 +404,8 @@ namespace eapxml } - inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ BSTR *pbstrValue) + inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ winstd::bstr &pbstrValue) { - assert(pbstrValue); - HRESULT hr; winstd::com_obj pXmlAttributes; winstd::com_obj pXmlAt; @@ -426,11 +413,11 @@ namespace eapxml V_VT(&varValue) = VT_EMPTY; return - SUCCEEDED(hr = pXmlParent->get_attributes(&pXmlAttributes)) ? + SUCCEEDED(hr = pXmlParent->get_attributes(&pXmlAttributes)) && SUCCEEDED(hr = pXmlAttributes->getNamedItem(bstrAttributeName, &pXmlAt)) ? pXmlAt ? SUCCEEDED(hr = pXmlAt->get_nodeValue(&varValue)) ? - V_VT(&varValue) == VT_BSTR ? *pbstrValue = V_BSTR(&varValue), S_OK : E_UNEXPECTED : hr : E_NOT_SET : hr : hr; + V_VT(&varValue) == VT_BSTR ? pbstrValue.attach(V_BSTR(&varValue)), V_VT(&varValue) = VT_EMPTY, S_OK : E_UNEXPECTED : hr : E_NOT_SET : hr; } @@ -438,39 +425,37 @@ namespace eapxml inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::basic_string &sValue) { winstd::bstr bstr; - HRESULT hr = get_attrib_value(pXmlParent, bstrAttributeName, &bstr); + HRESULT hr = get_attrib_value(pXmlParent, bstrAttributeName, bstr); if (SUCCEEDED(hr)) sValue.assign(bstr, bstr.length()); return hr; } - inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ DWORD *pdwValue) + inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ DWORD &pdwValue) { - assert(pdwValue); - winstd::bstr bstr; - HRESULT hr = get_attrib_value(pXmlParent, bstrAttributeName, &bstr); + HRESULT hr = get_attrib_value(pXmlParent, bstrAttributeName, bstr); if (SUCCEEDED(hr)) - *pdwValue = wcstoul(bstr, NULL, 10); + pdwValue = wcstoul(bstr, NULL, 10); return hr; } - inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ bool *pbValue) + inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ bool &pbValue) { assert(pbValue); winstd::bstr bstr; - HRESULT hr = get_attrib_value(pXmlParent, bstrAttributeName, &bstr); + HRESULT hr = get_attrib_value(pXmlParent, bstrAttributeName, bstr); if (SUCCEEDED(hr)) { if (CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"true" , -1, NULL, NULL, 0) == CSTR_EQUAL || CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"1" , -1, NULL, NULL, 0) == CSTR_EQUAL) - *pbValue = true; + pbValue = true; else if ( CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"false", -1, NULL, NULL, 0) == CSTR_EQUAL || CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"0" , -1, NULL, NULL, 0) == CSTR_EQUAL) - *pbValue = false; + pbValue = false; else hr = E_NOT_VALID_STATE; } diff --git a/lib/EAPBase/include/Method.h b/lib/EAPBase/include/Method.h index 2fdb62a..1eef7df 100644 --- a/lib/EAPBase/include/Method.h +++ b/lib/EAPBase/include/Method.h @@ -51,6 +51,8 @@ namespace eap { class method { + WINSTD_NONCOPYABLE(method) + public: /// /// Constructs an EAP method @@ -128,11 +130,6 @@ namespace eap /// @} - private: - // This class is noncopyable. - method(_In_ const method &other); - method& operator=(_In_ const method &other); - public: module &m_module; ///< EAP module config_method_with_cred &m_cfg; ///< Connection configuration @@ -143,6 +140,8 @@ namespace eap class method_noneap : public method { + WINSTD_NONCOPYABLE(method_noneap) + public: /// /// Constructs an EAP method diff --git a/lib/EAPBase/include/Module.h b/lib/EAPBase/include/Module.h index 1f32275..fa800d1 100644 --- a/lib/EAPBase/include/Module.h +++ b/lib/EAPBase/include/Module.h @@ -60,6 +60,8 @@ namespace eap { class module { + WINSTD_NONCOPYABLE(module) + public: /// /// Constructs a module for the given EAP type @@ -556,6 +558,8 @@ namespace eap class peer : public module { + WINSTD_NONCOPYABLE(peer) + public: /// /// Constructs a EAP peer module for the given EAP type diff --git a/lib/EAPBase/src/Config.cpp b/lib/EAPBase/src/Config.cpp index c13b04f..ace9478 100644 --- a/lib/EAPBase/src/Config.cpp +++ b/lib/EAPBase/src/Config.cpp @@ -219,7 +219,7 @@ void eap::config_method_with_cred::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOM // winstd::com_obj pXmlElClientSideCredential; - if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, winstd::bstr(L"eap-metadata:ClientSideCredential"), winstd::bstr(L"ClientSideCredential"), namespace_eapmetadata, &pXmlElClientSideCredential))) + if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, winstd::bstr(L"eap-metadata:ClientSideCredential"), winstd::bstr(L"ClientSideCredential"), namespace_eapmetadata, pXmlElClientSideCredential))) throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); // / @@ -241,11 +241,11 @@ void eap::config_method_with_cred::load(_In_ IXMLDOMNode *pConfigRoot) // winstd::com_obj pXmlElClientSideCredential; - if (SUCCEEDED(eapxml::select_element(pConfigRoot, winstd::bstr(L"eap-metadata:ClientSideCredential"), &pXmlElClientSideCredential))) { + if (SUCCEEDED(eapxml::select_element(pConfigRoot, winstd::bstr(L"eap-metadata:ClientSideCredential"), pXmlElClientSideCredential))) { std::wstring xpath(eapxml::get_xpath(pXmlElClientSideCredential)); // - eapxml::get_element_value(pXmlElClientSideCredential, winstd::bstr(L"eap-metadata:allow-save"), &m_allow_save); + eapxml::get_element_value(pXmlElClientSideCredential, winstd::bstr(L"eap-metadata:allow-save"), m_allow_save); m_module.log_config((xpath + L"/allow-save").c_str(), m_allow_save); try { @@ -416,7 +416,7 @@ void eap::config_provider::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pC // com_obj pXmlElProviderInfo; - if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ProviderInfo"), bstr(L"ProviderInfo"), namespace_eapmetadata, &pXmlElProviderInfo))) + if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ProviderInfo"), bstr(L"ProviderInfo"), namespace_eapmetadata, pXmlElProviderInfo))) throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); // / @@ -426,7 +426,7 @@ void eap::config_provider::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pC // / com_obj pXmlElHelpdesk; - if (FAILED(hr = eapxml::create_element(pDoc, pXmlElProviderInfo, bstr(L"eap-metadata:Helpdesk"), bstr(L"Helpdesk"), namespace_eapmetadata, &pXmlElHelpdesk))) + if (FAILED(hr = eapxml::create_element(pDoc, pXmlElProviderInfo, bstr(L"eap-metadata:Helpdesk"), bstr(L"Helpdesk"), namespace_eapmetadata, pXmlElHelpdesk))) throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); // // @@ -461,13 +461,13 @@ void eap::config_provider::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pC // com_obj pXmlElAuthenticationMethods; - if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:AuthenticationMethods"), bstr(L"AuthenticationMethods"), namespace_eapmetadata, &pXmlElAuthenticationMethods))) + if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:AuthenticationMethods"), bstr(L"AuthenticationMethods"), namespace_eapmetadata, pXmlElAuthenticationMethods))) throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); for (vector >::const_iterator method = m_methods.cbegin(), method_end = m_methods.cend(); method != method_end; ++method) { // com_obj pXmlElAuthenticationMethod; - if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"AuthenticationMethod"), namespace_eapmetadata, &pXmlElAuthenticationMethod))) + if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"AuthenticationMethod"), namespace_eapmetadata, pXmlElAuthenticationMethod))) throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); // /... @@ -498,7 +498,7 @@ void eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot) m_module.log_config((xpath + L" ID").c_str(), m_id.c_str()); // - if (FAILED(hr = eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:read-only"), &m_read_only))) + if (FAILED(hr = eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:read-only"), m_read_only))) m_read_only = true; m_module.log_config((xpath + L"/read-only").c_str(), m_read_only); @@ -511,7 +511,7 @@ void eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot) m_lbl_alt_identity.clear(); m_lbl_alt_password.clear(); com_obj pXmlElProviderInfo; - if (SUCCEEDED(eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:ProviderInfo"), &pXmlElProviderInfo))) { + if (SUCCEEDED(eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:ProviderInfo"), pXmlElProviderInfo))) { wstring lang; LoadString(m_module.m_instance, 2, lang); wstring xpathProviderInfo(xpath + L"/ProviderInfo"); @@ -521,7 +521,7 @@ void eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot) m_module.log_config((xpathProviderInfo + L"/DisplayName").c_str(), m_name.c_str()); com_obj pXmlElHelpdesk; - if (SUCCEEDED(eapxml::select_element(pXmlElProviderInfo, bstr(L"eap-metadata:Helpdesk"), &pXmlElHelpdesk))) { + if (SUCCEEDED(eapxml::select_element(pXmlElProviderInfo, bstr(L"eap-metadata:Helpdesk"), pXmlElHelpdesk))) { wstring xpathHelpdesk(xpathProviderInfo + L"/Helpdesk"); // / @@ -553,7 +553,7 @@ void eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot) // Iterate authentication methods (). m_methods.clear(); com_obj pXmlListMethods; - if (FAILED(hr = eapxml::select_nodes(pConfigRoot, bstr(L"eap-metadata:AuthenticationMethods/eap-metadata:AuthenticationMethod"), &pXmlListMethods))) + if (FAILED(hr = eapxml::select_nodes(pConfigRoot, bstr(L"eap-metadata:AuthenticationMethods/eap-metadata:AuthenticationMethod"), pXmlListMethods))) throw com_runtime_error(hr, __FUNCTION__ " Error selecting / elements."); long lCount = 0; pXmlListMethods->get_length(&lCount); @@ -565,7 +565,7 @@ void eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot) // Check EAP method type (). DWORD dwMethodID; - if (SUCCEEDED(eapxml::get_element_value(pXmlElMethod, bstr(L"eap-metadata:EAPMethod"), &dwMethodID))) { + if (SUCCEEDED(eapxml::get_element_value(pXmlElMethod, bstr(L"eap-metadata:EAPMethod"), dwMethodID))) { if ((eap_type_t)dwMethodID != cfg->get_method_id()) { // Wrong type. continue; @@ -705,13 +705,13 @@ void eap::config_connection::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode * // Create node. com_obj pXmlElIdentityProviderList; - if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:EAPIdentityProviderList"), bstr(L"EAPIdentityProviderList"), namespace_eapmetadata, &pXmlElIdentityProviderList))) + if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:EAPIdentityProviderList"), bstr(L"EAPIdentityProviderList"), namespace_eapmetadata, pXmlElIdentityProviderList))) throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); for (provider_list::const_iterator provider = m_providers.cbegin(), provider_end = m_providers.cend(); provider != provider_end; ++provider) { // com_obj pXmlElIdentityProvider; - if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"EAPIdentityProvider"), namespace_eapmetadata, &pXmlElIdentityProvider))) + if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"EAPIdentityProvider"), namespace_eapmetadata, pXmlElIdentityProvider))) throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); // /... @@ -732,7 +732,7 @@ void eap::config_connection::load(_In_ IXMLDOMNode *pConfigRoot) // Iterate authentication providers (). com_obj pXmlListProviders; - if (FAILED(hr = eapxml::select_nodes(pConfigRoot, bstr(L"eap-metadata:EAPIdentityProviderList/eap-metadata:EAPIdentityProvider"), &pXmlListProviders))) + if (FAILED(hr = eapxml::select_nodes(pConfigRoot, bstr(L"eap-metadata:EAPIdentityProviderList/eap-metadata:EAPIdentityProvider"), pXmlListProviders))) throw com_runtime_error(hr, __FUNCTION__ " Error selecting elements."); long lCount = 0; pXmlListProviders->get_length(&lCount); diff --git a/lib/EAPBase/src/Credentials.cpp b/lib/EAPBase/src/Credentials.cpp index 502239b..95b74dd 100644 --- a/lib/EAPBase/src/Credentials.cpp +++ b/lib/EAPBase/src/Credentials.cpp @@ -244,7 +244,7 @@ void eap::credentials_pass::load(_In_ IXMLDOMNode *pConfigRoot) std::wstring xpath(eapxml::get_xpath(pConfigRoot)); bstr pass; - if (FAILED(hr = eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:Password"), &pass))) + if (FAILED(hr = eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:Password"), pass))) throw com_runtime_error(hr, __FUNCTION__ " Error reading element."); m_password = pass; SecureZeroMemory((BSTR)pass, sizeof(OLECHAR)*pass.length()); @@ -542,7 +542,7 @@ void eap::credentials_connection::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMN // Create node. com_obj pXmlElIdentityProvider; - if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:EAPIdentityProvider"), bstr(L"EAPIdentityProvider"), namespace_eapmetadata, &pXmlElIdentityProvider))) + if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:EAPIdentityProvider"), bstr(L"EAPIdentityProvider"), namespace_eapmetadata, pXmlElIdentityProvider))) throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); // namespace @@ -568,7 +568,7 @@ void eap::credentials_connection::load(_In_ IXMLDOMNode *pConfigRoot) // winstd::com_obj pXmlElClientSideCredential; - if (FAILED(hr = eapxml::select_element(pConfigRoot, winstd::bstr(L"eap-metadata:EAPIdentityProvider"), &pXmlElClientSideCredential))) + if (FAILED(hr = eapxml::select_element(pConfigRoot, winstd::bstr(L"eap-metadata:EAPIdentityProvider"), pXmlElClientSideCredential))) throw com_runtime_error(hr, __FUNCTION__ " Error loading element."); std::wstring xpath(eapxml::get_xpath(pXmlElClientSideCredential)); diff --git a/lib/MSCHAPv2/include/Method.h b/lib/MSCHAPv2/include/Method.h index 2293226..8f32553 100644 --- a/lib/MSCHAPv2/include/Method.h +++ b/lib/MSCHAPv2/include/Method.h @@ -40,6 +40,8 @@ namespace eap { class method_mschapv2 : public method_noneap { + WINSTD_NONCOPYABLE(method_mschapv2) + public: /// /// Constructs an EAP method @@ -132,7 +134,7 @@ namespace eap static std::list parse_response(_In_count_(count) const char *resp, _In_ size_t count); protected: - credentials_pass &m_cred; ///< EAP-TLS user credentials + credentials_pass &m_cred; ///< Method user credentials winstd::crypt_prov m_cp; ///< Cryptography provider for general services challenge_mschapv2 m_challenge_server; ///< MSCHAP server challenge diff --git a/lib/PAP/include/Method.h b/lib/PAP/include/Method.h index cc02c33..213af06 100644 --- a/lib/PAP/include/Method.h +++ b/lib/PAP/include/Method.h @@ -38,6 +38,8 @@ namespace eap { class method_pap : public method_noneap { + WINSTD_NONCOPYABLE(method_pap) + public: /// /// Constructs an EAP method @@ -91,7 +93,7 @@ namespace eap /// @} protected: - credentials_pass &m_cred; ///< EAP-TLS user credentials + credentials_pass &m_cred; ///< Method user credentials enum { phase_unknown = -1, ///< Unknown phase diff --git a/lib/TLS/include/Method.h b/lib/TLS/include/Method.h index 642f394..44ea934 100644 --- a/lib/TLS/include/Method.h +++ b/lib/TLS/include/Method.h @@ -46,6 +46,8 @@ namespace eap { class method_tls : public method { + WINSTD_NONCOPYABLE(method_tls) + public: #pragma pack(push) #pragma pack(1) diff --git a/lib/TLS/src/Config.cpp b/lib/TLS/src/Config.cpp index 2adff51..d4007fe 100644 --- a/lib/TLS/src/Config.cpp +++ b/lib/TLS/src/Config.cpp @@ -145,13 +145,13 @@ void eap::config_method_tls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode * // com_obj pXmlElServerSideCredential; - if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ServerSideCredential"), bstr(L"ServerSideCredential"), namespace_eapmetadata, &pXmlElServerSideCredential))) + if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ServerSideCredential"), bstr(L"ServerSideCredential"), namespace_eapmetadata, pXmlElServerSideCredential))) throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); for (list::const_iterator i = m_trusted_root_ca.begin(), i_end = m_trusted_root_ca.end(); i != i_end; ++i) { // com_obj pXmlElCA; - if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"CA"), namespace_eapmetadata, &pXmlElCA))) + if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"CA"), namespace_eapmetadata, pXmlElCA))) throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); // / @@ -188,19 +188,19 @@ void eap::config_method_tls::load(_In_ IXMLDOMNode *pConfigRoot) // com_obj pXmlElServerSideCredential; - if (SUCCEEDED(eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:ServerSideCredential"), &pXmlElServerSideCredential))) { + if (SUCCEEDED(eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:ServerSideCredential"), pXmlElServerSideCredential))) { std::wstring xpathServerSideCredential(xpath + L"/ServerSideCredential"); // com_obj pXmlListCAs; long lCACount = 0; - if (SUCCEEDED(eapxml::select_nodes(pXmlElServerSideCredential, bstr(L"eap-metadata:CA"), &pXmlListCAs)) && SUCCEEDED(pXmlListCAs->get_length(&lCACount))) { + if (SUCCEEDED(eapxml::select_nodes(pXmlElServerSideCredential, bstr(L"eap-metadata:CA"), pXmlListCAs)) && SUCCEEDED(pXmlListCAs->get_length(&lCACount))) { for (long j = 0; j < lCACount; j++) { // Load CA certificate. com_obj pXmlElCA; pXmlListCAs->get_item(j, &pXmlElCA); bstr bstrFormat; - if (FAILED(eapxml::get_element_value(pXmlElCA, bstr(L"eap-metadata:format"), &bstrFormat))) { + if (FAILED(eapxml::get_element_value(pXmlElCA, bstr(L"eap-metadata:format"), bstrFormat))) { // not specified. continue; } @@ -229,7 +229,7 @@ void eap::config_method_tls::load(_In_ IXMLDOMNode *pConfigRoot) // com_obj pXmlListServerIDs; long lServerIDCount = 0; - if (SUCCEEDED(eapxml::select_nodes(pXmlElServerSideCredential, bstr(L"eap-metadata:ServerName"), &pXmlListServerIDs)) && SUCCEEDED(pXmlListServerIDs->get_length(&lServerIDCount))) { + if (SUCCEEDED(eapxml::select_nodes(pXmlElServerSideCredential, bstr(L"eap-metadata:ServerName"), pXmlListServerIDs)) && SUCCEEDED(pXmlListServerIDs->get_length(&lServerIDCount))) { for (long j = 0; j < lServerIDCount; j++) { // Load server name (). com_obj pXmlElServerID; diff --git a/lib/TLS/src/Credentials.cpp b/lib/TLS/src/Credentials.cpp index d383b09..c323ab7 100644 --- a/lib/TLS/src/Credentials.cpp +++ b/lib/TLS/src/Credentials.cpp @@ -99,7 +99,7 @@ void eap::credentials_tls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pC // com_obj pXmlElClientCertificate; - if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ClientCertificate"), bstr(L"ClientCertificate"), namespace_eapmetadata, &pXmlElClientCertificate))) + if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ClientCertificate"), bstr(L"ClientCertificate"), namespace_eapmetadata, pXmlElClientCertificate))) throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); if (m_cert) { @@ -127,12 +127,12 @@ void eap::credentials_tls::load(_In_ IXMLDOMNode *pConfigRoot) // com_obj pXmlElClientCertificate; - if (FAILED(hr = eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:ClientCertificate"), &pXmlElClientCertificate))) + if (FAILED(hr = eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:ClientCertificate"), pXmlElClientCertificate))) throw com_runtime_error(hr, __FUNCTION__ " Error reading element."); // / bstr bstrFormat; - if (SUCCEEDED(eapxml::get_element_value(pXmlElClientCertificate, bstr(L"eap-metadata:format"), &bstrFormat))) { + if (SUCCEEDED(eapxml::get_element_value(pXmlElClientCertificate, bstr(L"eap-metadata:format"), bstrFormat))) { if (CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstrFormat, bstrFormat.length(), L"PEM", -1, NULL, NULL, 0) == CSTR_EQUAL) { // / vector aData; diff --git a/lib/TLS/src/Method.cpp b/lib/TLS/src/Method.cpp index c1f55c5..b48b207 100644 --- a/lib/TLS/src/Method.cpp +++ b/lib/TLS/src/Method.cpp @@ -223,7 +223,7 @@ void eap::method_tls::begin_session( } // Prepare client credentials for Schannel. - PCCERT_CONTEXT certs[] = { m_cred.m_cert ? m_cred.m_cert : NULL }; + PCCERT_CONTEXT certs[] = { m_cred.m_cert ? (PCCERT_CONTEXT)m_cred.m_cert : NULL }; SCHANNEL_CRED cred = { SCHANNEL_CRED_VERSION, // dwVersion m_cred.m_cert ? 1 : 0, // cCreds diff --git a/lib/TTLS/include/Method.h b/lib/TTLS/include/Method.h index c9225da..66fb974 100644 --- a/lib/TTLS/include/Method.h +++ b/lib/TTLS/include/Method.h @@ -40,6 +40,8 @@ namespace eap { class method_ttls : public method_tls { + WINSTD_NONCOPYABLE(method_ttls) + public: /// /// Constructs an EAP method diff --git a/lib/TTLS/include/Module.h b/lib/TTLS/include/Module.h index 3506f67..d1238bb 100644 --- a/lib/TTLS/include/Module.h +++ b/lib/TTLS/include/Module.h @@ -37,6 +37,8 @@ namespace eap { class peer_ttls : public peer { + WINSTD_NONCOPYABLE(peer_ttls) + public: /// /// Constructs a EAP TTLS peer module diff --git a/lib/TTLS/src/Config.cpp b/lib/TTLS/src/Config.cpp index 0f68362..53764b9 100644 --- a/lib/TTLS/src/Config.cpp +++ b/lib/TTLS/src/Config.cpp @@ -94,7 +94,7 @@ void eap::config_method_ttls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode // com_obj pXmlElClientSideCredential; - if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), bstr(L"ClientSideCredential"), namespace_eapmetadata, &pXmlElClientSideCredential))) + if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), bstr(L"ClientSideCredential"), namespace_eapmetadata, pXmlElClientSideCredential))) throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); // / @@ -104,7 +104,7 @@ void eap::config_method_ttls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode // com_obj pXmlElInnerAuthenticationMethod; - if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:InnerAuthenticationMethod"), bstr(L"InnerAuthenticationMethod"), namespace_eapmetadata, &pXmlElInnerAuthenticationMethod))) + if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:InnerAuthenticationMethod"), bstr(L"InnerAuthenticationMethod"), namespace_eapmetadata, pXmlElInnerAuthenticationMethod))) throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); eap_type_t eap_type = m_inner->get_method_id(); @@ -123,20 +123,20 @@ void eap::config_method_ttls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode { com_obj pXmlElClientSideCredential; - if (SUCCEEDED(hr = eapxml::select_node(pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), &pXmlElClientSideCredential))) { + if (SUCCEEDED(hr = eapxml::select_node(pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), pXmlElClientSideCredential))) { // Fix 1: Configured outer credentials in draft-winter-opsawg-eap-metadata has some bizarre presence/absence/blank logic for EAP-TTLS methods only. // To keep our code clean, we do some post-processing, to make draft compliant XML on output, while keeping things simple on the inside. if (m_use_cred && m_cred->empty()) { // For empty configured client certificate must not be present. com_obj pXmlElClientCertificate; - if (SUCCEEDED(hr = eapxml::select_node(pXmlElClientSideCredential, bstr(L"eap-metadata:ClientCertificate"), &pXmlElClientCertificate))) { + if (SUCCEEDED(hr = eapxml::select_node(pXmlElClientSideCredential, bstr(L"eap-metadata:ClientCertificate"), pXmlElClientCertificate))) { com_obj pXmlElClientCertificateOld; hr = pXmlElClientSideCredential->removeChild(pXmlElClientCertificate, &pXmlElClientCertificateOld); } } else if (!m_use_cred) { // When not using configured client certificate (user must supply one), add empty . com_obj pXmlElClientCertificate; - hr = eapxml::create_element(pDoc, pXmlElClientSideCredential, bstr(L"eap-metadata:ClientCertificate"), bstr(L"ClientCertificate"), namespace_eapmetadata, &pXmlElClientCertificate); + hr = eapxml::create_element(pDoc, pXmlElClientSideCredential, bstr(L"eap-metadata:ClientCertificate"), bstr(L"ClientCertificate"), namespace_eapmetadata, pXmlElClientCertificate); } } } @@ -150,13 +150,13 @@ void eap::config_method_ttls::load(_In_ IXMLDOMNode *pConfigRoot) { com_obj pXmlElClientSideCredential; - if (SUCCEEDED(hr = eapxml::select_node(pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), &pXmlElClientSideCredential))) { + if (SUCCEEDED(hr = eapxml::select_node(pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), pXmlElClientSideCredential))) { com_obj pDoc; if (SUCCEEDED(hr = pXmlElClientSideCredential->get_ownerDocument(&pDoc))) { // Fix 1: Configured outer credentials in draft-winter-opsawg-eap-metadata has some bizarre presence/absence/blank logic for EAP-TTLS methods only. // To keep our code clean, we do some pre-processing, to accept draft compliant XML on input, while keeping things simple on the inside. com_obj pXmlElClientCertificate; - if (SUCCEEDED(hr = eapxml::select_node(pXmlElClientSideCredential, bstr(L"eap-metadata:ClientCertificate"), &pXmlElClientCertificate))) { + if (SUCCEEDED(hr = eapxml::select_node(pXmlElClientSideCredential, bstr(L"eap-metadata:ClientCertificate"), pXmlElClientCertificate))) { VARIANT_BOOL has_children; if (SUCCEEDED(hr = pXmlElClientCertificate->hasChildNodes(&has_children)) && !has_children) { // Empty means: do not use configured credentials. @@ -166,7 +166,7 @@ void eap::config_method_ttls::load(_In_ IXMLDOMNode *pConfigRoot) } else { // Nonexisting means: use blank configured credentials. com_obj pXmlElClientCertificate; - hr = eapxml::create_element(pDoc, pXmlElClientSideCredential, bstr(L"eap-metadata:ClientCertificate"), bstr(L"ClientCertificate"), namespace_eapmetadata, &pXmlElClientCertificate); + hr = eapxml::create_element(pDoc, pXmlElClientSideCredential, bstr(L"eap-metadata:ClientCertificate"), bstr(L"ClientCertificate"), namespace_eapmetadata, pXmlElClientCertificate); } } } @@ -180,7 +180,7 @@ void eap::config_method_ttls::load(_In_ IXMLDOMNode *pConfigRoot) // com_obj pXmlElClientSideCredential; - if (SUCCEEDED(eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), &pXmlElClientSideCredential))) { + if (SUCCEEDED(eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:ClientSideCredential"), pXmlElClientSideCredential))) { wstring xpathClientSideCredential(xpath + L"/ClientSideCredential"); // @@ -190,18 +190,18 @@ void eap::config_method_ttls::load(_In_ IXMLDOMNode *pConfigRoot) // com_obj pXmlElInnerAuthenticationMethod; - if (FAILED(hr = eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:InnerAuthenticationMethod"), &pXmlElInnerAuthenticationMethod))) + if (FAILED(hr = eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:InnerAuthenticationMethod"), pXmlElInnerAuthenticationMethod))) throw com_runtime_error(hr, __FUNCTION__ " Error selecting element."); // Determine inner authentication type ( and ). DWORD dwMethod; bstr bstrMethod; - if (SUCCEEDED(eapxml::get_element_value(pXmlElInnerAuthenticationMethod, bstr(L"eap-metadata:EAPMethod"), &dwMethod)) && + if (SUCCEEDED(eapxml::get_element_value(pXmlElInnerAuthenticationMethod, bstr(L"eap-metadata:EAPMethod"), dwMethod)) && eap_type_start <= dwMethod && dwMethod < eap_type_end) { m_inner.reset(make_config_method((eap_type_t)dwMethod)); m_module.log_config((xpath + L"/EAPMethod").c_str(), m_inner->get_method_str()); - } else if (SUCCEEDED(eapxml::get_element_value(pXmlElInnerAuthenticationMethod, bstr(L"eap-metadata:NonEAPAuthMethod"), &bstrMethod))) { + } else if (SUCCEEDED(eapxml::get_element_value(pXmlElInnerAuthenticationMethod, bstr(L"eap-metadata:NonEAPAuthMethod"), bstrMethod))) { m_inner.reset(make_config_method(bstrMethod)); m_module.log_config((xpath + L"/NonEAPAuthMethod").c_str(), m_inner->get_method_str()); } else diff --git a/lib/TTLS/src/Credentials.cpp b/lib/TTLS/src/Credentials.cpp index b9d6598..cb3ead9 100644 --- a/lib/TTLS/src/Credentials.cpp +++ b/lib/TTLS/src/Credentials.cpp @@ -100,7 +100,7 @@ void eap::credentials_ttls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *p // com_obj pXmlElInnerAuthenticationMethod; - if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:InnerAuthenticationMethod"), bstr(L"InnerAuthenticationMethod"), namespace_eapmetadata, &pXmlElInnerAuthenticationMethod))) + if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:InnerAuthenticationMethod"), bstr(L"InnerAuthenticationMethod"), namespace_eapmetadata, pXmlElInnerAuthenticationMethod))) throw com_runtime_error(hr, __FUNCTION__ " Error creating element."); // /... @@ -117,7 +117,7 @@ void eap::credentials_ttls::load(_In_ IXMLDOMNode *pConfigRoot) // Load inner credentials. com_obj pXmlElInnerAuthenticationMethod; - if (SUCCEEDED(hr = eapxml::select_node(pConfigRoot, bstr(L"eap-metadata:InnerAuthenticationMethod"), &pXmlElInnerAuthenticationMethod))) + if (SUCCEEDED(hr = eapxml::select_node(pConfigRoot, bstr(L"eap-metadata:InnerAuthenticationMethod"), pXmlElInnerAuthenticationMethod))) m_inner->load(pXmlElInnerAuthenticationMethod); else m_inner->clear(); diff --git a/lib/WinStd b/lib/WinStd index 490f37e..c2ba38a 160000 --- a/lib/WinStd +++ b/lib/WinStd @@ -1 +1 @@ -Subproject commit 490f37e89680e398f5770c31aca96f0a0a41dc8e +Subproject commit c2ba38a52460e51055333b68fd36c1ae282826ec