1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
|