diff options
Diffstat (limited to 'Src/auth/Loginbox/dataAddress.cpp')
-rw-r--r-- | Src/auth/Loginbox/dataAddress.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Src/auth/Loginbox/dataAddress.cpp b/Src/auth/Loginbox/dataAddress.cpp new file mode 100644 index 00000000..d22db6f5 --- /dev/null +++ b/Src/auth/Loginbox/dataAddress.cpp @@ -0,0 +1,46 @@ +#include "./dataAddress.h" +#include "./common.h" + +#include <strsafe.h> + +LoginDataAddress::LoginDataAddress(const GUID *pRealm, HWND hPage, HWND hLoginbox, LPCWSTR pszAddress) + : LoginData(pRealm, hPage, hLoginbox), address(NULL) +{ + address = LoginBox_CopyString(pszAddress); +} + +LoginDataAddress::~LoginDataAddress() +{ + LoginBox_FreeString(address); +} + +HRESULT LoginDataAddress::CreateInstance(const GUID *pRealm, HWND hPage, HWND hLoginbox, LPCWSTR pszAddress, LoginDataAddress **instance) +{ + if (NULL == instance) return E_POINTER; + if (NULL == hPage || NULL == hLoginbox) return E_INVALIDARG; + + *instance = new LoginDataAddress(pRealm, hPage, hLoginbox, pszAddress); + if (NULL == *instance) return E_OUTOFMEMORY; + return S_OK; +} + +HRESULT LoginDataAddress::QueryInterface(REFIID riid, void** ppObject) +{ + if (NULL == ppObject) + return E_POINTER; + + if (IsEqualIID(riid, IID_LoginDataAddress)) + { + *ppObject = static_cast<LoginDataAddress*>(this); + if (NULL == *ppObject) return E_UNEXPECTED; + AddRef(); + return S_OK; + } + + return __super::QueryInterface(riid, ppObject); +} + +LPCWSTR LoginDataAddress::GetAddress() +{ + return address; +}
\ No newline at end of file |