diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/auth/Loginbox/dataAddress.cpp | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
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 |