blob: aa175bd1936ddae1d88ac076b89dc9ebbad548d2 (
plain)
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
91
92
93
94
95
96
97
98
99
100
|
/* $Id$ */
/** @file
* VBoxCredProvProvider - The actual credential provider class.
*/
/*
* Copyright (C) 2012-2022 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef GA_INCLUDED_SRC_WINNT_VBoxCredProv_VBoxCredProvProvider_h
#define GA_INCLUDED_SRC_WINNT_VBoxCredProv_VBoxCredProvProvider_h
#ifndef RT_WITHOUT_PRAGMA_ONCE
# pragma once
#endif
#include <iprt/win/credentialprovider.h>
#include <iprt/win/windows.h>
#include <VBox/VBoxGuestLib.h>
#include "VBoxCredProvCredential.h"
#include "VBoxCredProvPoller.h"
class VBoxCredProvProvider : public ICredentialProvider
{
public:
/** @name IUnknown methods.
* @{ */
IFACEMETHODIMP_(ULONG) AddRef(void);
IFACEMETHODIMP_(ULONG) Release(void);
IFACEMETHODIMP QueryInterface(REFIID interfaceID, void **ppvInterface);
/** @} */
/** @name ICredentialProvider interface
* @{ */
IFACEMETHODIMP SetUsageScenario(CREDENTIAL_PROVIDER_USAGE_SCENARIO cpUsageScenario, DWORD dwFlags);
IFACEMETHODIMP SetSerialization(const CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION *pcpCredentialSerialization);
IFACEMETHODIMP Advise(__in ICredentialProviderEvents *pcpEvents, UINT_PTR upAdviseContext);
IFACEMETHODIMP UnAdvise();
IFACEMETHODIMP GetFieldDescriptorCount(__out DWORD* pdwCount);
IFACEMETHODIMP GetFieldDescriptorAt(DWORD dwIndex, __deref_out CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR **ppFieldDescriptor);
IFACEMETHODIMP GetCredentialCount(__out DWORD *pdwCount,
__out DWORD *pdwDefault,
__out BOOL *pfAutoLogonWithDefault);
IFACEMETHODIMP GetCredentialAt(DWORD dwIndex,
__out ICredentialProviderCredential **ppCredProvCredential);
/** @} */
friend HRESULT VBoxCredProvProviderCreate(REFIID riid, __deref_out void **ppvInterface);
protected:
VBoxCredProvProvider(void);
virtual ~VBoxCredProvProvider(void);
public:
/** Loads the configuration from the registry. */
DWORD LoadConfiguration(void);
/** Determines whether the current session this provider is
* loaded into needs to be handled or not. */
bool HandleCurrentSession(void);
/** Event which gets triggered by the poller thread in case
* there are credentials available from the host. */
void OnCredentialsProvided(void);
private:
/** Interface reference count. */
LONG m_cRefs;
/** Our one and only credential. */
VBoxCredProvCredential *m_pCred;
/** Poller thread for credential lookup. */
VBoxCredProvPoller *m_pPoller;
/** Used to tell our owner to re-enumerate credentials. */
ICredentialProviderEvents *m_pEvents;
/** Used to tell our owner who we are when asking to re-enumerate credentials. */
UINT_PTR m_upAdviseContext;
/** Saved usage scenario. */
CREDENTIAL_PROVIDER_USAGE_SCENARIO m_enmUsageScenario;
/** Flag whether we need to handle remote session over Windows Remote
* Desktop Service. */
bool m_fHandleRemoteSessions;
};
#endif /* !GA_INCLUDED_SRC_WINNT_VBoxCredProv_VBoxCredProvProvider_h */
|