VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredProv.h@ 39606

Last change on this file since 39606 was 36453, checked in by vboxsync, 14 years ago

VBoxCredProv: Implemented support for handling/ignoring remote (desktop) sessions.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1//
2// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
3// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
4// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
5// PARTICULAR PURPOSE.
6//
7// Copyright (c) Microsoft Corporation. All rights reserved.
8//
9// Modifications (c) 2009-2010 Oracle Corporation
10//
11
12#ifndef ___VBoxCredProv_h
13#define ___VBoxCredProv_h
14
15#include <credentialprovider.h>
16#include <windows.h>
17#include <strsafe.h>
18
19#include "VBoxCredential.h"
20#include "VBoxCredPoller.h"
21#include "helpers.h"
22
23class VBoxCredProv : public ICredentialProvider
24{
25 public:
26
27 /** IUnknown methods. */
28 STDMETHOD_(ULONG, AddRef)()
29 {
30 return m_cRef++;
31 }
32
33 STDMETHOD_(ULONG, Release)()
34 {
35 LONG cRef = m_cRef--;
36 if (!cRef)
37 {
38 delete this;
39 }
40 return cRef;
41 }
42
43 STDMETHOD (QueryInterface)(REFIID riid, void **ppv)
44 {
45 HRESULT hr;
46 if (IID_IUnknown == riid ||
47 IID_ICredentialProvider == riid)
48 {
49 *ppv = this;
50 reinterpret_cast<IUnknown*>(*ppv)->AddRef();
51 hr = S_OK;
52 }
53 else
54 {
55 *ppv = NULL;
56 hr = E_NOINTERFACE;
57 }
58 return hr;
59 }
60
61 public:
62
63 /** ICredentialProvider interface. */
64 IFACEMETHODIMP SetUsageScenario(CREDENTIAL_PROVIDER_USAGE_SCENARIO cpUsageScenario, DWORD dwFlags);
65 IFACEMETHODIMP SetSerialization(const CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION *pcpCredentialSerialization);
66
67 IFACEMETHODIMP Advise(__in ICredentialProviderEvents *pcpEvents, UINT_PTR upAdviseContext);
68 IFACEMETHODIMP UnAdvise();
69
70 IFACEMETHODIMP GetFieldDescriptorCount(__out DWORD* pdwCount);
71 IFACEMETHODIMP GetFieldDescriptorAt(DWORD dwIndex, __deref_out CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR **ppcpFieldDescriptor);
72
73 IFACEMETHODIMP GetCredentialCount(__out DWORD *pdwCount,
74 __out DWORD *pdwDefault,
75 __out BOOL *pbAutoLogonWithDefault);
76 IFACEMETHODIMP GetCredentialAt(DWORD dwIndex,
77 __out ICredentialProviderCredential **ppcpc);
78
79 friend HRESULT VBoxCredProv_CreateInstance(REFIID riid, __deref_out void **ppv);
80
81 protected:
82
83 VBoxCredProv(void);
84 virtual ~VBoxCredProv(void);
85
86 public:
87
88 DWORD LoadConfiguration();
89 bool HandleCurrentSession();
90
91 /** Events. */
92 void OnCredentialsProvided();
93
94 private:
95
96 /** Interface reference count. */
97 LONG m_cRef;
98 /** Our one and only credential. */
99 VBoxCredential *m_pCred;
100 /** Poller thread for credential lookup. */
101 VBoxCredPoller *m_pPoller;
102 /** Used to tell our owner to re-enumerate credentials. */
103 ICredentialProviderEvents *m_pCredProvEvents;
104 /** Used to tell our owner who we are when asking to re-enumerate credentials. */
105 UINT_PTR m_upAdviseContext;
106 /** Saved usage scenario. */
107 CREDENTIAL_PROVIDER_USAGE_SCENARIO m_cpUsageScenario;
108 /** Flag indicating we got some credentials to work with. */
109 bool m_fGotCredentials;
110 /** Flag whether we need to handle remote session over Windows Remote
111 * Desktop Service. */
112 bool m_fHandleRemoteSessions;
113};
114
115#endif /* ___VBoxCredProv_h */
116
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette