VirtualBox

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

Last change on this file since 33280 was 32431, checked in by vboxsync, 14 years ago

scm cleanup

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 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 /** Events. */
89 void OnCredentialsProvided();
90 private:
91
92 /** Interface reference count. */
93 LONG m_cRef;
94 /** Our one and only credential. */
95 VBoxCredential *m_pCred;
96 /** Poller thread for credential lookup. */
97 VBoxCredPoller *m_pPoller;
98 /** Used to tell our owner to re-enumerate credentials. */
99 ICredentialProviderEvents *m_pCredProvEvents;
100 /** Used to tell our owner who we are when asking to re-enumerate credentials. */
101 UINT_PTR m_upAdviseContext;
102 /** Saved usage scenario. */
103 CREDENTIAL_PROVIDER_USAGE_SCENARIO m_cpUsageScenario;
104 /** Flag indicating we got some credentials to work with. */
105 bool m_fGotCredentials;
106};
107
108#endif /* ___VBoxCredProv_h */
109
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