VirtualBox

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

Last change on this file since 34079 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: 5.2 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// Modifications (c) 2009-2010 Oracle Corporation
8//
9
10#ifndef ___VBoxCredential_h
11#define ___VBoxCredential_h
12
13#include <windows.h>
14#include <strsafe.h>
15#include <shlguid.h>
16#include "helpers.h"
17#include "dll.h"
18#include "resource.h"
19
20class VBoxCredProv;
21
22class VBoxCredential : public ICredentialProviderCredential
23{
24 public:
25 VBoxCredential(VBoxCredProv *pProvider);
26 virtual ~VBoxCredential();
27
28 public:
29
30 // IUnknown
31 STDMETHOD_(ULONG, AddRef)()
32 {
33 return m_cRef++;
34 }
35
36 STDMETHOD_(ULONG, Release)()
37 {
38 LONG cRef = m_cRef--;
39 if (!cRef)
40 {
41 delete this;
42 }
43 return cRef;
44 }
45
46 STDMETHOD (QueryInterface)(REFIID riid, void** ppv)
47 {
48 HRESULT hr;
49 if (ppv != NULL)
50 {
51 if (IID_IUnknown == riid ||
52 IID_ICredentialProviderCredential == riid)
53 {
54 *ppv = static_cast<IUnknown*>(this);
55 reinterpret_cast<IUnknown*>(*ppv)->AddRef();
56 hr = S_OK;
57 }
58 else
59 {
60 *ppv = NULL;
61 hr = E_NOINTERFACE;
62 }
63 }
64 else
65 {
66 hr = E_INVALIDARG;
67 }
68 return hr;
69 }
70
71 public:
72
73 // ICredentialProviderCredential
74 IFACEMETHODIMP Advise(ICredentialProviderCredentialEvents* pcpce);
75 IFACEMETHODIMP UnAdvise();
76
77 IFACEMETHODIMP SetSelected(BOOL* pbAutoLogon);
78 IFACEMETHODIMP SetDeselected();
79
80 IFACEMETHODIMP GetFieldState(DWORD dwFieldID,
81 CREDENTIAL_PROVIDER_FIELD_STATE* pcpfs,
82 CREDENTIAL_PROVIDER_FIELD_INTERACTIVE_STATE* pcpfis);
83
84 IFACEMETHODIMP GetStringValue(DWORD dwFieldID, PWSTR* ppwsz);
85 IFACEMETHODIMP GetBitmapValue(DWORD dwFieldID, HBITMAP* phbmp);
86 IFACEMETHODIMP GetCheckboxValue(DWORD dwFieldID, BOOL* pbChecked, PWSTR* ppwszLabel);
87 IFACEMETHODIMP GetComboBoxValueCount(DWORD dwFieldID, DWORD* pcItems, DWORD* pdwSelectedItem);
88 IFACEMETHODIMP GetComboBoxValueAt(DWORD dwFieldID, DWORD dwItem, PWSTR* ppwszItem);
89 IFACEMETHODIMP GetSubmitButtonValue(DWORD dwFieldID, DWORD* pdwAdjacentTo);
90
91 IFACEMETHODIMP SetStringValue(DWORD dwFieldID, PCWSTR pcwzString);
92 IFACEMETHODIMP SetCheckboxValue(DWORD dwFieldID, BOOL bChecked);
93 IFACEMETHODIMP SetComboBoxSelectedValue(DWORD dwFieldID, DWORD dwSelectedItem);
94 IFACEMETHODIMP CommandLinkClicked(DWORD dwFieldID);
95
96 IFACEMETHODIMP GetSerialization(CREDENTIAL_PROVIDER_GET_SERIALIZATION_RESPONSE *pcpGetSerializationResponse,
97 CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION *pcpCredentialSerialization,
98 PWSTR *ppwszOptionalStatusText,
99 CREDENTIAL_PROVIDER_STATUS_ICON *pcpsiOptionalStatusIcon);
100 IFACEMETHODIMP ReportResult(NTSTATUS ntsStatus,
101 NTSTATUS ntsSubstatus,
102 PWSTR* ppwszOptionalStatusText,
103 CREDENTIAL_PROVIDER_STATUS_ICON* pcpsiOptionalStatusIcon);
104
105 public:
106 void WipeString(const PWSTR pwszString);
107 void Reset();
108 HRESULT Initialize(CREDENTIAL_PROVIDER_USAGE_SCENARIO cpus,
109 const CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR* rgcpfd,
110 const FIELD_STATE_PAIR* rgfsp);
111 int Update(const char *pszUser,
112 const char *pszPw,
113 const char *pszDomain);
114 BOOL TranslateAccountName(PWSTR pwszDisplayName, PWSTR *ppwszAccoutName);
115 BOOL ExtractAccoutData(PWSTR pwszAccountData, PWSTR *ppwszAccoutName, PWSTR *ppwszDomain);
116 private:
117
118 /** @todo Merge all arrays which depend on SFI_NUM_FIELDS below
119 into an own structure! */
120
121 /** Pointer to parent. */
122 VBoxCredProv *m_pProvider;
123 /** Internal reference count. */
124 LONG m_cRef;
125 /** The usage scenario for which we were enumerated. */
126 CREDENTIAL_PROVIDER_USAGE_SCENARIO m_cpUS;
127 /** Holding type and name of each field in the tile. */
128 CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR m_rgCredProvFieldDescriptors[SFI_NUM_FIELDS];
129 /** Holding state of each field in the tile. */
130 FIELD_STATE_PAIR m_rgFieldStatePairs[SFI_NUM_FIELDS];
131 /** Holding string value of each field. This is different from the name of
132 the field held in m_rgCredProvFieldDescriptors. */
133 PWSTR m_rgFieldStrings[SFI_NUM_FIELDS];
134 ICredentialProviderCredentialEvents *m_pCredProvCredentialEvents;
135
136};
137
138#endif /* ___VBoxCredential_h */
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