aboutsummaryrefslogtreecommitdiff
path: root/Src/auth/Loginbox/loginbox.h
blob: 9729eace0e0f4161b46386257e71c3a6c7cda796 (plain) (blame)
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
86
87
88
89
90
#ifndef NULLSOFT_AUTH_LOGINBOX_HEADER
#define NULLSOFT_AUTH_LOGINBOX_HEADER

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

#include <wtypes.h>
class api_auth;
class LoginDownloadResult;
class LoginProviderEnumerator;
class ifc_omcacherecord;
class LoginImageCache;

#define LBS_NOCENTEROWNER		0x00000001

HWND LoginBox_CreateWindow(api_auth *auth, const GUID *pRealm, HWND hOwner, UINT fStyle);
INT_PTR LoginBox_Show(api_auth *auth, const GUID *pRealm, HWND hOwner, UINT fStyle);
HWND LoginBox_FindActive(const GUID *pRealm);


// messages
#define NLBM_FIRST			(WM_APP + 10)

#define NLBM_GETAUTHAPI			(NLBM_FIRST + 1)	// wParam  - not used, lParam = (LPARAM)(api_auth**)__authApi; Returns TRUE on success
#define LoginBox_GetAuthApi(/*HNWD*/ __hwnd, /*api_auth** */ __authApi)\
	((BOOL)SendMessage((__hwnd), NLBM_GETAUTHAPI, 0, (LPARAM)(__authApi)))

#define NLBM_GETREALM			(NLBM_FIRST + 2)	// wParam  - not used, lParam = (LPARAM)(GUID*)__pGuidRealm; Returns TRUE on success
#define LoginBox_GetRealm(/*HNWD*/ __hwnd, /*GUID* */ __pGuidRealm)\
	((BOOL)SendMessage((__hwnd), NLBM_GETREALM, 0, (LPARAM)(__pGuidRealm)))

#define NLBM_GETACTIVEPROVIDER	(NLBM_FIRST + 3)	// wParam  - not used, lParam = (LPARAM)(LoginProvider**)__ppProvider; Returns TRUE on success
#define LoginBox_GetActiveProvider(/*HNWD*/ __hwnd, /*LoginProvider** */ __ppProvider)\
	((BOOL)SendMessage((__hwnd), NLBM_GETACTIVEPROVIDER, 0, (LPARAM)(__ppProvider)))

#define NLBM_GETSTATUS			(NLBM_FIRST + 4)	// wParam - not used, lParam = (LPARAM)(LoginStatus**)ppStatus; Returns TRUE on success
#define LoginBox_GetStatus(/*HNWD*/ __hwnd, /*LoginStatus** */ __ppLoginStatus)\
	((BOOL)SendMessage((__hwnd), NLBM_GETSTATUS, 0, (LPARAM)(__ppLoginStatus)))

#define NLBM_ADDSTATUS			(NLBM_FIRST + 5)	// wParam - not used, lParam = (LPARAM)(BSTR)bstrStatusText; Return - (UINT)statusCookie or -1
#define LoginBox_AddStatus(/*HNWD*/ __hwnd, /*BSTR*/ __bstrStatusText)\
	((UINT)SendMessage((__hwnd), NLBM_ADDSTATUS, 0, (LPARAM)(__bstrStatusText)))

#define NLBM_SETSTATUS			(NLBM_FIRST + 6)	// wParam = (WPARAM)(UINT)statusCookie, lParam = (LPARAM)(BSTR)bstrStatusText; Return TRUE on success.
#define LoginBox_SetStatus(/*HNWD*/ __hwnd, /*UINT*/__statusCookie, /*BSTR*/ __bstrStatusText)\
	((BOOL)SendMessage((__hwnd), NLBM_SETSTATUS, (WPARAM)(__statusCookie), (LPARAM)(__bstrStatusText)))

#define NLBM_REMOVESTATUS		(NLBM_FIRST + 7)	// wParam = (WPARAM)(UINT)statusCookie, lParam - not used. Return ingored.
#define LoginBox_RemoveStatus(/*HNWD*/ __hwnd, /*UINT*/__statusCookie)\
	(SendMessage((__hwnd), NLBM_REMOVESTATUS, (WPARAM)(__statusCookie), 0L))

#define NLBM_UPDATEPROVIDERS	(NLBM_FIRST + 8)	// wParam - (WPARAM)(BOOL)fForce, lParam - not used.
#define LoginBox_UpdateProviders(/*HNWD*/ __hwnd, /*BOOL*/ __forceUpdate)\
	((BOOL)SendMessage((__hwnd), NLBM_UPDATEPROVIDERS, (WPARAM)(__forceUpdate), 0L))

#define NLBM_GETUPDATESTATE		(NLBM_FIRST + 9)	// wParam - not used, lParam - not used. Return TRUE if update active.
#define LoginBox_GetUpdateState(/*HNWD*/ __hwnd)\
	((BOOL)SendMessage((__hwnd), NLBM_GETUPDATESTATE, 0, 0L))

#define NLBM_LOGINCOMPLETED		(NLBM_FIRST + 20)	// wParam  - not used, lParam = (LPARAM)(LoginResult*)__pResult;

typedef struct __PROVIDERUPDATERESULT
{
	LoginDownloadResult *downloader;
	HRESULT errorCode;
	BOOL dataIdentical;
	LoginProviderEnumerator *enumerator;
} PROVIDERUPDATERESULT;

#define NLBM_PROVIDERSUPDATED	(NLBM_FIRST + 21)	// wParam  - not used, lParam = (LPARAM)(PROVIDERUPDATERESULT*)updateResult;
#define LoginBox_ProvidersUpdated(/*HNWD*/ __hwnd, /*LoginDownloadResult*/ __downloader, /*HRESULT*/ __errorCode, /*BOOL*/__dataIdentical, /*LoginProviderEnumerator**/ __enumerator)\
	{PROVIDERUPDATERESULT __updateResult;\
		__updateResult.downloader = (__downloader);\
		__updateResult.errorCode = (__errorCode);\
		__updateResult.dataIdentical = (__dataIdentical);\
		__updateResult.enumerator = (__enumerator);\
		(SendMessage((__hwnd), NLBM_PROVIDERSUPDATED, 0, (LPARAM)&(__updateResult)));}


typedef struct __IMAGECACHERESULT
{
	LoginImageCache *imageCache;
	ifc_omcacherecord *cacheRecord;
} IMAGECACHERESULT;

#define NLBM_IMAGECACHED				(NLBM_FIRST + 22) // wParam  - not used, lParam = (LPARAM)(IMAGECACHERESULT*)cacheResult;


#endif //NULLSOFT_AUTH_LOGINBOX_HEADER