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/resultWinampAuth.h | |
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/resultWinampAuth.h')
-rw-r--r-- | Src/auth/Loginbox/resultWinampAuth.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/Src/auth/Loginbox/resultWinampAuth.h b/Src/auth/Loginbox/resultWinampAuth.h new file mode 100644 index 00000000..c20b300b --- /dev/null +++ b/Src/auth/Loginbox/resultWinampAuth.h @@ -0,0 +1,85 @@ +#ifndef NULLSOFT_AUTH_LOGINRESULT_WINAMPAUTH_HEADER +#define NULLSOFT_AUTH_LOGINRESULT_WINAMPAUTH_HEADER + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include "./loginResult.h" +#include "../auth/ifc_authcallback.h" +#include "../auth/api_auth.h" + +class LoginData; +class LoginCredentials; +class LoginDataCredentials; + +class LoginResultWinampAuth : public LoginResult, + public ifc_authcallback +{ +protected: + LoginResultWinampAuth(api_auth *auth, LoginDataCredentials *pInput, Callback callback, void *user); + ~LoginResultWinampAuth(); + +public: + static HRESULT CreateInstance(LoginData *input, Callback callback, void *user, LoginResultWinampAuth **instance); + +public: + /* IUnknown */ + STDMETHOD(QueryInterface)(REFIID riid, PVOID *ppvObject); + STDMETHOD_(ULONG, AddRef)(void); + STDMETHOD_(ULONG, Release)(void); + + /* LoginResult */ + HRESULT GetWaitHandle(HANDLE *handle); + HRESULT GetUser(void **pUser); + HRESULT RequestAbort(BOOL fDrop); + HRESULT IsCompleted(); + HRESULT IsAborting(); + HRESULT GetLoginData(LoginData **loginData); + +public: + HRESULT GetResult(INT *authCode, LoginCredentials **credentials); + +protected: + /* Dispatchable */ + size_t Wasabi_AddRef(); + size_t Wasabi_Release(); + int Wasabi_QueryInterface(GUID iid, void **object); + + /*ifc_authcallback*/ + int Event_AuthConnecting(); + int Event_AuthSending(); + int Event_AuthReceiving(); + int Event_AuthIdle(); + +private: + HRESULT Start(); + DWORD ThreadProc(); + HRESULT IsAbortingEx(UINT waitMs); + LPWSTR MakeAuthParam(LPCWSTR pszInput, INT cchInput, INT min, INT max, BOOL removeSpaces, BOOL firstLetter, WORD typeMask, INT errorBase, INT *authError); + LPWSTR GetUsername(LPCWSTR pszInput, INT *authError); + LPWSTR GetPassword(LPCWSTR pszInput, INT *authError); + LPWSTR GetPasscode(LPCWSTR pszInput, INT *authError); + + friend static DWORD WINAPI WinampAuth_ThreadProcCallback(void *param); + + +protected: + ULONG ref; + LoginDataCredentials *input; + Callback callback; + void *user; + api_auth *authApi; + HANDLE thread; + HANDLE abort; + HANDLE completed; + LoginCredentials *credentials; + INT authCode; + CRITICAL_SECTION lock; + UINT statusCookie; + +protected: + RECVS_DISPATCH; +}; + +#endif //NULLSOFT_AUTH_LOGINRESULT_WINAMPAUTH_HEADER
\ No newline at end of file |